SPICE Tutorials Merged
SPICE Tutorials Merged
July 2013
N IF
For you
Objectives
Navigation and Ancillary Information Facility
Provide an overview of the entire SPICE system Provide a sense of the purpose and uses of SPICE Provide an introduction to the use of primary SPICE components Provide examples of how to use SPICE software and data files Provide some insight into conventions and common problems Provide a variety of hands-on programming exercises Provide a peek at new capabilities being worked on or considered Familiarize you with available SPICE resources
For NAIF (if these tutorials are being seen in a class setting)
Get students feedback on todays SPICE system Especially whats hard to understand, hard to use, missing Get students suggestions for further development of SPICE Get students suggestions for improvements to NAIF support of the space science community
Welcome to tutorials
N IF
Broad coverage
Scope
Navigation and Ancillary Information Facility
Begins at a high level, but quickly drills down to details Touches on many SPICE-related topics that could be of interest to science and engineering teams Depth of discussion varies somewhat amongst topics
Provide information for FORTRAN, C, IDL and MATLAB programmers Some tutorials have important material provided in a Backup section: you should read those charts too! Some topics are addressed rather little or not at all
Kernel production Archiving SPICE data
Welcome to tutorials
N IF
Repeated Material
Navigation and Ancillary Information Facility
Welcome to tutorials
N IF
but it does take a modest amount of effort to learn enough about SPICE to begin to use its features with good success. It helps to have some math skills, some innate sense of spatial orientation, and some familiarity with your computers operating system, a code editor, and a compiler or Integrated Development Environment (IDE).
5
Welcome to tutorials
N IF
Dont let the size of the Toolkit bother you just work your way into it bit by bit.
Hundreds of people like you are using this code successfully
Welcome to tutorials
N IF
Chuck Acton
Nat Bachman
Welcome to tutorials
Boris Semenov
Ed Wright
N IF
Navigation and Ancillary Information Facility
SPICE Introduction
July 2013
N IF
Ancillary Data
SPICE deals with these data to support the planning for and analysis of these data
Introduction
N IF
History
Navigation and Ancillary Information Facility
Implementation of a precursor to SPICE was initiated in 1984 as part of a major initiative to improve archiving and distribution of space science data in all NASA disciplines Responsibility for leading SPICE development was assigned to the newly-created Navigation and Ancillary Information Facility (NAIF), located at the Jet Propulsion Laboratory Todays SPICE system dates from about 1991
Tutorials Introduction
N IF
Breadth of Use
Navigation and Ancillary Information Facility
The original focus of SPICE was on ancillary data and associated software needed by scientists for:
initial science data analysis science archive preparation
The scope of SPICE usage has grown to cover the full mission lifecycle, as well as post-mission archive uses.
Mission design
Tutorials Introduction
N IF
Limited SPICE data have been (or are being) created for some past missions
Examples: Voyager, Viking Orbiter
SPICE is used to some degree in support of some space physics and astrophysics missions
Examples: Hubble Telescope, Spitzer Telescope, IBEX, Wise, Kepler, Solar Probe
SPICE will be used on at least one NASA earth science mission (SMAP) SPICE ephemerides are used at some terrestrial observatories SPICE is used by NASAs Deep Space Network for both scheduling and operating the DSN antennas.
* Not all are supported by NAIF; some are using SPICE on their own.
Tutorials Introduction
N IF
SPICE is the U.S. Planetary Data Systems de facto standard for archiving ancillary data
But its use is not a formal requirement
SPICE data for European planetary missions are archived in ESAs Planetary Science Archive
Some of these data will be mirrored on the NAIF server
SPICE data for some Japanese, Indian and Russian missions may be available in the future from their local archives
Already the case for Hayabusa
Tutorials Introduction
N IF
Users get complete source code and much documentation SPICE users are encouraged to reference SPICE when it has provided a significant contribution to ones work See the Rules link on the NAIF Home Page for a complete list of rules and recommendations
Tutorials Introduction
N IF
Training Materials
Navigation and Ancillary Information Facility
This set of tutorials has been presented and revised numerous times
No matter how hard we try, it seems impossible to:
get all the facts absolutely right and up-to-date get the level of detail right for every student get all of the language clear, complete and concise present everything in the correct order
These training materials are meant to supplementnot replacethe subroutine headers and the required reading reference documents that are the primary sources for user information about SPICE
Tutorials Introduction
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
Trajectory Data
SEDR Generation
SEDR
SEDR
Science Results
EDR* Generation
EDR
EDR
N IF
Generally only one SEDR file would be produced for each period of time Result: the scientist cant get better ancillary data if/when better inputs (e.g. spacecraft trajectory or orientation) are determined SEDR generation was done in the blind Operators were not familiar with processes used to make the inputs Operators were not familiar with scientists processing schemes Result: SEDR may not fully meet science teams expectations The SEDR system was not exportable to other institutions
N IF
Scientists Institution
Scientists Data Analysis Program
Science Telemetry
N IF
N IF
End users ("consumers") must do some non-trivial programming to read SPICE data and compute whatever is needed If the mission operations center is other than JPL, the appropriate project people need to learn how to produce SPICE data In some areas of SPICE the offering of choices to allow correct handling of different situations may present complexity that is unwarranted for simple problems
N IF
Navigation and Ancillary Information Facility
An Overview of SPICE
July 2013
N IF
Ancillary Data
SPICE deals with these data to support the planning for and analysis of these data
Overview of SPICE
N IF
Reference frames Positions Orientations Sizes/shapes Pointing Other
Orientation of spacecraft
Spacecraft Earth
Sun
Planet
N IF
Ancillary data are those that help scientists and engineers determine:
where the spacecraft was located how the spacecraft and its instruments were oriented (pointed) what was the location, size, shape and orientation of the target being observed what events were occurring on the spacecraft or ground that might affect interpretation of science observations
In the above weve used past tense, but doing the same functions for future times to support mission planning is equally applicable
Overview of SPICE
N IF
From the spacecraft From the mission control center From the spacecraft and instrument builders From science organizations SPICE is used to organize and package these data in a collection of stable file typescalled "kernels used by scientists and engineers
Overview of SPICE
N IF
Why SPICE?
Navigation and Ancillary Information Facility
space mission design, selection of observation opportunities, analysis of the science data returned from the instruments, mission engineering activities
Having proven, extensive and reusable means for producing and using ancillary data reduces cost and risk, and can help scientists and engineers achieve more substantive, accurate and timely results.
Overview of SPICE
N IF
Data files (kernels)... Software (SPICE Toolkit) .. Documentation .. Tutorials . Programming lessons .. Training classes User consultation ...
Overview of SPICE
N IF
S P I C E
* Coined by Dr. Hugh Kieffer, USGS Astrogeology Branch, Flagstaff AZ, circa 1985
Overview of SPICE
N IF
Logical Components
Spacecraft
Physical Files
Contents
Space vehicle or target body trajectory (ephemeris)
SPK PcK IK CK EK
ESP ESQ ENB
P Planet I Instrument
Camera-matrix
C E
Orientation of space vehicle or any articulating structure on it Events information: - Science Plan (ESP) - Sequence of events (ESQ) - Experimenters Notebook (ENB)
Events
Others
Overview of SPICE
Reference frame specifications Leapseconds tabulation Spacecraft clock coefficients Digital shape models 9
N IF
SPK
Space vehicle ephemeris (trajectory) Planet, satellite, comet and asteroid ephemerides More generally, position of something relative to something else Planet, satellite, comet and asteroid orientations, sizes, shapes Possibly other similar constants such as parameters for gravitational model, atmospheric model or rings model Instrument field-of-view size, shape, orientation Possibly additional information, such as internal timing
10
PcK
IK
Overview of SPICE
N IF
CK
Instrument platform (e.g. spacecraft) attitude More generally, orientation of something relative to a specified reference frame
EK
3 components
ESP: Science observation plans ESQ: Spacecraft & instrument commands ENB: Experiment notebooks and ground data system logs
Overview of SPICE
11
N IF
FK
Frames
- Definitions of and specification of relationships between reference frames (coordinate systems)
- Both fixed and dynamic frames are available
LSK
Leapseconds Tabulation
- Used for UTC <--> TDB (ET) time conversions
SCLK
DSK
Shape models (digital elevation model and tessellated plate model) (DSK)
Under development now
Overview of SPICE
ET = Ephemeris Time
12
N IF
Contents
Versions
Four languages
Fortran C Interactive Data Language (IDL) MATLAB Underdevelopment: Java Native Interface (JNI) Perhaps also Python PC/Linux PC/Windows Sun/Solaris Mac/OSX (even iPhone) Hewlett Packard/HP-UX
Programs (~30)
SPICE data production SPICE data management
Five platforms
Documentation
Highly annotated source code Technical Reference Manuals (23) User Guides
Several compilers
For the Fortran and C Toolkits
Overview of SPICE
13
N IF
SPK PcK
Evaluation of a planned orbit Instrument pointing plan Observation geometry visualization Analysis of expected communications link performance
IK
FK
SCLK LSK
Other needed data
EK
14
N IF
SPK PcK
IK
CK
FK
SCLK LSK
EK
Select kernel types and specific kernels as needed
Overview of SPICE
N IF
SPICE Toolkit software is portable between computers New Toolkits are released about every 10-15 months Code is well tested before being released to users New Toolkits are always 100% backwards compatible Source code is provided (and is well documented) Extensive user-oriented documentation is provided
Overview of SPICE
16
N IF
All numeric computations use double precision numbers Kernel files are portable between computers Kernel files are separable
Use only those you need for a particular application
SPICE kernels and software are free of licensing and U.S. ITAR restrictions
Everyone is free to use SPICE
17
N IF
Supported Environments
Navigation and Ancillary Information Facility
NAIF provides separate, ready-built SPICE Toolkit packages for each supported environment
If you need to port the Toolkit to a new environment yourself, consult with NAIF staff first
18
N IF
Pointing
Interference1
207
219
209
221
211
223
213
225
Interference2 215
NNO Pass
221
203
205
217
Elevation
Latitude
227
19
N IF
N IF
Find times when a selected geometric event occurs, or when a selected geometric condition exists
A Few Examples
50 100 150
When is the spacecrafts altitude within a given range? (say 50 to 100 km)
N IF
Cruise/Flyby
Remote sensing In-situ measurement Instrument calibration
Landers
Remote sensing In-situ measurements Rover or balloon relay
Orbiters
Remote sensing In-situ measurement Communications relay
Rovers
Remote sensing In-situ sensing Local terrain characterization
Terrestrial applications
Ephemerides for telescopes Radiometric tracking & comm Optical tracking & comm
Overview of SPICE
22
N IF
Time conversions UTC to ET mapping (generic LSK file)
Position Vectors Earth position relative to Solar System barycenter (planet ephemeris SPK file)
ZE Frame Orientations YE XO ZO ZR XR YJ2000 ZL YR YL XL Rover frame orientation relative to local level frame (rover CK file) YO Orbiter frame orientation relative to J2000 frame (orbiter CK file)
ZJ2000 Rover position relative to the landing site (lander) (rover SPK file)
XJ2000
Landing site (lander) position relative to the Mars center (landing site SPK file)
Mars position relative to the Solar System barycenter (planet ephemeris SPK file) XM Orbiter position relative to the center of Mars (orbiter SPK file) Overview of SPICE
ZM
Local level frame orientation relative to planet body-fixed frame (mission FK file)
YM
Planet body-fixed frame orientation relative to J2000 frame (generic PCK file)
23
N IF
Position Vectors Spacecraft position relative to planet center (spacecraft SPK file)
Orbiter Geometry
Navigation and Ancillary Information Facility
Frame Orientations Spacecraft frame orientation relative to inertial frame (spacecraft CK file) Camera frame orientation relative to spacecraft frame (mission FK file) XSC XA YSC ZSC ZA YA XAG ZAG YC ZC XC YSG YAG XSG ZSG Solar array gimbal frame orientation relative to spacecraft frame (solar array CK file) High gain antenna gimbal frame orientation relative to spacecraft frame (antenna CK file) Magnetometer frame orientation relative to solar array gimbal frame (mission FK file) High gain antenna frame orientation relative to high gain antenna gimbal frame (mission FK file)
High gain antenna gimbal position relative to spacecraft (structures SPK file)
High gain antenna phase center location relative to high gain antenna gimbal (structures SPK file)
Solar array gimbal position relative to spacecraft center (structures SPK file) XM YM Magnetometer position relative to solar array gimbal (structures SPK file) Overview of SPICE ZM
24
N IF
Position Vectors Left and right mast camera positions relative to camera head (structures SPK file) Robotic arm gimbal and camera relative positions (structures SPK file) Mast camera head position relative to lander (structures SPK file) Meteo sensor positions relative to lander (structures SPK file) Lander position relative to landing site (lander SPK file)
Lander Geometry
Navigation and Ancillary Information Facility
Frame Orientations Left and right mast camera frame orientations relative to camera head frame (mission FK file) Mast camera head frame orientation relative to lander frame (mast camera CK file) Robotic arm gimbal frames orientations relative to each other (arm CK file) Robotic arm camera frame orientation relative to last gimbal frame (mission FK file) Lander frame orientation relative to local level frame (lander CK file) Local level frame orientation relative to planet body-fixed frame (mission FK file) Descent camera frame orientation relative to lander frame (mission FK file)
YLC YRC ZRC XLC XCH YCH YRC ZCH XRC ZRC XL
YL
ZL
Descent camera position relative to lander (structures SPK file) Landing site position relative to planet center (landing site SPK file) Overview of SPICE
ZDC
YLL ZLL
25
N IF
Position Vectors Left and right mast camera center positions relative to end of mast (structures SPK file) End of mast position relative to elbow gimbal (structures SPK file) YRC ZRC
Rover Geometry
Navigation and Ancillary Information Facility
YLC XLC Frame Orientations Left and right mast camera frames orientation relative to mast elbow frame (mission FK file) Mast elbow frame orientation relative to mast shoulder frame (mast CK file) YE Mast shoulder frame orientation relative to mast torso frame (mast CK file) Mast torso frame orientation relative to rover frame (mast CK file) ZS YT ZR XR Rover frame orientation relative to local level frame (rover CK file) Local level frame orientation relative to planet body-fixed rotating frame (mission FK file)
XRC ZLC
XE Mast elbow gimbal position relative to shoulder gimbal (structures SPK file) Mast shoulder gimbal position relative to torso gimbal (structures SPK file) Mast torso gimbal position relative to rover (structures SPK file) Rover position relative to landing site (rover SPK file) Landing site position relative to planet center (landing site SPK file)
ZE
XS ZT
YS XT
YR YL XL(NORTH) ZL(GRAVITY)
Overview of SPICE
26
N IF
Data Restorations Apollo 15, 16 [L] Mariner 2 [L] Mariner 9 [L] Mariner 10 [L] Viking Orbiters [L] Viking Landers [L] Pioner 10/11/12 [L] Haley armada [L] Phobos 2 [L] (RSA) Ulysses [L] Voyagers [L] Lunar Orbiter [L] Helios 1,2 [L]
SPICE Users
Past Users Current/Pending Users Anticipated Navigation and Ancillary Information Facility Magellan [L] Cassini Orbiter Mars Rover 2020 Clementine (NRL) Mars Odyssey NASA Discovery Program Mars Observer [F] Mars Exploration Rover NASA New Frontiers Program Mars 96 (RSA) [F] Mars Reconnaissance Orbiter Mars Pathfinder DAWN Examples of Possible Future Use ? Mars Climate Orbiter [F] Mars Science Lab Solar Probe + Mars Polar Lander [F] Juno BepiColombo (ESA, JAXA) NEAR MAVEN Solar Orbiter (ESA) Deep Space 1 SMAP (Earth Science) JUICE (ESA) Galileo OSIRIS REx ExoMars (ESA, RSA) Genesis LADEE Akatsuki (JAXA) Deep Impact InSight Luna-Resurs (ISRO/RSA) Huygens Probe (ESA) [L] Luna-Glob (RSA) Stardust/NExT Europa Clipper Mars Global Surveyor Lunar Reconnaissance Orbiter Examples of Unsupported Users Phoenix New Horizons EPOXI Messenger STEREO GRAIL Spitzer Space Telescope [L] ISO [S] (ESA) Mars Express (ESA) Kepler [L] CONTOUR [F] Venus Express (ESA) Hubble Space Telescope [S] [L] = limited use Space VLBI [L] (multinational) Rosetta (ESA) Radioastron (RSA) [L] [S] = special services Smart-1 (ESA) IBEX [F] = mission failed Chandrayaan-1 (ISRO) James Webb Space Telescope [S] Hayabusa (JAXA) International Planetary Data Alliance Last updated 6/20/2013 Kaguya (JAXA) Planetary Data System NASA AMMOS Phobos Sample Return (RSA) [F] Planetary Science Archive (ESA) NASA Deep Space Network [S] NAIF has/had project-supplied funding to support mission operations, consultation for flight team members, and SPICE data archive preparation. NAIF also has PDS funding to help scientists and students with using SPICE data that have been officially archived at the NAIF Node of the PDS. NAIF has/had NASA funding to support a foreign partner in SPICE deployment and archive review, and to consult with flight team SPICE users. NAIF has token funding to consult with kernel producers at APL. APL provides support to science teams. NAIF has/had modest PDS-supplied funding to consult on assembly of a SPICE archive. NAIF has PDS funding to help scientists and students with using SPICE data that have been officially archived at the NAIF Node of the PDS. User consultation is provided by ESA's Science Operations Department. Note: SPICE is an option available to, but not a standard of, NASA, JPL, the PDS, ESA, ESA's PSA, and the IPDA. Overview of SPICE
27
N IF
The SPICE ancillary information system can serve as a set of blocks for building tools for implementing tools supporting multi-mission, international space exploration programs
S
Overview of SPICE
I C
E
28
SPICE: the ancillary information system that NAIF builds and often operates. NAIF: the JPL entity responsible for development and deployment of SPICE. NAIF Node of the PDS: one responsibility of the NAIF Group--archiving and providing long-term access to SPICE data for the worldwide science community.
N IF
Navigation and Ancillary Information Facility
Fundamental Concepts
April 2013
N IF
Topics
Navigation and Ancillary Information Facility
Preface Time Reference Frames Coordinate Systems Positions and States Aberration Corrections
Fundamental Concepts
N IF
Preface
Navigation and Ancillary Information Facility
This tutorial introduces terminology and concepts used in the later SPICE tutorials. Some of this material is more difficult than what follows in later presentations.
A complete understanding of this material is not essential in order to use SPICE.
Fundamental Concepts
N IF
Time
Navigation and Ancillary Information Facility
Clocks
Clocks count epochs specified by events such as: regular oscillations of a pendulum, quartz crystal, or electromagnetic radiation from a specified source, measured from an agreed upon reference epoch. Careful specification of epochs using clocks requires reference to the particular clock and the location of that clock.
Time Systems
Are agreed upon standards for naming epochs, measuring time, and synchronizing clocks
Fundamental Concepts
N IF
N IF
Astronomical Time (UT1) is an hour representation of the angle between the Greenwich zenith meridian and the location of the computed mean sun. Used prior to atomic time for civil time keeping
UT1
Fundamental Concepts
N IF
Ideally, UTC noon and astronomical noon at Greenwich (UT1) should occur simultaneously. However, the earths rotation is not uniform. Eventually, UTC noon and astronomical noon at Greenwich get out of sync. UTC
UT1 When the mismatch becomes greater than 0.9 atomic seconds, a leap second is added to (or removed from) the end of a designated UTC daynormally either June 30 or December 31. The variations in the earths rotation that cause leap seconds to be needed are not predictable.
Fundamental Concepts
N IF
1998 1998 1999 1999 Dec Dec Jan Jan 31 31 01 01
Leapseconds (+ and -)
Navigation and Ancillary Information Facility
Leap seconds complicate the task of finding the duration between two UTC epochs: You need to know when past leap seconds occurred to compute durations defined by pairs of past UTC epochs. Durations defined by pairs of future UTC epochs are indeterminate if leap seconds could occur in the interim.
Fundamental Concepts
N IF
Barycentric Dynamical Time (TDB) and Ephemeris Time (ET) are synonyms in SPICE documentation. TDB is
a mathematical Ideal used in the equations of motion. used as the independent time variable for many SPICE subroutine interfaces. related to ideal time at the Solar System Barycenter (TCB) by a scale factor, so that TDB advances on average at the same rate as TAI.
Fundamental Concepts
N IF
TDB and TDT have the same reference epoch (approximately 1 Jan 2000, 12:00:00 at Greenwich England) TDB and TDT advance at different rates.
Variations are small: ~ 1.6 milliseconds Variations are periodic with a period of 1 sidereal year (to first order) Variations are due to relativistic effects TDB = TDT + 0.001657 sin( E + 0.01671sin(E) )
10
N IF
Spacecraft Clocks
Navigation and Ancillary Information Facility
Spacecraft have onboard clocks to control scheduling of observations, maneuvers, attitude adjustments, etc. Used to time stamp data Fundamental unit of time is the tick
Smallest increment possible for spacecraft clock
Spacecraft clock time is a count of ticks since some reference tick. The duration of the tick drifts with respect to other time systems because spacecraft clocks are not very stable
Fundamental Concepts
11
N IF
SCLK string formats vary from one spacecraft clock to the next.
Cassini: Maximum reading for partition 1 = 1/4294967295.255 Partition number: 1 Seconds: 4294967295 Ticks (for Cassini, unit = 1/256 second): 255 Galileo: Maximum reading for partition 1 = 1/16777215:90:09:07 Partition number: 1 "RIM" count (unit = 60 2/3 seconds): 16777215 "Mod 91" count (unit = 2/3 second): 90 "RTI" count (unit = 1/15 second): 9 "Mod 8" count (unit = 1/120 second): 7
The format of spacecraft clock and the relationship between tick count and other time systems (usually UTC) is captured in a SPICE SCLK kernel
Fundamental Concepts
12
N IF
A reference frame is an ordered set of three mutually orthogonal (possibly time dependent) unitlength direction vectors, coupled with a location called the frames center or origin.
SPICE documentation frequently uses the shorthand frame instead of reference frame. The ordered set of axes of a reference frame is also called a basis.
A coordinate system specifies the method of locating a point within a reference frame.
Two examples of coordinate systems
Spherical coordinates
13
N IF
A reference frames center is an ephemeris object whose location is coincident with the origin (0, 0, 0) of the frame.
The center of the IAU_<body> frame is <body>. The center of any inertial frame is (in SPICE) the solar system barycenter. True even for frames naturally associated with accelerated bodies, such as MARSIAU.
Fundamental Concepts
14
N IF
Inertial
Non-rotating With respect to fixed stars Non-accelerating origin Velocity is typically non-zero; acceleration is negligible Examples: J2000 (also called ICRF), B1950
Non-Inertial
Examples Body-fixed
Centered at body center Topocentric
Fundamental Concepts
15
N IF
Mean Equator
Model gives mean direction of north pole of earth accounting for precession Defines z-axis of frame Defines a mean plane of equator
Mean Ecliptic
Model gives mean direction of the pole of the earth's orbit Defines a mean plane of the ecliptic
Ecliptic Plane
16
N IF
Fundamental Concepts
17
N IF
Rotating Frames
Navigation and Ancillary Information Facility
Rotating frames rotate with respect to Inertial Frames. Directions of axes are not constant w.r.t. inertial frames Centers may accelerate Examples:
Body-fixed frames are tied to the surface of a body and rotate with it. Spacecraft-fixed frames are defined by the time-varying orientation of a spacecraft
Fundamental Concepts
18
N IF
Defined with simple models for position of spin axis and motion of prime meridian Z-axis points to the north side of the invariable plane of the solar system Invariable plane is perpendicular to the angular momentum vector of the solar system
Fundamental Concepts
19
N IF
Topocentric Frames
Navigation and Ancillary Information Facility
z points up Topocentric frames are attached to a surface Z-axis is parallel to the gravity gradient or orthogonal to reference spheroid y points West
Position Vector
x points North
Azimuth (increases in clockwise direction, measured from +x axis)
20
N IF
Fundamental Concepts
21
N IF
Dwarf planets*, asteroids and comets spin in the right hand sense about their positive pole.
What the IAU now calls the positive pole is still referred to as the north pole in SPICE documentation. The positive pole may point above or below the invariable plane of the solar system (see above). This revision by the IAU Working Group (2006) inverts what had been the direction of the north pole for Pluto, Charon and Ida.
Y X
Fundamental Concepts
22
N IF
Planetodetic latitude
Tied to a reference ellipsoid For a point on a reference ellipsoid, angle measured from X-Y plane to the surface normal at the point of interest. For other points, equals latitude at the nearest point on the reference ellipsoid increases positively northward
Y X
Fundamental Concepts
23
N IF
Observer
24
N IF
State Vectors
Navigation and Ancillary Information Facility
The state of an object is its position and velocity relative to a second object
In SPICE, these objects are often referred to as target and observer or center E.g. Saturn relative to Saturn barycenter; Titan relative to Huygens probe
Fundamental Concepts
25
N IF
Transforming States
Navigation and Ancillary Information Facility
To perform algebraic operations on states they must be in the same reference frame. Position-only frame transformations require only a rotation* matrix given as a function of time.
PB (t) = RA to B(t) PA(t)
Position and velocity frame transformations require that we differentiate the above equation
dPB (t) /dt = dRA to B(t)/dt PA(t) + RA to B(t) d PA(t)/dt
We can use a 6x6 matrix to combine these two transformations into a single equation
Fundamental Concepts
26
N IF
where Si(t) = and
Transforming States
Navigation and Ancillary Information Facility
SB(t) = TA to B(t)SA(t)
( )
Pi(t) dPi(t)/dt
i = A or B
TA to B(t) =
RA to B(t)
)
27
The SPICELIB routines SXFORM and PXFORM return state transformation and position transformation matrices respectively.
Fundamental Concepts
N IF
Within the SPICE system, aberration corrections are adjustments made to state vectors and timedependent reference frames to accurately reflect the apparentas opposed to the actualstate and attitude of a target object as seen from a specified observer at a specified time.
Actual, uncorrected states from an ephemeris are called geometric states. When computing state vectors, SPICE users may request geometric or aberration-corrected states.
28
N IF
We compare the predicted appearance of a photograph from an optical camera against the actual photograph. We show three predictions derived using different aberration corrections: NONE, LT ("light time only"), and LT+S ("light time plus stellar aberration"). For each prediction, we use red overlays to indicate the expected location in the photo of the images of an extended target body (for example, a natural satellite), of features on the surface of the target body, and of a star.
NONE Predicted images using uncorrected target position and orientation and uncorrected star direction vector
Fundamental Concepts
LT Predicted images using light time-corrected target position and orientation and uncorrected star direction vector
LT+S Predicted images using light time and stellar aberrationcorrected target position, light time-corrected target orientation, and stellar aberration-corrected star direction vector
29
N IF
Predicted target body, surface feature, and star image locations (in red)
Actual image
Actual image
Using geometric target positions, target images in photos or other remote-sensing observations dont appear at their predicted locations.
Fundamental Concepts
30
N IF
Targets angular velocity vector Targets position and orientation at time ET-LT (light time corrected position and orientation)
Light travels this path in LT seconds Observers position at time ET At time ET, the observers camera records photons emitted from the target at time ET-LT, where LT is the one-way light time. The camera "sees" the target's position and orientation at ET-LT.
Fundamental Concepts
31
N IF
Predicted target body, surface feature, and star image locations (in red)
Actual image
Actual image
Using the light time corrected target position and orientation, the predicted locations in the photo of the target image and surface features have changed, but the accuracy of the prediction may still be poor.
Fundamental Concepts
32
N IF
Targets apparent position and orientation Targets position and orientation at time ET-LT (light time corrected position and orientation)
Observers position at time ET At time ET, the observers camera records photons emitted from the target at time ET-LT, where LT is the one-way light time. The vector from the observer at ET to the location of the target at ET-LT is displaced by a physical phenomenon called stellar aberration. The displaced vector yields the apparent position of the target.
Fundamental Concepts
33
N IF
Predicted target body, surface feature, and star image locations (in red)
Using the light time and stellar aberration-corrected target position, light timecorrected target orientation, and stellar aberration-corrected star direction, we obtain a significantly improved image location predictions. Remaining prediction errors may be due to, among other causes, pointing error, spacecraft and target ephemeris errors, and timing errors.
Fundamental Concepts
34
N IF
Angular offsets between corrected and uncorrected position vectors over the time span 2004 Jan 1--2005 Jan1
Mars as seen from MEX: LT+S vs NONE: .0002 to .0008 degrees LT vs NONE: .0006 to .0047 degrees Earth as seen from MEX: LT+S vs NONE: .0035 to .0106 degrees LT vs NONE: .0000 to .0057 degrees MEX as seen from Earth: LT+S vs NONE: .0035 to .0104 degrees LT vs NONE: .0033 to .0048 degrees Sun as seen from Mars: LT+S vs NONE: .0042 to .0047 degrees LT vs NONE: .0000 to .0000 degrees
Fundamental Concepts
35
N IF
Angular offsets between corrected and uncorrected position vectors over the time span 2004 Jan 1--2008 Jan1
Saturn as seen from CASSINI: LT+S vs NONE: .0000 to .0058 degrees LT vs NONE: .0001 to .0019 degrees Titan as seen from CASSINI: LT+S vs NONE: .0000 to .0057 degrees LT vs NONE: .0000 to .0030 degrees Earth as seen from CASSINI: LT+S vs NONE: .0000 to .0107 degrees LT vs NONE: .0000 to .0058 degrees CASSINI as seen from Earth: LT+S vs NONE: .0000 to .0107 degrees LT vs NONE: .0000 to .0059 degrees Sun as seen from CASSINI: LT+S vs NONE: .0000 to .0059 degrees LT vs NONE: .0000 to .0000 degrees
Fundamental Concepts
36
N IF
Navigation and Ancillary Information Facility
SPICE Conventions
A summary of standards, lingo and common usage within SPICE July 2013
N IF
SPICE
SPICE Lexicon - 1
Navigation and Ancillary Information Facility
NAIF
The name of the team of people at JPL who lead development of the SPICE system. Also the name of the ancillary data node of NASAs Planetary Data System (PDS).
SPICE Conventions
N IF
SPICE Toolkit The Toolkit Toolkit SPICELIB CSPICE
SPICE Lexicon - 2
Navigation and Ancillary Information Facility
Names that refer to the principal collection of software produced by JPLs NAIF Team as part of the SPICE information system. The Fortran 77 version of the Toolkit. The principal user library found within Fortran versions of the Toolkit. Used to refer to the entire C Toolkit, and also to the principal user library found within C versions of the Toolkit. An IDL interface to CSPICE A MATLAB interface to CSPICE
Icy Mice
N IF
Text kernel
SPICE Lexicon - 3
Navigation and Ancillary Information Facility
Any kernel type consisting entirely of ASCII information, with each line terminated using the local operating system convention (CR, LF, or CR+LF) Text kernel types are FK, IK, text PcK, LSK, SCLK, MK (Furnsh) Any set of text kernels could be combined in a single file. But this is certainly not recommended!
Binary kernel
Any kernel type using a binary file format Binary types are SPK, binary PcK, CK, DBK and DSK Different binary kernel types cannot be combined together
N IF
Command file
SPICE Lexicon - 4
Navigation and Ancillary Information Facility
Many SPICE application and utility programs either require, or optionally accept, an input file containing program directives, and sometimes input data. Unfortunately NAIF has not used a consistent approach for referring to such files. The following names have been used: setup file preferences file command file specifications file definitions file
Found flag
A Boolean output from a SPICE API that informs your program whether or not a result was obtained
N IF
SPICE Lexicon - 5
Navigation and Ancillary Information Facility
Deprecated software
Code that, while still useable, has been superseded with a newer and presumably better version We encourage you to not use deprecated SPICE software
Satellite is used to refer only to a natural satellite, never to a spacecraft. Run-time occurs when you execute a program
SPICE Conventions
N IF
SPICE Lexicon - 6
Navigation and Ancillary Information Facility
** Outside of SPICE the term coordinate system is often used synonymously with frame or
reference frame. We prefer to use coordinate system in the sense of describing how coordinates are measured (e.g. cylindrical coordinate system, rectangular coordinate system, polar coordinate system, etc), and to use frame in the sense of a set of three orthogonal vectors.
SPICE Conventions
N IF
NAIF suggests names conform to the PDS standard: 36.3 <1 to 36 alphanumeric characters>.<1 to 3 chars> Common usage within NAIF for SPICE kernel file name extensions is listed on the next page, with the following general style used:
t* b* x* text format (e.g. pck00008.tpc) binary format (e.g. de421.bsp) transfer format (e.g. de421.xsp)
SPICE Conventions
N IF
SPK: .bsp .xsp PcK: .tpc .bpc .xpc IK: .ti FK: .tf LSK: .tls CK: .bc .xc binary CK file transfer format CK file text LSK file text FK file text IK file binary SPK file transfer format SPK file text PcK file
(The most common type PcK)
text SCLK file text meta-kernel file (FURNSH kernel) binary DSK file
EK Family (ESP, ESQ, ENB) binary Science Plan EK file transfer format Science Plan EK file binary Sequence Component EK file transfer format Sequence Component EK file text Experimenters Notebook EK file
SPICE Conventions
N IF
These extensions are used for plain ASCII documents included with each Toolkit delivery
.ug .req .txt .idx Users Guide Required Reading technical reference document Used for a few miscellaneous documents Used only for the permuted index document
All HTML documents included in the Toolkit have extension .html Alternate formats of some Toolkit documents are available from the NAIF anonymous ftp server
.pdf PDF documents
SPICE Conventions
10
N IF
All Toolkits include public and private modules Public modules are available for your use
Names of public APIs are different in the four SPICE library implementations. For example, the top level SPK reader SPKEZR has the following names in SPICELIB (FORTRAN) SPKEZR In CSPICE (C) spkezr_c ICY (IDL) cspice_spkezr MICE (MATLAB) cspice_spkezr and mice_spkezr The API Reference Guide included in the Toolkit HTML documentation provides the complete list of all public SPICE APIs available in a specific implementation of the Toolkit
11
N IF
All reference frames used within SPICE are right handed systems: this means X cross Y = Z
Z
Y X
SPICE Conventions
12
N IF
Dwarf planets*, asteroids and comets spin in the right hand sense about their positive pole.
What the IAU now calls the positive pole is still referred to as the north pole in SPICE documentation. The positive pole may point above or below the invariable plane of the solar system (see above). This revision by the IAU Working Group (2006) inverts what had been the direction of the north pole for Pluto, Charon and Ida. Y X
13
N IF
Planetodetic latitude
Tied to a reference ellipsoid For a point on a reference ellipsoid, angle measured from X-Y plane to the surface normal at the point of interest. For other points, equals latitude at the nearest point on the reference ellipsoid increases positively northward
Y X
SPICE Conventions
14
N IF
Z
Spin direction
Y X
Observer
15
N IF
Quaternions
Navigation and Ancillary Information Facility
There are different styles of quaternions used in science and engineering applications. Styles are characterized by
The order of the quaternion elements The quaternion multiplication formula The convention for associating quaternions with rotation matrices
Engineering or MSOP
Widely used in JPL ACS/AACS and other aerospace applications
N IF
Many items within SPICE have assigned names (text strings) and IDs (integer numbers) The rules, standards, practices and exceptions regarding these names and IDs are discussed in a separate tutorial (NAIF IDs and Names)
SPICE Conventions
17
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
Summary of naming/numbering schemes used in SPICE Naming/numbering of physical objects Naming/numbering of reference frames Connection between the schemes
Caution: users sometimes confuse the ID assigned to an object and the ID(s) assigned to reference frame(s) associated with that object. Read on for details.
NAIF IDs and Names
N IF
physical objects reference frames
Overview - 1
Navigation and Ancillary Information Facility
SPICE uses IDs and names to identify: An ID is an integer number A name is a text string IDs are used primarily as data identifiers inside SPICE kernels Names are used primarily as input and output arguments in SPICE software interfaces (APIs)
N IF
Overview - 2
Navigation and Ancillary Information Facility
The schemes used for assigning IDs and names to physical objects and to reference frames are independent!
This means that, in general, SPICE does not make any assumptions about reference frame names and IDs based on the physical object names and IDs There are some exceptions; they will be mentioned later
N IF
Navigation and Ancillary Information Facility
N IF
One or more names can be assigned to that same object Within SPICE software there is a 1-to-MANY mapping between the ID and the name(s)
On input, the names are treated as synonyms On output, the name that was last associated with the ID is returned
NAIF IDs and Names
N IF
N IF
Physical object IDs are used in some APIs as input and/or output arguments:
in older SPK routines -- SPKEZ, SPKEZP, SPKGEO, in older derived geometry routines -- ET2LST, in older PCK routines -- BODVAR, BODMAT, in IK routines -- GETFOV, indirectly in G*POOL, in SCLK routines -- SCE2C, SCT2E, in coverage routines -- SPKOBJ, SPKCOV, CKOBJ, CKCOV and more
N IF
Physical object names are used in the high-level user APIs as input and/or output arguments:
in newer SPK routines -- SPKEZR, SPKPOS in newer derived geometry routines -- SINCPT, ILUMIN, SUBPNT, SUBSLR, in newer PCK routines -- BODVRD,
Physical object names are not used as data identifiers within kernels
N IF
These assignments exist most often in FKs (e.g. MER, MEX, JUNO, MSL), sometimes in IKs (e.g. CASSINI, MGS), but can be placed in any text kernel Mappings defined in text kernels take precedence over those defined in Toolkit source code
10
N IF
Unfortunately sometimes NASA re-uses a number This will happen with increasing frequency in the future Probably a new scheme is needed
11
N IF
0 10
Planets
N IF
301 401 402 501 901
Satellites
See the BACKUP section for details about how to handle more than 98 satellites.
13
N IF
1000001 1000002 1000032
There are three exceptions, for Gaspra, Ida and Dactyl See NAIF_IDS.REQ
One can search on SPK ID or name and find the other item using this website: http://ssd.jpl.nasa.gov/sbdb.cgi
*Sequence number is assigned by JPLs Solar System Dynamics Group
NAIF IDs and Names
14
N IF
Instruments
15
N IF
SPICE provides two routines to map physical object IDs to names, and vice versa
To get the ID for a given physical object name: CALL BODN2C ( NAME, ID, FOUND ) CALL BODS2C ( NAME, ID, FOUND )
To get the name for a given physical object ID: CALL BODC2N( ID, NAME, FOUND ) If the FOUND flag returned by either of these routines comes back FALSE, then the input ID or name cannot be mapped
16
N IF
You may define new or additional name-to-ID mappings using assignments inside any text kernel. For example, for a spacecraft:
NAIF_BODY_NAME NAIF_BODY_CODE += ( my_spacecraft_name += ( my_spacecraft_ID ) )
17
N IF
Navigation and Ancillary Information Facility
N IF
Text kernels define spacecraft frames, instrument frames, spacecraft subsystem frames, DSN station frames, etc.
See comments/data sections in a text kernel for the complete listing of the frames defined in that kernel
A single ID and a single name are assigned to a reference frame of any of the following types
Inertial frames Body-fixed frames Spacecraft and instrument frames Topocentric frames Any other reference frame for which the orientation may be needed to compute observation geometry
19
N IF
Reference frame IDs are used in the following kernels as data identifiers
in FKs -- to glue frame definition keywords together in SPKs -- to identify base reference frames in PCKs -- to identify base reference frames in CKs -- to identify base reference frames Reference frame IDs are not used in as input and/or output arguments in any high level user APIs
20
N IF
The reference frame name-to-ID mappings used by the SPICE system are defined in two places
Built into the Toolkit: hard-coded in source code For inertial frames For body-fixed frames defining the orientation for planets and most satellites See FRAMES REQUIRED READING for a complete listing In text kernels: provided by KEYWORD=VALUE sets Almost always in FKs (MER, MEX, JUNO, MSL, ) Very rarely in other kernels, but can be in any text kernel
(For example during operations MGS frames were defined in IKs and SCLK)
Unlike for physical objects, only one name may be directly associated with a reference frame ID
However, an alias for a given reference frame can be established by defining a new, zero-offset frame with its own unique name and ID
NAIF IDs and Names
21
N IF
1 17
NOTE: SPICE users would rarely if ever need to know or use the frame IDs; you use only the frame name
NAIF IDs and Names
22
N IF
IDs for frames associated with spacecraft, spacecraft structures, and instruments are usually defined as:
s/c ID times 1000 minus an arbitrary number
Spacecraft structure frame (ID and name) Instrument frames (ID and name)
NOTE: SPICE users would rarely if ever need to know or use the frame IDs; you use only the frame name
23
N IF
SPICE provides two routines to convert (map) reference frame IDs to names, and vice versa
To get the ID for a given reference frame name: CALL NAMFRM( NAME, ID ) To get the name for a given reference frame ID: CALL FRMNAM( ID, NAME ) If the ID or name cannot be mapped, these routines return zero and an empty/blank string respectively.
Note: SPICE users will rarely if ever need to call these routines
24
N IF
Although physical object and reference frame naming/numbering schemes are independent, there is nevertheless much overlap in the way objects and frames are named and numbered This overlap is due to the following reasons
Conventions adopted over the course of SPICE implementation Example: PCK-based body-fixed frames for planets and satellites are named IAU_<body name>
However, the IDs of these frames have nothing in common with the IDs of the objects (bodies) for which these frames are defined
The need for the object and frame IDs to be unique For this reason both the instrument (object) IDs and the instrument frame IDs are derived from the ID of the spacecraft on which the instrument is flown The need for the object and frame names to be meaningful For this reason the instrument frame names normally contain both the name of the spacecraft and the name of the instrument
25
N IF
CK IDs
Historically IDs used in CKs are called structure IDs but in reality they are much more closely related to frames than to physical objects To find which frame is associated with a particular CK ID, look through the FK for a frame whose _CLASS_ID keyword is set to the CK ID For CK-based frames both the frame ID and frame CLASS_ID are set equal to the CK ID
SCLK IDs
Because most spacecraft have only one on-board clock, the SCLK ID of that clock is the same as the spacecraft ID Should a spacecraft carry more than one independent clock, unique SCLK IDs for these other clocks would be needed Normally the ID of an additional clock will be set to the ID of the instrument, of which that clock is a part SCLK IDs are used in SCLK APIs (must be provided by the user) and by the frames subsystem when it reads CKs to determine orientation of CK-based frames (gets SCLK ID from CK_*_SCLK keyword provided in the frame definition or computes it by dividing CK ID by 1000)
NAIF IDs and Names
26
N IF
Ephemeris objects
Objects IDs/Names
10 399 699 601 602
Spacecraft and its structures
Frames IDs/Names
1 10013 10016 10039 10040 -82000 -82001 -82790 -82791 -82792 J2000 IAU_EARTH IAU_SATURN IAU_MIMAS IAU_ENCELADUS CASSINI_SC_COORD CASSINI_SRU-A CASSINI_CDA CASSINI_CDA_ART CASSINI_CDA_BASE CASSINI_CAPS CASSINI_CAPS_ART CASSINI_CAPS_BASE
CDA instrument
-82820
CAPS instrument
27
N IF
To find names and IDs associated with these objects and frames, users should refer as follows
For names/IDs of Cassini instruments: Cassini IKs For other missions this information is in the missions FK For names of the reference frames associated with the Cassini spacecraft, its subsystems and instruments: the Cassini FK For names of inertial frames and body-fixed frames associated with natural bodies: FRAMES.REQ For names/IDs of natural objects: NAIF_IDS.REQ
NAIF IDs and Names
28
N IF
Navigation and Ancillary Information Facility
Introduction to Kernels
July 2013
N IF
Overview Kernel architecture Producing kernels Using kernels
Agenda
Navigation and Ancillary Information Facility
Introduction to Kernels
N IF
Introduction to Kernels
N IF
SPK PcK
FK
Reference frame specifications
Spacecraft and Planet Ephemeris Planetary Constants, for natural bodies Orientation Size and shape
SCLK
Spacecraft clock correlation data
LSK
Leapseconds
IK
Instrument
MK
Meta-Kernel (a.k.a. FURNSH kernel) Mechanism for aggregating and easily loading a collection of kernel files
CK
Pointing (C-matrix)
EK
Events, up to three distinct components ESP: science plan ESQ: sequence ENB: experimenters notebook
DBK
Database mechanism
Primarily used to support the ESQ
Introduction to Kernels
N IF
Introduction to Kernels
N IF
Introduction to Kernels
N IF
Navigation and Ancillary Information Facility
Kernel Architecture
- Text kernels - Binary kernels - Comments in kernels
Introduction to Kernels
N IF
A text kernel is a plain text file of ASCII data It contains assignments of the form:
variable_name = value(s)
A text kernel can and should also contain descriptive meta-data (comments) that describe the assignments
Introduction to Kernels
N IF
KPL/<kernel type> \begindata NAME NaMe NUMBERS NUMBERS NUMBERS START \begintext
= 'Sample text value' = 'Keywords are case sensitive' = ( 10.123, +151.241, -1D14 ) += ( 1.0, 1, -10 ) += ( 1.542E-12, 1.123125412 ) = @2011-JAN-1
A data block
< some comments about the data > \begindata < more data in keyword = value syntax > \begintext < etc., etc. >
A meta-data block
(also called comments)
The next several pages describe what you see above See the Kernel Required Reading document for details
Introduction to Kernels
N IF
KPL/<kernel type>
- Appears on the first line - Tells SPICE software what kind of kernel it is - Examples of kernel type are FK, IK, PCK, SCLK
10
N IF
An assignment using the = operator associates one or more values with a variable name. An assignment using the += operator associates additional values with an existing variable name. An assignment using the @ symbol associates a calendar date with a variable name.
The string will be parsed and converted to an internal double precision representation of that epoch as seconds past J2000 There is no time system implied This conversion does not need a leap seconds kernel
Introduction to Kernels
11
N IF
Variable names
Max of 32 characters Are case sensitive (recommendation: use only upper case) Cannot include space, period, parenthesis, equals sign or tab Recommendation: dont use the + sign as the last character
Values
Numeric: integer, floating point and scientific notation are allowed String: maximum length of 80 characters and enclosed in single quotes SPICE has a means to concatenate multiple string values Time: identified by the @ character and converted to barycentric dynamical time (TDB) Any of these three types can be provided as a vector of values Components are separated by commas Parenthesis enclose the vector
12
N IF
A binary kernel contains lots of non-printing (unintelligible) data, usually interspersed with occasional occurrences of ASCII characters. Includes a comment area where descriptive meta-data should be placed.
Introduction to Kernels
13
N IF
All SPICE kernels can and should contain commentsdescriptive information about the data contained in the file.
Comments are also known as meta-data
Introduction to Kernels
14
N IF
Navigation and Ancillary Information Facility
Producing Kernels
Introduction to Kernels
15
N IF
Introduction to Kernels
16
N IF
Binary kernels are made using Toolkit utility programs, or by using Toolkit APIs built into your own application program See How Kernels are Made and Used in the BACKUP section for a bit more information See the Making an SPK and Making a CK tutorials
Introduction to Kernels
17
N IF
Navigation and Ancillary Information Facility
Using Kernels
Introduction to Kernels
18
N IF
Loading Kernels - 1
Navigation and Ancillary Information Facility
To make kernels available to a program you load them When you load a text kernel:
the file is opened the kernel contents are read into memory variable names and associated values are stored in a data structure called the kernel pool the file is closed
Introduction to Kernels
19
N IF
Loading Kernels - 2
Navigation and Ancillary Information Facility
Best practice: dont hard code filenameslist these in a meta-kernel and load the meta-kernel using FURNSH
CALL FURNSH (meta-kernel_name) (Fortran example) See the next page for more information on meta-kernels
Caution: Transfer format" versions of binary kernels can not be loaded; they must first be converted to binary with the Toolkit utility program tobin or spacit
Introduction to Kernels
20
N IF
What is a Meta-Kernel
Navigation and Ancillary Information Facility
A meta-kernel is a file that lists names (and locations) of a collection of SPICE kernels that are to be used together in a SPICE-based application
You can simply load the meta-kernel, causing all of the kernels listed in it to be loaded
Using a meta-kernel makes it easy to manage which SPICE files are loaded into your program A meta-kernel is implemented using the SPICE text kernel standards
Refer to the Kernels Required Reading technical reference for details
Introduction to Kernels
21
N IF
KPL/MK \begindata KERNELS_TO_LOAD = ( '/home/mydir/kernels/lowest_priority.bsp', '/home/mydir/kernels/next_priority.bsp', '/home/mydir/kernels/highest_priority.bsp', '/home/mydir/kernels/leapseconds.tls', '/home/mydir/kernels/sclk.tsc', '/home/mydir/kernels/c-kernel.bc', '/home/mydir/kernels+, '/custom/kernel_data/p_constants.tpc, )
The last file listed in this example (p_constants.tpc) demonstrates how to use the continuation character + to work around the 80 character limitation imposed on string sizes by the text kernel standards.
Introduction to Kernels
22
N IF
This meta-kernel uses the PATH_VALUES and PATH_SYMBOLS keywords to specify the directory where the kernels are located.
KPL/MK \begindata PATH_VALUES = ( '/home/mydir/kernels ) PATH_SYMBOLS = ( 'KERNELS' ) KERNELS_TO_LOAD = ( '$KERNELS/lowest_priority.bsp', '$KERNELS/next_priority.bsp', '$KERNELS/highest_priority.bsp', '$KERNELS/leapseconds.tls', '$KERNELS/sclk.tsc', '$KERNELS/c-kernel.bc', '$KERNELS/custom/kernel_data/p_constants.tpc )
Although the OS environment variable notation $<name> is used to refer to the symbols specified using the PATH_VALUES and PATH_SYMBOLS keywords, these symbols are NOT operating system environment variables and are set and used for substitution by SPICE only in the context of this particular meta-kernel. The + continuation character described on the previous page may be used to handle path strings that exceed 80 characters.
Introduction to Kernels
23
N IF
The number of binary kernels that may be loaded at any time is large, but limited.
For SPK, CK, and binary PCK files: Loaded SPKs + Loaded CKs + Loaded binary PCKs <= 1000
Will be increased to 5000 starting with the Version N65 Toolkits
For ESQ files: Loaded ESQs <= 20 For all kernels: Loaded kernels <= 1300
Assumes each has been loaded only once, and not unloaded.
There are also limits on the number of keywords and values for all loaded text kernels:
Maximum number of keywords is 5003. Maximum number of numeric data items is 200,000. Maximum number of character data items is 4000.
Introduction to Kernels
24
N IF
The order in which SPICE kernels are loaded at run-time determines their priority when requests for data are made
For binary kernels, data from a higher priority file will be used in the case when two or more files contain data overlapping in time for a given object. For SPKs, CKs and binary PCKs the file loaded last takes precedence (has higher priority). Priority doesnt apply to ESQ files all data from all loaded files are available. If two (or more) text kernels assign value(s) to a single keyword using the = operator, the data value(s) associated with the last loaded occurrence of the keyword are usedall earlier values have been replaced with the last loaded value(s). Orientation data from a binary PCK always supersedes orientation data (for the same object) obtained from a text PCK, no matter the order in which the kernels are loaded.
Introduction to Kernels
25
N IF
Unloading Kernels
Navigation and Ancillary Information Facility
The unloading of a kernel is infrequently needed for FORTRAN or CSPICE applications but is essential for Icy and Mice scripts
Because of the way IDL and MATLAB interact with external shared object libraries any kernels loaded during an IDL or MATLAB session will stay loaded until the end of the session unless they are specifically unloaded
The routines KCLEAR and UNLOAD may be used to unload kernels containing data you wish to be no longer available to your program.
KCLEAR unloads all kernels and clears the kernel pool UNLOAD unloads specified kernels KCLEAR and UNLOAD are only capable of unloading kernels that have been loaded with the routine FURNSH. They will not unload any files that have been loaded with older load routines such as SPKLEF (those used prior to availability of FURNSH).
Caution: unloading text kernels with UNLOAD will also remove any kernel pool data provided through the kernel pool API (P*POOL)
Introduction to Kernels
26
N IF
Backup
Navigation and Ancillary Information Facility
How kernels are made and used Why and how kernels are modified SPICE data structures hierarchy Problems making text kernels
Introduction to Kernels
27
N IF
How Made? SBP* Text editor SBP*
2 1
How Used?
Web browser or SBP*, depending on implementation
SPK PcK
2
SBP*
ESP
3
SBP*
SBP*
2
ESQ ENB
2
SBP*
Text editor
2
IK CK
2
SBP*
WWW or e-mail
SBP*
SBP*
SBP*
Text editor
3
LSK SCLK
3
SBP*
Text editor
2
FK DSK
SBP*
SBP*
SBP*
SBP*
SBP*
Text editor
Meta-kernel
(FURNSH)
SBP*
This represents current practice for most JPL missions, but is by no means a requirement. Anyone can make SPICE files.
28
N IF
File Type
SPK PcK
Text version
-To add metadata (comments) -To merge files or subset a file -To correct/revise an object ID -To revise data values -To add additional data items and values -To revise data values -To add additional data items and values -To add metadata (comments) -To merge files -To revise the interpolation interval -To subset a file -To revise data values -To add additional data items and values -To add metadata (comments) -To merge files or subset a file
IK
CK
FK DSK
Introduction to Kernels
N IF
File Type
The EK family
- To add metadata
- Text editor
- Text editor
Introduction to Kernels
30
N IF
SPK
High Level
EK Family
CK
PCK
OR
IK
FK SCLK
LSK
Meta-kernel
(FURNSH)
DSK
ENB
AND
ESP
OR
ESQ
Mid Level
DLA
DBK
MIME
Low Level
DAF
Binary DAF = Double Precision Array File DBK = Data Base Kernel DAS = Direct Access, Segregated
TEXT
Text
DAS
Binary
DSK = Digital Shape Kernel (under development) DLA = DAS Linked Array (under development)
Introduction to Kernels
Excepting MIME, each of these data structures is built entirely of SPICE components. PcK files are usually text-based, but binary versions exist for the earth and moon. The ESP has been implemented using both the ENB and ESQ mechanisms. The DBK is a SQL-like, homebrew database.
31
N IF
Cutting/pasting complete, or pieces of, data assignments or \begindata or \begintext markers into a text kernel can cause a problem
It may result in insertion of non-printing characters or incorrect end-of-line terminations This is not a problem for comments, but it is probably best to treat all portions of a text kernel the same
Introduction to Kernels
32
N IF
How do end-of-line markers appear when displayed in a text file using the cat -et command?
Unix/Linux/Mac: $ (line feed) Windows: ^M$ (carriage return followed by line feed)
Display the file type, language used, and end of line marker
file <file name>
Examples using Unix and Windows (PC) versions of the SPICE leapseconds kernel:
file naif0010.tls naif0010.tls: ASCII English text file naif0010.tls.pc naif0010.tls.pc: ASCII English text, with CRLF line terminators
Introduction to Kernels
33
N IF
To convert a Windows (DOS) style text kernel to Unix/Linux/Mac style: dos2unix <filename> For converting either style text kernel to the other style, use the SPICE bingo executable The bingo program and User Guide are available only from the NAIF/Toolkit/Utilities web page:
http://naif.jpl.nasa.gov/naif/utilities.html
More information
In Wikipedia, search on newline or unix2dos
Introduction to Kernels
34
N IF
Navigation and Ancillary Information Facility
Porting Kernels
July 2013
N IF
Porting Issues - 1
Navigation and Ancillary Information Facility
Data formats vary across platforms, so data files created on platform X may not be usable on platform Y.
Binary formats: different platforms use different bit patterns to represent numbers (and possibly characters). Text formats: different platforms use different mechanisms to represent lines in text files.
Usually a line terminator character sequence indicates endof-line.
We say two platforms have compatible binary or text formats if they use the same binary or text data representations. We say that a file is native if its format is the same as that used on the computer you are using.
Porting Kernels
N IF
Porting Issues - 2
Navigation and Ancillary Information Facility
Toolkit software can usually read kernels obtained from an incompatible platform
Binary SPK, CK, or PCK kernels from one system can always be read on an incompatible system Text kernels from one system can be read on an incompatible system only when using a C, IDL or MATLAB toolkit (not Fortran toolkits)
N IF
Porting Issues - 3
Navigation and Ancillary Information Facility
When conversion to native format is required to make the kernel usable, several options are available.
Use bingo for both binary and text kernels Available only from the NAIF website; not provided in Toolkit packages
For text kernels, doing your file download using ftp in ASCII mode will perform the required format conversion on the fly Web browsers often do text format conversion
However ASCII mode may not be available sftp clients usually dont provide it. In such cases other tools such as dos2unix and unix2dos, or bingo, must be used.
For binary kernels, the SPICE toxfr and tobin tools may be used to convert files to and from SPICE transfer format This is an ASCII-based format that may be transferred in the same way as other ASCII files.
Porting Kernels
N IF
Groupings of Text Compatible Environments 1 2 PC using Windows or N T Unix PC with LINUX Macintosh OSX (Motorola or Intel ch i p )
Porting Kernels
N IF
Groupings of Binary Compatible Environments PC/ Windows PC/Linux Mac Pro (Intel chip)
Porting Kernels
N IF
When you must email kernels, compress them either with zip, or gzip (or stuffit), then send the compressed file as an email attachment.
Porting Kernels
N IF
If the kernel you are using is a non-native binary kernel you can read this file but you may not write data to this file.
You can read most non-native binary kernels using the automatic runtime conversion capability found in the APIs of modern Toolkits. You cannot write information into the comment area, or delete information from the comment area. You cannot append additional data to the kernel.
Run-time conversion does not work for E-kernel (ESQ) or shape model (DSK) kernels.
More generally, it does not yet work for any file built upon the SPICE DAS architecture.
Porting Kernels
N IF
You may load and read both non-native and native binary kernels in the same runtime instance
But not including DSKs or ESQs
You may merge any combination of native and nonnative SPK files
The resultant, merged SPK file will be in native format
Porting Kernels
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Comments are information that describe the context of kernel data, i.e. data about data Comments are provided inside kernels as plain text (prose) Examples of comments:
Data descriptions This file contains representations of the trajectories for bodies X, Y and Z over the interval from launch to landing Data accuracy Data pedigree How and by whom the kernel was created
The program(s) and/or steps used in creation Contact information for users questions email address phone numbers
Data sources used as inputs when creating the kernel Intended kernel usage Companion files
N IF
Binary kernels contain a reserved comment area to hold comments Text kernels have comments interleaved with the data
Comments may be placed at the beginning of the text kernel, before any data Comments may be inserted between blocks of data using \begintext and \begindata as start and end markers: \begintext
Some comments
\begindata
Some data
N IF
Binary Kernels
Use the commnt utility program, available in the Toolkit Include comment information at the time of kernel creation using SPICE APIs (subroutines)
This capability is not yet available in Mice
Text Kernels
Use a text editor
Begin comment sections with the \begintext marker alone on a line
(The marker is not needed for comments placed at the beginning of a text kernel)
Restrictions
For both binary and text kernels
Comment line length limit is 255 characters. However, NAIF recommends using no more than 80 characters per line as this makes your comments far more readable! Use only printing characters (ASCII 32 - 126) Manipulating binary kernel comments requires the kernel be in the native binary format for the machine being used
N IF
Binary kernels:
Use either the commnt or spacit utility program Both are available in all Toolkits
Text kernels:
Use any available text file utility, such as: more, cat, vi, emacs Notepad, TextEdit, BBEdit, Word, etc.
N IF
This example shows reading the comments in an SPK file using the commnt utility program
Terminal Window Prompt> commnt -r de421.bsp | more ... DE 421 JPL Planetary Ephemeris SPK ================================== Original file name: Creation date: File created by: Comments added by: de421.bsp Feb. 13, 2008 Dr. William Folkner (SSD/JPL) Nat Bachman (NAIF/JPL)
This SPK file was released on February 13, 2008 by the Solar System Dynamics Group of JPL's Guidance, Navigation, and Control section. The DE 421 planetary ephemeris is described in JPL IOM 343R-08-002, dated Feb. 13, 2008. The introduction of that memo states, in part, that this ephemeris "represents an overall update for all --More--
N IF
This example show use of the unix more processor to examine an entire text kernel, both comments and data.
Terminal Window prompt> more naif0008.tls KPL/LSK LEAPSECONDS KERNEL FILE =============================================================== Modifications: -------------2005, Aug. 3 NJB 1998, Jun 17 1997, Feb 22 WLT WLT
Modified file to account for the leapsecond that will occur on December 31, 2005. Modified file to account for the leapsecond that will occur on December 31, 1998. Modified file to account for the leapsecond that will occur on June 30, 1997.
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Getting Toolkit
Navigation and Ancillary Information Facility
All instances of the SPICE Toolkit are available 24x7 from the NAIF server:
http://naif.jpl.nasa.gov/naif/toolkit.html
N IF
The packages provided on the NAIF server have been built and tested by NAIF on the indicated environments. We highly recommend you NOT try to port any instance of the Toolkit to some other environment, especially without consulting with NAIF first.
There are portability issues and compiler optimization issues that must be carefully dealt with.
N IF
Installing Toolkit
Navigation and Ancillary Information Facility Terminal Window
To install the Toolkit, follow the directions given in the README. Normally this consists of the following for Unix, Linux and OSX boxes:
prompt> chmod u+x importSpice.csh prompt> ./importSpice.csh prompt> rm toolkit.tar
For PCs running Windows, execute the toolkit.exe application (or cspice or icy or mice) to expand the archive.
> toolkit
You now have the expanded toolkit (or cspice or icy or mice) package.
N IF
For some programming environments there are required additional steps to prepare for programming using SPICE. For some programming environments there are recommended additional steps to make program development easier. Read the Preparing for Programming tutorial and the README file found in the Toolkit download directory for more information!
Installing the SPICE Toolkit
N IF
Checking It Out
Navigation and Ancillary Information Facility
Problems might occur if your operating system or compiler versions are (way) out of sync with what NAIF used in making its builds
Rebuild the Toolkit using the script makeall.csh (or makeall.bat) located in the top level directory (toolkit or cspice or icy or mice)
In the rare circumstance that things still dont work, contact your System Administrator or NAIF
N IF
Backup
Navigation and Ancillary Information Facility
N IF
prompt> ftp naif.jpl.nasa.gov Connected to naif.jpl.nasa.gov 220 Welcome to the NAIF FTP service. Name (your.sight:your_name): anonymous 331 Please specify the password Password: [email protected] 230230- ====================================================================== 230- | Jet Propulsion Laboratory | 230- | * * * W A R N I N G * * * | 230- | Property of the | 230- | UNITED STATES GOVERNMENT | 230- ====================================================================== 230230 Login successful. Have fun. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd pub/naif/toolkit/<FORTRAN or C or IDL or MATLAB> 250 CWD command successful. ftp> dir
N IF
ftp> dir Mac_OSX_Absoft Mac_OSX_IFORT Mac_OSX_g77 PC_Cygwin PC_Linux PC_Windows_Digital PC_Windows_IFORT PC_Windows_Lahey Sun_Solaris
The environments available at the time you download the Toolkit will likely differ from those shown here.
FORTRAN
IDL
MATLAB
N IF
ftp> cd <environment>/packages ftp> binary 200 Type set to I ftp> get toolkit.tar.Z ( or toolkit.exe or cspice.tar.Z or cspice.exe or icy.tar.Z or icy.exe or mice.tar.Z or mice.exe ) . . . ftp> ascii 200 Type set to A ftp> get importSpice.csh ( or importCSpice.csh or importIcy.csh or importMice.csh ) ( not availabe for Windows environment ) ftp> get README ftp> get dscriptn.txt ftp> get whats.new ftp> quit
10
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Unix
set set set set
csh, tcsh: Use the set command to add the location of toolkit executables to your path.
path path path path = = = = ($path ($path ($path ($path /my_directory/toolkit/exe) /my_directory/cspice/exe) /my_directory/icy/exe) /my_directory/mice/exe)
bash
PATH=$PATH:/my_directory/toolkit/exe PATH=$PATH:/my_directory/cspice/exe PATH=$PATH:/my_directory/icy/exe PATH=$PATH:/my_directory/mice/exe
Windows
Add location of toolkit executables to the environment variable PATH from the Advanced pane on the System Control Panel (Control Panel->System->Advanced).
drive:\my_directory\toolkit\exe drive:\my_directory\cspice\exe drive:\my_directory\icy\exe drive:\my_directory\mice\exe
Replace the italics with the path in which you installed the toolkit on your computer.
Preparing for Programming
N IF
/naif/cspice/ /naif/toolkit/
Unix/Linux: Builds
Navigation and Ancillary Information Facility
Compile and link an applicationlets pretend its named programagainst the CSPICE or SPICELIB library.
For C: $ gcc program.c -I/naif/cspice/include /naif/cspice/lib/cspice.a -lm For FORTRAN:
$ g77 program.f /naif/toolkit/spicelib.a
Note: some FORTRAN compilers (e.g. Absoft) require an additional flag "-lU77" to pull in the standard Unix symbols when linking against SPICELIB.
The default SPICE library names do not conform to the UNIX convention libname.a. So you cannot use the conventional library path/name options L and l, e.g.
gcc -L/path_to_libs/ -lname
N IF
The standard installation of Microsoft Visual Studio may not update environment variables needed to use the C compiler (cl) from the standard DOS shell. This depends on your version of the Microsoft development environment.
If programming for a 32-bit environment, you can set the environment variables by executing from a DOS shell one of the vars32 batch scripts supplied with Microsoft compilers:
vars32.bat vcvars32.bat vsvars32.bat
If available on your system, you can execute the Visual Studio version Command Prompt utility from the Programs -> Microsoft Visual Studio version -> Visual Studio Tools menu. The utility spawns a DOS shell set with the appropriate environment variables.
N IF
Compile and link an application, say program, against the CSPICE or SPICELIB library.
For C toolkits:
> cl program.c -IC:\naif\cspice\include C:\naif\cspice\lib\cspice.lib
N IF
e.g.
IDL > dlm_register, /naif/icy/lib/icy.dlm
Or, copy icy.dlm and icy.so (or icy.dll) to IDL's binary directory located at {The IDL install directory}/bin/bin.user_architecture, e.g.
Unix, X86 architecture
cp icy.dlm icy.so /usr/local/itt/idl64/bin/bin.linux.x86/
N IF
Unix specific:
Start the IDL application from a shell in the directory containing both icy.dlm and icy.so. Append the path to your icy.dlm to the IDL_DLM_PATH environment variable to include the directory containing icy.dlm and icy.so, e.g.:
setenv IDL_DLM_PATH "<IDL_DEFAULT>:_path_to_directory_containing_icy.dlm_"
Caveat: with regards to the Icy source directory, icy/src/icy, do not invoke IDL from the directory, do not register the directory, and do not append to IDL_DLM_PATH the directory. This directory contains an icy.dlm but not icy.so.
N IF
Windows specific:
Set environment variable IDL_DLM_PATH from the Advanced pane of the System Control Panel.
Once registered (by whatever means) confirm IDL recognizes and can access Icy.
Using the help command:
IDL> help, icy, /DL **ICY - IDL/CSPICE interface from JPL/NAIF (not loaded)
Appearance of the words not loaded might suggest something is wrong, but this is expected state until you execute an Icy command.
N IF
Recommended for Icy Use the IDL IDEs preferences panel to set the current working directory to the location where you will be developing your lessons code. Optional: Place your dlm_register command in a start up script. Specify the script using the IDL IDEs preferences panel.
N IF
Mice
Navigation and Ancillary Information Facility
Required for Mice Assume the Mice distribution is installed at C:\naif\mice\ on Windows, or /naif/mice/ on Unix/Linux. Use of Mice from Matlab requires the Mice source and library directories exist in the Matlab search path. The easiest way to update the Matlab path is with the addpath command.
On Windows:
>> addpath('C:\naif\mice\lib') >> addpath('C:\naif\mice\src\mice')
On Unix/Linux:
>> addpath('/naif/mice/lib') >> addpath('/naif/mice/src/mice')
10
N IF
Navigation and Ancillary Information Facility
Backup
Icy programming example Mice programming example References
11
N IF
As an example of Icy use with vectorization, calculate and plot the trajectory in the J2000 inertial frame of the Cassini spacecraft from June 20, 2004 to December 1, 2005.
;; Construct a meta kernel, "standard.tm, which will be used to load the needed ;; generic kernels: "naif0009.tls," "de421.bsp, and "pck0009.tpc. ;; Load the generic kernels using the meta kernel, and a Cassini spk. cspice_furnsh, 'standard.tm' cspice_furnsh, '/kernels/cassini/spk/030201AP_SK_SM546_T45.bsp' ;; Define the number of divisions of the time interval and the time interval. STEP = 10000 utc = [ 'Jun 20, 2004', 'Dec 1, 2005' ] cspice_str2et, utc, et times = dindgen(STEP)*(et[1]-et[0])/STEP + et[0] cspice_spkpos, 'Cassini', times, 'J2000', 'NONE', 'SATURN BARYCENTER', pos, ltime ;; Plot the resulting trajectory. x = pos[0,*] y = pos[1,*] z = pos[2,*] iplot, x, y, z cspice_kclear
12
N IF
Graphic Output
Navigation and Ancillary Information Facility
z y
Trajectory of the Cassini vehicle in the J2000 frame, for June 20, 2004 to Dec 1, 2005
Preparing for Programming
13
N IF
As an example of Mice use with vectorization, calculate and plot the trajectory in the J2000 inertial frame of the Cassini spacecraft from June 20, 2004 to December 1, 2005
% Construct a meta kernel, "standard.tm, which will be used to load the needed % generic kernels: "naif0009.tls," "de421.bsp, and "pck0009.tpc. % Load the generic kernels using the meta kernel, and a Cassini spk. cspice_furnsh( { 'standard.tm', '/kernels/cassini/spk/030201AP_SK_SM546_T45.bsp'} ) % Define the number of divisions of the time interval and the time interval. STEP = 1000; et = cspice_str2et( {'Jun 20, 2004', 'Dec 1, 2005'} ); times = (0:STEP-1) * ( et(2) - et(1) )/STEP + et(1); [pos, ltime]= cspice_spkpos( 'Cassini', times, 'J2000', 'NONE', 'SATURN BARYCENTER' ); % x y z Plot the resulting trajectory. = pos(1,:); = pos(2,:); = pos(3,:);
plot3(x,y,z) cspice_kclear
14
N IF
Graphic Output
Navigation and Ancillary Information Facility
Trajectory of the Cassini vehicle in the J2000 frame, for June 20, 2004 to Dec 1, 2005
Preparing for Programming
15
N IF
References
Navigation and Ancillary Information Facility
icy.req, Icy Required Reading mice.req, Mice Required Reading Introduction to the Family of SPICE Toolkits, tutorial
16
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
Architecture Contents Characteristics Versions Capabilities Directory Structure Application Programs Utility Programs Documentation Backup: Currently Supported Environments
N IF
Toolkit Architecture
Navigation and Ancillary Information Facility
The SPICE Toolkit is available in Fortran, C, IDL (Interactive Data Language), and Matlab. The Fortran, C, IDL, and Matlab Toolkits are packaged and delivered as standalone products.
The IDL and Matlab Toolkits, by necessity, also include the complete C Toolkit.
N IF
Users Application Program
ANSI Fortran 77
f2c
Translated C
Translated C
Translated C
f2c
FORTRAN Toolkit
C CSPICE
IDL Icy
MATLAB Mice
N IF
Fortran Toolkit
Navigation and Ancillary Information Facility
Compiles under a wide variety of Fortran compilers. While NAIF cannot guarantee proper functioning of SPICE under F90/F95 compilers except on officially supported environments, those compilers might properly compile SPICELIB with the resulting libraries being callable from F90/F95 code if that compiler supports the F77 standard.
N IF
C Toolkit
Navigation and Ancillary Information Facility
f2cd functions may be called directly, but this is strongly discouraged since f2cd functions emulate Fortran functionality:
Call by reference Fortran-style array indexing Fortran-style strings
N IF
C Toolkit, continued
Navigation and Ancillary Information Facility
CSPICE runs under a wide variety of ANSI C compilers. CSPICE functions may be called from within C++ source code. CSPICE prototypes are protected from name mangling. Current CSPICE Limitations Not all Required Reading reference documents have been converted to C style, with C examples.
Eventually all will be converted.
CSPICE wrappers do not exist for every API provided in the Fortran toolkits.
Includes all the most commonly used modules. More will be added as time permits.
In some very limited cases, code generated by f2c fails to emulate Fortran accurately. Should not be a problem.
List-directed I/O has some problems (not consequential for CSPICE). Treatment of white space in text output is slightly different in CSPICE. Logical unit-to-file name translation does not handle file name "synonyms" properly under Linux: once opened with a specified name, a file must be referred to using the same name throughout a program run.
N IF
IDL Toolkit
Navigation and Ancillary Information Facility
NAIF will add additional interfaces to Icy as time permits. By necessity all Icy Toolkit packages include the complete CSPICE Toolkit. Additional Icy software components are:
IDL interface wrappers (implemented in ANSI C) Icy cookbook programs (implemented in IDL)
N IF
Matlab Toolkit
Navigation and Ancillary Information Facility
By necessity all Mice Toolkit packages include the complete CSPICE Toolkit. Additional Mice software components are:
Matlab interface wrappers (implemented in Matlab wrapper scripts calling the ANSI C based interface library) Mice cookbook programs (implemented in Matlab script)
N IF
Software
Toolkit Contents
Navigation and Ancillary Information Facility
SPICELIB (Fortran) CSPICE (C) Icy (C) Mice (C and Matlab scripts)
Executable programs
Documentation
Available in ASCII and HTML
Data
Sample kernel files (supplied only for use with cookbook example programs, not valid for general use).
10
N IF
Toolkit Characteristics
Navigation and Ancillary Information Facility
Computations are identical in all languages. For a given computer and operating system, all Toolkits use identical kernel files.
Refer to the Porting Kernels tutorial for information about using kernels received from a machine different from what you are using.
Code is well tested before being released to users. New Toolkits are always backwards compatible.
An application that worked when linked against an older Toolkit will link and work, without need for changes, using a new Toolkit. Past functionality is never changed or removed.
Enhancements of existing routines are allowed. NAIF reserves the right to fix bugs.
11
N IF
Toolkit Version
Toolkit Versions
Navigation and Ancillary Information Facility
The version number applies to the Fortran, C, IDL and Matlab implementations for all supported platforms.
On rare occasion a Toolkit update is released to fix bugs, improve documentation, or satisfy an urgent request from a flight project.
12
N IF
Toolkit libraries contain a broad set of capabilities related to the computations needed for observation geometry and time conversions. Not all functionality is present in all four language versions of the Toolkit library.
The Fortran (Toolkit) and C (CSPICE) Toolkits provide almost identical functionality. The IDL (Icy) Toolkit duplicates most functionality available in the C Toolkit wrapper routines. The Matlab (Mice) Toolkit provides interfaces to those routines NAIF considers the most often needed by users.
13
N IF
14
N IF
Frame transformation
Obtain 3x3 matrices for frame transformations of positions Obtain 6x6 matrices for frame transformations of states
Time conversion
Conversion between standard systems: TDB, TT (TDT), UTC Conversion between SCLK and other systems Parsing and formatting
Geometry finder
Find times or time spans when a specified geometric situation is true Find times or time spans when a specified geometric parameter is within a given range, or is at a maximum or minimum
15
N IF
Math
Vector/Matrix operations Rotations, Euler angles, quaternions Coordinate conversion (systems: latitudinal, cylindrical, rectangular, RA and DEC, spherical, geodetic, planetographic) Geometry: ellipsoids, ellipses, planes High-level functions: illumination angles, sub-observer point, sub-solar point, surface intercept point.
Constants
Julian date of epoch J2000, SPD (seconds per day), PI, etc.
Strings
Parsing: find tokens, words Numeric conversion Pattern matching Replace marker, substring Suffix, prefix Case conversion Find first/last non-blank character, first/last printing character
16
N IF
Arrays
Sorting, finding order vector, reordering Searching: linear, binary Insertion and deletion
Name/code conversion
Bodies Frames
I/O support
Logical unit management (Fortran toolkits) Open, read, write text files Kernel pool API
Exception handling
Control exception handling behavior: mode, set message, assign output device.
17
N IF
18
N IF
The directory structures for the four kinds of Toolkits are almost identical. However
The CSPICE, Icy and Mice Toolkits also have a directory for include files. The names for application source code directories in CSPICE, Icy and Mice differ slightly from those in the Fortran toolkit. Icy and Mice include additional directories for :
Icy/Mice source code Icy/Mice cookbook programs
19
N IF
data doc
etc
In generic Toolkits this directory is empty.
exe
Executables for brief, chronos, ckbrief, commnt, inspekt, mkspk, msopck, spacit, spkdiff, frmdiff, spkmerge, tobin, toxfr, version. Executables for the several cookbook example programs.
20
N IF
lib
Toolkit libraries:
For Fortran SPICE Toolkits
spicelib.a or spicelib.lib (public modules; use these) support.a or support.lib (private modules; dont use these)
src
Source code directories for executables and libraries
Files have type *.f, *.for, *.inc, *.pgm, *.c, *.h, *.x, *.pro, *.m *.h files appearing here are not part of the user API
21
N IF
SPICE Toolkit application programs perform various tasks. Some examples are:
create a new SPK file from a text file of state vectors or elements
mkspk
22
N IF
commnt
23
N IF
Toolkit Documentation
Navigation and Ancillary Information Facility
24
N IF
Toolkit Documentation
Navigation and Ancillary Information Facility
HTML versions are are accessible using the Required Reading Documents link from the top level index. Plain text versions are located under doc and have extension .req Not all of Required Readings were adapted for all languages
Some of the Required Reading documents provided with CSPICE are still based upon Fortran SPICE Some of the Required Readings for Icy or Mice toolkits are still based upon CSPICE
Users Guides Interface specifications for the Toolkit utility programs and applications. HTML versions are accessible using the Users Guide Documents link from the top level index. Plain text versions are located under doc and have extension .ug.
25
N IF
Toolkit Documentation
Navigation and Ancillary Information Facility
Other documents
Permuted Index Maps phrases describing functionality to corresponding module names and file names Shows names of all entry points in Fortran toolkit APIs HTML version is accessible using the Permuted Index link from the top level index. Plain text version is located under doc and has extension .idx:
Fortran: C: IDL: Matlab: spicelib.idx cspice.idx icy.idx and cspice .idx mice.idx and cspice.idx
Toolkit Description Describes the directory structure and contents of an installed Toolkit Customized based on set of delivered products and platform HTML version is accessible using the Toolkit Contents link from the top level index. Plain text version is doc/dscriptn.txt
continues on next page
Introduction to the SPICE Toolkit
26
N IF
Toolkit Documentation
Navigation and Ancillary Information Facility
Introduction to SPICE HTML document containing a brief introduction to the Toolkit and SPICE system; accessible using the Introduction to the SPICE System link from the top level index. Whats New in SPICE Describes new features and bug fixes in each Toolkit release. Plain text version is doc/whats.new. HTML version is accessible using the Whats New in SPICE link from the top level index. Toolkit Version Description Indicates Toolkit version Plain text version is doc/version.txt Not available in HTML
27
N IF
Navigation and Ancillary Information Facility
28
N IF
Supported Environments
Navigation and Ancillary Information Facility
For the version N0064 Toolkit, NAIF supports a few more environments than those shown on the next four charts, but these will be gone as of N0065.
29
N IF
Product Name
Mac/Intel, OS-X, Intel FORTRAN, 32bit Mac/Intel, OS-X, Intel FORTRAN, 64bit Mac/Intel, OS-X, gfortran, 32bit Mac/Intel, OS-X, gfortran, 64bit PC, CYGWIN, g77, 32bit PC, Linux, Intel FORTRAN, 32bit PC, Linux, g77, 32bit PC, Linux, gfortran, 32bit PC, Linux, gfortran, 64bit PC, Windows, Intel FORTRAN, 32bit PC, Windows, Intel FORTRAN, 64bit Sun/Intel, Solaris, SUN FORTRAN, 32bit Sun/SPARC, Solaris, SUN FORTRAN, 32bit
Operating System
OS X 10.6.8 OS X 10.6.8 OS X 10.6.8 OS X 10.6.8 Windows/Cygwin Red Hat Linux (RHE4) Red Hat Linux (RHE4) Red Hat Linux (RHE4) Red Hat Linux (RHE4) Windows XP Windows XP Solaris 9 Solaris 9
Compiler
Intel Fortran 10.1 Intel Fortran 10.1 gfortran, GNU Fortran 4.3 gfortran, GNU Fortran 4.3 g77, GNU Fortran 3.2 Intel Fortran 10.0 g77, GNU Fortran 3.4 gfortran, GNU Fortran 4.3 gfortran, GNU Fortran 4.3 Intel Fortran 9.1 Intel Fortran 9.1 Sun FORTRAN 95 8.2 Sun FORTRAN 95 8.2
30
N IF
Product Name
Mac/Intel, OS-X, Apple C. 32bit Mac/Intel, OS-X, Apple C, 64bit PC, CYGWIN, gCC, 32bit PC, Linux, gCC, 32bit PC, Linux, gCC, 64bit PC, Windows, Microsoft Visual C, 32bit PC, Windows, Microsoft Visual C, 64bit Sun/Intel, Solaris, SunC, 32bit Sun/Intel, Solaris, SunC, 64bit Sun/SPARC, Solaris, gCC, 32bit Sun/SPARC, Solaris, gCC, 64bit Sun/SPARC, Solaris, SUN C, 32bit Sun/SPARC, Solaris, SUN C, 64bit
Supported Environments - C
Navigation and Ancillary Information Facility
Operating System
OS X 10.4.x OS X 10.4.x Windows/Cygwin Red Hat Linux (RHE4) Red Hat Linux (RHE4) Windows NT/2K/XP Windows NT/2K/XP Solaris 9 Solaris 9 Solaris 9 Solaris 9 Solaris 9 Solaris 9
Compiler
gcc, GNU C 4.2.1 gcc, GNU C 4.2.1 gcc, GNU C 3.2 gcc, GNU C 3.4.6 gcc, GNU C 3.4.6 Microsoft Visual Studio 2008 C Microsoft Visual Studio 2008 C SunC, GNU C 3.3.2 SunC, GNU C 3.3.2 gcc, GNU C 3.3.2 gcc, GNU C 3.3.2 Sun C 5.8 Sun C 5.8
31
N IF
Product Name
Mac/Intel, OS-X, Apple C/IDL, 32bit Mac/Intel, OS-X, Apple C/IDL, 64bit PC, Linux, gcc/IDL, 32bit PC, Linux, gcc/IDL, 64bit
Operating System
OS X 10.6.8 OS X 10.6.8 Red Hat Linux (RHE4) Red Hat Linux (RHE4) Windows XP Windows XP Solaris 9 Solaris 9 Solaris 9
Compiler
gcc, GNU C 4.2.1 gcc, GNU C 4.2.1 gcc, GNU C 3.4.6 gcc, GNU C 3.4.6 Microsoft Visual Studio 2008 C Microsoft Visual Studio 2008 C gcc, GNU C 3.3.2 gcc, GNU C 3.3.2 Sun C 5.8
PC, Windows, Microsoft Visual C/IDL, 32bit PC, Windows, Microsoft Visual C/IDL, 64bit Sun, Solaris, gcc/IDL, 32bit Sun, Solaris, gcc/IDL, 64bit Sun, Solaris, SUN C/IDL, 32bit
32
N IF
Product Name
Mac/Intel, OS-X, Apple C, 32bit Mac/Intel, OS-X, Apple C, 64bit PC, Linux, gCC, 32bit PC, Linux, gCC, 64bit PC, Windows, Microsoft Visual C/ Matlab, 32bit PC, Windows, Microsoft Visual C/ Matlab, 64bit Sun, Solaris, SUN C/Matlab, 32bit
Operating System
OS X 10.6.8 OS X 10.6.8 Red Hat Linux (RHE4) Red Hat Linux (RHE4) Windows XP Windows XP Solaris 9
Compiler
gcc, GNU C 4.2.1 gcc, GNU C 4.2.1 gcc, GNU C 3.4.6 gcc, GNU C 3.4.6 Microsoft Visual Studio .NET 7.0 C Microsoft Visual Studio 2008 C Sun C 5.8
33
N IF
Unsupported Environments
Navigation and Ancillary Information Facility
NAIF is unable to support environments other than those listed on the previous set of charts. The SPICE and CSPICE packages should function as expected on platforms running:
OpenBSD FreeBSD minGW
34
N IF
Unsupported Environments
Navigation and Ancillary Information Facility
35
N IF
Navigation and Ancillary Information Facility
The
MathWorks Inc.
N IF
Topics
Navigation and Ancillary Information Facility
Mice Benefits How does it work? Distribution Mice Operation Vectorization Simple Mice Examples
N IF
Mice Benefits
Navigation and Ancillary Information Facility
Mice operates as an extension to the Matlab environment. All Mice calls are functions regardless of the call format of the underlying CSPICE routine, returning Matlab native data types. Mice has some capability not available in CSPICE such as vectorization. CSPICE error messages return to Matlab in the form usable by the try...catch construct.
N IF
N IF
When a user invokes a call to a Mice function: 1. Matlab calls 2. the function's wrapper, which calls 3. the Mice MEX shared object library, which performs its function then returns the result 4. to the wrapper, which 5. returns the result to the user transparent from the users perspective.
N IF
Mice Distribution
Navigation and Ancillary Information Facility
N IF
Consequence: some kernel data may be available to one of your scripts even though not intended to be so.
You could get incorrect results! If you run only one script during your Matlab session, theres no problem.
N IF
N IF
Most Mice functions include use of vectorized arguments, a capability not available in C or Fortran toolkits. Example: use Mice to retrieve state vectors and light-time values for 1000 ephemeris times.
Create the array of 1000 ephemeris times in steps of 10 hours, starting from July 1, 2005:
start = cspice_str2et('July 1 2005'); et = (0:999)*36000 + start;!
Retrieve the state vectors and corresponding light times from Mars to earth at each et in the J2000 frame with LT+S aberration correction:
! [state, ltime] = cspice_spkezr( 'Earth', et, 'J2000', 'LT+S', 'MARS'); or starg = mice_spkezr( 'Earth', et, 'J2000', 'LT+S', 'MARS');
N IF
Access the ith state 6-vector (6x1 array) corresponding to the ith ephemeris time with the expression
state_i = state(:,i) or state_i = starg(i).state
Convert the ephemeris time vector et from the previous example to UTC calendar strings with three decimal places of precision in the seconds field.
!
The call returns utcstr, an array of 1000 strings (dimensioned 1000x24), where each ith string is the calendar date corresponding to et(i).
MATLAB Interface to CSPICE
continued on next page
10
N IF
Access the ith string of utcstr corresponding to the ith ephemeris time with the expression
utcstr_i = utcstr(i,:)
Convert the position components (the first three components in a state vector) of the N state vectors returned in state by the cspice_spkezr function to latitudinal coordinates.
[radius, latitude, longitude] = cspice_reclat( state(1:3,:) );
! The call returns three double precision 1x1000 arrays (vectorized scalars): radius, latitude, longitude.
11
N IF
As an example of using Mice, calculate and plot the trajectory of the Cassini spacecraft, in the J2000 inertial frame, from June 20 2004 to December 1 2005. This example uses the cspice_spkpos function to retrieve position data.
% Define the number of divisions of the time interval. STEP = 1000; % Construct a meta kernel, "standard.tm, which will be used to load the needed % generic kernels: "naif0009.tls," "de421.bsp, and "pck00009.tpc. % Load the generic kernels using the meta kernel, and a Cassini spk. cspice_furnsh( { 'standard.tm', '/kernels/cassini/spk/030201AP_SK_SM546_T45.bsp'} ) et times = cspice_str2et( {'Jun 20, 2004', 'Dec 1, 2005'} ); = (0:STEP-1) * ( et(2) - et(1) )/STEP + et(1);
[pos,ltime]= cspice_spkpos( 'Cassini', times, 'J2000', 'NONE', 'SATURN BARYCENTER' ); % x y z Plot the resulting trajectory. = pos(1,:); = pos(2,:); = pos(3,:);
plot3(x,y,z) cspice_kclear
continued on next page
12
N IF
Repeat the example of the previous page, except use the mice_spkezr function to retrieve full state vectors.
% Define the number of divisions of the time interval. STEP = 1000; % Construct a meta kernel, "standard.tm, which will be used to load the needed % generic kernels: "naif0009.tls," "de421.bsp, and "pck00009.tpc. % Load the generic kernels using the meta kernel, and a Cassini spk. cspice_furnsh( { 'standard.tm', '/kernels/cassini/spk/030201AP_SK_SM546_T45.bsp'} ) et = cspice_str2et( {'Jun 20, 2004', 'Dec 1, 2005'} ); times = (0:STEP-1) * ( et(2) - et(1) )/STEP + et(1); ptarg = mice_spkpos( 'Cassini', times, 'J2000', 'NONE', 'SATURN BARYCENTER' ); pos = [ptarg.pos]; % x y z Plot the resulting trajectory. = pos(1,:); = pos(2,:); = pos(3,:);
plot3(x,y,z) cspice_kclear
13
N IF
Trajectory of the Cassini spacecraft, in the J2000 frame, from June 20 2004 to Dec 1 2005
MATLAB Interface to CSPICE
14
N IF
Navigation and Ancillary Information Facility
Exelis
N IF
Topics
Navigation and Ancillary Information Facility
Icy Benefits How does it work? Distribution Icy Operation Vectorization Simple Use of Icy Functionality
N IF
Icy Benefits
Navigation and Ancillary Information Facility
Ease of use: Icy operates as an extension to the IDL language regime. Icy supports more than three-hundred CSPICE routines. Icy calls usually correspond to the call format of the underlying CSPICE routine, returning IDL native data types. Icy has some capability not available in CSPICE such as vectorization. CSPICE error messages return to IDL in a form usable by the catch error handler construct.
N IF
The IDL environment includes an intrinsic capability to use external routines. Icy functions as an IDL Dynamically Loadable Module (DLM). A DLM consists of a shared object library (icy.so/.dll) and a DLM text definition file (icy.dlm).
The shared library contains a set of IDL callable C interface routines that wrap a subset of CSPICE wrapper calls. The text definition file lists the routines within the shared library and the format for the routines call parameters.
Using Icy from IDL requires you register the Icy DLM with IDL to access the interface routines. Several means exist to do so.
On Unix/Linux, start IDL from the directory containing icy.dlm and icy.so
N IF
From the IDL interpreter (or from a command script), execute the dlm_register command: IDL> dlm_register,_path_to_directory_containing_icy.dlm_
Examples (Unix and Windows): IDL> dlm_register, /naif/icy/lib/icy.dlm IDL> dlm_register, c:\naif\icy\lib\icy.dlm
Append to the IDL_DLM_PATH environment variable the directory name containing icy.dlm and icy.so or icy.dll:
setenv IDL_DLM_PATH "<IDL_DEFAULT>:_path_to_directory_containing_icy.dlm_ Caveat: with regards to the Icy source directory, icy/src/icy, do not invoke IDL from the directory, do not register the directory, and do not append to IDL_DLM_PATH the directory. This directory contains an icy.dlm but no icy.so.
N IF
When a user invokes a call to a DLM routine: 1. IDL calls 2. the interface routine in the shared object library, linked against 3. CSPICE, which performs its function and returns the result 4. to IDL transparent from the users perspective.
N IF
Icy Distribution
Navigation and Ancillary Information Facility
NAIF distributes the Icy package as an independent product analogous to SPICELIB and CSPICE. The package includes:
the CSPICE source files the Icy interface source code platform specific build scripts for Icy and CSPICE IDL versions of the SPICE cookbook programs, states, tictoc, subpt, and simple an HTML based help system for both Icy and CSPICE, with the Icy help cross-linked to CSPICE the Icy shared library and DLM file. The system is ready for use after installation of the these files
N IF
In all known cases, the SIGFPE exceptions caused by CSPICE can be ignored. CSPICE assumes numeric underflow as zero.
A user can adjust IDLs response to math exceptions by setting the !EXCEPT variable:
!EXCEPT = 0 suppresses the SIGFPE messages, and even more (e.g. a fatal error). !EXCEPT = 1, the default, reports math exceptions on return to the interactive prompt.
NAIF recommends this be used.
N IF
Consequence: some kernel data may be available to one of your scripts even though not intended to be so.
You could get incorrect results! (If you run only one script during your IDL session, theres no problem.)
N IF
10
N IF
Several common Icy functions include use of vectorized arguments, a capability not available in C or FORTRAN toolkits.
Note: IDL indexes arrays using a base value of zero as opposed to FORTRAN, which uses a base value of one.
Example: access the first element of an IDL 1xN array using array[0], the second element using array[1], etc.
Example: use Icy to retrieve state vectors and light-time values for 1000 ephemeris times.
Create an array of 1000 ephemeris times with step size of 10 hours, starting from July 1, 2005.
cspice_str2et, 'July 1, 2005', start et = dindgen( 1000 )*36000.d + start
11
N IF
Retrieve the state vectors and corresponding light times from Mars to earth at each et, in the J2000 frame, using LT+S aberration correction:!
cspice_spkezr, 'Earth', et, 'J2000', 'LT+S', 'MARS', state, ltime
Access the ith state 6-vector corresponding to the ith ephemeris time with the expression
state_i = state[*,i]
Convert the ephemeris time vector et from the previous example to UTC calendar strings with three decimal places accuracy.
!
12
N IF
The call returns utcstr, an array of 1000 strings each ith string the calendar date corresponding to et[i]. Access the ith string of utcstr corresponding to the ith ephemeris time with the expression
utcstr_i = utcstr[i]
Convert the position components of the N state vectors to latitudinal coordinates (the first three components of a state vector - IDL uses a zero based vector index).
! cspice_reclat, state[0:2,*], radius, latitude, longitude !
The call returns three double precision variables of type Array[1000] (vectorized scalars): radius, latitude, longitude.
13
N IF
As an example of using Icy with vectorization, calculate and plot, in the J2000 inertial frame, the trajectory of the Cassini spacecraft from June 20 2004 to December 1 2005.
;; Construct a meta kernel, "standard.tm, which will be used to load the needed ;; generic kernels: "naif0009.tls," "de421.bsp, and "pck0009.tpc. ;; Load the generic kernels using the meta kernel, and a Cassini spk. cspice_furnsh, 'standard.tm' cspice_furnsh, '/kernels/cassini/spk/030201AP_SK_SM546_T45.bsp' ;; Define the number of divisions of the time interval and the time interval. STEP = 10000 utc = [ 'Jun 20, 2004', 'Dec 1, 2005' ] cspice_str2et, utc, et times = dindgen(STEP)*(et[1]-et[0])/STEP + et[0] cspice_spkpos, 'Cassini', times, 'J2000', 'NONE', 'SATURN BARYCENTER', pos, ltime ;; Plot the resulting trajectory. x = pos[0,*] y = pos[1,*] z = pos[2,*] iplot, x, y, z cspice_kclear IDL Interface to CSPICE
14
N IF
z y
Trajectory of the Cassini spacecraft, in the J2000 frame, from June 20 2004 to Dec 1 2005
15
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
Module* Header Purpose FORTRAN Module Header Locations C Module Header Locations Icy Module Header Locations Mice Module Header Locations Examine a Typical Header
N IF
NAIF uses module headers to provide detailed information describing how to use the module
In FORTRAN, C and MATLAB Toolkits the headers are comment blocks inserted in the source code In IDL Toolkits, where there are (currently) no source code files, the headers exist as independent files
All Toolkit distributions include plain text and HTML versions of the module headers.
Using the HTML version is usually the best approach because they are hyperlinked with other NAIF documentation
N IF
HTML versions:
<path to SPICELIB>/toolkit/doc/html/spicelib/index.html
N IF
HTML versions:
<path to CSPICE>/cspice/doc/html/cspice/index.html
N IF
The information provided in an Icy header is minimal in some cases; the corresponding CSPICE header provides more detail
A link to the corresponding CSPICE header is provided in the Icy header
N IF
The information provided in a Mice header is minimal in some cases; the corresponding CSPICE header provides more detail
A link to the corresponding CSPICE header is provided in the Mice header
N IF
As example, look for and examine the headers for the modules named spkezr and str2et
FORTRAN
SPKEZR STR2ET
C
spkezr_c str2et_c
IDL (Icy)
cspice_spkezr cspice_str2et
MATLAB (Mice)
cspice_spkezr cspice_str2et
spkezr is the principal ephemeris access module str2et is a key time conversion module
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Time inputs to and outputs from users programs are usually strings representing epochs in these three time systems:
Ephemeris Time (ET, also referred to as Barycentric Dynamical Time, TDB) Coordinated Universal Time (UTC) Spacecraft Clock (SCLK)
Time stamps in kernel files, and time inputs to and outputs from SPICE routines reading kernel data and computing derived geometry, are double precision numbers representing epochs in these two time systems:
Numeric Ephemeris Time (TDB), expressed as ephemeris seconds past J2000 Encoded Spacecraft Clock, expressed as clock ticks since the clock start
SPICE provides routines to convert between these string and numeric representations
N IF
N IF
Numeric Ephemeris Time to Calendar, DOY or Julian Date UTC, TDB, or TDT String
TIMOUT ( et, fmtpic, STRING ) fmtpic is an output time string format specification, giving the user great flexibility in setting the appearance of the output time string and the time system used (UTC, TDB, TDT).
See a backup slide for examples of format pictures to produce a variety of output time strings See the TIMOUT header for complete format picture syntax The module TPICTR may be useful in constructing a format picture specification from a sample time string
N IF
Any kind of time string used as an argument in a SPICE API must be provided in quotes
Fortran, Matlab and IDL: use single quotes C: use double quotes
N IF
N IF
Uniform time systems (TDT,TAI, JED, JDTDT)
SCE2C
SCT2E SCDECD
N IF
Navigation and Ancillary Information Facility
Backup
N IF
N IF
Navigation and Ancillary Information Facility
N IF
Topics
Navigation and Ancillary Information Facility
N IF
In most cases one or two kernel files are needed to perform conversions between supported time systems. LSK - The leapseconds kernel is used in conversions between ephemeris time (ET/TDB) and Coordinated Universal Time (UTC). SCLK - The spacecraft clock kernel is used in conversions between spacecraft clock time (SCLK) and ephemeris time (ET/TDB).
(Its possible there could be two or more clocks associated with a given spacecraft.)
N IF
The leapseconds kernel contains a tabulation of all the leapseconds that have occurred, plus additional terms. Used in ET UTC and in ET SCLK conversions.
Utility programs using LSK: spkmerge, chronos, spacit, etc. Subroutines using LSK: STR2ET, TIMOUT, ET2UTC, etc.
As with all SPICE kernels, load it using FURNSH. NAIF updates the LSK when a new leap second is announced by the International Earth Rotation Service (IERS).
The latest LSK file is always available from the NAIF server. The latest is always the best one to use. Announcement of each new LSK is made using the spice_announce system. http://naif.jpl.nasa.gov/mailman/listinfo/spice_announce Updates can occur ONLY on January 1st and July 1st
LSK & SCLK
N IF
KPL/LSK . . . <comments> . . . \begindata DELTET/DELTA_T_A DELTET/K DELTET/EB DELTET/M DELTET/DELTA_AT
1.99096871D-7 )
= ( 10, @1972-JAN-1 11, @1972-JUL-1 12, @1973-JAN-1 13, @1974-JAN-1 14, @1975-JAN-1 . . . <more leapsecond records> . . . 32, @1999-JAN-1 33, @2006-JAN-1 34, @2009-JAN-1 )
\begintext
N IF
An out-of-date leapseconds kernel can be used successfully for conversions that occur at epochs prior to the epoch of the first missing leapsecond.
Any conversions of epochs occurring after the epoch of a missing leapsecond will introduce inaccuracies in multiples of one second per missed leapsecond.
Using the latest leapseconds kernel to perform conversions at epochs more than six months ahead of the last leapsecond listed may result in an error if, later on, a new leapsecond is declared for a time prior to the epochs you processed.
N IF
The spacecraft clock kernel contains data used in conversions from SCLK to other time systems. It is required by Toolkit utilities and routines that utilize SCLK time.
For example, the SPICE CK subsystem makes heavy use of spacecraft clock time.
As with all SPICE kernels, use FURNSH to load it. Ensure you have the correct version of the SCLK file for your spacecraft since this kernel may be updated rather frequently.
SCLK files are usually maintained on a flight projects database. For JPL operated missions they can always be found on the NAIF server as well. When using a CK, correct SCLK means compatible with that CK. For reconstructed CKs, this is most likely the latest version of the SCLK. For predict CKs, this is probably the SCLK kernel used when the CK was produced.
N IF
KPL/SCLK . . . <comments> . . . \begindata SCLK_KERNEL_ID SCLK_DATA_TYPE_74 SCLK01_TIME_SYSTEM_74 SCLK01_N_FIELDS_74 SCLK01_MODULI_74 SCLK01_OFFSETS_74 SCLK01_OUTPUT_DELIM_74 = = = = = = = ( ( ( ( ( ( (
SCLK_PARTITION_START_74 = ( 0.0000000000000E+00 . . . <more partition start records> . . . 2.4179319500800E+11 ) SCLK_PARTITION_END_74 = ( 2.0692822929300E+11 . . . <more partition end records> . . . 1.0995116277750E+12 ) SCLK01_COEFFICIENTS_74 = ( 0.0000000000000E+00 -6.3119514881600E+08 1.0000000000000E+00 1.2098765056000E+10 -5.8393434781600E+08 1.0000000000000E+00 . . . <more coefficient records> . . . 2.4179319365000E+11 3.1330950356800E+08 9.9999997500000E-01 ) \begintext
LSK & SCLK
N IF
A SCLK character string is composed of one or more cascading integer numbers similar to a digital clock.
This form is derived from clock values represented by sets of bits or bytes, found in downlinked telemetry, whether for science or engineering/housekeeping data.
A SCLK value encoded as a double precision number (called ticks) is used within SPICE because its easy to convert this to other time systems, such as ephemeris time (ET, also called TDB).
LSK & SCLK
N IF
The Cassini orbiter SCLK time string consists of three fields separated by delimiters.
Partition Delimiter
1/1609504792.123
Least Significant Clock Field: Ranges from 0 to 255. Nominally 1/256th of a second increment.
Most Significant Clock Field: Ranges from 0 to 4294967295 (232-1). Nominally 1 second increment.
LSK & SCLK
* Several SCLK delimiter characters are available in SPICE. See SCLK Required Reading for details.
10
N IF
What is a Partition?
Navigation and Ancillary Information Facility
1/1609504792.123 The portion of the SCLK string circled above indicates the partition to which the remaining portion of the string is related.
A partition is a NAIF-created construct to handle spacecraft clock rollovers or resets. When referring to epochs in the first partition, the leading 1/ may be omitted. Many modern spacecraft dont use a partition other than 1.
11
N IF
Usually SCLK tags in raw telemetry are represented by sets of bits or bytes. Such tags must be converted to SCLK strings used in SPICE. This is an example of how it is done for the sample CASSINI SCLK string from previous slides.
Start with a 5-byte CASSINI TLM SCLK First four bytes are an unsigned integer representing seconds Last byte is an unsigned byte representing fractional seconds (as a count of 1/256 second ticks) Convert integer and fractional seconds to two strings Concatenate strings together using a recognized delimiter (., :, etc) Add the partition number and delimiter Optional, for most modern missions it may be omitted (not so for Chandrayaan-1 )
LSK & SCLK
5F EF 18 18 7B
12
N IF
The representation of SCLK time in the SPICE system is a double precision encoding of a SCLK string. Encoded spacecraft clock values represent ticks since spacecraft clock start.
The time corresponding to tick 0 is mission dependent and does not necessarily relate to launch time. It is often an arbitrary epoch occurring before launch.
A tick is the smallest increment of time that a spacecraft clock measures. For example, in the case of the Cassini orbiter this is nominally 1/256th of a second. Encoded SCLK increases continuously independent of leapseconds, clock resets, and clock rollovers.
LSK & SCLK
13
N IF
For more information about LSK, SCLK, and time conversions, look at the following documents
Time Required Reading SCLK Required Reading Time tutorial Most Useful SPICELIB Routines headers for the routines mentioned in this tutorial CHRONOS Users Guide Porting_kernels tutorial
Related documents
Kernel Required Reading CK Required Reading
14
N IF
Backup
Navigation and Ancillary Information Facility
15
N IF
The Galileo spacecraft SCLK time string consists of five fields separated by delimiters.
Clock Field Delimiters Partition Delimiter
1/16777214:90:9:7
Least Significant Clock Field: Ranges from 0 to 7. Nominally 1/120th of a second. Intermediate Clock Field: Ranges from 0 to 9. Nominally 1/15th of a second. Intermediate Clock Field: Ranges from 0 to 90. Nominally 2/3rd of a second.
Partition: Accounts for clock resets or counter rollover. Most Significant Clock Field: Ranges from 0 to 16777214. Nominally 60 2/3rd second increment.
16
N IF
The following are examples of SCLK strings* from missions using SPICE.
Cassini
1/1334314108.134
MPF
1/559627908.058
Viking 1&2
1/32233616
DS1
1/67532406.010
Mariner 9
1/11542909
Voyager 1&2
1/05812:00:001
Galileo
1/16777214:90:9:7
Mars Odyssey
1/687231994.091
Mars Express
1/0090979196.29713
Genesis
1/666230496.204
NEAR
1/40409721942
Venus Express
1/0033264000.50826
MGS
1/655931592.103
Stardust
1/697451990.042
Rosetta
1/0101519975.65186
* When clock strings are used as arguments in modules they must be contained in quotes:
- Single quotes for Fortran - Double quotes for C - Single quotes for IDL and MATLAB
LSK & SCLK
17
N IF
18
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
SPK is probably unlike any previous ephemeris or trajectory representation youve used or heard about. We think youll find it to be much more capable than other ephemeris system architectures. As such, its also a bit more complicated to grasp. Dont panic! Shortly youll be reading SPK files like a pro.
SPK Subsystem
N IF
Navigation and Ancillary Information Facility
SPK Subsystem
N IF
A Picture is worth
Navigation and Ancillary Information Facility
Well start with a mostly pictorial view of ephemeris data and SPK files, just to ease you into this topic.
SPK Subsystem
N IF
A single SPK file can contain data for multiple ephemeris objects, and often does See the next page for a pictorial representation of some of these objects.
SPK Subsystem
N IF
The head and the tail of every blue arrow are located at ephemeris objects.
Sun
Earth
....
*A barycenter is the center
of mass of a system of bodies, such as Saturn plus all of Saturn's satellites, or, the sun and all the planets and satellites in the solar system. SPK Subsystem
Lander or rover
N IF
epoch_1, x1, y1, z1, vx1, vy1, vz1 epoch_2, x2, y2, z2, vx2, vy2, vz2 epoch_3, x3, y3, z3, vx3, vy3, vz3 epoch_4, x4, y4, z4, vx4, vy4, vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn epoch = time
Perhaps this is an ASCII table or an Excel spreadsheet containing rows of time-tagged Cartesian state vectors
It may not be written inside the table or spreadsheet, but perhaps an interface agreement and/or a table name somehow tells you:
what objectthe targetthis ephemeris is for what is the name of the reference frame (coordinate frame) in which the data are given what is the center of motion of the target maybe also what are the start and stop times of the file meaning, what are epoch_1 and epoch_n
SPK Subsystem
N IF
epoch_1, x1, y1, z1, vx1, vy1, vz1 epoch_2, x2, y2, z2, vx2, vy2, vz2 epoch_3, x3, y3, z3, vx3, vy3, vz3 epoch_4, x4, y4, z4, vx4, vy4, vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
SPK Subsystem
N IF
epoch_1, x1, y1, z1, vx1, vy1, vz1 epoch_2, x2, y2, z2, vx2, vy2, vz2 epoch_3, x3, y3, z3, vx3, vy3, vz3 epoch_4, x4, y4, z4, vx4, vy4, vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
SPK Subsystem
N IF
An SPK Segment
Navigation and Ancillary Information Facility
epoch_1, x1, y1, z1, vx1, vy1, vz1 epoch_2, x2, y2, z2, vx2, vy2, vz2 epoch_3, x3, y3, z3, vx3, vy3, vz3 epoch_4, x4, y4, z4, vx4, vy4, vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
One segment
10
N IF
Some other stuff
epoch_1, x1, y1, z1, vx1, vy1, vz1 epoch_2, x2, y2, z2, vx2, vy2, vz2 epoch_3, x3, y3, z3, vx3, vy3, vz3 epoch_4, x4, y4, z4, vx4, vy4, vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
This most simple of SPK files is made up of a single segment containing ephemeris data:
SPK Subsystem
for a single object (perhaps a spacecraft, an asteroid, or whatever) given in a single reference frame (coordinate frame) having a single center of motion with data spanning from Tstart to Tstop
11
N IF
Some other stuff
epoch-1, x1, y1, z1, vx1, vy1, vz1 Target, Ref Frame ID, Center of Motion, T3, T4 epoch-2, x2, y2, z2, vx2, vy2, vz2 epoch-3, x3, y3, z3, vx3, vy3, vz3 epoch-1, x1, y1, vx1, vy1, epoch-4, x4, Ref y4,Frame z4, z1, vx4, vy4, vz4 vz1 Target, ID, Center of Motion T5, T6 epoch-2, x2, y2, z2, vx2, vy2, vz2 .................. etc. ................... epoch-3, x3, y3, z3, vx3, vy3, vz3 .................. etc. ................... epoch_1, x1, z4, y1, vx4, z1, vx1, vy1, epoch-4, x4, y4, vy4, vz4 vz1 epoch-n, xn, yn, zn, vxn, vyn, vzn epoch_2, x2, y2, z2, vx2, vy2, vz2 .................. etc. ................... epoch_3, x3, y3, z3, vx3, vy3, vz3 .................. etc. ................... epoch_4, x4, zn, y4, vxn, z4, vx4, epoch-n, xn, yn, vyn,vy4, vzn vz4 .................. etc. ................... .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
This more substantial SPK is made up of multiple segments containing ephemeris data:
for a single object (perhaps a spacecraft, an asteroid, or ???) given in a single reference frame (coordinate frame) having a single center of motion with data spanning from T1 to T6
SPK Subsystem
12
N IF
Some other stuff Target, Ref Frame ID, Center of Motion, T1, T2
epoch-1, x1, y1, z1, vx1, vy1, vz1 Target, Ref Frame Center of Motion, epoch-2, x2, y2, z2,ID, vx2, vy2, vz2 T5, T6 epoch-1, x1, y1, z1, vx1, vy1, vz1 epoch-3, x3,x2, y3, z3,z2, vx3, vy3, vz3 Target, Ref Frame ID, Center of Motion, epoch-2, y2, vx2, vy2, vz2 T7, T8 epoch-1, x1, y1, z1, vx1, vy1, vz1 epoch-4, x4, y4, z4, vx4, vy4, vz4 epoch-3, x3, y3, z3, vx3, vy3, vz3 Target, Ref Frame Center of Motion, epoch-2, x2, y2, z2,ID, vx2, vy2, vz2 T9, T10 .................. etc. ................... epoch-1, x1, z4, y1, vx4, z1, vx1, vy1, vz1 epoch-4, x4, y4, vy4, vz4 epoch-3, x3, y3, z3, vx3, vy3, vz3 .................. etc. ................... Target, Ref Frame Center of Motion, epoch-2, x2, y2, z2,ID, vx2, vy2, vz2 T11, T12 .................. etc. ................... epoch-1, x1, y1, z1, vx1, vy1, vz1 epoch-4, x4, y4, z4, vx4, vy4, vz4 epoch-n, xn, yn, x3, zn, y3, vxn, vyn, vzn epoch-3, z3, vx3, vy3, vz3 .................. etc. ................... epoch-2, x2, y2, z2, vx2, vy2, vz2 .................. etc. ................... epoch_1, x1, y1,vx4, z1, vy4, vx1, vy1, vz1 epoch-4, x4, y4, z4, vz4 epoch-n, xn, yn, x3, zn, y3, vxn, vyn, vzn epoch-3, z3, vx3, vy3, vz3vz2 .................. etc. ................... epoch_2, x2, y2, z2, vx2, vy2, .................. etc. ................... epoch-4, x4, x3, y4, y3, z4, z3, vx4, vy4, vz4vz3 epoch-n, xn, yn, zn, vxn, vyn, vzn epoch_3, vx3, vy3, .................. etc. ................... .................. etc. ................... epoch_4, x4,zn, y4,vxn, z4, vx4, epoch-n, xn, yn, vyn, vy4, vzn vz4 .................. etc. ................... .................. etc. ................... epoch-n, xn, yn, zn, vxn, vyn, vzn .................. etc. ................... epoch_n, xn, yn, zn, vxn, vyn, vzn
13
N IF
Some other stuff
Each segment can contain a different type of ephemeris data (as long as its been built into the SPK subsystem). Examples:
Discrete state vectors Chebyshev polynomials Conic elements Etc., etc.
MID, RADIUS, X coefs, Y coefs, Z coefs MID, RADIUS, X coefs, Y coefs, Z coefs MID, RADIUS, X coefs, Y coefs, Z coefs (some time tag info)
Target, Ref Frame ID, Center of Motion, T5, T6, Type 1
Each segment has the SPK Type stored in its meta-data record. Toolkit software knows how to evaluate each Type; no worries for you!
First set of difference line coefs Second set of difference line coefs epoch_1 epoch_2
SPK Subsystem
14
N IF
epoch_1, epoch_2, epoch_3, epoch_4, x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4, vx1, vx2, vx3, vx4,
Within the time bounds (T1, T2) of a segment, SPICE software will return a resulta state vectorat any epoch not just at the epochs of the ephemeris records (epoch_1, epoch_2, etc.). In the example above, SPICE will return the position and velocity (the state) of the Cassini spacecraft relative to Saturn at any time t where: T1 t T2
SPK Subsystem
15
N IF
SPICE automatically searches across all loaded SPK files to find the segments needed to compute the vectors needed to obtain the result the customer has asked for. SPICE chains these together using addition and subtraction.
In this example the user wants the position of the Huygens Probe as seen from Deep Space Station 14. This is obtained by SPICE by chaining the gold, blue and violet chunks.
Huygens Probe
Titan-centered position Probe Ephemeris File DSN Stations Ephemeris File Satellite Ephemeris File Planet Ephemeris File
DSS-63
DSS-62
DSS-61
DSS-15
DSS-14
DSS-13
DSS-12
Earth-centered positions
Titan
Tethys
Enceladus
Mimas
Saturn
Technically, these are planet barycenter locations. More on this later on.
Jupiter
Mars
Earth
Venus
Mercury
16
N IF
Saturn Barycenter
The position of the Huygens Probe relative to DSS-14, at time t, given in the DSS-14 topocentric reference frame, can be determined using a SINGLE Toolkit subroutine call.
Earth
N IF
SPK Subsystem
18
N IF
When you read an SPK file you specify which ephemeris object is to be the target and which is to be the observer. The SPK system returns the state of the target relative to the observer.
The position data point from the observer to the target. The velocity is that of the target relative to the observer. Observer Target
velocity vector
position vector
position vector
velocity vector
Target
Observer
SPK Subsystem
19
N IF
The time period over which an SPK file provides data for an ephemeris object is called the coverage or time coverage for that object.
An SPK files coverage for an object consists of one or more time intervals. Often the coverage for all objects in an SPK file is a single, common time interval.
SPK containing data for one object, with two data gaps
START END
More typical: SPK containing data for one object with no data gaps
START END
SPK containing data for three objects, each with data gaps
START END
SPK containing data for three objects, each having different coverage but with no data gaps
START
END
The most typical situation: SPK containing data for three objects, each having the same coverage and with no data gaps
START END
SPK Subsystem
20
N IF
For any request time within any time interval comprising the coverage for an object, the SPK subsystem can return a vector representing the state of that body relative to its center of motion.
The SPK system will automatically interpolate ephemeris data to produce a state vector at the request time. To a users program, the ephemeris data appear to be continuous over each time interval, even if the data stored inside the SPK file are discrete.
The SPK subsystem will not return a result for a request time falling within a data gap.
Results will be returned by the SPK reader API for any request time falling within these three intervals
START
END
No results will be returned by the SPK reader API for any request time falling within these two data gaps
SPK Subsystem
21
N IF
A program reading an SPK file must specify relative to what reference frame the output state or position vectors are to be given
This frame must be known to the program Known means either a built-in frame (hard coded) or one fully specified at run-time The users program may need to have access to additional SPICE data in order to construct some of these frames
SPK Subsystem
22
N IF
SPK files contain various mathematical representations of ephemeris data ("data types"), but the high-level user interfaces (SPK "readers") are type-independent:
X, Y, Z, dX, dY, dZ at requested time
SPKEZR (to get position and velocity) SPKPOS (to get position only)
SPK Type 5
Weighted Two-body Motion
N IF
To allow SPK producers to choose an ephemeris representation well-suited for their applications. For example:
Weighted two-body extrapolation (type 5) yields compact files; may be used with sparse data. Only accurate for motion that is well approximated by the two-body model. SPK files based on sliding-window Lagrange and Hermite interpolation (types 9 and 13) are easy to create. Position can be made arbitrarily accurate with sufficiently small time separation of states. Chebyshev polynomials (types 2, 3, 14) yield the best combination of evaluation speed and accuracy. But the file creator must do more work to use these data types.
SPK Subsystem
24
N IF
25
N IF
For planets
Barycenters
Navigation and Ancillary Information Facility
For example, the planet Jupiter (599) and each of Jupiters satellites (501 - 5xx) orbit the Jupiter system barycenter (5)
Because Mercury and Venus have no satellites, their barycenters (1 and 2) are at exactly the same locations as their mass centers (199 and 299)
SPICE objects 199 and 299 as well as 1 and 2 are found in a planet ephemeris file
Note: because the masses of Phobos and Deimos are so small compared to the mass of Mars, the mass center for Mars (499) was treated as being located at the Mars barycenter (4) But starting about 2013 this is no longer the case
Planet system barycenters (i.e. 1 through 9) and the sun (10) orbit the solar system barycenter (0)
SPK Subsystem
26
N IF
Body Mass Center ID Sun (10) Mercury (199) Venus (299) Earth (399) Mars (499) Jupiter (599) Saturn (699) Uranus (799) Neptune (899) Pluto (999)
System Barycenter ID SSB (0) M. BC (1) V. BC (2) E. BC (3) M. BC (4) J. BC (5) S. BC (6) U. BC (7) N. BC (8) P. BC (9)
Barycenter offset from Offset as % of body mass center (km)* body radius* 1,378,196 0 0 4942 0.002 220 312 43 74 2080 198% 0 0 77% ~0 0.3% 0.5% 0.17% 0.3% 174%
27
N IF
A single SPK file can hold data for one ephemeris object, or for many ephemeris objects
This is illustrated in the next three charts
The objects in a given SPK file need not all be of the same type
One might find data for a spacecraft, some planets and some satellites all in one file, split across multiple segments
SPK Subsystem
28
N IF
Planet Ephemeris
de421.bsp
S.S. BC Merc. BC Mercury Venus BC Venus Earth BC Moon Earth Mars BC Mars Jupiter BC Saturn BC Uranus BC Neptune BC Pluto BC Sun
Earth BC Earth Jupiter BC Io Europa Ganymede Callisto Amalthea Thebe Jupiter Sun
29
N IF
Probe
-150 = Huygens probe
This made-up example shows five collections of SPK files for the Cassini-Huygens mission
Orbiter
-82 = Cassini S/C
Planets
0 = solar system bc 3 = Earth barycenter 6 = Saturn barycenter 399 = Earth mass center 301 = Moon
Multiple objects
Satellites - 1
601 = Mimas 602 = Enceladus 603 = Tethys 604 = Dione 605 = Rhea 606 = Titan 607 = Hyperion 608 = Iapetus 609 = Phoebe 699 = Saturn mass center
Multiple objects
One object
One object
610 = Janus 611 = Epimetheus : 617 = Pandora 699 = Saturn mass center
The users program must load as many of these SPK files as needed to satisfy her/his requirements. Sometimes a project NAV team combines (merges) several of these collections before releasing them, making the users job easier.
SPK Subsystem See the next page for a graphical representation of this collection of SPKs
Multiple objects
Satellites - 2
30
N IF
Planet: Satellite - 1:
(Major satellites)
Satellite - 2:
(Minor satellites)
Orbiter :
Probe :
Time line:
Launch
cruise phase
Orbit Insertion
orbit phase
Probe Release
End of Mission 31
SPK Subsystem
* Note: This was not the real Cassini scenarioit is simply an illustration of some of the possibilities for ephemeris delivery on a planetary mission.
N IF
An SPK file may contain positions of tracking stations, observatories, rovers, etc.
The object could be stationary or moving Usually such SPKs contain ephemeris data given in the body-fixed reference frame
One reads this file the same as for any other SPK file
Use the name or NAIF ID of the antenna, observatory or rover as the target or observer in an SPK reader argument list Also requires use of a SPICE PcK file if you request vectors to be returned in an inertial frame such as J2000 Needed to rotate body-fixed vectors to the J2000 frame
SPK Subsystem
32
N IF
Navigation and Ancillary Information Facility
SPK Subsystem
33
N IF
To retrieve position or state vectors of ephemeris objects one normally needs two kinds of SPICE kernels
Ephemeris kernel(s) (SPK) Leapseconds kernel (LSK) Used to convert between Coordinated Universal Time (UTC) and Ephemeris Time (ET)
Retrieving ephemeris data from an SPK file is usually called reading the file
This term is not very accurate since the SPK reader software also performs interpolation, and may chain together data from multiple sources and/or perform aberration corrections
State and position vectors retrieved from an SPK file by the SPK reader routines are of the form:
X,Y, Z, dX, dY, dZ for a state vector (km, km/sec) X, Y, Z for a position vector (km)
SPK Subsystem
34
N IF
Tell your program which SPICE files to use (loading files) CALL FURNSH ('spk_file_name') Its better to replace these two calls with a single call to CALL FURNSH ('leapseconds_file_name')
a furnsh kernel containing the names of all kernel files to load.
Convert UTC time to ephemeris time (TDB), if needed CALL STR2ET ( 'utc_string', tdb) Retrieve state vector from the SPK file at your requested time CALL SPKEZR (target, tdb, 'frame', 'correction', observer, state, light time)
inputs outputs
Now use the returned state vector in other SPICE routines to compute observation geometry of interest.
SPK Subsystem
35
N IF
INPUTS
Arguments of SPKEZR - 1
Navigation and Ancillary Information Facility
TARGET* and OBSERVER*: Character names or NAIF IDs for the end point and origin of the state vector (Cartesian position and velocity vectors) to be returned.
The position component of the requested state vector points from observer to target.
TDB: The time at the observer at which the state vector is to be computed. The time system used is Ephemeris Time (ET), now generally called Barycentric Dynamical Time (TDB). FRAME: The SPICE name for the reference frame in which your output state vector is to be given. SPK software will automatically convert ephemeris data to the frame you specify (if needed). SPICE must know the named frame. If it is not a built-in frame SPICE must have sufficient data at run-time to construct it.
* Character names work for the target and observer inputs only if built into SPICE or if registered using the SPICE ID-body name mapping facility. Otherwise use the SPICE numeric ID in quotes, as a character string.
SPK Subsystem
36
N IF
Arguments of SPKEZR - 2
Navigation and Ancillary Information Facility
CORRECTION: Specification of what kind of aberration correction(s), if any, to apply in computing the output state vector.
Use LT+S to obtain the apparent state of the target as seen by the observer. LT+S invokes light time and stellar aberration corrections. (CN+S is better in some cases.) Use NONE to obtain the uncorrected (aka geometric) state, as given by the source SPK file or files.
See the header for subroutine SPKEZR, the document SPK Required Reading, or the Fundamental Concepts tutorial for details. See the backup charts for examples of aberration correction magnitudes.
OUTPUTS
STATE: This is the Cartesian state vector you requested. Contains 6 components: three for position (x,y,z) and three for velocity (dx, dy, dz) of the target with respect to the observer. The position component of the state vector points from the observer to the target. LIGHT TIME: The one-way light time between the (optionally aberration-corrected) position of target and the geometric position of the observer at the specified epoch.
SPK Subsystem
37
N IF
Its better to replace these two calls with a single call to a furnsh kernel containing the names of all kernel files to load.
CALL STR2ET ('2004 NOV 21 02:40:21.3', TDB ) CALL SPKEZR ('TITAN', TDB, 'J2000', 'LT+S', 'HUYGENS PROBE', STATE, LT )
(Insert additional code here to make derived computations such as spacecraft sub-latitude and longitude, lighting angles, etc. Use more SPICE subroutines to help.)
In this example we get the state (STATE) of Titan as seen from the Huygens probe at the UTC epoch 2004 NOV 21 02:40:21.3. The state vector is returned in the J2000 inertial reference frame (which in SPICE is the same as the ICRF frame) and has been corrected for both light time and stellar aberration (LT+S). The oneway light time (LT) is also returned. A SPICE leapseconds file (NAIF0010.TLS) is used, as is a SPICE ephemeris file (HUYGENS_3_MERGE.BSP) containing ephemeris data for the Huygens probe (-150), Saturn barycenter (6), Saturn mass center (699), Saturn's satellites (6xx) and the sun (10), relative to the solar system barycenter.
SPK Subsystem
38
N IF
SPK Subsystem
39
N IF
To get state vectors referenced to a non-inertial reference frame, or when the data within the SPK file are provided in a non-inertial frame, typically more kernels will be needed.
To get the state of an object relative to a body in the bodys IAU body-fixed reference frame youll need: PcK file containing orientation data for the body SPK(s) for the object and body LSK To get the state of an object in a spacecraft-fixed reference frame youll need: FK, CK and SCLK for the spacecraft SPK(s) for the spacecraft and object LSK
SPK Subsystem
40
N IF
Obtain the state of Titan relative to Huygens Probe in the Titan body-fixed reference frame
Initialization...typically once per program execution
Tell your program which SPICE files to use (loading files) CALL FURNSH ('HUYGENS_MERGED_SPK.BSP') Its better to replace these two calls with a single call to a CALL FURNSH ('NAIF0010.TLS') furnsh kernel containing the CALL FURNSH (NAIF0010.TPC') names of all kernel files to load.
Loop... do as many times as you need
Convert UTC time to ephemeris time (TDB), if needed CALL STR2ET ( '2004 NOV 21 02:40:21.3', TDB) Get state vector from SPK file at requested time, in planets IAU body-fixed frame CALL SPKEZR (TITAN', TDB, 'IAU_TITAN, 'LT+S', HUYGENS PROBE', STATE, LT)
(Insert additional code here to make derived computations such as spacecraft sub-latitude and longitude, lighting angles, etc. Use more SPICE subroutines to help.
SPK Subsystem
41
N IF
You can read data from just one, or many* SPK files in your application program
Dont forget the precedence rule: data in a later loaded file take precedence over data from an earlier loaded file
( * The allowed number of simultaneously loaded DAF-based files is currently set to 1000.)
You can convert an SPK that is in non-native binary format to native binary format if you need to add data or comments
SPK Subsystem
42
N IF
The SPK producer should have provided descriptive meta-data inside an SPK file, in the comment area
The comments should say when/why/how and for what purpose the file was made Additional useful information could also be provided by the producer
These comments may be extracted or viewed using an API (subroutine) or a SPICE utility program.
SPK Subsystem
43
N IF
BRIEF SPACIT COMMNT MKSPK SPKDIFF SPKMERGE
These additional SPK utility programs are provided on the NAIF Web site (http://naif.jpl.nasa.gov/naif/utilities.html)
SPY PINPOINT BSPIDMOD DAFMOD DAFCAT BFF BINGO
SPK Subsystem
validates, inspects, and analyses SPK files creates an SPK file for fixed locations (ground stations, etc) alters body IDs in an SPK file alters body or frame IDs in an SPK file concatenates together SPK files displays binary file format of an SPK file converts SPK files between big- and little-endian formats
44
N IF
A summary of the contents and time coverage of an SPK file can be made using the SPICE Toolkit utility brief
See the brief Users Guide for details
% brief 070413BP_SCPSE_07097_07121.bsp
Summary for: 070413BP_SCPSE_07097_07121.bsp Bodies: CASSINI (-82) MERCURY BARYCENTER (1) VENUS BARYCENTER (2) EARTH BARYCENTER (3) MARS BARYCENTER (4) JUPITER BARYCENTER (5) SATURN BARYCENTER (6) URANUS BARYCENTER (7) NEPTUNE BARYCENTER (8) PLUTO BARYCENTER (9) SUN (10) MERCURY (199) VENUS (299) MOON (301) EARTH (399) MARS (499) MIMAS (601) ENCELADUS (602) TETHYS (603) DIONE (604) RHEA (605) TITAN (606) HYPERION (607) IAPETUS (608) PHOEBE (609) SATURN (699)
SPK Subsystem
45
N IF
SPK Subsystem
: : (This is a partial output; not all data could be displayed on this chart)
46
N IF
Call SPKOBJ to find the set of objects for which a specified SPK provides data.
INPUT: an SPK file name and initialized SPICE integer Set data structure. The set may optionally contain ID codes obtained from previous calls. OUTPUT: the input set, to which have been added (via set union) the ID codes of objects for which the specified SPK provides coverage.
CALL SPKOBJ ( SPK, IDSET ) Call SPKCOV to find the window of times for which a specified SPK file provides coverage for a specified body:
INPUT: an SPK file name, body ID code and initialized SPICE double precision Window data structure. The window may optionally contain coverage data from previous calls. OUTPUT: the input window, to which have been added (via window union) the sequence of start and stop times of segment coverage intervals of the specified SPK, expressed as seconds past J2000 TDB.
47
N IF
Related documents:
SPK Subsystem
48
N IF
Backup
Navigation and Ancillary Information Facility
Problems Using SPK Files Dont Mix Planet Ephemerides Effect of Aberration Corrections Examples of Retrieving State Vectors SPK File Structure
SPK Subsystem
49
N IF
The file, or files, you loaded do not contain data for both your target and observer bodies
You may have loaded the wrong file, or assumed the file contains data that it doesnt You may not have loaded all the files needed
The file, or files, you loaded do not cover the time at which you requested a state vector
In the above situations youll get an error message like the following:
SPICE(SPKINSUFFDATA) - Insufficient ephemeris data has been loaded to compute the state of xxx relative to yyy.
SPK Subsystem
This could occur if youve been given a file coverage summary in calendar ET form and you mistook this for UTC ( ET = UTC + DELTAET, where DELTAET is about 65 seconds as of 9/11) This could occur if you are requesting a light-time corrected state and the SPK files being used do not have data at the time that is one-way lighttime away* from your ET epoch of interest * Earlier, for the receive case; later, for the transmission case
50
N IF
You have requested aberration-corrected states but the file, or files, you loaded do not contain sufficient data to relate both your target and observer bodies back to the solar system barycenter, which is required for this calculation.
You may not have loaded all the files needed You may have assumed the file contains data that it doesnt
In the above situations youll get an error message like the following:
SPICE(SPKINSUFFDATA) - Insufficient ephemeris data has been loaded to compute the state of xxx relative to yyy.
SPK Subsystem
51
N IF
An infrequent problem occurs when your SPK file(s) contain data for both target and observer, and cover the period of interest, but ephemeris data for an intermediate body needed to chain the target and observer together is missing.
Example: You load a spacecraft SPK containing ephemeris for Cassini (-82) relative to the solar system barycenter (0), and you load a satellite SPK containing the ephemeris for Titan (606) and Saturn (699) relative to the Saturn barycenter (6). But you forgot to load a planet SPK file that contains data for the Saturn barycenter relative to the solar system barycenter. The SPK software cannot connect Cassini to Titan or to Saturn. (See the drawing on the next page.) In this case, knowing what is the Center Body of movement for each target body is important; this is shown in SPACIT, and also in BRIEF summaries when the -c command line option is used.
SPK Subsystem
52
N IF
Saturn These vectors obtained from a satellite ephemeris SPK
Titan
In this example the absence of a planet ephemeris SPK means the Cassini-Titan and CassiniSaturn vectors shown here cannot be determined because the Saturn Barycenter-to-Solar System Barycenter vector is not available. Given
This vector cannot be obtained from either the spacecraft or satellite SPKs; a planet ephemeris SPK is needed.
Sun
53
N IF
You see an error message to the effect that pole RA (right ascension) data cannot be found
You are requesting results in a body-fixed frame, but you have not loaded a SPICE PcK file that defines this frame.
SPK Subsystem
54
N IF
Segment Masking: You've loaded sufficient data to chain together the target and observer, but the SPK subsystem can't make the connection.
This can happen when a high-priority segment that can't be connected to both target and observer "masks" a lower-priority segment that can be connected. Example: you want the state of earth as seen from the Galileo orbiter at a specified ephemeris time ET1. You have loaded SPK files providing:
the state of the Galileo orbiter relative to the asteroid Gaspra the state of the orbiter relative to the sun the state of the earth relative to the earth-moon barycenter the states of the sun and earth-moon barycenter relative to the solar system barycenter
If an SPK segment for the orbiter relative to Gaspra covering ET1 has higher priority than the segment for the orbiter relative to the sun covering ET1, no connection between the orbiter and the earth will be made. Solution:
Load an SPK file providing the ephemeris of Gaspra relative to the sun or the solar system barycenter (for a time interval containing ET1)
SPK Subsystem
55
N IF
Mistaking ET for UTC, or vice-versa. You must have loaded sufficient SPKs to be able to chain states to the solar system barycenter if doing aberration corrections. Using light time corrections requires target ephemeris data at the light time-corrected epoch.
If youre working near the beginning of an SPK, the light timecorrected epoch may occur earlier than available data.
SPK Subsystem
56
N IF
This is NOT true unless you have requested geometric states in both cases (i.e. no light time or stellar aberration corrections are applied)
SPK Subsystem
57
N IF
S.S.Barycenter S.S.Barycenter
With each new version of the JPL planetary ephemeris, the solar system barycenter moves with respect to the planets Changes in relative planet positions are much smaller than changes in the planet locations relative to the solar system barycenter
Earth
Mars
SPK Subsystem
58
N IF
S.S.Barycenter
SPICE allows you to load different planetary ephemerides (or portions of them)
Potentially can subtract the solar system barycenter-relative positions from different ephemerides to get relative states
Dont mix planetary ephemerides For JPL flight projects, a consistent set of ephemerides is provided to the mission team
Earth
Mars
SPK Subsystem
59
N IF
Angular offsets between corrected and uncorrected position vectors over the time span 2004 Jan 1 to 2005 Jan1
Mars as seen from MEX: LT+S vs NONE: .0002 to .0008 degrees LT vs NONE: .0006 to .0047 degrees Earth as seen from MEX: LT+S vs NONE: .0035 to .0106 degrees LT vs NONE: .0000 to .0057 degrees MEX as seen from Earth: LT+S vs NONE: .0035 to .0104 degrees LT vs NONE: .0033 to .0048 degrees Sun as seen from Mars: LT+S vs NONE: .0042 to .0047 degrees LT vs NONE: .0000 to .0000 degrees
SPK Subsystem
60
N IF
Angular offsets between corrected and uncorrected position vectors over the time span 2004 Jan 1 to 2008 Jan1
Saturn as seen from CASSINI: LT+S vs NONE: .0000 to .0058 degrees LT vs NONE: .0001 to .0019 degrees Titan as seen from CASSINI: LT+S vs NONE: .0000 to .0057 degrees LT vs NONE: .0000 to .0030 degrees Earth as seen from CASSINI: LT+S vs NONE: .0000 to .0107 degrees LT vs NONE: .0000 to .0058 degrees CASSINI as seen from Earth: LT+S vs NONE: .0000 to .0107 degrees LT vs NONE: .0000 to .0059 degrees Sun as seen from CASSINI: LT+S vs NONE: .0000 to .0059 degrees LT vs NONE: .0000 to .0000 degrees
SPK Subsystem
61
N IF
Example: find the geometric state of the MGS orbiter relative to Mars at the observation epoch ET, expressed in the J2000 reference frame.
CALL SPKEZR ( 'MGS', ET, 'J2000', 'NONE', 'MARS', STATE, LT ) The SPK subsystem locates an SPK segment containing the ephemeris of the orbiter relative to Mars covering epoch ET, interpolates the ephemeris data at ET, and returns the interpolated state vector.
Example: find the geometric state of Titan relative to the earth at epoch ET, expressed in the J2000 reference frame.
CALL SPKEZR ( 'TITAN', ET, 'J2000', 'NONE', 'EARTH', STATE, LT ) The SPK subsystem looks up and interpolates ephemeris data to yield: The state of the earth relative to the earth-moon barycenter (A) The state of the earth-moon barycenter relative to the solar system barycenter (B) The state of Titan relative to the Saturn system barycenter at ET (C) The state of the Saturn system barycenter relative to the solar system barycenter at ET (D) SPKEZR then returns the state vector C + D ( A + B )
SPK Subsystem
62
N IF
Example: find the apparent state of the Cassini orbiter relative to the DSN station DSS-14, expressed in the topocentric reference frame centered at DSS-14, at a specified observation epoch ET.
CALL SPKEZR ( 'CASSINI', ET, 'DSS-14_TOPO', 'LT+S', 'DSS-14', STATE, LT ) The SPK subsystem looks up and interpolates ephemeris data to yield: The state of DSS-14 relative to the earth in the ITRF93 terrestrial reference frame (A) The state at ET of the earth relative to the earth-moon barycenter in the J2000 reference frame (B) The state at ET of the earth-moon barycenter relative to the solar system barycenter in the J2000 frame (C) The state at the light time-corrected epoch ET-LT of the Cassini orbiter relative to the Saturn system barycenter (other centers are possible) in the J2000 frame (D)
63
N IF
The state at ET-LT of the Saturn system barycenter relative to the solar system barycenter in the J2000 frame (E) The SPK subsystem also looks up transformation matrices to map states: From the J2000 frame to the ITRF93 terrestrial (earth bodyfixed) frame at the observation epoch ET (T1) From the ITRF93 terrestrial frame to the DSS-14-centered topocentric frame (T2) SPKEZR then computes the J2000-relative, light-time corrected observer-target state vector E + D ( (T1)-1 *A + B + C)) SPKEZR corrects this vector for stellar aberration Call the result "V_J2000_apparent" and finally returns the requested state vector in the DSS-14 topocentric reference frame STATE = T2 * T1 * V_J2000_apparent
SPK Subsystem
64
N IF
A description of the SPK file structure is shown near the beginning of the Making an SPK tutorial.
SPK Subsystem
65
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
Overview Text PCKs PCK reference frames Binary PCKs Using PCKs Interface Routines PCK Precedence Rules PCK Utility Programs
PcK Subsystem
N IF
Overview
Navigation and Ancillary Information Facility
The Planetary Constants Kernel (PCK) subsystem comprises both text and binary kernels
Text PCKs provide orientation and shape models for the sun, planets, natural satellites and a few asteroids Binary PCKs are used only for high-accuracy orientation data
Available only for the earth and the moon
PcK Subsystem
N IF
Text PCKs - 1
Navigation and Ancillary Information Facility
Text PCK files contain orientation, shape and other data associated with natural solar system bodies. NAIF creates and distributes a generic text PCK based on the latest IAU/IAG Report.*
The reports are issued about once every three years, and so might not contain the very latest available results. SPICE PCK software is designed to use these data to compute orientation of body-fixed frames. These frames have a name style of IAU_body-name
NAIF also provides a masses PCK, containing GM values for the Sun and planetary systems.
Values from this file are typically used with SPICE osculating element routines, and in using the MAKSPK application to make a Type 5 SPK file.
Text PCKs are sometimes produced by flight projects and othersnot only by NAIF.
PcK Subsystem
* Report of the IAU/IAG Working Group on cartographic coordinates and rotational elements: <year issued>; published in Celestial Mechanics and Dynamical Astronomy
N IF
Text PCKs - 2
Navigation and Ancillary Information Facility
Users may easily visually inspect data. Users may (carefully!) modify text PCKs with a text editor.
Data or comments may be added, deleted, or changed. Comments should be added to explain changes.
The user may include additional kernel variables to change the base frame or reference epoch. Kernel variable names are case-sensitive.
NAIF uses only upper case for variable names; we suggest you do the same.
PcK Subsystem
N IF
PcK Subsystem
N IF
The base frame for PCK orientation models is the International Celestial Reference Frame (ICRF), as defined by the International Earth Rotation Service (IERS).
For historical and backwards compatibility reasons SPICE uses the names J2000 and EME2000 as synonyms for the ICRF inertial reference frame, even though J2000 and ICRF are, in fact, not identical. (The difference is well under 0.1 arc seconds.)
PcK Subsystem
N IF
Body-fixed frames provided in text PCKs are planetocentric. For planets and satellites the +Z axis (+90 LAT) always points to the
north side of the invariable plane (the plane whose normal vector is the angular momentum vector of the solar system)
Planetocentric longitude increases positively eastward Planetocentric latitude increases positively northward
Dwarf planets*, asteroids and comets spin in the right hand sense about their positive pole.
What the IAU now calls the positive pole is still referred to as the north pole in SPICE documentation. The positive pole may point above or below the invariable plane of the solar system (see above). This revision by the IAU Working Group (2006) inverts what had been the direction of the north pole for Pluto, Charon and Ida.
PcK Subsystem
N IF
Load the appropriate binary PCK for either the earth or the moon For the earth IERS frame: ITRF93 For a lunar frame based on JPL ephemeris: DExxx See the special tutorial lunar-earth_pck-fk for details on these
Other PCK frames are not built in and must be specified at run time by loading frame kernels, for example:
Body fixed frames for asteroids or newer natural satellites
See the Frames Required Reading technical reference for information on creating frame kernels that specify PCK reference frames.
PcK Subsystem
N IF
Although many bodies are in fact modeled as spheres or spheroids, SPICE usually deals with the general, triaxial case.
Exception: SPICE supports geodetic coordinate transformations only for bodies modeled as spheres or spheroids.
RECGEO, GEOREC, DGEODR and DRDGEO are the modules performing these transformations.
Exception: SPICE supports planetographic coordinate transformations only for bodies modeled as spheres or spheroids.
PGRREC, RECPGR, DPGRDR and DRDPGR are the modules supporting these transformations.
PcK Subsystem
10
N IF
Orientation data from a binary PCK always supersede orientation data (for the same object) obtained from a text PCK, no matter the order in which the kernels are loaded
11
N IF
PCK orientation data are usually accessed using Frame system or SPK calls
Example: Get the IAU_SATURN body-fixed reference frame to J2000 position or state transformation matrix at ET:
CALL PXFORM ( 'IAU_SATURN', 'J2000', ET, RMAT ) CALL SXFORM ( 'IAU_SATURN', 'J2000', ET, XFORM )
Example: Get state of Saturn relative to Cassini in the IAU_SATURN body-fixed reference frame:
CALL SPKEZR ( 'SATURN', ET, 'IAU_SATURN', 'LT+S', CASSINI', STATE, LT )
PCK shape data are usually accessed using APIs needing size and shape data such as SUBPT, SUBSLR, ILUMIN, etc.
PcK Subsystem
12
N IF
Interface Routines - 1
Navigation and Ancillary Information Facility
Get state of Saturn relative to Cassini in the IAU_SATURN body-fixed reference frame:
CALL SPKEZR ( 'SATURN', ET, 'IAU_SATURN', 'LT+S', CASSINI', STATE, LT )
Get state of Cassini relative to the DSN station DSS-13 in the J2000 inertial reference frame:
CALL SPKEZR ( 'CASSINI', ET, 'J2000', 'LT+S', 'DSS-13', STATE, LT )
PcK Subsystem
13
N IF
Interface Routines - 2
Navigation and Ancillary Information Facility
Call BODVRD or BODVCD to retrieve constants associated with a body. For example:
CALL BODVRD ( 'SATURN', CALL BODVCD ( 699, 'RADII', 3, 'RADII', 3, N, N, RADII RADII ) )
These calls retrieve values associated with the variable BODY699_RADII. The variable name is case-sensitive, so the string RADII above must be in upper case.
You can use general kernel pool fetch routines to fetch data assigned to any non-standard names
GCPOOL, for character data GDPOOL, for double precision data GIPOOL, for integer data
PcK Subsystem
14
N IF
Orientation data from a binary PCK always supersede orientation data (for the same object) obtained from a text PCK, no matter the order in which the kernels are loaded In text PCKs, assignments are of two types:
Direct: variable name = value(s) Incremental: variable name += value(s) The last direct assignment made to a given variable replaces any/all previous assignments for that variable Incremental assignments simply add additional values to an existing variable The variable will be newly created if it didnt already exist
PcK Subsystem
15
N IF
BRIEF SPACIT COMMNT FRMDIFF
PcK Subsystem
16
N IF
Related documents:
Frames Required Reading Kernel Required Reading NAIF_IDS Required Reading Time Required Reading
PcK Subsystem
17
N IF
Navigation and Ancillary Information Facility
Camera-matrix Kernel CK
(Orientation or Attitude Kernel) Emphasis on reading CK files
July 2013
N IF
CK File Contents - 1
Navigation and Ancillary Information Facility
A CK file holds orientation data for a spacecraft or a moving structure on the spacecraft
Orientation data quaternions, from which orientation matrices are formed by SPICE software. These matrices are used to rotate position vectors from a base reference frame (the from frame) into a second reference frame (the to frame) In SPICE this is often called the C-matrix or Camera matrix Optionally may include angular velocity of the to frame with respect to the from frame Angular velocity vectors are expressed relative to the from frame.
A CK file should also contain commentssometimes called metadatathat provide some details about the CK such as:
the purpose for this particular CK when and how it was made what time span(s) the data cover
C-Kernel
N IF
CK File Contents - 2
Navigation and Ancillary Information Facility
A single CK file can hold orientation data for one, or for any combination of spacecraft or their structures
Some examples 1. Huygens Probe 2. Cassini Orbiter and its CDA instrument mirror 3. Mars Express Orbiter, PFS scanner, Beagle Lander 4. MRO orbiter, MRO high gain antenna, MRO solar arrays
But in practice CKs usually contain data for just one structure
C-Kernel
N IF
CK File Varieties - 1
Navigation and Ancillary Information Facility
Predict CK
A CK file can be made using information that predicts what the orientation will be some time in the future Input data usually come from a modeling program, or a set of orientation rules This kind of file is generally used for engineering assessment, science observation planning, software testing and quick-look science data analysis If it has good fidelity, such a file might be used to fill in the data gaps of a reconstruction CK file In some cases (ESA in particular) the predict meets the reconstruction accuracy requirements; a true reconstruction CK is not produced
C-Kernel
N IF
CK File Varieties - 2
Navigation and Ancillary Information Facility
Knowledge of CK varietyreconstruction or predictmight be implicit in the file naming schema, and/or might be provided in the comment section, but is not available using a SPICE API It is rare, and inadvisable, that both varieties be combined in a single file
C-Kernel
N IF
The underlying orientation data are of varying types, but the user interface to each of these CK types is the same.
Rotation matrix and Angular Velocity
CK Type 1
CK Type 2
CK Type 3
CK Type 4
Chebychev Polynomials
CK Type 5
ESOC DDID
N IF
To obtain orientation one needs at least three SPICE kernel types: CK, SCLK, and LSK.
CK contains spacecraft or other structure orientation SCLK and LSK contain time correlation coefficients used to convert between ephemeris time (ET) and spacecraft clock time (SCLK) Sometimes an LSK is not needed in this conversion, but best to have it available as it is usually needed for other purposes
One may also need an FK if planning to access CK data via high level SPICE interfaces.
FK associates reference frames with CK data via CK IDs
C-Kernel
N IF
High-level SPICELIB routines are used more often than the original CK readers to access CK data. These high-level routines are:
Position or state transformation matrix determination PXFORM: return a rotation matrix (3x3) from one frame to another, either of which can be a CK-based frame or have CK-based frames as links in its chain SXFORM: return a state transformation matrix (6x6) from one frame to another, either of which can be a CK-based frame or have CK-based frames as links in its chain Position or state vector determination SPKPOS: return a position vector (3x1) in a specified frame, which can be a CK-based frame or have CK-based frames as links in its chain SPKEZR: return a state vector (6x1) in a specified frame, which can be a CK-based frame or have CK-based frames as links in its chain
Use of the above mentioned routines is discussed in the FK, Using Frames, and SPK tutorials The original CK access routines are CKGP and CKGPAV
Use of these routines is described in the BACKUP section of this tutorial
C-Kernel
N IF
CASSINI SPACECRAFT
HUYGENS PROBE
-82000
-150000
-82791
A users program must be able to load as many of these files as needed to satisfy his/her requirements. It is strongly recommended that users programs have the flexibility to load a list of CK files provided to the program at run time; this is easily accomplished using the Toolkit's FURNSH routine.
C-Kernel
N IF
Cassini Orbiter:
Huygens Probe:
Time line:
End of Mission 10
C-Kernel
* Note: This is not an actual Cassini/Huygens scenario; it is a highly simplified illustration of some of the possibilities for orientation delivery on a planetary mission.
N IF
Even though a project's CK production process may suggest that CK files provide continuous coverage for the interval of time for which they were generated, in reality this is rarely the case. CK files almost always contain gaps in coverage! Below is an example of this.
Time
Coverage of
as appears in file name/comments
Tstart
Tstop
a CK file:
CK file segments:
Summary of pointing available to the CK reader for this CK file: Blue line segments represent interpolation intervalstimes when pointing will be returned and the FOUND flag set to TRUE.
C-Kernel
11
N IF
An interpolation interval is a time period for which the CK reader routines can compute and return pointing.
For CK Types 3 and 5 the pointing is computed by interpolating between the attitude data points that fall within the interval. For CK Type 2 the pointing within each interval is computed by extrapolating from a single attitude and associated angular velocity. For CK Type 4 the pointing is computed by evaluating polynomials covering the interval. For CK Type 1 (discrete pointing instances) the notion of an interpolation interval is not relevant.
The time periods between interpolation intervals are gaps during which the CK readers are not able to compute pointing. The interpolation intervals in Type 3 CK segments can be modified without changing the actual pointing data.
The CKSPANIT and CKSMRG programs are used to make these changes.
C-Kernel
12
N IF
Any high-level SPICE API that needs to use a CK to help determine a reference frame orientation will NOT return a result for any time falling in a CK gap!
The orange bars above are called interpolation intervals The white spaces between the orange bars are gaps
C-Kernel
13
N IF
See the headers of these routines for example programs. Also see the CELLS, SETS and WINDOWS Required Reading for background information on these SPICE data types.
C-Kernel
14
N IF
When using high-level routines* that need orientation data from a C-kernel, it's often a good idea to first determine what are the valid interpolation intervals in your CK using CKCOV.
If using multiple CKs, all of which are needed to construct a frame chain, call CKCOV for each one and then intersect the coverage windows.
Then check each time of interest for your geometry calculations against the window of valid intervals before proceeding onwards.
* For example: SPKEZR, SPKPOS, SXFORM, PXFORM, SINCPT
C-Kernel
15
N IF
Three Toolkit utility programs can provide various kinds of CK summaries, including listings of gaps or of interpolation intervals
CKBRIEF FRMDIFF SPACIT
C-Kernel
16
N IF
Summarizing a CK file - 1
Navigation and Ancillary Information Facility
% ckbrief 07102_07107ra.bc naif0008.tls cas00106.tsc CKBRIEF Ver 3.2.0, 2006-11-02. SPICE Toolkit Version: N0061. Summary for: 07102_07107ra.bc Object: -82000 Interval Begin ET Interval End ET AV ------------------------ ------------------------ --2007-APR-12 00:01:06.462 2007-APR-17 00:01:03.726 Y
C-Kernel
17
N IF
Summarizing a CK file - 2
Navigation and Ancillary Information Facility
A summary of interpolation intervals in a CK can be made using CKBRIEF using its -dump option
% ckbrief dump 07102_07107ra.bc naif0008.tls cas00106.tsc CKBRIEF Ver 3.2.0, 2006-11-02. SPICE Toolkit Version: N0061. Summary for: 07102_07107ra.bc Segment No.: 1 Object: -82000 Interval Begin ET -----------------------2007-APR-12 00:01:06.462 2007-APR-12 05:58:22.576 . . .
AV --Y Y
18
C-Kernel
N IF
Summarizing a CK file - 3
Navigation and Ancillary Information Facility
continued from previous page
A summary of interpolation intervals in a CK can also be made using FRMDIFF with its -t dumpc option A summary of gaps within interpolation intervals in a CK can be made using FRMDIFF with its -t dumpg option
% frmdiff -t dumpg \ k cas_v40.tf naif0008.tls cas00106.tsc \ -f 'YYYY-MM-DDTHR:MN:SC ::RND \ 07102_07107ra.bc # # . . . <FRMDIFF report header> . . . # # gap_start, gap_stop, gap_duration_sec, gap_duration_string 2007-102T05:56:57 2007-102T05:57:17 19.999 0:00:00:19.999 2007-102T21:33:21 2007-102T21:33:41 19.999 0:00:00:19.999 2007-102T21:34:57 2007-102T21:35:25 27.999 0:00:00:27.999 . . .
C-Kernel
19
N IF
Summarizing a CK file - 4
Navigation and Ancillary Information Facility
A detailed summary of a CK can be made using SPACIT. See the SPACIT User's Guide for details.
-------------------------------------------------------------Segment ID : CASSINI ATT: -Y TO TITAN, +Z - VELCTY Instrument Code: -82000 Spacecraft : Body -82, CAS Reference Frame: Frame 1, J2000 CK Data Type : Type 3 Description : Continuous Pointing: Linear Interpolation Available Data : Pointing and Angular Velocity UTC Start Time : 2005 FEB 15 07:59:59.999 UTC Stop Time : 2005 FEB 15 08:59:59.998 SCLK Start Time: 1/1487147147.203 SCLK Stop Time : 1/1487150747.209 -------------------------------------------------------------. . . . etc. etc.
C-Kernel
20
N IF
CKBRIEF SPACIT COMMNT MSOPCK FRMDIFF
CK Utility Programs
Navigation and Ancillary Information Facility
These additional CK utility programs are provided on the NAIF Web site
CKSLICER CKSMRG DAFCAT CKSPANIT DAFMOD prediCkt BFF BINGO subsets a CK file merges segments in a type 3 CK file (*) concatenates together CK files (*) modifies interpolation interval information in a Type 3 CK file alters structure or frame IDs in a CK file creates a CK file representing an orientation profile described by a set of orientation rules and a schedule displays binary file format of a CK file converts CK files between IEEE and PC binary formats
(*) DAFCAT and SKSMRG are frequently used together to first merge many CK files into a single file using DAFCAT and then merge segments inside the merged file using CKSMRG.
C-Kernel
21
N IF
Additional Information on CK
Navigation and Ancillary Information Facility
Related documents
C-Kernel
22
N IF
Backup
Navigation and Ancillary Information Facility
The meaning of Tolerance Examples of Problems Encountered When Using CK Subsystem Using the CK reader APIs
C-Kernel
23
N IF
The CKGP and CKGPAV routines use a time tolerance, tol, measured in ticks, in executing pointing lookups.
No matter whether your CK is a discrete type (Type 1) or a continuous type (Types 2 - 5), if pointing information is not found within +/- tol of your pointing request time, no pointing will be returned and the found flag will be set to FALSE. For Type 1 (discrete) CKs, the pointing instance nearest* to your request time will be returned, as long as it is within tol of your request time. If the nearest pointing instances on each side of your request time are equidistant from your request time, the later instance will be selected. For Types 2 - 5 (continuous pointing), pointing for exactly your request time will be returned if this time falls anywhere within an interpolation interval. For all Types, the time tag associated with the pointing data will also be returned.
*Ignoring segment priority
C-Kernel
24
N IF
| | |/ \ [---+---] . . . (0----0--0--0--0--0---0--0--0--0-----0--0--0)
0 is used to represent discrete pointing instances (quaternions) () are used to represent the end points of a segment within a CK file SCLKDP is the time at which you have requested pointing TOL is the time tolerance you have specified in your pointing request The quaternions occurring in the segment need not be evenly spaced in time
C-Kernel
25
N IF
When reading a Type 2, 3, 4 or 5 CK (continuous pointing), with a pointing request that falls within a span of continuous pointing (an interpolation interval)
TOL | / |/\ [--+--] . . . (==----=============---======------===--) SCLKDP \
== is used to indicate interpolation intervals of continuous pointing () are used to represent the end points of a segment within a CK file SCLKDP is the time at which you have requested pointing TOL is the time tolerance you have specified in your pointing request; for this particular case it does not come into play The quaternions occurring in the periods of continuous pointing need not be evenly spaced in time
C-Kernel
26
N IF
When reading a Type 2, 3, 4 or 5 CK (continuous pointing), with a pointing request that is NOT within a span of continuous pointing (an interpolation interval)
SCLKDP \ TOL | / |/\ [--+--] . . . (--==============----======------===--)
A SPICELIB CK reader returns pointing at the epoch closest to the request time, if this is within TOL of that request time.
== is used to indicate interpolation intervals of continuous pointing () are used to represent the end points of a segment within a CK file SCLKDP is the time at which you have requested pointing TOL is the time tolerance you have specified in your pointing request The quaternions occurring in the periods of continuous pointing need not be evenly spaced in time
C-Kernel
27
N IF
Problems using CK - 1
Navigation and Ancillary Information Facility
The file or files you loaded do not contain orientation data for the object of interest.
Make sure the ID that you use in a call to CKGP or CKGPAV matches one in the CK file(s) you have loaded. Make sure the frame that you specify in a call to SXFORM, PXFORM, SPKEZR, or SPKPOS is transformable to one available in the loaded CK files.
CKGP or CKGPAV returns a transformation matrix and/or angular velocity that does not appear correct.
Probably the FOUND flag is FALSE and you are using data left over from a previous query. Remember to always check the FOUND flag! (If the FOUND flag is TRUE but the data seem bad, contact the data producer.)
C-Kernel
28
N IF
Problems using CK - 2
Navigation and Ancillary Information Facility
The file, or files, you loaded do not cover the time at which you requested orientation
Check file coverage on the segment level by summarizing the file(s) using CKBRIEF or SPACIT Check interpolation interval coverage using CKBRIEF with option -dump, or by examining comments provided in the comment area of the file - you may be asking for data within a coverage gap (outside of interpolation intervals)
One of the frames routines (SPKEZR, SPKPOS, SXFORM, PXFORM, SINCPT) signals an error
All frames routines read CK files using tolerance = 0 For discrete CKs (Type 1) the orientation of a CK-based frame will be computed only if the time provided to a Frames routine exactly matches one of the times stored in the CK file; otherwise an error will be signaled. For continuous CKs (all but Type 1) the orientation of a CKbased frame will be computed only if the time provided to a frame routine falls within one of the interpolation intervals defined by the CK file; otherwise an error will be signaled.
C-Kernel
29
N IF
Problems using CK - 3
Navigation and Ancillary Information Facility
Youve confirmed not having any of the previously described problems, but the FOUND flag comes back FALSE when using CKGPAV, or SXFORM or SPKEZR signals a frame related error.
You are using a SPICE routine that expects angular velocity as well as orientation, but the CK segments available at your requested epoch dont contain angular velocity. Routines expecting AV are: CKGPAV, SXFORM, SPKEZR Routines not expecting AV are: CKGP, PXFORM, SPKPOS
C-Kernel
30
N IF
Problems using CK - 4
Navigation and Ancillary Information Facility
The FOUND flag comes back TRUE when using CKGPAV but returned angular velocity does not appear correct.
While many sources of angular rate data, for example spacecraft telemetry, specify it relative to the spacecraft frame, SPICE CK files store it, and CKGPAV returns it, with respect to the base frame. So the sense of returned angular velocity in a CK may be unexpected.
The FOUND flag comes back TRUE when using CKGP/ CKPGAV but the quaternion computed from the returned transformation matrix via a call to M2Q does not appear correct.
The quaternion returned by M2Q follows the SPICE style, which is different from the quaternion styles used by some other sources of orientation data, for example most spacecraft telemetry. See the headers of the M2Q and Q2M routines, and the Rotations Required Reading technical reference document for more details. NAIF also prepared and can provide a white paper explaining differences between various quaternion styles commonly used in space applications.
C-Kernel
31
N IF
Problems using CK - 5
Navigation and Ancillary Information Facility
Youre trying to use a CK file that is not properly formatted for your computer
You can read only a binary CK file with the CK subroutines; you cant read a transfer format file Although not required, binary CK files often have a name like xxxxxx.bc Although not required, transfer format CK files often have a name like xxxxxx.xc If using Toolkit Version N0051 or earlier you must have the proper kind of CK binary file for your computer (a native binary file) Sun, HP, SGI and MAC (Motorola cpu) use the unix binary standard PC (Windows or Linux) uses its own binary standard The pair of utility programs named TOBIN and TOXFR, or the utility program SPACIT, can be used to port CK files between computers having incompatible binary standards
C-Kernel
32
N IF
Get rotation matrix, or rotation matrix and angular velocity at requested time
or
* Although most spacecraft have a single on-board clock and this clock has the same ID as the spacecraft, the user should know which SCLK was used to tag data in a CK file in order to specify the correct ID in a call to SCE2C.
C-Kernel
33
N IF
Inputs instid
Arguments of CKGPAV
Navigation and Ancillary Information Facility
NAIF ID for the spacecraft, instrument or other structure for which the orientation is to be returned sclkdp the time at which the orientation matrix and angular velocity are to be computed. The time system used is encoded spacecraft clock time (SCLK). The units are ticks since the zero epoch of the clock tol* the tolerance, expressed as number of SCLK ticks, to be used in searching for and computing the orientation data ref_frame the name of the reference frame with respect to which the orientation is to be computed. This is also called the base or from frame. Outputs cmat the 3x3 rotation matrix that you requested av the angular velocity that you requested clkout the exact time for which the orientation and angular velocity was computed found the logical flag indicating whether the orientation and angular velocity data were found. Note that if the loaded CK file(s) do not contain angular velocity data, CKGPAV will return a FALSE found flag even if orientation could have been computed. If found is .FALSE., then the values of the output arguments cmat and av are undefined and should not be used! Always check the FOUND flag returned by CKGPAV and CKGP!
* tol is explained in detail in backup slides
C-Kernel
34
N IF
Navigation and Ancillary Information Facility
Frames Kernel FK
July 2013
N IF
Background
Navigation and Ancillary Information Facility
Frames Subsystem
N IF
Y X
Frames Subsystem
N IF
Within SPICE, a coordinate system is the method used to specify a vector within a reference frame. Examples:
Rectangular
Spherical
Cylindrical
Frames Subsystem
N IF
Introduction
Navigation and Ancillary Information Facility
2. It connects frames with the sources of their orientation specifications. In some cases those data are included in the Frames kernel. Based on these relationships and the orientation source information, it allows SPICE software to compute rotations between neighboring frames in the frame tree, and to combine these rotations in the right order, thus providing an ability to compute the orientation of any frame in the tree with respect to any other frame in the tree, at any time
Frames Subsystem
N IF
Saturn Body-fixed frame
PCK-based transformation
PCK-based transformation
Earth Body-fixed frame Titan body-fixed frame Topocentric Frame at the landing site
Frames Subsystem
N IF
Frame class Inertial
Examples Earth Equator/Equinox of Epoch (J2000, ) Planet Equator/Equinox of Epoch (MARSIAU, ...) Ecliptic of Epoch (ECLIPJ2000, ...) Solar system body IAU frames (IAU_MARS, IAU_SATURN, ) High accuracy Earth frames (ITRF93, ) High accuracy Moon frames (MOON_PA, MOON_ME) Spacecraft (CASSINI_SC_BUS, ) Moving parts of an instrument (MPL_RA_JOINT1, ...) Instrument mounting alignment (CASSINI_ISS_NAC, ) Topocentric (DSS-14_TOPO, ) Geomagnetic Geocentric Solar Equatorial Planet true equator and equinox of date
Body-fixed
Frames Subsystem
N IF
Frame class Inertial Bodyfixed CK based Fixed offset Dynamic
Orientation data provided in Toolkit PCK CK FK Toolkit, or computed using FK, SPK, CK, and/or PCK
Frames Subsystem
N IF
SXFORM/PXFORM
CALL SXFORM ( FROM_FRAME_NAME, TO_FRAME_NAME, ET, MAT6x6 ) CALL PXFORM ( FROM_FRAME_NAME, TO_FRAME_NAME, ET, MAT3X3 )
SPKEZR/SPKPOS
CALL SPKEZR ( BOD, ET, FRAME_NAME, CORR, OBS, STATE, LT ) CALL SPKPOS ( BOD, ET, FRAME_NAME, CORR, OBS, POSITN, LT )
The above are FORTRAN examples, using SPICELIB modules. The same interfaces exist for C, using CSPICE modules, and for Icy and Mice.
Frames Subsystem
N IF
Frame Names
Navigation and Ancillary Information Facility
Frame names are character strings used to identify frames to Toolkit APIs Some examples of frame names:
J2000 IAU_MARS DAWN_SPACECRAFT MEX_OMEGA DSS-14_TOPO
Frames Subsystem
10
N IF
Refer to the NAIF IDs Tutorial for an introduction to reference frame names and IDs Refer to the FRAMES.REQ document for the list of NAIF built in (hard coded) inertial and body-fixed frames Refer to a projects Frames Kernel (FK) file for a list of frames defined for the spacecraft, its subsystems and instruments Refer to an earth stations FK for a list of frames defined for the DSN and other stations Refer to the moon FKs for names and descriptions of the body-fixed frames defined for the moon
Frames Subsystem
11
N IF
Uses the SPICE text kernel standards Loaded using the FURNSH routine Usually contains comprehensive information about the defined frames in the comment section(s) of the file Contains frame definition information consisting of a set of keywords in the data sections of the file. Below are examples defining a CK-based frame and a fixed-offset frame.
CK-based Frame Example
FRAME_DAWN_SPACECRAFT FRAME_-203000_NAME FRAME_-203000_CLASS FRAME_-203000_CLASS_ID FRAME_-203000_CENTER CK_-203000_SCLK CK_-203000_SPK = = = = = = = -203000 'DAWN_SPACECRAFT 3 -203000 -203 -203 -203
12
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
The Frame ID, shown in red in the two examples above, is an integer number used by the SPICE system as a handle in buffering and retrieving various parameters associated with a frame. In an FK it glues together the keywords defining the frame.
Frames Subsystem
13
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
These keywords
FRAME_<name> = <id> FRAME_<id>_NAME = <name>
establish the association between the name and the ID of the frame.
Frames Subsystem
14
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
The FRAMECLASS keyword specifies the method by which the frame is related to its base frame This keyword is set to:
2, 3, 4, 5,
Frames Subsystem
for PCK-based frames for CK-based frames for fixed-offset frames for dynamic frames
15
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
The FRAMECLASS_ID is the number that connects a frame with the orientation data for it.
For body-fixed frames the CLASS_ID is the ID of the natural body. It is used as input to PCK routines called by the Frame subsystem to compute orientation of the frame. The Frame ID and CLASS_ID are not the same for the body-fixed frames defined in the Toolkit but they can be the same for frames defined in FK files. For CK-based frames the CLASS_ID is the CK structure ID. It is used as input to CK routines called by the Frame subsystem to compute orientation of the frame. Usually the CLASS_ID of a CK-based frame is the same as the frame ID, but this is not required. For fixed offset and dynamic frames the CLASS_ID is the ID that is used to retrieve the frame definition keywords. The CLASS_ID of a fixed offset or dynamic frame is the same as the frame ID.
Frames Subsystem
16
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
The FRAMECENTER specifies the ephemeris object at which the frame origin is located
It is used ONLY to compute the light-time corrected orientation of the frame
Frames Subsystem
17
N IF
Frame definition for the DAWN spacecraft FRAME_DAWN_SPACECRAFT = -203000 FRAME_-203000_NAME = 'DAWN_SPACECRAFT FRAME_-203000_CLASS = 3 FRAME_-203000_CLASS_ID = -203000 FRAME_-203000_CENTER = -203 CK_-203000_SCLK = -203 CK_-203000_SPK = -203
Additional frame definition keywords may be required depending on the frame class
For CK frames, CKSCLK and CKSPK keywords identify the spacecraft clock ID and physical object ID associated with the CK structure ID For fixed-offset frames, TKFRAME_* keywords specify the base frame and the fixed orientation with respect to this frame For dynamic frames, additional keywords depend on the dynamic frame family
Frames Subsystem
18
N IF
The frames routines (SPKEZR, SPKPOS, SXFORM, PXFORM) all read CK files using tolerance = 0
For discrete CKs (Type 1) the orientation of a CK-based frame will be computed only if the time provided to a Frames routine exactly matches one of the times stored in the CK file; otherwise an error will be signaled. For continuous CKs (Types 2 5) the orientation of a CK-based frame will be computed only if the time provided to a Frames routine falls within one of the interpolation intervals defined by the CK file; otherwise an error will be signaled.
Using SPKEZR or SXFORM requires CKs that contain angular rate data
Since these routines return a state vector (6x1) or state transformation matrix (6x6), angular rate must be present in the CK in order to compute vectors and matrices; if angular rate is not present an error will be signaled. SPKPOS and PXFORM, which return a position vector (3x1) and a position transformation matrix (3x3) respectively, can be used when angular rate data are NOT present in a CK.
Frames Subsystem
19
N IF
20
N IF
FRMDIFF CKBRIEF BRIEF
FK Utility Programs
Navigation and Ancillary Information Facility
The following FK and frames utility programs are included in the Toolkit
samples orientation of a frame or compares orientation of two frames summarizes coverage for one or more CK files summarizes coverage for one or more binary PCK files
These additional FK and frames utility programs are provided on the NAIF Web site
PINPOINT BINGO creates SPK and topocentric frames FK files for fixed locations (ground stations, etc) converts FK files between UNIX and DOS text formats
Frames Subsystem
21
N IF
Frames Subsystem
Additional Information on FK
Navigation and Ancillary Information Facility
For more information about FK and frames, look at the following documents
Frames Required Reading Using Frames Tutorial Dynamic Frames Tutorial NAIF IDs Tutorial headers for the routines mentioned in this tutorial Most Useful SPICELIB Routines FRMDIFF Users Guide Porting_kernels tutorial CK Required Reading PCK Required Reading SPK Required Reading Rotations Required Reading
22
Related documents
N IF
Navigation and Ancillary Information Facility
N IF
The power of the Frames capability stems from the SPICE systems ability to construct complex reference frame transformations with no programming effort required of you - the end user
But its crucial that you select and load the needed kernels
The principal benefit from the Frames capability is obtained through the main SPK subsystem interfaces (SPKEZR and SPKPOS) and the Frames subsystem interfaces (SXFORM and PXFORM) The remaining pages illustrate typical use of frames Several VERY IMPORTANT usage issues are mentioned in the core Frames tutorial; be sure to also read that.
Using Frames
N IF
CASSINI
S/C Frame
WAC Boresight
ISS = Imaging Science System
Compute the angular separation between the ISS Narrow Angle Camera and Wide Angle Camera boresights:
C C Retrieve the matrix that transforms vectors from NAC to WAC frame CALL PXFORM( CASSINI_ISS_NAC, CASSINI_ISS_WAC, ET, MAT ) Transform NAC boresight to WAC frame and find separation angle CALL MXV ( MAT, NAC_BORESIGHT_nac, NAC_BORESIGHT_wac ) ANGLE = VSEP( NAC_BORESIGHT_wac , WAC_BORESIGHT_wac )
3
Using Frames
N IF
CASSINI ISS NAC Frame S/C Frame
Angular Constraints
Navigation and Ancillary Information Facility
J2000 Frame SSB Sun Sun direction in the NAC frame
Angle between NAC Boresight and Sun direction Saturn J2000 Frame
Required Kernels: Generic LSK Mission FK Spacecraft SCLK Camera IK Planetary Ephemeris SPK Spacecraft SPK Spacecraft CK
NAC Boresight
Check whether the angle between the camera boresight and the direction to the Sun is within the allowed range:
CALL SPKPOS( SUN, ET, CASSINI_ISS_NAC, LT+S, CASSINI, SUNVEC, LT ) ANGLE = VSEP( NAC_BORESIGHT_nac, SUNVEC ) IF ( ANGLE .LE. CONSTRAINT ) WRITE(*,*) WE ARE IN TROUBLE!
Using Frames
N IF
J2000 Frame Sun Sun Direction In Local Level Frame Solar EL SSB
Solar AZ
Compute solar azimuth and elevation at the Huygens probe landing site
CALL SPKPOS(SUN,ET,HUYGENS_LOCAL_LEVEL,LT+S,HUYGENS_PROBE,SUNVEC,LT) CALL RECLAT(SUNVEC, R, AZIMUTH, ELEVATION) ELEVATION = -ELEVATION IF (AZIMUTH .LT. 0.D0) THEN AZIMUTH = AZIMUTH + TWOPI() ENDIF
Using Frames
N IF
Find the position of one MGS MAG sensor with respect to the other in the MGS s/c frame. Also find the relative orientation of the sensors:
CALL SPKEZR(MGS_MAG-Y, ET, MGS_SPACECRAFT, NONE, MGS_MAG+Y, STATE, LT) CALL PXFORM(MGS_MAG_+Y_SENSOR, MGS_MAG_-Y_SENSOR, ET, MAT)
Using Frames
N IF
MG S
Manipulators - 1
Navigation and Ancillary Information Facility Required Kernels: Generic LSK Mission FK Spacecraft SCLK HGA IK Structure Locations SPK Planetary Ephemeris SPK Spacecraft SPK Spacecraft CK HGA CK
SSB J2000 Frame Earth
HGA = High Gain Antenna
S/C Frame HGA Hinge frame HGA Gimbal frame J2000 Frame Sun HGA frame
Mars
Compute the angle between the direction to Earth and the MGS HGA boresight:
CALL SPKEZR( EARTH, ET, MGS_HGA, LT+S, MGS, EARTH_STATE, LT ) ANGLE = VSEP( HGA_BORESIGHT, EARTH_STATE )
Using Frames
N IF
RA J2 Frame RA Scoop Frame Dig Location in Surface fixed frame RA J1 Frame Dig Loc. in SSI frame
Manipulators - 2
Navigation and Ancillary Information Facility SSI Frame SSI Camera head Frame Required Kernels: Generic LSK Mission FK Lander SCLK Structure Locations SPK Lander SPK Lander CK SSI CK RA CK
MVACS Frame
Surface-fixed Frame
Compute the soil digging location in the MPL surface-fixed and camera left eye frames:
Using Frames
N IF
Navigation and Ancillary Information Facility
N IF
Topics
Navigation and Ancillary Information Facility
Introduction to Dynamic Reference Frames Terminology Parameterized Dynamic Reference Frames Defining Dynamic Reference Frames
Two-Vector Frame Concepts Two-Vector Frame Examples "Of-Date" Frames Euler Frames Frozen Dynamic Frames Inertial Dynamic Frames
N IF
The dynamic frames capability is an extension to the original SPICE frames subsystem. This capability enables SPICE users to conveniently use a wide variety of frames that are not "built in" to SPICE.
Dynamic Frames
N IF
Geocentric Solar Ecliptic (GSE) Solar Magnetic (SM) Spacecraft-centered roll-celestial frame Geocentric Solar Magnetospheric (GSM) Geomagnetic (MAG)
Using constant north centered geomagnetic dipole Using dipole direction defined by time-dependent Euler angles
Geocentric Solar Equatorial (GSEQ) Solar Equatorial frame for any ephemeris object Orbital frame for any ephemeris object Earth mean equator and equinox of date Earth true equator and equinox of date Earth mean ecliptic and equinox of date Nadir-oriented frame for planetary orbiter RTN ("radial, tangential, normal)
4
Dynamic Frames
N IF
Then, refer to the dynamic frame by name in calls to SPICE routines, just as you would do with built-in frames such as "J2000."
Dynamic Frames
N IF
Find the 6x6 matrix to transform states from the J2000 frame to the Geocentric Solar Ecliptic (GSE) frame at the TDB epoch given by ET1.
CALL SXFORM( 'J2000', 'GSE', ET1, XFORM )
Look up the state of Jupiter relative to the earth in the GSE frame:
CALL SPKEZR( 'JUPITER', ET1, 'GSE', 'NONE', 'EARTH', STATE, LT )
N IF
To define dynamic frames using a frames kernel, a fairly detailed understanding of the SPICE dynamic frames capability is required. A good understanding of the basic SPICE system (in particular, the SPK and frames subsystems) is also a prerequisite for defining dynamic frames. See the Frames Required Reading document for the most detailed documentation available. The rest of this tutorial is concerned with:
explaining the SPICE dynamic frames capability showing how to create dynamic frames kernels We present many frame definition examples
Dynamic Frames
N IF
Rationale
Navigation and Ancillary Information Facility
Why should SPICE offer dynamic frames implemented using a frames kernel? Instead
a user could build a C-kernel for any frame. SPICE could provide a limited number of "built-in" dynamic frames which wouldn't require a frames kernel. users can create their own routines to implement dynamic frames.
N IF
Terminology - 1
Navigation and Ancillary Information Facility
"Frame" is an abbreviation for "reference frame." A frame can be thought of as a set of three mutually orthogonal, unit-length vectors.
These vectors are called "basis vectors." The lines containing the basis vectors are the "axes" of the frame. The basis vectors indicate the "positive" axis directions; we label these vectors +X, +Y, and +Z. The negatives of these vectors are labeled -X, -Y, and -Z. We number the axes as follows:
All of the frames we'll deal with are "right-handed": this means +Z is the cross product +X x +Y. A reference frame's orientation is always defined relative to another specified frame: the "base frame."
Dynamic Frames
N IF
Terminology - 2
Navigation and Ancillary Information Facility
By "evaluating" a frame or "evaluating the orientation of a frame," we mean computing the rotation between the frame and its base frame.
An epoch is required in order to evaluate a dynamic frame.
Dynamic Frames
10
N IF
Terminology - 3
Navigation and Ancillary Information Facility
When we say that a vector is "aligned" with another vector, we mean that the angular separation between the two vectors is zero. We use the terms "defining a frame" and "specifying a frame" interchangeably. Both refer to creating a frame definition in a frame kernel. The term "API" stands for "Application Programming Interface." This term refers to the set of SPICE routines that are intended to be called directly by SPICE-based programs. The notation
[theta]n
indicates a frame rotation of theta radians about axis n, where n is one of {1, 2, 3}. This transformation rotates vectors by theta radians about axis n.
Dynamic Frames
11
N IF
This is the only frame definition style currently supported by the dynamic frames subsystem.
Future versions of SPICE might support additional styles such as script-based dynamic frames
Parameterized dynamic frames are grouped into frame "families". Each family corresponds to a distinct, parameterized geometric formula providing a frame definition. The families are:
Two-Vector Frames Of-date frames Mean Equator and Equinox True Equator and Equinox Mean Ecliptic and Equinox Euler Frames
Dynamic Frames
12
N IF
Parameterized dynamic frames are defined using "keyword=value" assignments in a frames kernel. The following items must be specified in the frame definition:
Frame name Frame ID code
The range 1400000-2000000 is reserved for people outside of the NAIF group
Class (=5 for dynamic frames) Class ID code (=frame ID code for dynamic frames) Frame center (=name or NAIF ID code for central body) Frame definition style (='PARAMETERIZED') Base frame
Frame definition specifies mapping from dynamic frame to the base frame.
Frame family Family-specific assignments
continued on next page
Dynamic Frames
13
N IF
Rotation state
Presence of this optional assignment in a frames kernel indicates that the frame orientation, relative to the base frame, is held constant ("frozen") at the specified epoch. Most dynamic frames are not frozen.
Dynamic Frames
14
N IF
Two-vector frames are defined using two timedependent vectors: the "primary" and "secondary" vectors.
Each may be defined by a variety of geometric means: Position vector Target near point vector Velocity vector Constant vector
The user associates specified positive or negative axes of the two-vector frame with the primary and secondary vectors.
Two-vector frames are always right-handed and have orthogonal axes, so two non-parallel vectors and associations of axes with these vectors suffice to define the orientation of a frame.
Dynamic Frames
15
N IF
Primary Vector
A specified positive or negative axis of the two-vector frame is aligned with this vector. The frame kernel creator assigns to this vector one of the axis designations { +X, -X, +Y, -Y, +Z, -Z }. Two degrees of freedom of the frame orientation are removed by association of an axis with the primary vector. The third degree of freedom is the frame's rotation about the primary vector. Example: a frame's -X axis is aligned with the primary vector:
Primary Vector Z
-X
X
Dynamic Frames
16
N IF
Secondary Vector
A specified positive or negative axis of the two-vector frame is aligned with the component of the secondary vector orthogonal to the primary vector. The frame kernel creator associates with this vector one of the axis designations { +X, -X, +Y, -Y, +Z, -Z }, where the axis is orthogonal to that associated with the primary vector. Example, continued: the frame's +Y axis is associated with the secondary vector. The component of the secondary vector orthogonal to the primary vector is aligned with the frame's +Y axis. The secondary vector thus lies in the frame's X-Y plane.
Primary Vector Z
-X
Y Secondary Vector X
Component of secondary vector orthogonal to primary vector
17
Dynamic Frames
N IF
Designers of two-vector frames should ensure that the primary and secondary vectors can't become nearly parallel for any realistic evaluation epoch.
Dynamic Frames
18
N IF
Position Vector
Is defined by the position of one ephemeris object relative to another. The frame kernel creator specifies: the target the observer the aberration correction
The vector may optionally be corrected for light time and stellar aberration.
The epoch at which the position vector is computed is supplied via a call to a SPICE API routine: as an input to an SPK routine, e.g. SPKEZR, SPKPOS. as an input to a frame system routine, e.g. SXFORM, PXFORM. The reference frame relative to which the vector is expressed is not specified by the frame kernel creator. SPICE automatically selects this frame.
Dynamic Frames
19
N IF
The epoch is supplied via a SPICE API call, as for position vectors. The reference frame relative to which the vector is expressed is not specified by the frame kernel creator.
SPICE automatically selects this frame.
Dynamic Frames
20
N IF
Velocity Vector
Is defined by the velocity of a target ephemeris object relative to an observing ephemeris object. The frame kernel creator specifies: the target the observer the velocity reference frame
This frame may be distinct from the base frame. Different velocity frame choices can lead to radically different two-vector frame definitions.
The epoch is supplied via a SPICE API call, as for position vectors.
Dynamic Frames
21
N IF
Constant Vector
The vector is constant in a frame specified by the kernel creator. The constant vector's frame may be time-dependent. This frame may be distinct from the base frame. The vector may be specified in a variety of coordinate systems. Cartesian Latitudinal Right ascension/declination (RA/DEC) An observer may optionally be associated with a constant vector for the purpose of defining aberration corrections. The orientation of the constant vector's frame may optionally be corrected for one-way light time between the frame's center and the observer: if the frame is noninertial, it is evaluated at a light time corrected epoch.
Dynamic Frames
22
N IF
A constant vector may optionally be corrected for stellar aberration due to motion of observer relative to solar system barycenter.
Stellar aberration can be specified without light time correction; the string indicating stellar aberration correction alone is 'S
The epoch is supplied via a SPICE API call, as for position vectors. If the constant vector's frame is time-dependent, that frame is evaluated at this epoch, optionally adjusted for light time.
Dynamic Frames
23
N IF
Z X
Secondary vector: spacecraft velocity relative to center of motion in J2000 frame. Associated with nadir frame's +X axis in frame kernel.
Normalized component of secondary vector orthogonal to primary vector. This vector is aligned with the nadir frame's +X axis.
Dynamic Frames
24
N IF
The -Z axis points from the spacecraft toward the closest point on Mars. The component of inertially referenced spacecraft velocity vector orthogonal to Z is aligned with the +X axis. The +Y axis is the cross product of the +Z axis and the +X axis. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PRI_AXIS FRAME_<frame_ID>_PRI_VECTOR_DEF FRAME_<frame_ID>_PRI_OBSERVER FRAME_<frame_ID>_PRI_TARGET FRAME_<frame_ID>_PRI_ABCORR FRAME_<frame_ID>_SEC_AXIS FRAME_<frame_ID>_SEC_VECTOR_DEF FRAME_<frame_ID>_SEC_OBSERVER FRAME_<frame_ID>_SEC_TARGET FRAME_<frame_ID>_SEC_ABCORR FRAME_<frame_ID>_SEC_FRAME
Dynamic Frames
= = = = = = = = = = = = = = = = = = =
Definitions <frame_ID> <frame_name> <frame_ID> = integer frame ID 5 code <frame_ID> <frame_name> = user-specified <orbiter_ID> frame name 'J2000' <orbiter_ID> = NAIF ID code of 'PARAMETERIZED' spacecraft 'TWO-VECTOR' <orbiter_ID/name> = NAIF ID code or '-Z' name of spacecraft 'TARGET_NEAR_POINT' <orbiter_ID/name> 'MARS' 'NONE' 'X' 'OBSERVER_TARGET_VELOCITY' 'MARS' <orbiter_ID/name> 'NONE' 'J2000' 25
N IF
Z Y
Normalized component of secondary vector orthogonal to primary vector. This vector is aligned with the view frame's +Y axis. ("In plane" direction)
Primary vector: spacecraft velocity relative to center of motion in J2000 frame. Associated with view frame's +Z axis in frame kernel. ("Down track" direction)
Dynamic Frames
26
N IF
The +Z axis is aligned with the J2000-referenced velocity of the spacecraft relative to Mars. The component of the spacecraft position orthogonal to +Z is aligned with the +Y axis. The +X axis is the cross product of the +Y axis and the +X axis. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PRI_AXIS FRAME_<frame_ID>_PRI_VECTOR_DEF FRAME_<frame_ID>_PRI_OBSERVER FRAME_<frame_ID>_PRI_TARGET FRAME_<frame_ID>_PRI_ABCORR FRAME_<frame_ID>_PRI_FRAME FRAME_<frame_ID>_SEC_AXIS FRAME_<frame_ID>_SEC_VECTOR_DEF FRAME_<frame_ID>_SEC_OBSERVER FRAME_<frame_ID>_SEC_TARGET FRAME_<frame_ID>_SEC_ABCORR
Dynamic Frames
= = = = = = = = = = = = = = = = = = =
<frame_ID> <frame_name> 5 <frame_ID> <orbiter_ID> 'J2000' 'PARAMETERIZED' 'TWO-VECTOR' 'Z' 'OBSERVER_TARGET_VELOCITY' 'MARS' <orbiter_ID/name> 'NONE' 'J2000' 'Y' 'OBSERVER_TARGET_POSITION' 'MARS' <orbiter_ID/name> 'NONE'
Definitions <frame_ID> = integer frame ID code <frame_name> = user-specified frame name <orbiter_ID> = NAIF ID code of spacecraft <orbiter_ID/name> = NAIF ID code or name of spacecraft
27
N IF
Z = X x Y, X
Y
Secondary vector: velocity of sun relative to earth in J2000 frame. Associated with GSE frame's +Y axis in frame kernel.
Dynamic Frames
N IF
Geocentric Solar Ecliptic (GSE) frame: +X is parallel to the geometric earth-sun position vector. +Y axis is the normalized component of the geometric earth-sun velocity vector orthogonal to the GSE +X axis. +Z axis is parallel to the cross product of the GSE +X axis and the GSE +Y axis. \begindata FRAME_GSE FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PRI_AXIS FRAME_<frame_ID>_PRI_VECTOR_DEF FRAME_<frame_ID>_PRI_OBSERVER FRAME_<frame_ID>_PRI_TARGET FRAME_<frame_ID>_PRI_ABCORR FRAME_<frame_ID>_SEC_AXIS FRAME_<frame_ID>_SEC_VECTOR_DEF FRAME_<frame_ID>_SEC_OBSERVER FRAME_<frame_ID>_SEC_TARGET FRAME_<frame_ID>_SEC_ABCORR FRAME_<frame_ID>_SEC_FRAME
Dynamic Frames
= = = = = = = = = = = = = = = = = = =
Definition <frame_ID> 'GSE' <frame_ID> = integer frame 5 ID code <frame_ID> 399 'J2000' 'PARAMETERIZED' 'TWO-VECTOR' 'X' 'OBSERVER_TARGET_POSITION' 'EARTH' 'SUN' 'NONE' 'Y' 'OBSERVER_TARGET_VELOCITY' 'EARTH' 'SUN' 'NONE' 'J2000' 29
N IF
Z = normalized component of secondary vector orthogonal to primary vector Primary vector: position of sun relative to earth Associated with GSM frame's +X axis in frame kernel. Y = Z x X, completing the right-handed frame
Dynamic Frames
30
N IF
Geocentric Solar Magnetospheric (GSM) frame: +X is parallel to the geometric earth-sun position vector. +Z axis is normalized component of north centered geomagnetic dipole vector orthogonal to GSM +X axis. +Y completes the right-handed frame. \begindata FRAME_GSM FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PRI_AXIS FRAME_<frame_ID>_PRI_VECTOR_DEF FRAME_<frame_ID>_PRI_OBSERVER FRAME_<frame_ID>_PRI_TARGET FRAME_<frame_ID>_PRI_ABCORR FRAME_<frame_ID>_SEC_AXIS FRAME_<frame_ID>_SEC_VECTOR_DEF FRAME_<frame_ID>_SEC_FRAME FRAME_<frame_ID>_SEC_SPEC FRAME_<frame_ID>_SEC_UNITS FRAME_<frame_ID>_SEC_LONGITUDE FRAME_<frame_ID>_SEC_LATITUDE
Dynamic Frames
= = = = = = = = = = = = = = = = = = = =
<frame_ID> Definition 'GSM' 5 <frame_ID> = integer frame <frame_ID> ID code 399 'J2000' 'PARAMETERIZED' 'TWO-VECTOR' 'X' 'OBSERVER_TARGET_POSITION' 'EARTH' 'SUN' 'NONE' 'Z' 'CONSTANT' 'IAU_EARTH' 'LATITUDINAL' 'DEGREES' 288.43 79.54 31
N IF
X = normalized component of secondary vector orthogonal to primary vector Primary vector: position of earth relative to spacecraft. Associated with Roll-Celestial frame's +Z axis in frame kernel.
Dynamic Frames
N IF
Spacecraft-centered roll-celestial frame: +Z is parallel to the geometric earth-sun position vector. +X axis is normalized component of star direction orthogonal to Z axis. The star direction is corrected for stellar aberration due to motion of the spacecraft. +Y completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PRI_AXIS FRAME_<frame_ID>_PRI_VECTOR_DEF FRAME_<frame_ID>_PRI_OBSERVER FRAME_<frame_ID>_PRI_TARGET FRAME_<frame_ID>_PRI_ABCORR FRAME_<frame_ID>_SEC_AXIS FRAME_<frame_ID>_SEC_VECTOR_DEF FRAME_<frame_ID>_SEC_FRAME FRAME_<frame_ID>_SEC_SPEC FRAME_<frame_ID>_SEC_UNITS FRAME_<frame_ID>_SEC_RA FRAME_<frame_ID>_SEC_DEC FRAME_<frame_ID>_SEC_OBSERVER FRAME_<frame_ID>_SEC_ABCORR
Dynamic Frames
Definitions <frame_ID> = integer frame ID code <frame_name> = user-specified frame name <spacecraft_ID> = NAIF ID code of spacecraft <spacecraft_ID/name> = NAIF ID code or name of spacecraft
= = = = = = = = = = = = = = = = = = = = = =
<frame_ID> <frame_name> 5 <frame_ID> <spacecraft_ID> 'J2000' 'PARAMETERIZED' 'TWO-VECTOR' 'Z' 'OBSERVER_TARGET_POSITION' <spacecraft_ID/name> 'EARTH' 'NONE' 'X' 'CONSTANT' 'J2000' 'RA/DEC' 'DEGREES' <star right ascension in degrees> <star declination in degrees> <spacecraft_ID/name> 'S'
33
N IF
"Of-Date" Frames - 1
Navigation and Ancillary Information Facility
Of-date frames are associated with user-specified bodies and are based on user-selected dynamical models.
Implementations of these models are built into SPICE.
Currently the earth is the only supported body for of-date frames.
Dynamic Frames
34
N IF
Precession Nutation Mean obliquity
"Of-Date" Frames - 2
Navigation and Ancillary Information Facility
Dynamic Frames
35
N IF
"Of-Date" Frames - 3
Navigation and Ancillary Information Facility
The frame kernel creator must either specify the frame's rotation state or must designate the frame "frozen" at a specified "freeze epoch."
Dynamic Frames
36
N IF
"Of-Date" Frames - 4
Navigation and Ancillary Information Facility
Earth mean equator and equinox of date frame: +Z axis is perpendicular to mean equator of date and points north. +X axis is parallel to the cross product of the +Z axis and the north-pointing vector normal to the mean ecliptic of date. +Y axis completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PREC_MODEL FRAME_<frame_ID>_ROTATION_STATE = = = = = = = = = = Definitions <frame_ID> = integer frame ID code <frame_name> = user-specified frame name
Dynamic Frames
37
N IF
"Of-Date" Frames - 5
Navigation and Ancillary Information Facility
The frame kernel creator must either specify the frame's rotation state or must designate the frame "frozen" at a specified "freeze epoch."
Dynamic Frames
38
N IF
"Of-Date" Frames - 6
Navigation and Ancillary Information Facility
Earth true equator and equinox of date frame: +Z axis is perpendicular to true equator of date and points north. +X axis is parallel to the cross product of the +Z axis and the north-pointing vector normal to mean ecliptic of date. +Y axis completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PREC_MODEL FRAME_<frame_ID>_NUT_MODEL FRAME_<frame_ID>_ROTATION_STATE = = = = = = = = = = = Definitions <frame_ID> = integer frame ID code <frame_name> = user-specified frame name
<frame_ID> <frame_name> 5 <frame_ID> 399 'J2000' 'PARAMETERIZED' 'TRUE_EQUATOR_AND_EQUINOX_OF_DATE' 'EARTH_IAU_1976' 'EARTH_IAU_1980' 'ROTATING'
Dynamic Frames
39
N IF
"Of-Date" Frames - 7
Navigation and Ancillary Information Facility
The frame kernel creator must either specify the frame's rotation state or must designate the frame "frozen" at a specified "freeze epoch."
Dynamic Frames
40
N IF
"Of-Date" Frames - 8
Navigation and Ancillary Information Facility
Earth mean ecliptic and equinox of date frame: +Z axis is perpendicular to mean ecliptic of date and points toward ecliptic north. +X axis is parallel to the cross product of the north-pointing vector normal to mean equator of date and the +Z axis. +Y axis completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PREC_MODEL FRAME_<frame_ID>_OBLIQ_MODEL FRAME_<frame_ID>_ROTATION_STATE = = = = = = = = = = = Definitions <frame_ID> = integer frame ID code = user-specified frame name
<frame_name> <frame_ID> <frame_name> 5 <frame_ID> 399 'J2000' 'PARAMETERIZED' 'MEAN_ECLIPTIC_AND_EQUINOX_OF_DATE' 'EARTH_IAU_1976' 'EARTH_IAU_1980' 'ROTATING'
Dynamic Frames
41
N IF
Euler Frames - 1
Navigation and Ancillary Information Facility
42
N IF
Examples
Euler Frames - 2
Navigation and Ancillary Information Facility
Dynamic version of earth magnetospheric frame (MAG) Latitude and longitude of the north centered geomagnetic dipole are given by polynomials. Spinning spacecraft frame The base frame could be a: Built-in inertial frame C-kernel frame Roll-celestial frame (using lock star) Nadir frame Topocentric frames for tracking stations for which crustal plate motion is modeled The frame rotation keeps the frame orientation consistent with the changing station location.
Dynamic Frames
43
N IF
Euler Frames - 3
Navigation and Ancillary Information Facility
Mean or true body equator and earth equinox of date frame, where the body is a planet or satellite other than the earth The base frame is an IAU_<body> frame. The Euler frame "removes" the body's rotation about the spin axis. Variation on supported "of date" frame An existing supported "of date" frame is used as the base frame. Perturbations to the "of date" frame are expressed using Euler angles.
Dynamic Frames
44
N IF
Euler Frames - 4
Navigation and Ancillary Information Facility
As an example, we construct an Euler frame called IAU_MARS_EULER. Frame IAU_MARS_EULER is mathematically identical to the PCK frame named IAU_MARS. The PCK data defining the underlying IAU_MARS frame are: BODY499_POLE_RA = ( 317.68143 -0.1061 0. ) BODY499_POLE_DEC = ( 52.88650 -0.0609 0. ) BODY499_PM = ( 176.630 350.89198226 0. ) Relative to the angles used to define the IAU_MARS frame, the angles for our Euler frame definition are reversed and the signs negated. Angular units are degrees. Rate units are degrees/second, unlike the PCK units of degrees/day. PCK: angle_3 is angle_2 is angle_1 is 90 + RA 90 - Dec PM = = = = = = = = = = = = = = Euler Frame: angle_1 is -90 - RA angle_2 is -90 + Dec angle_3 is - PM
\begindata FRAME_IAU_MARS_EULER FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_EPOCH FRAME_<frame_ID>_AXES FRAME_<frame_ID>_UNITS FRAME_<frame_ID>_ANGLE_1_COEFFS FRAME_<frame_ID>_ANGLE_2_COEFFS FRAME_<frame_ID>_ANGLE_3_COEFFS
Dynamic Frames
<frame_ID> Definition 'IAU_MARS_EULER' 5 <frame_ID> = integer frame ID <frame_ID> code 499 'J2000' 'PARAMETERIZED' 'EULER' @2000-JAN-1/12:00:00 ( 3 1 3 ) 'DEGREES' ( -47.68143 0.33621061170684714E-10 ) ( -37.1135 -0.19298045478743630E-10 ) ( -176.630 -0.40612497946759260E-02 ) 45
N IF
Dynamic Frames
46
N IF
Frozen version of Earth mean equator and equinox of date frame: +Z axis is perpendicular to mean equator of date. +X axis is parallel to cross product of +Z axis and vector normal to mean ecliptic of date. +Y axis completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PREC_MODEL FRAME_<frame_ID>_FREEZE_EPOCH = = = = = = = = = = Definitions <frame_ID> = integer frame ID <frame_ID> code <frame_name> <frame_name> = user-specified 5 frame name <frame_ID> 399 'J2000' 'PARAMETERIZED' 'MEAN_EQUATOR_AND_EQUINOX_OF_DATE' 'EARTH_IAU_1976' @1949-DEC-31/22:09:46.861901
Dynamic Frames
47
N IF
Inertial dynamic frames are specified by setting the rotation state to 'INERTIAL' in the rotation state assignment:
FRAME_<FRAME_ID>_ROTATION_STATE = 'INERTIAL'
The 'INERTIAL' state implies the frame is treated as inertial for the purpose of velocity transformations. The state transformation between any inertial frame and "inertial dynamic frame" has zero derivative block: the state transformation matrix has the form
Derivative block
Dynamic Frames
48
N IF
In contrast, for any rotating frame R(t), the state transformation between any inertial frame and R(t) has a corresponding matrix of the form
Dynamic Frames
49
N IF
Inertial version of Earth true equator and equinox of date frame: +Z axis is perpendicular to true equator of date. +X axis is parallel to cross product of +Z axis and vector normal to mean ecliptic of date. +Y axis completes the right-handed frame. \begindata FRAME_<frame_name> FRAME_<frame_ID>_NAME FRAME_<frame_ID>_CLASS FRAME_<frame_ID>_CLASS_ID FRAME_<frame_ID>_CENTER FRAME_<frame_ID>_RELATIVE FRAME_<frame_ID>_DEF_STYLE FRAME_<frame_ID>_FAMILY FRAME_<frame_ID>_PREC_MODEL FRAME_<frame_ID>_NUT_MODEL FRAME_<frame_ID>_ROTATION_STATE = = = = = = = = = = = Definitions <frame_ID> = integer frame ID code <frame_name> = user-specified frame name
<frame_ID> <frame_name> 5 <frame_ID> 399 'J2000' 'PARAMETERIZED' 'TRUE_EQUATOR_AND_EQUINOX_OF_DATE' 'EARTH_IAU_1976' 'EARTH_IAU_1980' 'INERTIAL'
Dynamic Frames
50
N IF
Dynamic Frames
51
N IF
Numerical Issues Limitations
Backup
Navigation and Ancillary Information Facility
Dynamic Frames
52
N IF
Numerical Issues - 1
Navigation and Ancillary Information Facility
Two-vector frame derivatives may be inaccurate. Let R(t) represent a time-dependent rotation:
If R(t) depends on CK data, dR(t)/dt may be inaccurate because CK rates frequently have low accuracy. If R(t) depends on velocity vectors, then dR(t)/dt depends on acceleration determined via numerical differentiation. Typically such derivatives suffer loss of accuracy. However, if velocities are "well-behaved," numerically derived acceleration can be quite good. Example: GSE frame. If R(t) depends on position vectors, the velocities associated with those vectors by the SPK system may not be mathematically consistent with the positions. This can happen for SPK types with separate polynomials for position and velocity, such as types 3, 8, 9, and 14. If R(t) depends on aberration-corrected vectors, the associated velocities may be inaccurate due to accuracy limitations of the aberration corrections applied to velocities by the SPK system.
Dynamic Frames
53
N IF
Numerical Issues - 2
Navigation and Ancillary Information Facility
Recommendations
Avoid using aberration corrections in two-vector frame definitions if accurate velocity transformations are required. Be aware of the accuracy of the data on which two-vector frames are based.
Dynamic Frames
54
N IF
Limitations - 1
Navigation and Ancillary Information Facility
Simulated recursion:
ANSI Fortran 77 doesn't support recursion, so the SPICE dynamic frame system implements limited, simulated recursion. Basically, two levels of recursion are supported for selected SPK and Frames System routines. Users must avoid requesting "deeper" recursion than the SPICE dynamic frame system can support. When defining dynamic frames:
Choose J2000 as the base frame for two-vector frames. Except for Euler frames, avoid using dynamic frames as base frames. Try to avoid choosing a dynamic frame as the frame associated with a velocity or constant vector.
In SPK, CK, or PCK kernels, don't use two-vector frames as the base frame relative to which ephemeris or attitude data are specified.
"Of-date" or Euler frames are OK for this purpose.
Dynamic Frames
55
N IF
Run-time efficiency:
Limitations - 2
Navigation and Ancillary Information Facility
Dynamic frame evaluation typically requires more computation than is needed for CK or PCK frames. For example, evaluation of a two-vector frame may involve several SPK calls. Euler frames are an exception: these are fairly efficient as long as they don't have a base frame that requires a lot of computation to evaluate. To minimize the performance penalty: Use J2000 as the base frame for two-vector frames. Use the simplest frames possible for association with velocity or constant vectors in two-vector frame definitions.
Prefer non-dynamic frames to dynamic frames and inertial frames to non-inertial frames where there is a choice.
Dynamic Frames
56
N IF
Navigation and Ancillary Information Facility
High Accuracy Orientation and Body-fixed Frames for the Moon and Earth
July 2013
N IF
Introduction Earth binary PCKs Lunar binary PCKs Lunar Frames Kernel
Frame specifications Frame alias names
Topics
Navigation and Ancillary Information Facility
Backup
Earth and Moon frame association kernels
Special PCK and FK for Earth and Moon
N IF
Introduction-1
Navigation and Ancillary Information Facility
Having read about standard PCKs and FKs in other tutorials you may want to learn about several special PCKs and FKs dealing with the Earth and the Moon. While it is ultimately up to you, in most cases you should use the PCK and FK kernels described here when working with the Moon or the Earth.
N IF
Introduction-2
Navigation and Ancillary Information Facility
NAIF provides High accuracy orientation data for the Earth and Moon in binary PCKs.
For the Earth, three versions are made: High accuracy, frequently updated file
Contains high accuracy historical data and fairly accurate, short-term predict data
High accuracy, infrequently updated historical file Lower accuracy long term predict file For the Moon, a single, long-term file is made each time an official new JPL Developmental Ephemeris (DE) is released. Contains accurate historical and predictive lunar orientation data
Load the PCK(s) using FURNSH For the Moon, also load the lunar FK Reference the Earth body-fixed frame using the name ITRF93
CAUTION: IAU_EARTH cannot be used to reference high-accuracy earth orientation data
N IF
Navigation and Ancillary Information Facility
N IF
The ITRF93 high accuracy earth rotation model takes into account:
Precession: 1976 IAU model due to Lieske. Nutation: 1980 IAU model, with IERS corrections due to Herring et al. True sidereal time using accurate values of TAI-UT1 Polar motion
It is more accurate than the IAU rotation models found in text PCKs.
See the plot on the next slide comparing orientation of the ITRF93 frame to that of the IAU_EARTH frame. IAU_EARTH frame orientation error is ~1 milliradian, or ~6km on a great circle!
N IF
N IF
N IF
Data for the earth come from a JPL Earth Orientation Parameters file (EOP).
Binary earth PCKs represent the orientation of an earth ITRFxx body-fixed reference frame relative to the ICRF*. ITRF* frames are defined by the International Earth Rotation Service (IERS). Currently only the ITRF93 frame is supported within SPICE.
ICRF = International Celestial Reference Frame, often referred to in SPICE as the J2000 frame, and also often referred to as the EME 2000 frame. This is an inertial frame. ITRF = International Terrestrial Reference Frame IERS = International Earth Rotation Service
Special PCK and FK for Earth and Moon
N IF
Three versions of the high accuracy binary Earth PCK are produced
The latest, using each new release by JPL of a reconstructed EOP file Covers well into the past and approximately two months into the future beyond the production date Accuracy of the future data degrades rapidly past the production date Produced several times per week using an automatic script Long term predict, for future uses not requiring high accuracy Produced infrequently Covers several years into the past and approximately 30 years into the future Accuracy at epochs in the future is low compared to that for past epochs, but any of it is far better than what is obtained from the IAU rotation model for the Earth (IAU_EARTH) provided in any text PCK History file, containing only high accuracy historical data
All are in the pck directory under generic_kernels on the NAIF server: ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/
Read the aareadme file to see the file naming schema and more details
Special PCK and FK for Earth and Moon
10
N IF
High accuracy determination of surface locations relative to an inertial frame involves motions in addition to Earth rotation, including:
tectonic plate motion tidal effects relativistic effects
11
N IF
If youre using SPICE to access Earth size and shape information, youll also need to load a text PCK file containing these data.
Typically use the latest generic text PCK: pck000xx.tpc
12
N IF
Navigation and Ancillary Information Facility
N IF
The high accuracy lunar rotation models available in binary PCKs are more accurate than the IAU rotation model found in a text PCK (IAU_MOON).
Rotation error between IAU_MOON and the corresponding high accuracy MOON_ME (mean Earth/rotation axis) frame for the DE-421 and 2000 IAU data sets and for the time period of 2000-2020 is approximately: Worst case: ~0.0051 degrees, or ~155m on a great circle Average: ~0.0025 degrees, or ~76m on a great circle The error is due to truncation of the libration series in the IAU model See the plot in the following chart comparing the IAU lunar rotation model to the integrated DE-421 model.
14
N IF
Difference between the IAU_Moon frame and the Moon_ME frame (equivalent to the Moon_ME_DE421 frame)
15
N IF
The high accuracy lunar orientation model obtained from the DE421 lunar ephemeris represents the result of a simultaneous numerical integration of lunar rotation and orbit, and of orbits of the planets.
The DE421 integration model includes*: A solid Moon Torques on the Moon from the static gravity field of degree 2-4. Torque is due to Earth, Sun, Venus, and Jupiter. Torques on the Moon and moments of inertia due to (degree 2) tides raised by Earth. Dissipation effects on torques and moments due to tides on the Moon. Torques due to Earth J2 interacting with Moon degree 2 (J2 and C22). Lunar quantities fit for DE421 include: Initial conditions for lunar orbit and rotation of body Moment of inertia difference (C-A)/B and (B-A)/C Third-degree gravity field coefficients Tidal Love numbers and dissipation Locations of four laser retroreflector arrays
It is anticipated that further improvements in the orientation of the moon will become available in new DExxx-based kernels in the future.
*Description provided by James G. Williams (JPL)
Special PCK and FK for Earth and Moon
16
N IF
Data for lunar orientation come from JPLs DE/ LExxx planet/lunar ephemeris files.
Binary lunar PCKs represent the orientation of the Moons principal axis reference frame, referred to as MOON_PA_DExxx, relative to the ICRF*.
ICRF = International Celestial Reference Frame, often referred to in SPICE as the J2000 frame, and also often referred to as the EME 2000 frame. This is an inertial frame. JPL-produced planet/lunar ephemeris files are sometimes referred to as DE/LExxx but more often are referred to as simply DExxx.
17
N IF
Navigation and Ancillary Information Facility
N IF
A lunar frames kernel is maintained and available from NAIF. It has four functions.
1. Make two lunar framesPrincipal Axes (PA) and Mean Earth/Polar Axis (ME) known to the SPICE system. Within SPICE their names are MOON_PA_DExxx and MOON_ME_DExxx These frames are unique to a particular JPL-produced planetary and lunar ephemeris (e.g. DE421). 2. Connect the MOON_PA_DExxx frame name to the high accuracy lunar orientation PCK data that implement the PA orientation (relative to the ICRF). 3. Provide specifications, in the SPICE context, for implementing the rotation between the PA frame and the ME frame. Makes the MOON_ME_DExxx frame available to SPICE. 4. Provide generic frame names, aliased to the MOON_PA_DExxx and MOON_ME_DExxx frame names. The generic frame names are simply MOON_PA and MOON_ME. The generic names need not be changed in your programs when the MOON_PA_Dexxx and MOON_ME_DExxx names change due to use of new defining data.
The DE-specific frames to which these aliases point will be updated by NAIF whenever a new binary lunar orientation PCK is produced. NAIF will release a new lunar FK at that time.
To access the PA or ME frame you must load the lunar FK into your program in addition to the lunar binary PCK that implements the lunar PA frame orientation.
19
N IF
If youre using SPICE to access Moon size and shape information, youll also need to load a text PCK file containing these data.
Typically use the latest generic text PCK, such as pck00009.tpc
20
N IF
Example of file name
Kernel(s) needed
Which kernels are needed to access each of the three lunar body-fixed reference frames providing lunar orientation?
moon_pa_de421_1900-2 050.bpc moon_080317.tf pck00009.tf
Lunar FK
Your objective
MOON_PA
MOON_ME
IAU_MOON
21
N IF
Navigation and Ancillary Information Facility
N IF
SPICE binary PCK files are used to accommodate high accuracy rotation models.
Just as for SPKs and CKs, the data are held in SPICE Double Precision Array files (DAF) Multiple types are supported Type 2: Chebyshev polynomials are used to represent Euler angles giving orientation as a function of time. Rates are obtained by differentiating polynomials. Coverage intervals have fixed length.
Used for the Earth and the Moon
Type 3: Separate sets of Chebyshev polynomials are used to represent Euler angles and their rates. Coverage intervals have variable length.
Not currently used for Earth or Moon
Binary PCKs include a comment area for storing descriptive metadata Access the comment area using the Toolkits commnt utility program Binary PCKs support high-speed direct access Cheby polynomials are fit to source Euler angles; these evaluate very quickly
Special PCK and FK for Earth and Moon
23
N IF
Navigation and Ancillary Information Facility
N IF
If two (or more) binary PCKs with functionally equivalent data are loaded, a later loaded file takes precedence. Loading one text PCK that supersedes another can lead to errors if data from the old PCK remain in the kernel pool.
Its essential to unload the old text PCK before loading the new one. Use UNLOAD or KCLEAR to unload the old text PCK. This problem doesnt apply to binary PCKs.
If both a binary and a text PCK provide orientation for the same frame, data available from the binary PCK always take precedence over data available from the text PCK.
This is independent of file loading order Note: the binary PCKs discussed in this tutorial define earth-fixed and moon-fixed frames different from those defined by a text PCK (e.g. pck00009.tpc), so there will be no conflict.
25
N IF
Non-native binary PCKs can be read without first being converted to the native binary form
If you need to write to a non-native binary PCK you must first convert it to native binary form using bingo or the pair of toxfr and tobin toxfr and tobin are avaiable in each Toolkit; bingo is available only from the NAIF website Converting a non-native binary PCK to native form will also speed up data access somewhat
26
N IF
Navigation and Ancillary Information Facility
Backup
Association Frames Kernels for the Earth and the Moon
N IF
In most SPICE modules that deal with one or more reference frames the name(s) of that/those frame(s) must be provided as input argument(s), for example:
CALL SPKEZR (target,time, frame, observer, correction, state, lighttime)
Many years ago the SPICE developers assumed there would be only one body-fixed reference frame associated with each natural body during a program run.
Thus a specific body-fixed frame name would rarely be needed as an input to modules dealing with body-fixed frames Instead, SPICE could use the body-fixed frame associated with a given body simply by knowing the body name or ID For most bodies SPICE associates the body with a body-fixed frame named
IAU_<body name> (example: IAU_MOON)
This was a bad assumption at least for the Earth and the Moon!
Multiple body-fixed frames exist for the Moon and Earth The default body-fixed frames for the Moon and the Earth, for which the defining data are provided in a generic text PCK (taken from an IAU report) are very inaccurate representations of the actual orientations of these bodies
28
N IF
For the earth and the moon there are other choices for body-fixed frame that are almost certainly better than the default body-fixed frame conjured up by SPICE
29
N IF
The Problem
Navigation and Ancillary Information Facility
The SPICE modules that make use of the default body-fixed Old: still available, but better to use those noted below reference frame are these
LSPCN, ET2LST, ILLUM, SRFXPT, SUBPT, SUBSOL (and their C, Icy and Mice equivalents) Your code might overtly call one of these, or it could call one indirectly through use of a parameterized dynamic frame
NAIF rules regarding stability of our software offerings prevent us from changing the designs of those modules
So we have provided you means to change the default body-fixed frame associated with any solar system body of interest to you. See the next several pages.
However, starting with the version N62 Toolkits, a new set of modules is available for those calculations where precision body orientation is important.
These modules require the user to name the desired body-fixed frame, rather than using a default body-fixed frame New: safer to use, and offer improved The new modules are these: accuracy in some cases ILUMIN, SINCPT, SUBPNT, SUBSLR
30
N IF
All bodies for which a body-fixed frame is defined by the IAU, and where the defining data are found in a SPICE text PCK file, have an associated default body-fixed frame name within SPICE:
The name pattern is: IAU_<body name> Examples: IAU_MARS, IAU_MOON, IAU_EARTH
A different default body-fixed frame name can be assigned within a program by placing the following assignment in any text kernel that is loaded into the program:
OBJECT_<body name>_FRAME = <new default frame name>
31
N IF
For the earth and the moon, changing the default body-fixed frame name as described on the previous page can be accomplished by loading the appropriate association frame kernel provided by NAIF. The association kernels available are shown below
For the Earth: earth_assoc_itrf93.tf For the Moon: (pick one or the othernot both) moon_assoc_me.tf moon_assoc_pa.tf
32
N IF
Which additional kernel is needed to use the indicated frame in those (older) SPICE APIs* that use a default (assumed) frame? Pick one or the other.
MOON_PA MOON_ME IAU_MOON
Usually a bad choice for the moon!
File name
moon_assoc_pa.tf
moon_assoc_me.tf
PA Association FK**
ME Association FK**
no additional kernels
But best to use the replacements for these four, which dont use a default body-fixed frame: ILUMIN SINCPT SUBPNT SUBSLR
* LSPCN, ET2LST, ILLUM, SRFXPT, SUBPT, SUBSOL (and their C, Icy and Mice equivalents)
**Any version of one or the other of these kernels is good indefinitely; you do not need to use the latest instance offered on the NAIF server.
Special PCK and FK for Earth and Moon
33
N IF
Navigation and Ancillary Information Facility
Instrument Kernel IK
July 2013
N IF
Purpose
Navigation and Ancillary Information Facility
The Instrument Kernel serves as a repository for instrument specific information that may be useful within the SPICE context.
Always included: Specifications for an instruments field-of-view (FOV) size, shape, and orientation Other possibilities: Internal instrument timing parameters and other data relating to SPICE computations might also be placed in an I-kernel Instrument geometric calibration data
Note: instrument mounting alignment data are specified in a missions Frames Kernel (FK)
(Wasnt true for some of the earliest missions that used SPICE)
Instrument Kernel
N IF
I-Kernel Structure
Navigation and Ancillary Information Facility
Instrument Kernel
N IF
N IF
This documentation exists primarily to assist users in integrating I-Kernel data into their applications
One needs to know the keyword name to get its value(s) from the IK data One needs to know what each value means in order to use it properly
Instrument Kernel
N IF
By knowing the name and type (DP, integer, or character) of a keyword of interest, the value(s) associated with that keyword can be retrieved using G*POOL routines
CALL GDPOOL ( NAME, START, ROOM, N, VALUES, FOUND ) for DP values CALL GIPOOL ( NAME, START, ROOM, N, VALUES, FOUND ) for integer values CALL GCPOOL ( NAME, START, ROOM, N, VALUES, FOUND ) for character string values
When an instruments FOV is defined in the IK using a special set of keywords discussed later in this tutorial, the FOV shape, reference frame, boresight vector, and boundary vectors can be retrieved by calling the GETFOV routine
CALL GETFOV ( INSTID, ROOM, SHAPE, FRAME, BSIGHT, N, BOUNDS)
N IF
The following keywords defining FOV attributes for the instrument with NAIF ID (#) must be present in the IK if the SPICE Toolkits GETFOV module will be used
Keyword defining shape of the FOV INS#_FOV_SHAPE = 'CIRCLE' or 'ELLIPSE' or 'RECTANGLE' or 'POLYGON'
Keyword defining reference frame in which the boresight vector and FOV boundary vectors are specified INS#_FOV_FRAME = 'frame name'
Instrument Kernel
N IF
Keyword(s) defining FOV boundary vectors, provided in either of two ways 1) By specifying boundary vectors explicitly INS#_FOV_CLASS_SPEC = 'CORNERS INS#_FOV_BOUNDARY_CORNERS = ( X(1), Y(1), Z(1), X(n), Y(n), Z(n) ) where the FOV_BOUNDARY_CORNERS keyword provides an array of vectors that point to the "corners" of the instrument field of view. Note: Use of the INS#_FOV_CLASS_SPEC keyword is optional when explicit boundary vectors are provided.
Instrument Kernel
N IF
2) By providing half angular extents of the FOV (possible only for circular, elliptical or rectangular FOVs) INS#_FOV_CLASS_SPEC INS#_FOV_REF_VECTOR INS#_FOV_REF_ANGLE INS#_FOV_CROSS_ANGLE INS#_FOV_ANGLE_UNITS = = = = = 'ANGLES' ( X, Y, Z ) halfangle1 halfangle2 'DEGREES' or 'RADIANS or
where the FOV_REF_VECTOR keyword specifies a reference vector that, together with the boresight vector, define the plane in which the half angle given in the FOV_REF_ANGLE keyword is measured. The other half angle given in the FOV_CROSS_ANGLE keyword is measured in the plane normal to this plane and containing the boresight vector.
Instrument Kernel
N IF
When explicit boundary vectors are provided, they must be listed in either clockwise or counter-clockwise order, not randomly Neither the boresight nor reference vector has to be co-aligned with one of the FOV frames axes
But for convenience, each is frequently defined to be along one of the FOV axes
Neither the boresight nor corner nor reference vector has to be a unit vector
But these frequently are defined as unit vectors
When a FOV is specified using the half angular extents method, the boresight and reference vectors have to be linearly independent but they dont have to be perpendicular
But for convenience the reference vector is usually picked to be normal to the boresight vector
Half angular extents for a rectangular FOV specify the angles between the boresight and the FOV sides, i.e. they are for the middle of the FOV The next several pages show examples of FOV definitions
Instrument Kernel
10
N IF
Y
14.03 O
Y Boundary Corner Vector X (0,0,0) Instrument focal point Boresight Vector (0,1,4)
Angular Size
Instrument Kernel
11
N IF
The following sets of keywords and values describe this circular field of view:
Specifying boundary vectors explicitly:
INS-11111_FOV_SHAPE INS-11111_FOV_FRAME INS-11111_BORESIGHT INS-11111_FOV_BOUNDARY_CORNERS = = = = 'CIRCLE' 'FRAME_FOR_INS-11111' ( 0.0 0.0 1.0 ) ( 0.0 1.0 4.0 )
Instrument Kernel
12
N IF
26.57 O
Boresight Vector
13
N IF
The following sets of keywords and values describe this elliptical field of view:
Specifying boundary vectors explicitly:
INS-22222_FOV_SHAPE INS-22222_FOV_FRAME INS-22222_BORESIGHT INS-22222_FOV_BOUNDARY_CORNERS = = = = 'ELLIPSE' 'FRAME_FOR_INS-22222' ( 0.0 0.0 1.0 ) ( 0.0 1.0 4.0 2.0 0.0 4.0 )
= = = = = = = =
'ELLIPSE' 'FRAME_FOR_INS-22222' ( 0.0 0.0 1.0 ) 'ANGLES' ( 0.0 1.0 0.0 ) 14.03624347 26.56505118 'DEGREES'
14
N IF
Y
14.03 O
26.57 O
(2,-1,4)
(-2,-1,4)
15
N IF
The following sets of keywords and values describe this rectangular field of view:
Specifying boundary vectors explicitly:
INS-33333_FOV_SHAPE INS-33333_FOV_FRAME INS-33333_BORESIGHT INS-33333_FOV_BOUNDARY_CORNERS = = = = RECTANGLE' 'FRAME_FOR_INS-33333' ( 0.0 0.0 1.0 ) ( 2.0 1.0 4.0 -2.0 1.0 4.0 -2.0 -1.0 4.0 2.0 -1.0 4.0 ) RECTANGLE' 'FRAME_FOR_INS-33333' ( 0.0 0.0 1.0 ) 'ANGLES' ( 0.0 1.0 0.0 ) 14.03624347 26.56505118 'DEGREES'
16
= = = = = = = =
N IF
(1,1,4)
(-1,1,4) Z
(2,-1,4)
(-2,-1,4)
Instrument Kernel
17
N IF
The following sets of keywords and values describe this polygonal field of view:
Specifying boundary vectors explicitly:
INS-44444_FOV_SHAPE INS-44444_FOV_FRAME INS-44444_BORESIGHT INS-44444_FOV_BOUNDARY_CORNERS = = = = 'POLYGON' 'FRAME_FOR_INS-44444' ( 0.0 0.0 1.0 ) ( 1.0 1.0 4.0 -1.0 1.0 4.0 -2.0 -1.0 4.0 2.0 -1.0 4.0 )
Instrument Kernel
18
N IF
IK Utility Programs
Navigation and Ancillary Information Facility
No IK utility programs are included in the Toolkit Two IK utility programs are provided on the NAIF Web site (http://naif.jpl.nasa.gov/naif/utilities.html)
OPTIKS BINGO displays field-of-view summary for all FOVs defined in a collection of IK files. converts IK files between UNIX and DOS text formats
C-Kernel
19
N IF
Additional Information on IK
Navigation and Ancillary Information Facility
The best way to learn more about IKs is to examine some found in the NAIF Node archives.
Start looking here: http://naif.jpl.nasa.gov/naif/data_archived.html
Unfortunately NAIF does not yet have an I-Kernel Required Reading document But information about IKs is available in other documents:
header of the GETFOV routine Kernel Required Reading OPTIKS Users Guide Porting_kernels tutorial NAIF IDs Tutorial Frames Required Reading
C-Kernel
20
N IF
IK file example
Backup
Navigation and Ancillary Information Facility
Instrument Kernel
21
N IF
Sample IK Data
Navigation and Ancillary Information Facility
The following LEMMS1 FOV definition was taken from the Cassini MIMI IK (cas_mimi_v11.ti):
Low Energy Magnetospheric Measurements System 1 (LEMMS1) Since the MIMI_LEMMS1 detector's FOV is circular and it's diameter is 15.0 degrees, looking down the X-axis in the CASSINI_MIMI_LEMMS1 frame, we have: (Note we are arbitrarily choosing a vector that terminates in the Z=1 plane.) ^ Y | ins | | /| | / | | / | | / o | |/ 7.50 | x---------------> X \ | Z ins \ | ins \ | \ | \| |-- 1.0 --|
Instrument Kernel
continues
22
N IF
Sample IK Data
Navigation and Ancillary Information Facility
Instrument Kernel
23
N IF
The angular separation between the boundary corner vector and the boresight is the angular size.
FORTRAN EXAMPLE C Retrieve FOV parameters. CALL GETFOV(-11111, 1, SHAPE, FRAME, BSGHT, N, BNDS) Compute the angular size. ANGSIZ = VSEP( BSGHT, BNDS(1,1) ) C EXAMPLE /* /* Define the string length parameter. */ #define STRSIZ 80 Retrieve the field of view parameters. */ getfov_c(-11111, 1, STRSIZ, STRSIZ, shape, frame, bsght, &n, bnds); Compute the angular separation. */ angsiz = vsep_c( bsght, &(bnds[0][0]));
/*
Instrument Kernel
24
N IF
The angular sizes are the angular separations between the boresight and the boundary vectors.
FORTRAN EXAMPLE C Retrieve the FOV parameters from the kernel pool. CALL GETFOV(-22222, 2, SHAPE, FRAME, BSGHT, N, BNDS) Compute the angular separations. ANG1 = VSEP( BSGHT, BNDS(1,1) ) ANG2 = VSEP( BSGHT, BNDS(1,2) ) The angle along the semi-major axis is the larger of the two separations computed. LRGANG = MAX( ANG1, ANG2) SMLANG = MIN( ANG1, ANG2)
C C
Instrument Kernel
25
N IF
/*
Define the string length parameter. */ #define STRSIZ 80 Retrieve the FOV parameters from the kernel pool. */ getfov_c(-22222, 2, STRSIZ, STRSIZ, shape, frame, bsght, &n, bnds); Compute the angular separations. */ ang1 = vsep_c( bsght, &(bnds[0][0])); ang2 = vsep_c( bsght, &(bnds[1][0])); The angle along the semi-major axis is the larger of the two separations computed. */ if ( ang1 > ang2 ) { lrgang = ang1; smlang = ang2; } else { lrgang = ang2; smlang = ang1; }
/*
/*
/*
Instrument Kernel
26
N IF
The angular extents of the FOV are computed by calculating the angle between the bisector of adjacent unit boundary vectors and the boresight.
Bisectors
sml_ang lrg_ang
(0,0,0) Instrument
Instrument Kernel
27
N IF
C
Retrieve FOV parameters from the kernel pool. CALL GETFOV(-33333, 4, SHAPE, FRAME, BSGHT, N, BNDS) Normalize the 3 boundary vectors CALL UNORM(BNDS(1,1), UNTBND(1,1), MAG) CALL UNORM(BNDS(1,2), UNTBND(1,2), MAG) CALL UNORM(BNDS(1,3), UNTBND(1,3), MAG) Compute the averages. CALL VADD(UNTBND(1,1), UNTBND(1,2), VEC1) CALL VSCL(0.5, VEC1, VEC1) CALL VADD(UNTBND(1,2), UNTBND(1,3), VEC2) CALL VSCL(0.5, VEC2, VEC2)
Compute the angular separations ANG1 = VSEP( BSGHT, VEC1 ) ANG2 = VSEP( BSGHT, VEC2 ) Separate the larger and smaller angles. LRGANG = MAX( ANG1, ANG2) SMLANG = MIN( ANG1, ANG2)
Instrument Kernel
28
N IF
/* /*
Define the string length parameter. */ #define STRSIZ 80 Retrieve the FOV parameters from the kernel pool. */ getfov_c(-33333, 4, STRSIZ, STRSIZ, shape, frame, bsght, &n, bnds); Normalize the 3 boundary vectors. */ unorm_c(&(bnds[0][0]), &(untbnd[0][0]), &mag); unorm_c(&(bnds[1][0]), &(untbnd[1][0]), &mag); unorm_c(&(bnds[2][0]), &(untbnd[2][0]), &mag); Compute the averages */ vadd_c(&(untbnd[0][0]), &(untbnd[1][0]), vec1); vscl_c(0.5, vec1, vec1); vadd_c(&(untbnd[1][0]), &(untbnd[2][0]), vec2); vscl_c(0.5, vec2, vec2); Compute the angular separations. */ ang1 = vsep_c( bsght, vec1); ang2 = vsep_c( bsght, vec2); Separate the larger and smaller angles. */ if ( ang1 > ang2 ) { lrgang = ang1; smlang = ang2; } else { lrgang = ang2; smlang = ang1; } 29
/*
/*
/*
/*
Instrument Kernel
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
It may be useful for the student to examine a few existing Frames Kernels and Instrument Kernels to get a better understanding of the FK and IK tutorial information. NAIF suggests you use your browser to examine some of the following real life kernels. (You may use http in place of ftp.) DEEP IMPACT:
ftp://naif.jpl.nasa.gov/pub/naif/pds/data/di-c-spice-6-v1.0/disp_1000/data/fk/*.tf ftp://naif.jpl.nasa.gov/pub/naif/pds/data/di-c-spice-6-v1.0/disp_1000/data/ik/*.ti
CASSINI:
ftp://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/*.tf ftp://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/*.ti
MESSENGER:
ftp://naif.jpl.nasa.gov/pub/naif/pds/data/mess-e_v_h-spice-6-v1.0/messsp_1000/data/fk/*.tf ftp://naif.jpl.nasa.gov/pub/naif/pds/data/mess-e_v_h-spice-6-v1.0/messsp_1000/data/ik/*.ti
MARS EXPRESS:
ftp://naif.jpl.nasa.gov/pub/naif/MEX/kernels/fk/*.TF ftp://naif.jpl.nasa.gov/pub/naif/MEX/kernels/ik/*.TI
Reading FKs and IKs
N IF
Navigation and Ancillary Information Facility
Derived Quantities
July 2013
N IF
Examples are:
Lighting conditions Surface intercept (LAT/LON) General geometry Coordinate system conversions Matrix and vector operations
The SPICE Toolkit contains many routines that assist with the computations of derived quantities.
Some are fairly low level, some are quite high level. More are being added as time permits.
Derived Quantities
N IF
Geometric Objects
Planes Ellipses Ellipsoids Rays
A Quick Tour
Navigation and Ancillary Information Facility
Vector/Matrix Routines
Coordinate Systems
Spherical: latitude/longitude, co-latitude/longitude, right ascension/declination; Geodetic, Cylindrical, Rectangular, Planetographic
The lists on the following pages are just a subset of whats available in the Toolkit.
N IF
Function
Vectors
Navigation and Ancillary Information Facility
Routine
VDOT, DVDOT VCROSS, DVCRSS VHAT, DVHAT UCROSS, DUCRSS VADD, VADDG VSUB, VSUBG VSCL, [VLCOM, [VLCOM3]] VSEP VNORM
<v,w> vxw v/|v| v x w / | v x w| v+w v-w av [+ bw [+ cu]] angle between v and w |v|
v v v
||
VPROJ,
VPERP
TWOVEC,
FRAME
w
Derived Quantities
N IF
Function
Mxv MxM Mt x v Mt x M M x Mt vt x M x v Mt M-1
M V X T
Derived Quantities
Matrices
Navigation and Ancillary Information Facility
Routine
MXV MXM MTXV MTXM MXMT VTMV XPOSE INVERSE, INVSTM
= = = = Matrix Vector Multiplication Transpose
5
N IF
Matrix Conversions
Navigation and Ancillary Information Facility
Function
Transform between Euler angles
ax ay az bx by bz cx cy cz
Routines
EUL2M, M2EUL
3x3 rotation matrix
ax ay az bx by bz cx cy cz x y z x y z x y z
0
ax ay az bx by bz cx cy cz
Transform between Euler angles and Euler angle rates or rotation matrix and angular velocity vector
Transform between
(Q0,Q1,Q2,Q3)
SPICE Style Quaternion
Derived Quantities
Transform between
Q2M, M2Q
6
N IF
Function
Ellipsoids
Geometry
Navigation and Ancillary Information Facility
Routine
NEARPT, SUBPNT, DNEARP SURFPT, SINCPT SURFNM EDLIMB INELPL NPEDLN
nearest point surface ray intercept surface normal limb slice with a plane altitude of ray w.r.t. to ellipsoid
Planes
intersect ray and plane INRYPL PJELPL SAELGV
Ellipses
project onto a plane find semi-axes of an ellipse
Derived Quantities
N IF
Coordinate Transformation
Latitudinal to/from Rectangular Planetographic to/from Rectangular R.A. Dec to/from Rectangular Geodetic to/from Rectangular Cylindrical to/from Rectangular Spherical to/from Rectangular
Routine
LATREC RECLAT PGRREC RECPGR RADREC RECRAD GEOREC RECGEO CYLREC RECCYL SPHREC RECSPH
Derived Quantities
N IF
Coordinate Transformation
Latitudinal to/from Rectangular Planetographic to/from Rectangular R.A. Dec to/from Rectangular Geodetic to/from Rectangular Cylindrical to/from Rectangular Spherical to/from Rectangular
Jacobian matrices for the R.A and Dec to/from rectangular mappings are identical to those for the latitudinal to/ from rectangular mappings
Derived Quantities
N IF
Example: transform velocities from rectangular to spherical coordinates using the SPICE Jacobian matrix routines. The SPICE calls that implement this computation are:
CALL SPKEZR ( TARG, ET, REF, CORR, OBS, STATE, LT ) CALL DSPHDR ( STATE(1), STATE(2), STATE(3), JACOBI ) CALL MXV ( JACOBI, STATE(4), SPHVEL )
After these calls, the vector SPHVEL contains the velocity in spherical coordinates: specifically, the derivatives
( d (r) / dt, d (colatitude) / dt, d (longitude) /dt )
Caution: coordinate transformations often have singularities, so derivatives may not exist everywhere.
Exceptions are described in the headers of the SPICE Jacobian matrix routines. SPICE Jacobian matrix routines signal errors if asked to perform an invalid computation.
Derived Quantities
10
N IF
Subsolar point
SUBSLR*
Subobserver point
SUBPNT*
Derived Quantities
* These routines supercede the now deprecated routines ILLUM, SUBSOL, SUBPT and SRFXPT
11
N IF
Most SPICE routines are used to determine a quantity at a specified time. The SPICE Geometry Finder (GF) subsystem takes the opposite approach: find times, or time spans, when a specified geometric condition or event occurs.
This is such a large topic that a separate tutorial (geometry_finder) has been written for it.
Derived Quantities
12
N IF
Examples
Navigation and Ancillary Information Facility
On the next several pages we present examples of using some of the derived quantity APIs.
Derived Quantities
13
N IF
Given the direction of an instrument boresight in a bodyfixed frame, return the illumination angles (incidence, phase, emission) at the surface intercept on a tri-axial ellipsoid
Derived Quantities
14
N IF
CALL SINCPT to find intersection of boresight direction vector with surface CALL ILUMIN to determine illumination angles
Derived Quantities
15
N IF
Determine the intersection of the apparent line of sight vector between Earth and Cassini with Saturns ring plane and determine the distance of this point from the center of Saturn.
Derived Quantities
16
N IF
This computation is for the reception case; radiation is received at the earth at a given epoch ET.
This simplified computation CALL SPKEZR to get light time corrected position of center of Saturn ignores the difference at time ET as seen from earth in J2000 frame SATCTR. between the light time from Saturn to the earth and the CALL PXFORM to get rotation from Saturn body-fixed coordinates to light time from the ring J2000 at light time corrected epoch. The third column of this matrix intercept point to the earth. gives the pole direction of Saturn in the J2000 frame SATPOL. The position and orientation of Saturn can be re-computed using the light time from earth to the intercept; the intercept can be re-computed until convergence is attained.
Derived Quantities
CALL SPKEZR to get light time corrected position of spacecraft as seen from earth at time ET in J2000 reference frame SCVEC.
CALL NVP2PL and use SATCTR and SATPOL to construct the ring plane RPLANE. CALL INRYPL to intersect the earth-spacecraft vector SCVEC with the Saturn ring plane RPLANE to produce the intercept point X. CALL VSUB to get the position of the intercept with respect to Saturn XSAT (subtract SATCTR from X) and use VNORM to get the distance of XSAT from the center of Saturn.
17
N IF
Create a dynamic frame with one axis pointing from earth to the light time corrected position of the Cassini orbiter. Use the CN correction for this position vector. (This gives us a frame in which the direction vector of interest is constant.) Temporarily change the radii of Saturn to make the polar axis length 1 cm and the equatorial radii 1.e6 km. This can be done either by editing the PCK or by calling BODVCD to fetch the original radii, then calling PDPOOL to set the kernel pool variable containing the radii to the new values. This flat ellipsoid will be used to represent the ring plane. Use SINCPT to find the intercept of the earth-Cassini ray with the flat ellipsoid. Use the CN correction. SINCPT returns both the intercept in the IAU_SATURN frame and the earth-intercept vector. Use VNORM to get the distance of the intercept from Saturns center. Restore the original radii of Saturn. If PDPOOL was used to update the radii in the kernel pool, use PDPOOL again to restore the radii fetched by BODVCD.
Derived Quantities
An alternate approach
18
N IF
Determine when the spacecraft will be occulted by an object (such as a natural satellite) as seen from an observer (such as earth).
Spacecraft motion
Derived Quantities
19
N IF
Spacecraft motion
CALL GFOCLT to find occultations, if any. The time intervals, within the confinement window, over which occultations occur will be returned in a SPICE window.
GFOCLT can treat targets as ellipsoids or points (but at least one must be an ellipsoid). GFOCLT can search for different occultation or transit geometries: full, partial, annular, or any.
Derived Quantities
20
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
Overview Language-specific status File Operations String Manipulation Searching, Sorting and Other Array Manipulations Windows Symbol Tables Sets and Cells Constants and Unit Conversion Numerical Functions
N IF
Overview
Navigation and Ancillary Information Facility
The routines described in this tutorial originated in the Fortran version of the the SPICE Toolkit. Many, but not all, of these routines have implementations in the C, IDL, and MATLAB Toolkits. The descriptions include a language identifier or set of identifiers prefixed to the routines name to indicate which Toolkit language(s) include that routine.
[F] available in Fortran (SPICELIB) [C] available in C (CSPICE) [I] available in IDL (Icy) [M] available in MATLAB (Mice)
NAIF adds interfaces to the CSPICE, Icy, and Mice Toolkits as needed or when requested by a customer. CSPICE, Icy, and Mice do not need all of the functionality implemented in the Fortran Toolkit.
Other Useful Functions
N IF
Text files provide a simple, human readable mechanism for sharing data. The Toolkit contains several utility routines to assist with the creation and parsing of text, and with the reading and writing of text files.
[F,C] RDTEXT: read a line of text from a text file [F] TOSTDO: write a line of text to standard output [F,C] PROMPT: display a prompt, wait for and return users response [F] TXTOPN: open a new text file returning a logical unit [F] WRITLN: write a line of text to the file attached to a logical unit.
4
N IF
CALL PROMPT ( Filename? , NAME ) CALL TOSTDO ( You specified the file: // NAME ) Now that we have the filename, read and process its contents CALL RDTEXT ( NAME, LINE, EOF ) DO WHILE ( .NOT. EOF ) process the line just read CALL RDTEXT ( NAME, LINE, EOF ) END DO
Terminal Window
N IF
File Operations
Navigation and Ancillary Information Facility
N IF
N IF
Locating substrings
[F] LTRIM, RTRIM: return the location of the leftmost or rightmost non-blank character. [F,C] POS, CPOS, POSR, CPOSR, NCPOS, NCPOSR: locate substring or member of specified character set searching forward or backward.
Pattern matching
[F,C,I] MATCHI: matches a string against a wildcard template, case insensitive. [F,C,I] MATCHW: matches a string against a wildcard template, case sensitive.
N IF
lparsm
Split on a comma!
Remove
extra
spaces
cmprss
Green eggs and ham the cat in the hat how the grinch stole Christmas
matchi( *g*)
N IF
[F,C] REPMOT: Replace a marker with the text representation of an ordinal number.
CALL REPMOT ( It was the # term., '#, L, 2, OUT )
10
N IF
Numeric Formatting
[F] DPFMT: Using a format template, create a formatted string that represents a double precision number
CALL DPFMT ( PI(), 'xxx.yyyy', OUT ) OUT becomes 3.1416
11
N IF
Time formatting
[F,C,I,M] TPICTR: Given a sample time string, create a time format picture suitable for use by the routine TIMOUT. [F,C,I,M] TIMOUT: Converts an input epoch to a character string formatted to the specifications of a user's format picture.
Changing case
[F,C,I] UCASE: Convert all characters in string to uppercase. [F,C,I] LCASE: Convert all characters in string to lowercase.
Building strings
[F] SUFFIX: add a suffix to a string [F] PREFIX: add a prefix to a string
12
N IF
Sorting arrays
[F,C] SHELLC, SHELLI, SHELLD, ORDERI, ORDERC, ORDERD, REORDC, REORDI, REORDD, REORDL
13
N IF
Body A.U.1
Sorted Body
A.U.1
sun mercury venus earth mars jupiter saturn uranus neptune pluto
00.0 00.455 00.720 00.983 01.531 05.440 09.107 20.74 30.091 31.052
orderc
04 06 05 02 09 10 07 01 08 03
reordc,d
earth jupiter mars mercury neptune pluto saturn sun uranus venus
00.983 05.440 01.531 00.445 30.091 31.052 09.107 00.000 20.74 00.720
N IF
Windows
Navigation and Ancillary Information Facility
The Toolkit contains a family of routines for creating windows and performing set arithmetic on them. SPICE windows are frequently used to specify intervals of time when some set of user constraints are satisfied.
Let window NotBehind contain intervals of time when Cassini is not behind Saturn as seen from earth. Let window Goldstone contain intervals of time when Cassini is above the Goldstone horizon. Cassini can be tracked from Goldstone during the intersection of these two windows (Track = NotBehind * Goldstone).
15
N IF
Union
Windows Math
Navigation and Ancillary Information Facility
Intersection
Difference
16
N IF
Symbol Tables
Navigation and Ancillary Information Facility
SPICELIB (Fortran) supports the use of associative arrays/ hashes through the use of an abstract data type called symbol tables.
These are used to associate a set of names with collections of associated values. Values associated with a name are exclusively character, exclusively integer or exclusively double precision. Routines to manipulate a symbol table have the form SY***<T> where <T> is the data type of the values (C, D, or I).
Operations include:
Insert a symbol Remove a symbol Push/Pop a value onto the list of values associated with a symbol Fetch/Sort values associated with a symbol
17
N IF
Cells are arrays that know how many addresses are available for use and how many are currently used.
Routines that use cells typically have simpler interfaces than routines that use arrays. See cells.req for more information.
Sets are cells that contain no duplicate elements and whose elements are ordered in ascending order.
Two Sets can be: intersected, unioned, differenced, differenced symmetrically (union - intersection) See sets.req for more information.
18
N IF
NAIF Boris Chuck Ed Nat Lee Cassini Boris Chuck Ed Nat
MGS Boris Ed
Other Lee
CALL UNIONC ( CASSINI, MGS, PROJECTS) CALL DIFFC ( NAIF, PROJECTS, OTHER )
19
N IF
System Constants
[F,C,I,M] DPMIN, DPMAX, INTMIN, INTMAX
Numeric Constants
[F,C,I,M] PI, HALFPI, TWOPI, RPD (radians/degree), DPR(degrees/ radian)
Physical Constants
[F,C,I,M] CLIGHT, SPD, TYEAR, JYEAR
Epochs
[F,C,I,M] J2000,J1950, J1900, J2100, B1900, B1950
20
N IF
Several routines are provided to assist with numeric computations and comparisons. Functions
[F] DCBRT: cube root Hyperbolic Functions: [F] DACOSH, DATANH Polynomial Interpolation and Evaluation: [F] LGRESP, LGRINT, LGRIND, POLYDS, HRMESP, HRMINT Chebyshev Polynomial Evaluation: [F] CHBDER, CHBVAL, CHBINT
21
N IF
Numerical Decisions
Same or opposite sign (Boolean): [F] SMSGND, SMSGNI, OPSGND, OPSGNI Force a value into a range (bracket): [F,C] BRCKTD, BRCKTI Determine parity of integers (Boolean): [F] ODD, EVEN Truncate conditionally: [F] EXACT
Arithmetic
Greatest common divisor: [F] GCD Positive remainder: [F] RMAINI, RMAIND
22
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
GF Subsystem Overview SPICE Windows GF Search Examples Geometric Search Types and Constraints More Details
Root finding, including step size Workspace
An Example
N IF
Navigation and Ancillary Information Facility
GF Subsystem Overview
N IF
Purpose
Navigation and Ancillary Information Facility
Much SPICE software computes a geometry parameter at a given time, t, i.e. x = f(t).
Example: on 2011 MAR 30 14:57:08, what is the spacecrafts altitude above Mars?
50 100 150
N IF
Some Examples
Navigation and Ancillary Information Facility
The SPICE Geometry Finder (GF) subsystem finds times when specified geometric events occur.
A geometric event is an occurrence of a given geometric quantity satisfying a specified condition. For example: Mars Express distance from Mars is at a local minimum (periapse) Elevation of the Cassini orbiter is above a given threshold angle as seen from DSS-14 Titan is completely occulted by Saturn The Mars Reconnaissance Orbiter is in the penumbral shadow of Mars The Saturn phase angle as seen by the Cassini orbiter is 60 degrees Each GF search is conducted over a user-specified time window. A time window is a union of time intervals. The result of a GF search is the time window over which the specified condition is met.
N IF
Types of GF APIs
Navigation and Ancillary Information Facility
N IF
The current GF subsystem allows one to search for events involving the geometric quantities listed below
(B) = Boolean Observer-target distance (N) Phase angle (N) Illumination angles (N) Occultations or transits (B) Ray containment in an instruments field of view (B) Target body appears in an instruments field of view (B) (N) =Numeric Observer-target range rate (N) Target body angular separation (N) Ray-body surface intercept coordinates (N) Position vector coordinates (N) Sub-observer point coordinates (N) User-defined Boolean quantity (B) User-defined scalar quantity (N)
N IF
The GF subsystem provides the following high-level API routines; these search for events involving the respective geometric quantities listed below
GFDIST: observer-target distance GFILUM: illumination angles GFOCLT: occultations or transits GFPA: phase angle GFPOSC: position vector coordinates GFRFOV: ray is contained in an instruments field of view GFRR: observer-target range rate GFSEP: target body angular separation GFSNTC: ray-body surface intercept coordinates GFSUBC: sub-observer point coordinates GFTFOV: target body appears in an instruments field of view GFUDB: user-defined Boolean quantity GFUDS: user-defined scalar quantity (Fortran and C only)
N IF
The current Fortran and C SPICE Toolkits provide some mid-level API routines that provide additional capabilities:
Progress reporting, which can be customized by the user Interrupt handling which can be customized by the user
In Fortran, no default interrupt detection is available
User-customizable search step and refinement routines User-adjustable root finding convergence tolerance
N IF
10
N IF
Time
11
N IF
N IF
N IF
The result window from one search can be used as the confinement window for another.
This is often a convenient and efficient way of performing searches for times when multiple constraints are met. This technique can be used to accelerate searches in cases where a fast search can be performed to produce a small confinement window for a second, slower search. See the next chart and the example program CASCADE in the Geometry Finder Required Reading document.
14
N IF
Example: accelerate a solar occultation search. First search for times when the angular separation of the figures of the Sun and Moon, as seen from DSS-14, is less than 3 degrees. Use the result window of the angular separation search as the confinement window of an occultation search. Because the angular separation search is much faster than the occultation search (on the original confinement window), the total search time is greatly reduced.
15
N IF
16
N IF
Given an initial confinement window, restrict that window to times when required CK and SPK data are available. Use CKCOV and SPKCOV to find CK and SPK availability windows. Contract CK window slightly to avoid round-off problems. Contract SPK window by a few seconds if discrete differentiation is used by search algorithms (e.g. for acceleration or for is function decreasing? tests).
Original confinement window A Reconstructed pointing availability window B Spacecraft ephemeris availability window C Data availability window A1 = B intersect C Confinement window A2 = A intersect A1
17
N IF
GF Documentation
Navigation and Ancillary Information Facility
The GF module headers contain complete example programs for each GF API routine The GF Required Reading document (gf.req) contains lots of details Documentation on SPICE windows:
The WINDOWS Required Reading windows.req The Other Functions tutorial API documentation for SPICE window routines
18
N IF
Navigation and Ancillary Information Facility
GF Search Examples
19
N IF
MEX
20
N IF
Find the time period when the Mars Reconnaissance Orbiter (MRO) is within 500km of the Opportunity rover. MRO
Opportunity
.. .
Mars
21
N IF
Find the times when the range rate of a lunar reflector, as seen by an Earth station, attains an absolute extremum.
Reflector
Station Moon
Earth
Geometry Finder Subsystem
22
N IF
Find the time period when the angular separation of the Mars-to Mars Reconnaissance Orbiter (MRO) and Mars-to-Opportunity Rover position vectors is less than 3 degrees. Both targets are modeled as points. Mars
.. .
Rover location
MRO
23
N IF
Find the time period when the angular separation of the figures of the Moon and Sun, as seen from the Earth, is less than 1 degree. Both targets are modeled as spheres. Sun
Moon
Earth
24
N IF
Occultation/Transit Search
Navigation and Ancillary Information Facility
Find the ingress and egress times of an occultation of Phobos by Mars, as seen from Earth. Both targets are modeled as triaxial ellipsoids. Point target in occultation Phobos in partial transit Point target in transit Earth
Mars
25
N IF
Find the time period when Titan appears in the FOV of the Cassini ISS Narrow Angle Camera (NAC). The target is an ephemeris object; the target shape is modeled as an ellipsoid. (Point targets are also supported.)
Cassini orbiter
26
N IF
Find the time period when the star having Hipparcos catalog number 6000 appears in the FOV of the Cassini ISS Narrow Angle Camera (NAC). The target direction is modeled as a ray, optionally corrected for stellar aberration.
Cassini orbiter
27
N IF
Find the time(s) at which the planetocentric latitude of the Earth-Sun vector, expressed in the J2000 frame, is at a local maximum.
J2000 X
28
N IF
Find the time(s) at which the Z component of the Earth-Sun vector, expressed in the J2000 frame, is 0.
J2000 Z
J2000 Y
J2000 X
29
N IF
Find the time period when the elevation of the DSS-13 to Mars Reconnaissance Orbiter (MRO) spacecraft vector, expressed in the DSS-13 topocentric frame, is greater than 6 degrees.
DSS-13_TOPO Z
DSS-13_TOPO X
Direction to MRO
30
N IF
Find the time period when the Lunar Reconnaissance Orbiters (LRO) off-nadir angle exceeds 5 degrees. Solution requires CKbased LRO spacecraft frame. LRO s/c frame +X axis LRO
LRO s/c frame +Y axis Moon Colatitude of LRO-Moon position vector in LRO s/c frame
31
N IF
Find the time at which the planetocentric latitude of the sub-spacecraft point, using the near point definition, is 25 degrees.
Body-fixed Z Outward surface normal direction at sub-spacecraft point
Spacecraft
Body-fixed Y
Body-fixed X
Geometry Finder Subsystem
32
N IF
Find the time at which the planetographic longitude of a given camera boresight surface intercept is -45 degrees.
Body-fixed Z
Spacecraft
Body-fixed X
Geometry Finder Subsystem
N IF
Find the time period when the planetographic longitude of a given camera boresight surface intercept is between -70 and -45 degrees, and the intercept latitude is between 0 and 30 degrees. The solution requires four (cascading) inequality searches.
Body-fixed Z
Spacecraft
Body-fixed X
Geometry Finder Subsystem
N IF
Find the time at which the ring plane intercept of the Cassini to DSS-13 vector, corrected for transmission light time (stellar aberration correction is unnecessary), has radius 300000km. The solution requires a dynamic frame for which one axis points along the radiation path. IAU_SATURN Z IAU_SATURN X Cassini to DSS-13 radiation direction IAU_SATURN Y Path of radiation intercept (in red)
DSS-13
Geometry Finder Subsystem
Cassini orbiter
Earth
Ring plane ellipsoid: 1cm thick, radius 600000 km, centered at Saturns center
35
N IF
Find the time period when the angular separation of the geometric and apparent positions of Titan as seen from the Cassini orbiter attains an absolute maximum. Apparent position of Titan (computed using LT+S correction)
Cassini orbiter
36
N IF
Navigation and Ancillary Information Facility
37
N IF
38
N IF
Binary state searches find times when a specified binary state function takes the value true.
SPICE window arithmetic can be used to find the times when a binary state function is false.
39
N IF
Numeric Searches
Navigation and Ancillary Information Facility
Numeric searches find times when a scalar numeric quantity satisfies a mathematical constraint. The supported constraints are:
The function equals a specified reference value. is less than a specified reference value. is greater than a specified reference value. is at a local maximum. is at a local minimum. is at an absolute maximum. is at an absolute minimum. is at an adjusted absolute maximum: the function is within a given tolerance of the absolute maximum. is at an adjusted absolute minimum: the function is within a given tolerance of the absolute minimum.
40
N IF
RELATE ADJUST REFVAL = = = =! 0.D0! D0!
Find time window during which Distance = D0 GF API input arguments defining constraint:
Confinement Window
[ D = f(t)
Distance
D0
Result Window
[t0, t0] Time[t1, t1] Time [t2, t2] [t3, t3]
41
N IF
RELATE ADJUST REFVAL = = = <!
Find time window during which Distance < D0 GF API input arguments defining constraint:
0.D0! D0!
Confinement Window
[ D = f(t)
Distance
D0
Result Window
[t0, Time t1] Time [t2, t3 ]
42
N IF
RELATE ADJUST REFVAL = = =
Find time window during which Distance > D0 GF API input arguments defining constraint:
>! 0.D0 ! D0!
Confinement Window
[ D = f(t)
Distance
D0
Result Window
[t0, t1 ] Time [t2, Time t3 ] [t4,t5]
43
N IF
Find time window during which Distance is a local minimum. GF API input arguments defining constraint:
RELATE = LOCMIN! ADJUST = 0.D0 ! REFVAL = 0.D0
(REFVAL is not used in this case but should be initialized for portability)
Confinement Window
Distance
D = f(t)
[t0,t0] Time
Geometry Finder Subsystem
[t1,t1]
Result Window
44
N IF
Find time window during which Distance is a local maximum. GF API input arguments defining constraint:
RELATE = LOCMAX! ADJUST = 0.D0 ! REFVAL = 0.D0
(REFVAL is not used in this case but should be initialized for portability)
Confinement Window
Not Solutions
Distance
D = f(t)
Local extrema are always in the interior of the confinement window, never on the boundary
[t0,t0] Time
Geometry Finder Subsystem
Result Window
45
N IF
Find the time at which Distance is an absolute minimum. GF API input arguments defining constraint:
RELATE = ABSMIN! ADJUST = 0.D0! REFVAL = 0.D0!
(REFVAL is not used in this case but should be initialized for portability)
Confinement Window
Distance
D = f(t)
DMIN
[t0,t0] Time
Geometry Finder Subsystem
Result Window
46
N IF
Find the time at which Distance is an absolute maximum. GF API input arguments defining constraint:
RELATE = ABSMAX! ADJUST = 0.D0! REFVAL = 0.D0!
(REFVAL is not used in this case but should be initialized for portability)
Distance
D = f(t)
[t0,t0] Time
Geometry Finder Subsystem
Result Window
47
N IF
Find time window during which Distance < DADJ = DMIN + ADJ0 GF API input arguments defining constraint:
RELATE = ABSMIN ADJUST = ADJ0 REFVAL = 0.D0 (ADJ0 > 0)
(REFVAL is not used in this case but should be initialized for portability)
Confinement Window
[ D = f(t)
Distance
Result Window
[ t0, t1 Time ] [ t 2 , t3 ]
48
N IF
Find time window during which Distance > DADJ = DMAX - ADJ0 GF API input arguments defining constraint:
RELATE = ABSMAX ADJUST = ADJ0 REFVAL = 0.D0 (ADJ0 > 0)
(REFVAL is not used in this case but should be initialized for portability)
[
ADJ0
Distance
D = f(t)
t0, t1 ] Time
[ t2, t3 ]
Result Window
49
N IF
Navigation and Ancillary Information Facility
More Details
Root Finding, including step size selection Workspace API Example: GFDIST
50
N IF
Navigation and Ancillary Information Facility
Root Finding
51
N IF
Root Finding
Navigation and Ancillary Information Facility
To produce a final or intermediate result window, the GF subsystem must accurately locate the endpoints of the windows intervals. These endpoints are called roots.
The green regions below (rectangles and vertical line segment) represent intervals of a window. Roots are indicated by the red, vertical arrows.
Elsewhere, root finding often refers to solving f(x) = 0. In the GF setting, roots are boundaries of time intervals over which a specified constraint is met.
Roots can be times when a binary state function changes values.
Most popular root finding methods, e.g. Newton, secant, bisection, require the user to first bracket a root: that is, determine two abscissa values such that a single root is located between those values. The GF subsystem solves a more difficult problem: it performs a global search for roots. That is, given correct inputs, it finds all roots within a user-specified confinement window.
The user is not asked to bracket the roots.
Geometry Finder Subsystem
52
N IF
The GF subsystem asks the user to specify a time step (often called thestep size) that will be used to bracket roots.
For binary state searches, the step size is used to bracket the endpoints of the intervals of the result window. The step size must be shorter than any event of interest, and shorter than any interval between events that are to be distinguished. For numeric searches, the step size is used to bracket the endpoints of the intervals of the window on which the geometric quantity is monotonically decreasing. The step size must be shorter than any interval on which the function is monotonically increasing or decreasing. In both cases, the step size must be large enough so the search completes in a reasonable amount of time.
Geometry Finder Subsystem
53
N IF
Note that:
Monotone Windows -1
Navigation and Ancillary Information Facility
[ ]
] [
[ ]
[ [
] D = f(t)
Distance
D0
Time
Geometry Finder Subsystem
54
N IF
Monotone Windows-2
Navigation and Ancillary Information Facility
The shortest interval on which the function is monotonically increasing or decreasing may be LONGER than the event of interest. For example, consider the search for times when D < D0. The result window consists of the interval [t0, t1] shown below.
f(t) Increasing Window f(t) Decreasing Window Confinement Window
[ ]
[ [
] D = f(t)
Distance
D0
[ t0, t1 ] Time
Geometry Finder Subsystem
55
N IF
In the diagram below, the green boxes denote intervals of a window. The start of the first interval is bracketed by the first and second times; the end of the first interval is bracketed by the third and fourth times. The start of the second interval is bracketed by the fourth and fifth times.
window interval 1 step size delta window interval 2
t7
step = 3*delta
t1
t2
t3
t4
t5
t6
step = 2*delta
56
N IF
window interval 2
t1
t2
t3
t4
t5
t6
t7
Once an interval endpoint is bracketed, the GF subsystem performs a refinement search to locate the endpoint precisely (shown by the red arrows).
The default tolerance for convergence is 1.e-6 second.
The refinement search is usually relatively fast compared to the interval bracketing search.
57
N IF
For binary state searches, the window whose endpoints are found IS the result window.
The search is done once the endpoint refinement step has been completed for each interval over which the state is true.
For numeric searches, once the monotone windows have been found, the result window still must be computed:
Local and absolute extrema can be found without further searching. Equalities, inequalities, and adjusted absolute extrema require a second search pass in which each monotone interval is examined. These searches dont require sequential stepping and are
usually relatively fast compared to the interval bracketing search.
Since the roots are found by a search process, they are subject to approximation errors.
NOTE: The geometric condition may not be satisfied at or near the endpoints of the result windows intervals.
Usually data errors are large enough so that the accuracy of the result is poorer than its precision.
Geometry Finder Subsystem
58
N IF
Navigation and Ancillary Information Facility
Workspace
59
N IF
GF numeric scalar searches can require relatively large amounts of memory to store intermediate results.
For Fortran Toolkits, user applications must declare a buffer of workspace windows. For C, IDL, and MATLAB Toolkits, users need only specify the maximum number of workspace window intervals that are needed; these Toolkits will dynamically allocate the amount of memory required by the specified workspace window interval count.
In most cases, users need not accurately compute the required amount of workspace; its usually safe to specify a number much larger than the amount actually needed.
For example, if the result window is anticipated to contain 100 intervals, specifying a workspace window interval count of 10000 will very likely succeed. See the GF Required Reading and the API documentation for details.
Geometry Finder Subsystem
60
N IF
Navigation and Ancillary Information Facility
61
N IF
GFDIST finds times when a specified constraint on the distance between two ephemeris objects is met.
The distance is the norm of a position vector The position vector is defined using a subset of the inputs accepted by SPKPOS: Target Observer Aberration Correction The constraint is a numeric relation: equality or inequality relative to a reference value, or attainment of a local or absolute extremum.
The search is conducted within a specified confinement window. The search produces a result window which indicates the time period, within the confinement window, over which the constraint is met.
Geometry Finder Subsystem
62
N IF
Language Differences
Navigation and Ancillary Information Facility
Due to use of SPICE windows, some of the GFDIST set-up code differs substantially across languages.
Well show how to perform the set-up unique to each language. Note: theres no set-up to do in the MATLAB case; hence theres no MATLAB-specific set-up slide. The rest of the code is sufficiently parallel across languages to justify showing only the Fortran code. Note however that the treatment of workspace differs across languages: only in Fortran does the user application have to pass the workspace array to the GF API routine.
63
N IF
Fortran constant and variable declarations
Fortran Set-up
Navigation and Ancillary Information Facility
Initialize confinement and result windows. Workspace need not be initialized here. CALL SSIZED ( MAXWIN, CNFINE ) CALL SSIZED ( MAXWIN, RESULT )
64
N IF
C constant and variable declarations
C Set-up
Navigation and Ancillary Information Facility
SPICEDOUBLE_CELL SPICEDOUBLE_CELL
These macro calls declare CSPICE window structures and set their maximum sizes.
65
N IF
IDL window creation
IDL Set-up
Navigation and Ancillary Information Facility
Choose a large value for window size (called MAXWIN here), if youre not sure what size is required. Actual requirement depends on underlying geometry, confinement window, and search step size. The window size must be twice the maximum number of intervals the window is meant to hold.
The output result window is created by CSPICE_GFDIST; it does not require a constructor call by the user application.
66
N IF
The next step is to insert times into the confinement window. The simplest confinement window consists of a single time interval.
Convert UTC start and stop times to ephemeris time (TDB), if needed:
67
N IF
Choose:
Geometric input arguments: Target Observer Aberration correction Constraint arguments: Relation Reference value, if applicable Adjustment value, if applicable Search step size
68
N IF
Search execution, continued
Note:
The result window may be empty. The constraint might not be satisfied at or near the endpoints of any interval of RESULT. Consider using the window contraction routine WNCOND to shrink the intervals of the result window slightly, so the constraint is met on the entire result window. Caution: DONT use WNCOND for minimum, maximum, or equality searches---the result window will disappear! (WNCOND is ok for adjusted absolute extrema search results, though, since the result intervals are not singletons.) Caution: using WNCOND may not be desirable if the window is an intermediate result: subsequent, derived results might be made less accurate.
Geometry Finder Subsystem
69
N IF
Arguments of GFDIST - 1
Navigation and Ancillary Information Facility
INPUTS TARGET* and OBSERVER*: Character names or NAIF IDs for the end point and origin of the position vector (Cartesian position and velocity vectors) whose length is the subject of the search. Below, well simply call this length the distance.
The position vector points from observer to target.
CORRECTION: Specification of what kind of aberration correction(s), if any, to apply in computing the distance.
Use LT+S to use the apparent position of the target as seen by the observer. LT+S invokes light time and stellar aberration corrections. Use NONE to use the uncorrected (aka geometric) position, as given by the source SPK file or files. See the headers of the subroutines GFDIST and SPKEZR, the document SPK Required Reading, or the Fundamental Concepts tutorial for details. See the Reading an SPK tutorial backup charts for examples of aberration correction magnitudes.
* Character names work for the target and observer inputs only if built into SPICE or if registered using the SPICE ID-body name mapping facility. Otherwise use the SPICE numeric ID in quotes, as a character string.
Geometry Finder Subsystem
70
N IF
INPUTS
Arguments of GFDIST - 2
Navigation and Ancillary Information Facility
STEP: search step size, expressed as TDB seconds. CNFINE: the confinement window over which the search will be performed. MW, NW, WORK: the maximum capacity of each workspace window, the number of workspace windows, and the workspace array.
OUTPUTS
RESULT: the window of times over which the distance constraint is satisfied.
Geometry Finder Subsystem
71
N IF
Navigation and Ancillary Information Facility
Exception Handling
July 2013
N IF
Topics
Navigation and Ancillary Information Facility
What Exceptions Are Language Dependencies C and Fortran Error Handling Features Error Messages Error Handling Actions Error Device Customize Error Handling Get Error Status Signal Errors Icy Error Handling Mice Error Handling Recommendations
Exception Handling
N IF
Exceptions Are - 1
Navigation and Ancillary Information Facility
Exception Handling
N IF
Exceptions Are - 2
Navigation and Ancillary Information Facility
Exception Handling
N IF
Language Dependencies
Navigation and Ancillary Information Facility
SPICELIB and CSPICE provide essentially identical error handling capabilities. Icy and Mice provide similar error handling functionality; this functionality is quite different from that of CSPICE.
These systems do rely on CSPICE for most error detection. Icy and Mice provide no API for customizing underlying CSPICE error handling behavior. Short, long, and traceback error messages are merged into a single, parsable, message. Use IDL or MATLAB features to customize error handling to prevent your program from stopping to capture SPICE error messages
Most of this tutorial deals with SPICELIB and CSPICE error handling.
There is a bit on Icy and Mice near the end.
Exception Handling
N IF
Exception Handling
N IF
Signal errors
Create descriptive messages when and where an error is detected Short message, long message, (explanation), traceback Signal the error: set error status, output messages By default, CSPICE error output goes to stdout (not stderr)
Inhibit tracing
To improve run-time performance (only for thoroughly debugged code)
Exception Handling
N IF
Short message
Error Messages
Navigation and Ancillary Information Facility
Long message
Up to 1840 characters. Can contain values supplied at run time. Example: 'The file <sat077.bsp> was not found.'
Traceback
Shows call tree above routine where error was signaled. Not dependent on system tracing capability. Dont need a crash to obtain a traceback.
Exception Handling
N IF
ABORT
Designed for safety. Output messages and traceback to your screen or stdout. Stop program; return status code if possible.
RETURN
For use in programs that must keep running. Attempts to return control to the calling application. Preserves error information so calling application can respond. Output messages to current error device. Set error status to true: FAILED() will return true. Set return status to true: RETURN() will return true. Most SPICE routines will return on entry. Very simple routines will generally execute anyway.
--continues--
Exception Handling
N IF
Capture traceback at point where error was signaled. Inhibit error message writing and error signaling. Must call RESET to resume normal error handling.
Exception Handling
10
N IF
Error Device
Navigation and Ancillary Information Facility
Limitations
In C, cannot send messages to stderr. In C, writing to a file opened by means other than calling errdev_c is possible only if CSPICE routines were used to open the file. These limitations may be removed in a later version of CSPICE.
Exception Handling
11
N IF
12
N IF
Disable tracing
Normally done to speed up execution by a few percent Benefit is highly dependent on application NAIF normally recommends users not turn tracing off Use TRCOFF: CALL TRCOFF or trcoff_c();
Do this at the beginning of your program. Once disabled you cannot re-enable tracing during a program run.
Exception Handling
13
N IF
Exception Handling
14
N IF
Exception Handling
15
N IF
Signal Errors - 1
Navigation and Ancillary Information Facility
Exception Handling
16
N IF
Signal error
Signal Errors - 2
Navigation and Ancillary Information Facility
Use SIGERR to signal error. Supply short error message as input to SIGERR. CALL SIGERR ( FILE OPEN FAILED ) sigerr_c ( FILE OPEN FAILED ); Signaling error causes SPICE error response to occur Output messages, if enabled Set error status Set return status, if error action is RETURN Inhibit further error signaling if in RETURN mode Stop program if in abort mode
17
N IF
Error action:
By default, a SPICE error signal stops execution of IDL scripts; a SPICE error message is displayed; control returns to the execution level (normally the command prompt). Icy sets the CSPICE shared object librarys error handling system to RETURN mode. No other modes are used. The CSPICE error state is reset after detecting an error. Use the IDL CATCH feature to respond to error condition.
Error status
Value of !error_state.name ICY_M_BAD_IDL_ARGS - indicates invalid argument list. ICY_M_SPICE_ERROR - indicates occurrence of a SPICE error.
Error message
CSPICE short, long, and traceback error messages are merged into a single, parsable, message. The merged error message is contained in the variable !error_state.msg. Example:
CSPICE_ET2UTC: SPICE(MISSINGTIMEINFO): [et2utc->ET2UTC->UNITIM] The following, needed to convert between the uniform time scales, could not be found in the kernel pool: DELTET/DELTA_T_A, DELTET/K, DELTET/EB, DELTET/M. Your program may have failed to load
Exception Handling
18
N IF
Error action:
By default, a SPICE error signal stops execution of MATLAB scripts; a SPICE error message is displayed; control returns to the execution level. Mice sets the CSPICE shared object librarys error handling system to RETURN mode. No other modes are used. The CSPICE error state is reset after detecting an error. Use the MATLAB try/catch construct to respond to error condition.
Error message
CSPICE short, long, and traceback error messages are merged into a single, parsable, message. Example:
??? SPICE(MISSINGTIMEINFO): [et2utc->ET2UTC->UNITIM] The following, needed to convert between the uniform time scales, could not be found in the kernel pool: DELTET/DELTA_T_A, DELTET/K, DELTET/EB, DELTET/M. Your program may have failed to load
Use the MATLAB function lasterror to retrieve SPICE error diagnostics. When a SPICE error occurs:
the message field of the structure returned by lasterror contains the SPICE error message. the stack field of this structure refers to the location in the m-file from which the Mice wrapper was called (and so is generally not useful). the identifier field of this structure currently is not set.
Exception Handling
19
N IF
Recommendations
Navigation and Ancillary Information Facility
Use SPICE error handling in your own code where appropriate. When reporting errors to NAIF, have SPICE error message output available Note whether error output is actually from SPICE routines, from non-SPICE code, or was generated at the system level.
Exception Handling
20
N IF
Navigation and Ancillary Information Facility
Toolkit Applications
July 2013
N IF
Toolkit Applications
Navigation and Ancillary Information Facility
Toolkit applications create or manipulate kernels, or perform other functions such as time conversion. Each of the following applications is included in the generic Toolkits. Time conversion tool: chronos SPK generation tool: mkspk SPK merge and subset tool: spkmerge SPK comparison tool: spkdiff CK generation tool: msopck Frame comparison tool: frmdiff Kernel summary tools: brief, ckbrief, spacit Comments manipulation tools: commnt, spacit File format converters: tobin, toxfr
Toolkit Applications
N IF
All of these apps are meant to be used as operating system shell executables
One generally cannot run these inside of IDL or MATLAB
Toolkit Applications
N IF
CHRONOS
Navigation and Ancillary Information Facility
chronos is an application that provides a flexible interface to the SPICE Toolkit time conversion capabilities. chronos supports time conversion between the following time systems/types and using the indicated time types for those systems.
Supported Time Systems -----------------------------Universal Coord. Time (UTC) Ephemeris Time (ET) S/C On-board Clock Time (SCLK) Local Solar Time (LST) --> Supported Time Types ----------------------------> SCET, ERT, ETT, LT --> SCET, ERT, ETT, SECONDS, LT --> SCLK, HEX, TICKS --> LST, LSUN
Toolkit Applications
N IF
Input System/Type ----------------UTC / SCET (*) UTC / ERT UTC / ETT ET / SCET (*) ET / ERT ET / ETT ET / SECONDS SCLK / SCLK (*) SCLK / HEX SCLK / TICKS LST / LST
Output System/Type ----------------UTC / SCET (*) UTC / ERT UTC / ETT UTC / LT ET / SCET (*) ET / ERT ET / ETT ET / SECONDS ET / LT SCLK / SCLK (*) SCLK / HEX SCLK / TICKS LST / LST (*) LST / LSUN
5
N IF
CHRONOS - Miscellaneous
Navigation and Ancillary Information Facility
chronos normally converts one input time per execution, but can run in batch mode to speed up conversion for multiple input times. OS shell alias capabilities can be used to define shortcuts for commonly used time conversions. chronos has an extensive User's Guide.
Toolkit Applications
N IF
CHRONOS - Usage
Navigation and Ancillary Information Facility Terminal Window
$ chronos ... CHRONOS Usage -----------------------------------------------------------------To convert time from one supported system/type to another: % CHRONOS -SETUP <setup file name OR kernel file name(s)> -FROM <"from" time system> [-FROMTYPE <"from" time type>] -TO <"to" time system> [-TOTYPE <"to" time type>] [-FORMAT <output time format picture>] -TIME <input time> | -BATCH [-SC <sc ID>] [-CENTER <cental body ID>] [-LANDINGTIME <UTC time of the landing>] [-SOL1INDEX <index of the first SOL>] [-NOLABEL] [-TRACE]
Toolkit Applications
N IF
CHRONOS - Example
Navigation and Ancillary Information Facility Terminal Window
$ cat chronos.cas Sample CHRONOS setup file for Cassini \begindata KERNELS_TO_LOAD = ( 'naif0007.tls', 'cas00085.tsc' ) SPACECRAFT_ID = -82 \begintext $ chronos -setup chronos.cas -from utc -to et -time 1999 JAN 12 12:00 1999-01-12, 12:01:04.184 (ET/SCET) $ chronos -setup chronos.cas -from utc -to sclk -time 1999 JAN 12 12:00 1/1294833883.185 (SCLK/SCLK) $ chronos -setup naif0007.tls cas00085.tsc -sc -82 -from sclk -to utc -time 1/1294833883.185 1999-01-12 11:59:59.998 (UTC/SCET) $ chronos -setup naif0007.tls cas00085.tsc -sc -82 -from sclk -to utc -time 1/1294833883.185 -format 'YYYY-DOYTHR:MN:SC ::RND' -nolabel 1999-012T12:00:00
Toolkit Applications
N IF
MKSPK
Navigation and Ancillary Information Facility
mkspk may be used to generate an SPK file from any of several types of data, such as discrete states, classic elements, and two-line elements Use of this program is discussed in a separate tutorial about making SPK files, and in the mkspk Users Guide.
Toolkit Applications
N IF
SPKMERGE
Navigation and Ancillary Information Facility
The contents of an SPK file or set of SPK files may be merged or subsetted using spkmerge
Extract an interval of time of interest from a single SPK file or a set of SPK files. Extract data for one or more objects from a single SPK file or a set of SPK files. You can combine both the time and object selection mechanisms for the greatest flexibility.
Toolkit Applications
10
N IF
SPK files created with spkmerge have no overlapping ephemeris data. The order in which the source files are specified determines precedence when sources have overlapping coverage for a body of interest.
IMPORTANT NOTE: Data from an earlier specified source file take precedence over data from a later specified source file when the new (merged) file is created.
Toolkit Applications
11
N IF
SPKMERGE - Example
Navigation and Ancillary Information Facility Terminal Window
$ cat spkmerge_cas_example.cmd ;This command file directs spkmerge to take data for ;Cassini, the Sun, the Earth, the Moon, and the Earth;Moon barycenter and place them into a single SPK. leapseconds_kernel spk_kernel bodies source_spk_kernel source_spk_kernel = = = = = naif0007.tls output.bsp -82, 10, 301, 399, 3 de403s.bsp 990825A_SCEPH_EM52_JP0.bsp
$ spkmerge SPKMERGE -- SPK Merge Tool, Version 3.2, SPICE Toolkit N0057 Enter the name of the command file > spkmerge_cas_example.cmd Creating output.bsp $
Toolkit Applications
12
N IF
SPKDIFF
Navigation and Ancillary Information Facility
spkdiff is a command line program for comparing trajectories provided by two SPK files spkdiff compares SPKs by computing a set of geometric states for a specified body, center and frame over an interval of time with a fixed time step using one SPK file, then computing another set of geometric states for the same or different body, center, and frame at the same times using the other SPK file, and then subtracting the corresponding states from each other Depending of the requested output type spkdiff prints to the screen:
only the maximum differences, a complete table of differences, or a statistical analysis of the differences.
Toolkit Applications
13
N IF
$ spkdiff
SPKDIFF - Usage
Navigation and Ancillary Information Facility Terminal Window
spkdiff computes differences between geometric states obtained from two SPK files and either displays these differences or shows statistics about them (see the User's Guide for more details.) The program usage is: % spkdiff [options] <first SPK file> <second SPK file> Options are shown below. Order and case of keys are not significant. Values must be space-separated from keys, i.e. '-n 10', not '-n10'. -b1 -c1 -r1 -b2 -c2 -r2 -k -b -e -s -n -f -t
Toolkit Applications
<first body name or ID> <first center name or ID> <first reference frame name> <second body name or ID> <second center name or ID> <second reference frame name> <other kernel file name(s)> <interval start time> <interval stop time> <time step in seconds> <number of states: 2 to 1000000 (default: 1000)> <output time format (default: TDB seconds past J2000)> <report type: basic|stats|dump|dumpvf (default: basic)> 14
N IF
$ # # # # # # # # # # # # #
spkdiff mro_psp.bsp mro_psp_rec.bsp Comparison of 1000 'J2000'-referenced geometric states of 'MARS RECON ORBITER' (-74) relative to 'MARS BARYCENTER' (4) from SPK 'mro_psp.bsp' with 1000 'J2000'-referenced geometric states of 'MARS RECON ORBITER' (-74) relative to 'MARS BARYCENTER' (4) from SPK 'mro_psp_rec.bsp' evenly-spaced with 2617.6524668123 second (0d 0h 43m 37.652467s) step size within the time interval
# from '2007 APR 01 00:01:05.185 TDB' (228657665.18565 TDB seconds) # to '2007 MAY 01 06:25:00.000 TDB' (231272700.00000 TDB seconds) # Relative differences in state vectors: maximum average Position: 8.4872836561757E-05 1.2312974450656E-05 Velocity: 8.5232570159796E-05 1.2314285182022E-05 Absolute differences in state vectors: maximum Position (km): 3.1341344106404E-01 Velocity (km/s): 2.8848827480682E-04
Toolkit Applications
15
N IF
$ spkdiff -t dumpvf mro_psp.bsp mro_psp_rec.bsp | more # Comparison of 1000 'J2000'-referenced geometric states # # of 'MARS RECON ORBITER' (-74) relative to 'MARS BARYCENTER' (4) # from SPK 'mro_psp.bsp' # # with 1000 'J2000'-referenced geometric states # # of 'MARS RECON ORBITER' (-74) relative to 'MARS BARYCENTER' (4) # from SPK 'mro_psp_rec.bsp' # # evenly-spaced with 2617.6524668123 second (0d 0h 43m 37.652467s) step size # within the time interval # # from '2007 APR 01 00:01:05.185 TDB' (228657665.18565 TDB seconds) # to '2007 MAY 01 06:25:00.000 TDB' (231272700.00000 TDB seconds) # # time, down_track_p_diff, normal_to_plane_p_diff, in_plane_p_diff, down_track_v _diff, normal_to_plane_v_diff, in_plane_v_diff 2.2865766518565E+08 +4.2593079332056E-02 -9.0540866105197E-05 -3.9705894066565E-04 -1.0394439243989E-07 -3.9614350816493E-05 2.2866028283812E+08 +4.2172435702119E-02 +2.3672255851626E-06 -1.1475679619731E-04 +1.4080506259574E-07 -3.9250157214024E-05 2.2866290049059E+08 +4.4830247467488E-02 +9.1590974014175E-05 -7.3802870365833E-04 -1.1724240528272E-07 -4.2099832045985E-05 2.2866551814305E+08 +4.5968515669515E-02 -1.3529652839857E-04 -7.5686845133612E-05 +3.4127364997784E-08 -4.2529268294482E-05 --More--
Toolkit Applications
16
N IF
MSOPCK
Navigation and Ancillary Information Facility
msopck is a program for making CK files from orientation provided in a text file as a time tagged, space-delimited table
has a simple command line interface requires all setups to be provided in a setup file that follows the SPICE text kernel syntax can process quaternions (SPICE and non-SPICE flavors), Euler angles, or matrixes, tagged with UTC, SCLK, or ET for more details see the Making a CK File Tutorial
Toolkit Applications
17
N IF
FRMDIFF
Navigation and Ancillary Information Facility
frmdiff is a command line program for sampling the orientation of a reference frame or for computing the difference between orientations of two reference frames based on provided set(s) of SPICE kernels In sampling mode, frmdiff computes a set of transformations from one frame to another frame over a specified interval with a specified step In comparison mode, frmdiff computes two sets of transformations for two pairs of from and to frames and then computes the difference in rotation and angular velocity between these transformations over a specified interval with a specified step Depending on the execution mode and the requested output type frmdiff prints to the screen:
only the maximum rotation or the maximum rotation difference, a complete table of rotations or differences (as angle and axis, SPICE- or engineering-style quaternions, matrixes, or Euler angles), or a statistical analysis of rotations or differences.
Toolkit Applications
18
N IF
FRMDIFF - Usage
Navigation and Ancillary Information Facility Terminal Window
$ frmdiff % frmdiff [options] <first kernel name> <second kernel name> % frmdiff [options] <kernel name> % frmdiff [options] where kernel can be a CK, an FK, or a PCK. Options are shown below. -k <supporting kernel(s) name(s)> -f1 <first ``from'' frame, name or ID> -t1 <first ``to'' frame, name or ID> -c1 <first frame for coverage look up, name or ID> -k1 <additional supporting kernel(s) for first file> -f2 <second ``from'' frame, name or ID> -t2 <second ``to'' frame, name or ID> -c2 <second frame for coverage look up, name or ID> -k2 <additional supporting kernel(s) for second file> -a <compare angular velocities: yes|no> -m <frame for angular velocities: from|to> -b <interval start time> -e <interval stop time> -n <number of points: 1 to 1000000 (default: 1000)> -s <time step in seconds> -f <time format: et|sclk|sclkd|ticks|picture_for_TIMOUT> -t <report: basic|stats|dumpaa|dumpm|dumpqs|dumpqo|dumpea|dumpc|dumpg> -o <rotation axes order (default: z y x)> -x <units for output angles> (only for -t dumpaa and -t dumpea)
Toolkit Applications
19
N IF
$ frmdiff -k naif0009.tls DIF_SCLKSCET.00036.tsc di_v17.tf -s 5 -t dumpqo -f sclkd -a yes -m to dif_sc_2009-01-27.bc > output.txt $ cat output.txt # # Sampling of 16864 rotations # # from 'J2000' (1) to 'DIF_SPACECRAFT' (-140000) # computed using # # naif0009.tls DIF_SCLKSCET.00036.tsc di_v17.tf # dif_sc_2009-01-27.bc # # with a 5.0000000000000 second (0:00:00:05.000000) step size # within the non-continuous (with 2 gaps) time period # # from '2009 JAN 27 00:01:06.713' TDB (286286466.71354 TDB # to '2009 JAN 28 00:01:05.346' TDB (286372865.34683 TDB # # including angular velocities relative to 'to' frame. # # Times are decimal SCLKs computed using SCLK ID -140. # # time, q_sin1, q_sin2, q_sin3, q_cos, av_x, av_y, av_z 2.8628543276953E+08 +6.9350853049532E-01 +3.7594179111024E-01 2.8628543776953E+08 +6.9350851552324E-01 +3.7594215798843E-01
seco... seco...
-6.1... -6.1...
Toolkit Applications
20
N IF
$ frmdiff -k naif0009.tls cas00130.tsc cas_v40.tf -s 10 -b 2009-JAN-09 00:00 -e 2009-JAN-10 00:00 -t dumpaa 09009_09025pa_fsiv_lud2.bc 09006_09011ra.bc > output.txt $ cat output.txt # # Comparison of 3143 rotations # from 'J2000' (1) to 'CASSINI_SC_COORD' (-82000) # computed using # naif0009.tls cas00130.tsc cas_v40.tf # 09009_09025pa_fsiv_lud2.bc # # with 3143 rotations # from 'J2000' (1) to 'CASSINI_SC_COORD' (-82000) # computed using # naif0009.tls cas00130.tsc cas_v40.tf # 09006_09011ra.bc # # with a 10.000000000000 second (0:00:00:10.000000) step size # within the non-continuous (with 1 gaps) time period # # from '2009 JAN 09 15:17:06.359' TDB (284786226.35996 TDB seco... # to '2009 JAN 10 00:01:06.184' TDB (284817666.18419 TDB seco... # # Times are TDB seconds past J2000. # angle is shown in radians. # # time, angle, axis_x, axis_y, axis_z +2.8478622635996E+08 +5.4958832051797E-05 +8.2101753099566E-01 +4.... +2.8478623635996E+08 +5.4931030131424E-05 +8.2046010733260E-01 +4.... Toolkit Applications
21
N IF
The contents of binary kernels can be summarized with the kernel summary tools. brief displays the bodies and associated time coverage in an SPK file or set of SPK files.
brief also works on binary PCK files
ckbrief displays the structure(s) and associated time coverage in a CK file or set of CK files. spacit displays a segment by segment summary of the contents of a CK, SPK, binary PCK, or EK/ ESQ file.
spacit also identifies the SPK or CK data type present in each segment.
Toolkit Applications
22
N IF
BRIEF
Navigation and Ancillary Information Facility
brief is a simple command line program for summarizing the contents of SPK or binary PCK files the files to be summarized can listed on the command line, given in a meta-kernel provided on the command line, or provided in a list file brief provides command line options for
displaying coverage boundaries as date UTC, DOY UTC, or ET seconds past J2000 (default time format is calendar ET) to display time as UTC an LSK file must be provided on the command line displaying centers of motions along with the bodies treating all input files as if they were a single file displaying summary only for files covering a specified time or time range or containing data for a specified body displaying summary in tabular format or grouped by coverage and many others ...
Toolkit Applications
23
N IF
$ brief
BRIEF - Usage
Navigation and Ancillary Information Facility Terminal Window
BRIEF -- Version 3.0.0, January 14, 2008 -- Toolkit Version N0063 BRIEF is a command-line utility program that displays a summary for one or more binary SPK or binary PCK files. The program usage is: % brief [-options] file [file ...] The most useful options are shown below. For the complete set of options, run BRIEF with the -h option. The order of options is not significant. The case of option keys is significant: they must be lowercase as shown below. -c -t -a -utc -utcdoy -etsec display centers of motion/relative-to frames display summary in a tabular format treat all files as a single file display times in UTC calendar date format (needs LSK) display times in UTC day-of-year format (needs LSK) display times as ET seconds past J2000
An LSK file must be provided on the command line to display times in UTC formats. FK file(s) must be provided on the command line to display names of any frames that are not built into the Toolkit.
Toolkit Applications
24
N IF
$ brief de405s.bsp m01_cruise.bsp
BRIEF - Example
Navigation and Ancillary Information Facility Terminal Window
Summary for: de405s.bsp Bodies: MERCURY BARYCENTER (1) SATURN BARYCENTER (6) MERCURY (199) VENUS BARYCENTER (2) URANUS BARYCENTER (7) VENUS (299) EARTH BARYCENTER (3) NEPTUNE BARYCENTER (8) MOON (301) MARS BARYCENTER (4) PLUTO BARYCENTER (9) EARTH (399) JUPITER BARYCENTER (5) SUN (10) MARS (499) Start of Interval (ET) End of Interval (ET) --------------------------------------------------------1997 JAN 01 00:01:02.183 2010 JAN 02 00:01:03.183
Summary for: m01_cruise.bsp Body: MARS SURVEYOR 01 ORBITER (-53) Start of Interval (ET) ----------------------------2001 APR 07 16:25:00.000
Toolkit Applications
25
N IF
CKBRIEF
Navigation and Ancillary Information Facility
ckbrief is a simple command line program for summarizing the contents of CK files the files to be summarized can listed on the command line, given in a meta-kernel provided on the command line, or provided in a list file ckbrief provides command line options for
displaying coverage at interpolation interval level displaying coverage boundaries as date UTC, DOY UTC, SCLK, or encoded SCLK (default time format is calendar ET) to display times as ET, UTC, or SCLK, an LSK file and SCLK file(s) must be provided on the command line Displaying frames with respect to which orientation is provided Displaying the names of the frames associated with CK IDs an FK file(s) defining these frames must be provided on the command line displaying summary only for files with data for a given CK ID and many others ...
Toolkit Applications
26
N IF
There often are coverage gaps within a CK segment Using the -dump option allows to get a complete list of continuous coverage intervals for each segment
Segment coverage reported by ckbrief with -dump Segment Coverage Reported by ckbrief without -dump
Time Sample CK Segment Type 3 Coverage Gaps Instances of Available Pointing Data
Toolkit Applications
27
N IF
$ ckbrief
CKBRIEF Usage
Navigation and Ancillary Information Facility Terminal Window
CKBRIEF -- Version 5.0.0, February 11, 2009 -- Toolkit Version N0063 CKBRIEF is a command-line utility program that displays a summary for one or more binary CK files. The program usage is: % ckbrief [-options] file [file ...] The most useful options are shown below. For the complete set of options, run CKBRIEF with the -h option. The order of options is not significant. The option keys must be lowercase as shown below. -dump -rel -n -t -utc -utcdoy -sclk display display display display display display display interpolation intervals relative-to frames (may need FK) frames associated with CK IDs (may need FK) summary in a tabular format times in UTC calendar date format (needs LSK&SCLK) times in UTC day-of-year format (needs LSK&SCLK) times as SCLK strings (needs SCLK)
LSK and SCLK files must be provided on the command line to display times in UTC, ET, or SCLK formats. FK file(s) must be provided on the command line to display names of any frames that are not built into the Toolkit.
Toolkit Applications
28
N IF
CKBRIEF Example
Navigation and Ancillary Information Facility Terminal Window
$ ckbrief -sclk 981116_981228pa.bc sclk.ker CKBRIEF -- Version 5.0.0, February 11, 2009 -- Toolkit Version N0063 Summary for: 981116_981228pa.bc Object: -82000 Interval Begin SCLK Interval End SCLK AV ------------------------ ------------------------ --1/1289865849.116 1/1293514473.118 N $ ckbrief -utc sclk.ker naif0007.tls 990817_990818ra.bc CKBRIEF -- Version 5.0.0, February 11, 2009 -- Toolkit Version N0063 Summary for: 990817_990818ra.bc Object: -82000 Interval Begin UTC -----------------------1999-AUG-17 17:30:01.418 1999-AUG-17 23:05:45.289 1999-AUG-18 06:06:09.124 1999-AUG-18 11:52:20.991 Interval End UTC -----------------------1999-AUG-17 23:05:42.039 1999-AUG-18 06:06:05.874 1999-AUG-18 11:52:17.741 1999-AUG-18 13:30:00.953 AV --N N N N
Toolkit Applications
29
N IF
$ ckbrief mgs_spice_c_kernel_2004-099.bc MGS_SCLKSCET.00053.tsc naif0007.tls -dump -rel -utc CKBRIEF -- Version 5.0.0, February 11, 2009 -- Toolkit Version N0063 Summary for: mgs_spice_c_kernel_2004-099.bc Segment No.: 1 Object: -94000 Interval End UTC -----------------------2004-APR-08 06:53:47.805 2004-APR-08 06:54:07.805 2004-APR-08 06:54:35.805 2004-APR-08 06:54:55.805 2004-APR-08 06:55:07.805 2004-APR-08 06:55:23.805 2004-APR-08 11:59:55.802 2004-APR-08 23:59:55.795 AV --Y Y Y Y Y Y Y Y Relative to FRAME ----------------J2000 J2000 J2000 J2000 J2000 J2000 J2000 J2000
Interval Begin UTC -----------------------2004-APR-08 00:00:59.809 2004-APR-08 06:54:07.805 2004-APR-08 06:54:19.805 2004-APR-08 06:54:51.805 2004-APR-08 06:55:07.805 2004-APR-08 06:55:23.805 2004-APR-08 06:55:35.805 2004-APR-08 12:00:55.802
Toolkit Applications
30
N IF
SPACIT
Navigation and Ancillary Information Facility
spacit may be used to obtain a more detailed summary of an SPK or CK file than that offered by brief or ckbrief, respectively
spacit may also be used to summarize a binary PCK or an EK/ ESQ. spacit is an interactive program It will prompt you for all needed inputs It displays short menus where you choose the action desired
spacit may also be used to manage comments, and to convert between binary and transfer format
Toolkit Applications
31
N IF
Every kernel should contain metadata called comments describing the file contents, intended usage, etc. In binary kernels SPKs, CKs, binary PCKs, and EKs comments are stored in a special area of the file called the comment area. commnt can read, extract, add, or delete comments stored in the comment area
Caution: you cannot add or delete comments if the kernel file is not in native format for the machine on which youre working. You can convert a non-native binary format file to native binary format by converting the file to transfer format using toxfr and then converting it back to binary format using tobin. Or use the bingo utility (available only from the NAIF website).
Toolkit Applications
32
N IF
COMMNT
Navigation and Ancillary Information Facility
commnt is both a command line utility and an interactive menu-driven program In command line mode, commnt provides options to
print comments to the screen $ commnt -r kernel_file extract comments to a text file $ commnt e kernel_file text_file add comments from a text file $ commnt a kernel_file comment_file delete comments $ commnt d kernel_file
Important
When comments are added, they are appended at the end of the existing comments Comments should be deleted ONLY to be replaced with better comments
Toolkit Applications
33
N IF
$ ; ; ; ; ;
commnt -r de405.bsp | more de405.bsp LOG FILE Created 1999-10-03/14:31:58.00. BEGIN NIOSPK COMMANDS = = = = = = /kernels/gen/lsk/naif0007.tls de405.bsp /usr2/nio/gen/de405.nio 1 2 3 4 5 6 7 8 9 10 301 399 199 299 499 CAL-ET 1950 JAN 01 00:00:41.183 CAL-ET 2050 JAN 01 00:01:04.183
; END NIOSPK COMMANDS A memo describing the creation of the DE405 generic planet ephemeris is avail able from NAIF or from the author: Dr. Myles Standish of JPL's Solar System Dy namics Group. Because this memo was produced using the TeX processor and inclu des numerous equations
Toolkit Applications
34
N IF
$ commnt
Welcome to COMMNT Version: 6.0.0 (Spice Toolkit N0050) COMMNT Options ( ( ( ( ( Q A R E D ) ) ) ) ) Quit. Add comments to a binary file. Read the comments in a binary file. Extract comments from a binary file. Delete the comments in a binary file.
Option: E Enter the name of the binary file. Filename? de405.bsp Enter the name of the comment file to be created. Filename? de405_comments.txt The comments were successfully extracted.
Toolkit Applications
35
N IF
With modern Toolkits (N0052 and later) the porting of DAF-based binary kernels* between computers having dissimilar binary standards is usually not necessary.
The advent of binary kernel readers that detect the binary style and do runtime translation if needed generally makes porting unnecessary for DAFbased types. Refer to the Porting Kernels tutorial for more on this topic.
Toolkit Applications
36
N IF
Navigation and Ancillary Information Facility
Non-Toolkit Applications
July 2013
N IF
Summary
Navigation and Ancillary Information Facility
NAIF makes available a set of applications not included in the generic Toolkits. This set includes programs for:
making, modifying, validating, inspecting, and analyzing SPK files: pinpoint, dafcat, bspidmod, dafmod, spy making and modifying CK files prediCkt, ckslicer, ckspanit, dafcat, cksmrg, dafmod making SCLK files makclk computing derived quantities orbnum, optics, spy determining SPICE kernel type and binary format archtype, bff converting between binary and text kernel formats bingo
Executables and Users Guides for selected computer environments are available from the NAIF server at:
http://naif.jpl.nasa.gov/naif/utilities.html
Non-Toolkit Applications
N IF
All of these apps are meant to be used as operating system shell executables
One generally cannot run these inside of IDL or MATLAB
Toolkit Applications
N IF
Ground stations
PINPOINT
Navigation and Ancillary Information Facility
pinpoint is a program for creating SPK files and topocentric frames FK files for objects whose position is a constant offset with respect to another object
Landing sites, sites along a rover path Relative positions of manipulator joints, etc.
deffile is an input definitions file following text kernel file format and containing a set of keywords defining ID, center, reference frame, position (as XYZ or Gaussian Lat/Lon/Alt) and time coverage boundaries, and optionally velocity and topocentric frame axes specifications, for one or more objects The contents of deffile are included in the comment area spkfile is an output SPK file containing a type 8 SPK segment for each of the objects specified in the deffile tkfile is an optional input PCK file (needed if positions in the deffile are given as Lat/Lon/Alt) or FK file (needed if one or more of the frames specified in deffile is not one of the frames built into the Toolkit) fk is an optional output topocentric frames FK file
Non-Toolkit Applications
N IF
$ more mer1_meridiani.def
PINPOINT Example
Navigation and Ancillary Information Facility Terminal Window
Sample PINPOINT input for MER-1 landing site coordinates. \begindata SITES = ( 'LS' ) LS_CENTER = 499 LS_FRAME = 'IAU_MARS' LS_IDCODE = -253900 LS_XYZ = ( +3.3764222E+03 -3.2664876E+02 -1.1539218E+02 ) LS_BOUNDS = ( @2001-01-01-00:00:00.000, @2100-01-01-00:00:00.000 ) \begintext $ pinpoint -def mer1_meridiani.def -spk mer1_meridiani.bsp $ brief mer1_meridiani.bsp Brief. Version: 2.2.0
Summary for: mer1_meridiani.bsp Body: -253900* w.r.t. MARS (499) Start of Interval (ET) -------------------------------2001 JAN 01 00:00:00.000
Non-Toolkit Applications
N IF
DAFCAT
Navigation and Ancillary Information Facility
dafcat is a program for concatenating binary DAF files by simply copying all data segments from all input files, in the order they are provided, into the output file
Works on SPKs, CKs, and binary PCKs will not merge different types of kernels together, i.e. will not merge SPKs with CKs, CKs with PCKs, etc. for merging SPKs in most cases spkmerge should be used instead because it provides a much more powerful and sophisticated capability
output_file is the output file name and is the programs only argument Input file names are provided from standard input this is very convenient for use with Unix shell pipes
dafcat does not put any information into the comment area of the output file, leaving this responsibility to the user (use commnt to do so)
Non-Toolkit Applications
N IF
$ dafcat m01_merged.bsp
DAF binary files concatenation program version 1.00 spk_m_od33905-33993_rec_v1.bsp spk_m_od33992-34065_rec_v1.bsp ^D Concatenating files: spk_m_od33905-33993_rec_v1.bsp spk_m_od33992-34065_rec_v1.bsp to: m01_merged.bsp $ ls -1 spk_m_od*_rec_v1.bsp | dafcat m01_merged_2.bsp DAF binary files concatenation program version 1.00 Concatenating files: spk_m_od32371-32458_rec_v1.bsp ... to: m01_merged_2.bsp
Non-Toolkit Applications
N IF
$ dafcat m01.bc
DAFCAT Example: CK
Navigation and Ancillary Information Facility Terminal Window
DAF binary files concatenation program version 1.00 m01_sc_2004-04-20.bc m01_sc_2004-04-21.bc ^D Concatenating files: m01_sc_2004-04-20.bc m01_sc_2004-04-21.bc to: m01.bc $ ls -1 m01_sc_2004-04-2*.bc | dafcat m01.bc DAF binary files concatenation program version 1.00 Concatenating files: m01_sc_2004-04-20.bc m01_sc_2004-04-21.bc to: m01.bc
Non-Toolkit Applications
N IF
BSPIDMOD
Navigation and Ancillary Information Facility
bspidmod is a program for altering the object IDs in a binary SPK file
can be used to modify IDs in an SPK file(s) produced with a bogus spacecraft ID (or a simulation spacecraft ID) can be used to replace good IDs with bogus IDs if two different trajectories for the same object need to be used in the same program at the same time (for example for comparison)
inpspk is the input SPK file; inpid and outid are the current ID and new ID item indicates which IDs are to be replaced:
TARGET -- only target IDs are replaced, CENTER -- only center IDs are replaced, or OBJECT -- both target and center IDs are replaced
Replacements are made only when inpid matches an ID found in the input SPK -oflg flag indicating that changes should be made directly in the input file; if not specified, the program produces an output file with name that has _out appended to the name of the input file In order for changes to be made in the input file it must the in native binary format; if it is not, bingo may be used to convert it to the native binary format A note stating which IDs were modified is put in the comment area
Non-Toolkit Applications
N IF
$ brief mer2_crus_sim_id.bsp Brief. Version: 2.2.0
BSPIDMOD Example
Navigation and Ancillary Information Facility Terminal Window
(SPICE Toolkit N0057)
Summary for: mer2_crus_sim_id.bsp Body: -255 Start of Interval (ET) -------------------------------2003 JUL 09 00:15:00.000
$ bspidmod -spki mer2_crus_sim_id.bsp -idi -255 -ido -254 -mod target -oflg The file mer2_crus_sim_id.bsp has been updated. $ brief mer2_crus_sim_id.bsp Brief. Version: 2.2.0
Summary for: mer2_crus_sim_id.bsp Body: MER-2 (-254) Start of Interval (ET) -------------------------------2003 JUL 09 00:15:00.000
Non-Toolkit Applications
N IF
DAFMOD
Navigation and Ancillary Information Facility
dafmod is a program for altering selected segment attributes in a binary SPK, CK, or PCK file
in an SPK file it can alter the target, center, or reference frame ID in a CK or binary PCK file it can alter the object or reference frame ID
dafmod puts into the comment area a warning note stating which items in which segments of the file were changed dafmod works only on files in native binary format
bingo may be used to convert a non-native binary kernel to native binary format
Non-Toolkit Applications
11
N IF
$ brief mer2_crus_sim_id.bsp
Summary for: mer2_crus_sim_id.bsp Body: -255 ... $ dafmod DAFMOD -- Version 2.0.0, January 30, 2008 -- Toolkit Version N0063 (... banner providing usage instructions ...) 1) File : mer2_crus_sim_id.bsp 2) Item : target 3) Old Value: -255 4) New Value: -254 The file mer2_crus_sim_id.bsp has been updated. $ brief mer2_crus_sim_id.bsp Summary for: mer2_crus_sim_id.bsp Body: MER-2 (-254)
Non-Toolkit Applications
12
N IF
DAFMOD Example: CK
Navigation and Ancillary Information Facility Terminal Window
$ ckbrief -rel mro_sc_pred.bc mro.tsc naif0009.tls Summary for: mro_sc_pred.bc ... 2009-AUG-15 23:31:02.347 2009-AUG-30 00:00:58.388 Y $ dafmod DAFMOD -- Version 2.0.0, January 30, 2008 -- Toolkit Version N0063 (... banner providing usage instructions ...) 1) File : mro_sc_pred.bc 2) Item : frame 3) Old Value: -74900 4) New Value: 16 The file mro_sc_pred.bc has been updated. $ ckbrief -rel mro_sc_pred.bc mro.tsc naif0009.tls Summary for: mro_sc_pred.bc ... 2009-AUG-15 23:31:02.347 2009-AUG-30 00:00:58.388 Y
-74900
MARSIAU
Non-Toolkit Applications
13
N IF
SPY
Navigation and Ancillary Information Facility
Spy is a command-line utility for validating, inspecting, and analyzing SPK files Spy can:
Dump SPK file contents Data Summary information Comment area Bookkeeping information Sample data from a set of loaded kernels Sample position, distance, velocity, derived velocity, speed, acceleration, acceleration magnitude, osculating elements Check SPK files Validate SPK structure Check sampled data for bounds violations Locate invalid double precision numbers Find some geometric events Distance: find times when specified constraints on observer-target distance are met Elevation: find times when specified constraints on elevation of target in specified frame are met
Non-Toolkit Applications
14
N IF
Operating modes Auxiliary files
Interactive, batch, shell command line Start-up file, command files, log file, save file
Input options
Define user symbols in commands Embed prompts in commands
Output options
Dump subsets of SPK data Show epoch and packet deltas in data dumps Set sample count or density Set time and number formats Set angular units Set coordinate system for sampled data Control error diagnostic verbosity
15
N IF
Spy > dump data spk testspk.bsp segment index 13 stop packet 2;
Dump of SPK File testspk.bsp
================================================================== Segment number 13 -----------------------------Segment Summary: Segment ID : SPY test segment: type 18 subtype 0 Target Body : Body 1800 Center Body : Body 1899 Reference Frame : Frame 17, ECLIPJ2000 SPK Data Type : Type 18 Description : Mex/Rosetta Hermite/Lagrange Interpolation UTC Start Time : 2000 JAN 01 11:59:05.816 UTC Stop Time : 2000 JAN 01 12:32:15.816 ET Start Time : 2000-JAN-01 12:00:10.000000 (TDB) ET Stop Time : 2000-JAN-01 12:33:20.000000 (TDB) DAF Begin Address: 35287 DAF End Address : 37890 -----------------------------Segment Parameters: Packet Count : 200 Directory Count : 1 Window Size - 1 : 6 Polynomial Degree: 13 Subtype : 0 Description : Hermite interpolation, 12-element packets -----------------------------Time Tags and Packets: State Components: Position Velocity Velocity Accel. X, X, X, X, Y, Y, Y, Y, Z Z Z Z (km) (km/s) (km/s) (km/s^2) 1.00103333E+03 1.00703333E+03 2.00103333E+03 2.00703333E+03 1.00203333E+03 1.00803333E+03 2.00203333E+03 2.00803333E+03 1.00303333E+03 1.00903333E+03 2.00303333E+03 2.00903333E+03 1.00403333E+03 1.01003333E+03 2.00403333E+03 2.01003333E+03 1.00503333E+03 1.01103333E+03 2.00503333E+03 2.01103333E+03 1.00603333E+03 1.01203333E+03 2.00603333E+03 2.01203333E+03
1 2
Non-Toolkit Applications
16
N IF
Spy > load naif0009.tls; Spy > load de421.bsp; Spy > sample states observer earth target moon start time 2008 oct 28 00:00:00.000000 TDB stop time 2008 oct 28 00:01:00.000000 TDB frame eclipJ2000 aberration correction none coordinates latitudinal time format numeric E23.16 number format F13.6 step size 10.0; Sample STATE Results ================================================================== Target : moon Observer : earth Frame : eclipJ2000 Aberration Correction: none Coordinate System : latitudinal -----------------------------0.2784240000000000E+09 395800.315095 -156.260092 -4.660937 0.2784240100000000E+09 395800.673459 -156.258644 -4.660983 0.2784240200000000E+09 395801.031820 -156.257196 -4.661028 0.2784240300000000E+09 395801.390177 -156.255748 -4.661074 0.2784240400000000E+09 395801.748532 -156.254300 -4.661120 0.2784240500000000E+09 395802.106883 -156.252851 -4.661165 0.2784240600000000E+09 395802.465231 -156.251403 -4.661211
==================================================================
Non-Toolkit Applications
17
N IF
Structure Inspection of SPK File testspk.bsp ================================================================== Segment Number 11 -----------------------------Segment Summary: Segment ID : SPY test segment: type 15 Target Body : Body 1501 Center Body : Body 1599 Reference Frame : Frame 17, ECLIPJ2000 SPK Data Type : Type 15 Description : Two-Body with J2 Precession UTC Start Time : 2000 JAN 01 11:59:05.816 UTC Stop Time : 2000 JAN 01 12:32:15.816 ET Start Time : 2000-JAN-01 12:00:10.000000 (TDB) ET Stop Time : 2000-JAN-01 12:33:20.000000 (TDB) DAF Begin Address: 35259 DAF End Address : 35274 -----------------------------%% Error: Invalid Unit Periapsis Pole Vector The periapsis pole vector should have unit length but in fact has length 4.58257569E+04. -----------------------------One error diagnostic and no warnings generated for SPK file testspk.bsp
==================================================================
Non-Toolkit Applications
18
N IF
PREDICKT
Navigation and Ancillary Information Facility
prediCkt is a program for making CK files from a set of orientation specification rules and schedules defining when these rules are to be applied
has a simple command line interface requires orientation and schedule specification to be provided in a setup file that follows the SPICE text kernel syntax requires all supporting kernels -- SPK, PCK, etc -- to be loaded using a meta kernel for more details see Making CK Tutorial
Non-Toolkit Applications
19
N IF
CKSLICER
Navigation and Ancillary Information Facility
ckslicer is a program for subsetting a CK file ckslicer is a command line program with the following usage
ckslicer -lsk <lsk_file_name> -sclk <sclk_file_name(s)> -inputck <ck_file_name> -outputck <ck_file_name> -id <naif_id> -timetype <utc|sclk|ticks> -start <start_time> -stop <stop_time>
ckslicer is useful in the situation when only a portion of a CK covering a short interval of time is needed (for example when the whole CK is not needed and it takes up a lot of space) or to cut parts from a few CKs with the intent to merge them together (if reconstructed CKs from different sources have too much overlap to simply cat them together) A note stating which subset was extracted is put into the comment area of the output CK file
Non-Toolkit Applications
20
N IF
$ dir mgs_sc_ab1_v2.bc -rw-rw-r-1 naifuser
CKSLICER Example
Navigation and Ancillary Information Facility Terminal Window
195535872 Jul 17 1999 mgs_sc_ab1_v2.bc
$ ckslicer -lsk naif0007.tls -sclk MGS_SCLKSCET.00054.tsc -inputck mgs_sc_ab1_v2.bc -outputck mgs_sc_ab1_970915.bc -id -94000 -timetype utc -start 1997-SEP-15 18:00 stop 1997-SEP-15 21:00 CKSLICER: Version 1.0.1 July 17, 1999; Toolkit Version N0057 $ dir mgs_sc_ab1_970915.bc -rw-rw-rw1 naifuser 480256 Apr 25 10:23 mgs_sc_ab1_970915.bc $ ckbrief mgs_sc_ab1_970915.bc naif0007.tls MGS_SCLKSCET.00054.tsc -utc CKBRIEF Version: 2.0.0, 2001-05-16. SPICE Toolkit Version: N0057. Summary for: mgs_sc_ab1_970915.bc Object: -94000 Interval Begin UTC Interval End UTC AV ------------------------ ------------------------ --1997-SEP-15 18:00:00.001 1997-SEP-15 21:00:00.000 Y
Non-Toolkit Applications
21
N IF
CKSPANIT
Navigation and Ancillary Information Facility
ckspanit is used when one is dealing with a type 3 CK containing many small gaps within segments. It allows you to alter the CK in such a way that SPICE will interpolate over those gaps ckspanit is a command line program with the following usage
ckspanit -in inp_ck -out out_ck -tol threshold [-frm fk]
threshold is the longest time interval over which interpolation is to be permitted in the output CK file must be specified in SCLK ticks
For example if 1 tick is 1/256 of a second and interpolation over 30 second intervals is needed, threshold must be set to 256*30=7680
fk is an optional FK file name, needed only if the base frame in the input CK is not one of the frames built into the Toolkit
CAUTION: before running ckspanit, make sure that interpolation over larger gaps is appropriate for the vehicle or structure you are dealing with. And dont forget to add appropriate comments to the newly created CK file.
Non-Toolkit Applications
22
N IF
CKSPANIT Example
Navigation and Ancillary Information Facility Terminal Window
$ ckbrief m01_sc_2004-04-22.bc naif0007.tls ORB1_SCLKSCET.00078.tsc -utc -dump CKBRIEF Version: 2.0.0, 2001-05-16. SPICE Toolkit Version: N0057. Summary for: m01_sc_2004-04-22.bc Segment No.: 1 Object: -53000 Interval Begin UTC Interval End UTC AV ------------------------ ------------------------ --2004-APR-22 00:00:05.455 2004-APR-22 18:53:29.054 Y 2004-APR-22 18:55:05.054 2004-APR-22 21:44:22.979 Y 2004-APR-22 21:51:34.974 2004-APR-22 23:59:58.919 Y $ ckspanit -in m01_sc_2004-04-22.bc -out m01_sc_2004-04-22_sp.bc -tol 153600 $ ckbrief m01_sc_2004-04-22_sp.bc naif0007.tls ORB1_SCLKSCET.00078.tsc -utc -dump CKBRIEF Version: 2.0.0, 2001-05-16. SPICE Toolkit Version: N0057. Summary for: m01_sc_2004-04-22_sp.bc Segment No.: 1 Object: -53000 Interval Begin UTC Interval End UTC AV ------------------------ ------------------------ --2004-APR-22 00:00:05.455 2004-APR-22 23:59:58.919 Y
Non-Toolkit Applications
23
N IF
CKSMRG
Navigation and Ancillary Information Facility
cksmrg is a program for merging data from two or more uniform CK segments (same ID, base frame and type) provided in a single CK file cksmrg is used for eliminating gaps between segments (that cannot be removed by ckspanit) and removing duplicate data points contained in different segments cksmrg is a command line program with the following usage
cksmrg -k|-kernels <meta kernel name|kernel file names> -i|-input <input ck file name> -o|-output <output ck file name> -s|-segid <output ck segment id string> -f|-fileid <output ck file id string> -b|-body <body id|name> -r|-reference <reference id|name> -a|-av <drop|keep|make|makeavrg> -t|-tolerance <tolerance (number units)> [-c|-correction <time delta|cor. table file>]
CAUTION: cksmrg should not be used to merge CKs from different sources, nor should it be used to merge overlapping predict CKs
Non-Toolkit Applications
24
N IF
CKSMRG Example
Navigation and Ancillary Information Facility Terminal Window
$ ckbrief m01.bc naif0007.tls ORB1_SCLKSCET.00078.tsc -utc -rel . . . Object: -53000 Interval Begin UTC Interval End UTC AV Relative to FRAME ------------------------ ------------------------ --- ----------------2004-APR-20 00:00:03.622 2004-APR-20 23:59:56.288 Y MARSIAU 2004-APR-21 00:00:02.288 2004-APR-21 23:59:59.455 Y MARSIAU $ cksmrg -k naif0007.tls ORB1_SCLKSCET.00078.tsc -i m01.bc -o m01s.bc -s 'CKSMRGed' -f 'CKSMRGed' -b -53000 -r 'MARSIAU' -a keep -t 60 seconds . . . (cksmrg displays quite a lot of diagnostics and progress information) . . . $ ckbrief m01s.bc naif0007.tls ORB1_SCLKSCET.00078.tsc -utc -rel . . . Object: -53000 Interval Begin UTC Interval End UTC AV Relative to FRAME ------------------------ ------------------------ --- ----------------2004-APR-20 00:00:03.622 2004-APR-21 23:59:59.455 Y MARSIAU
Non-Toolkit Applications
25
N IF
MAKCLK
Navigation and Ancillary Information Facility
makclk is an interactive program prompting for a single input - the name of the setup file The setup file uses KEYWORD=VALUE assignments to specify input files (SCLKSCET, template SCLK, and LSK), output files (SCLK kernel and log), and control parameters (spacecraft ID, partition tolerance, time filtering flag, and rate adjustment flag) The makclk Users Guide provides detailed information about the setup file parameters and the SCLKSCET file format and contents.
Non-Toolkit Applications
26
N IF
$ more makclk.setup SCLKSCET_FILE OLD_SCLK_KERNEL FILE_NAME NAIF_SPACECRAFT_ID LEAPSECONDS_FILE PARTITION_TOLERANCE LOG_FILE = = = = = = =
MAKCLK Example
Navigation and Ancillary Information Facility Terminal Window
flc_sclkscet.00007 flc_template.tsc flc_sclkscet.00007.tsc -77 naif0009.tls 10 flc_sclkscet.00007.log
$ more flc_sclkscet.00007 (... SCLKSCET SFDU header ...) CCSD3RE00000$$scet$$NJPL3IS00613$$data$$ *____SCLK0_____ ________SCET0________ 0.000 2000-001T11:58:55.816 189345665.000 2006-001T00:00:00.816 189345666.000 2006-001T00:00:00.817 268620868.000 2008-188T12:53:23.211 276588129.000 2008-280T18:00:53.314 281552200.000 2008-338T04:55:23.270 284040077.000 2009-001T00:00:00.341 284040078.000 2009-001T00:00:00.342 287261113.000 2009-038T06:43:55.535 291848718.000 2009-091T09:04:01.136 CCSD3RE00000$$data$$CCSD3RE00000$$sclk$$
Non-Toolkit Applications
_DUT__ __SCLKRATE__ 64.184 1.000000000 64.184 0.000010000 65.184 1.000000000 65.184 0.999998631 65.184 0.999999788 65.184 1.000000029 65.184 0.000010000 66.184 1.000000029 66.184 1.000000131 66.184 1.000000166
27
N IF
$ more flc_template.tsc KPL/SCLK \begindata SCLK_KERNEL_ID SCLK_DATA_TYPE_77 SCLK01_TIME_SYSTEM_77 SCLK01_N_FIELDS_77 SCLK01_MODULI_77 SCLK01_OFFSETS_77 SCLK01_OUTPUT_DELIM_77 SCLK_PARTITION_START_77 SCLK_PARTITION_END_77 SCLK01_COEFFICIENTS_77 \begintext
= = = = = = = = = =
( ( ( ( ( ( ( ( ( (
$ makclk ..... Enter the name of the command file > flc_sclkscet.00007.setup flc_sclkscet.00007.tsc created. $
Non-Toolkit Applications
28
N IF
ORBNUM
Navigation and Ancillary Information Facility
orbnum is a program for generating a SPICE orbit number file containing orbit start/stop times and orbit numbers along with some additional derived quantities (orbital elements and coordinates of sub-spacecraft and sub-solar points)
The orbit number increment can be specified as occurring at one of these events: periapsis or apoapsis, ascending or descending equatorial node crossing, min or max value for the s/c positions Z-coordinate, or min or max value of the s/c latitude
pref_file is a preferences file using text kernel syntax, specifying setup parameters along with the kernels containing data to be used to search for orbit start and stop events -- spacecraft trajectory SPKs, center body PCK, spacecraft SCLK, etc. init_orbit is the number to be assigned to the first orbit determined using the kernels provided; subsequent orbits are assigned by incrementing init_orbit by 1
If -pref, -num or -file have not been provided, the program will prompt for them If -d is not specified the program will prompt for the time span within which the search for orbit events is to be performed
Non-Toolkit Applications
29
N IF
ORBNUM Example
Navigation and Ancillary Information Facility Terminal Window
$ more mex_orbnum.setup \begindata TARGET = -41 OBSERVER = 499 EVENT_DETECTION_FRAME = 'MARSIAU EVENT_DETECTION_KEY = 'PERI ELEMENTS_INERTIAL_FRAME = 'MARSIAU' ABERRATION_CORRECTION = 'NONE' ORBIT_PARAMS = ( 'Sub Sol Lon', 'Sub Sol Lat', .. ) TEXT_KERNELS = ( 'de-245-masses.tpc, NAIF0007.TLS', 'mex_030722_step.tsc, ..) BIN_KERNELS = ( 'ORMF_PSTPIX_DB_00001.bsp', DE405S.BSP) SAFETY_MARGIN = 0.5 STEP_SIZE_TDB = 'DEFAULT' \begintext $ orbnum -pref mex_orbnum.setup -num 1 -file mex_orbnum.orb ....Loading Kernels Start UTC (RET for default = 2004 JAN 13 15:54:19.8):<RETURN> End UTC (RET for default = 2004 AUG 05 02:10:24.8):<RETURN> Working, please wait. Program Finished!
Non-Toolkit Applications
30
N IF
OPTIKS
Navigation and Ancillary Information Facility
optiks is a utility program that generates information about instrument fields of view (FOV) from parameters present in IK and FK files
FOVs must be defined using the keywords required by the GETFOV routine
optiks uses a set of SPICE kernels specified on the command line; one or more of these kernels may be a meta-kernel The output data are organized in two tables
The first table lists the angular extents (size) of circular, elliptical, and rectangular FOVs. Using command line options -units and -half the user can select the unit of measure for the angular measurements, and whether half or full FOV angular extents are listed. The second table contains FOV boresights in a user specified frame at a particular epoch, specified using the -epoch option
Non-Toolkit Applications
31
N IF
OPTIKS Example
Navigation and Ancillary Information Facility Terminal Window
$ optiks -frame CASSINI_SC_COORD cas_iss_v09.ti cas_v37.tf naif0007.tls cas00084.tsc . . . Kernels Loaded: . . . FOV full-angular extents computed in RADIANS Field of View ------------CASSINI_ISS_NAC CASSINI_ISS_NAC_RAD CASSINI_ISS_WAC CASSINI_ISS_WAC_RAD Shape ----RECTANGULAR CIRCULAR RECTANGULAR CIRCULAR Length -----+0.006108652382 +3.141592653590 +0.060737457969 +3.141592653590 Width ----+0.006108652382 +3.141592653590 +0.060737457969 +3.141592653590
FOV boresights computed at epoch 2001-JAN-01 12:00 FOV boresights computed in frame CASSINI_SC_COORD Field of View Boresight Vector ---------------------------CASSINI_ISS_NAC ( +0.000575958621, -0.999999819520, CASSINI_ISS_NAC_RAD ( +1.000000000000, -0.000000000000, CASSINI_ISS_WAC ( +0.001218344236, -0.999999225446, CASSINI_ISS_WAC_RAD ( +1.000000000000, -0.000000000000,
Non-Toolkit Applications
) ) ) ) 32
N IF
ARCHTYPE
Navigation and Ancillary Information Facility
archtype is a program that displays the file architecture and type of a SPICE kernel; it is useful for scripting applications
To identify the architecture and type archtype uses the same mechanism as the FURNSH routine
archtype has a simple command line interface and requires only one argument -- the name of a kernel file:
archtype kernel_name
archtype prints architecture and type to standard output as two space delimited acronyms
Architecture can be: DAF or DAS for binary kernels KPL for text kernels Type can be SPK, PCK, IK, CK, EK, LSK, FK
If architecture and/or type cannot be determined, the program displays UNK In order for text kernels to be recognized, the first few characters of the file must contain KPL/<type> (i.e. KPL/IK, KPL/FK, etc.)
Non-Toolkit Applications
33
N IF
ARCHTYPE Examples
Navigation and Ancillary Information Facility Terminal Window
$ archtype 020514_SE_SAT105.bsp DAF SPK $ archtype 04135_04171pc_psiv2.bc DAF CK $ archtype cas00084.tsc KPL SCLK $ archtype cas_v37.tf KPL FK $ archtype cpck05Mar2004.tpc KPL PCK $ archtype naif0008.tls KPL LSK $ archtype .cshrc UNK UNK
Non-Toolkit Applications
34
N IF
BFF
Navigation and Ancillary Information Facility
bff is a program that displays the binary file format of one or a few SPICE kernels bff has a simple command line interface requiring kernel names to be listed on the command line:
bff kernel_name [kernel_name ...]
bff prints the binary file format string (BIG-IEEE or LTL-IEEE) to standard output
when run on a single kernel, it prints only the format string when run on more than one kernel, it prints the format string followed by the file name on a separate line for each file
If an input file is not a binary kernel, the program displays the format string N/A If the binary file format cannot be determined (for DAS files produced by applications linked to SPICE Toolkit N0051, April 2000 or earlier), the program displays the format string UNK
Non-Toolkit Applications
35
N IF
$ bff mer2_surf_rover.bsp BIG-IEEE
BFF Examples
Navigation and Ancillary Information Facility Terminal Window
$ bff ./*.bc ./*.bsp ./*.tf ./*.xsp BIG-IEEE ./MRO_PHX_EDL_07260_PASS1_sc_20070917181502.bc LTL-IEEE ./070416BP_IRRE_00256_14363.bsp LTL-IEEE ./mars_north.bsp BIG-IEEE ./mer2_surf_rover.bsp LTL-IEEE ./sb406-20pb.bsp LTL-IEEE ./zero_offset.bsp N/A ./vo.tf N/A ./mgn06127.xsp $
Non-Toolkit Applications
36
N IF
BINGO
Navigation and Ancillary Information Facility
The conversion direction flag does not need to be specified for DAF-based binary file conversions (SPK, CK, binary PCK) and post-N0051 DAS-based binary file conversions (EK, DBK, DSK)
The program automatically determines the input file format and performs conversion to the other format
The conversion direction flag must be specified for pre-N0051 DAS-based binary file conversions, and for text file conversions
Non-Toolkit Applications
37
N IF
BINGO Examples
Navigation and Ancillary Information Facility Terminal Window
DAF-based binary kernel conversions: $ bingo de405s_ieee.bsp de405s_pc.bsp $ bingo de405s_pc.bsp de405s_ieee.bsp Modern DAS-based binary kernel conversions: $ bingo 10A_ieee.bdb 10A_pc.bdb $ bingo 10A_pc.bdb 10A_ieee.bdb Text kernel conversions: $ bingo -unix2dos naif0008_unix.tls naif0008_dos.tls $ bingo -dos2unix naif0008_dos.tls naif0008_unix.tls
Non-Toolkit Applications
38
N IF
Navigation and Ancillary Information Facility
N IF
Topics
Navigation and Ancillary Information Facility
Prevention The Common Problems Required Reading document Reporting a Problem to NAIF
Common Problems
N IF
Prevention - 1
Navigation and Ancillary Information Facility
Read the pertinent documentation Tutorials, module headers, Required Reading technical reference documents, comments inside kernels Get the correct (usually latest) kernel files Verify that coverage and intended use are suitable If you are using a Fortran Toolkit, be sure your text kernels all use the line termination appropriate for your platform. Unix/Linux/OSX use <LF>; PC/Windows uses <CR><LF> Using the BINGO utility from the NAIF website to make the change, if needed, is one solution.
continued on next page Common Problems
N IF
Prevention - 2
Navigation and Ancillary Information Facility
N IF
Useful Documentation
Navigation and Ancillary Information Facility
NAIF has compiled a list of common problems, probable causes, and solutions encountered by users of the various SPICE Toolkits:
Refer to /doc/html/req/problems.html or doc/req/PROBLEMS.REQ, both of which are provided in each Toolkit package.
Some tutorials (e.g. SPK and CK) contain a section near the end describing common problems. It may be useful to read these documents BEFORE embarking on extensive SPICE-based programming projects, since some problems are best solved early in the software development cycle.
Common Problems
N IF
If you need help troubleshooting a programming or usage problem, you can send email to NAIF. At a minimum include these items in your email message.
The SPICE or operating system diagnostic messages written to the screen or to log files. The name and version of the operating system youre using. The name and version of the compiler or programming environment (IDL, Matlab). The Toolkit version you are using, i.e. N0064 (also called N64). Names of the kernel files being used. You may need to provide the kernels themselves if these are not available to NAIF. Your inputs to SPICE modules that signaled the error. If possible, a code fragment from where the error seems to occur.
Common Problems
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Overview
Navigation and Ancillary Information Facility
N IF
NAIF home page http://naif.jpl.nasa.gov Here you may access all official SPICE products produced by NAIF - kernels (generic, mission operations, and PDS archived) - software (Toolkits and individual utility programs) - documents - tutorials - programming lessons - problem solving tips - rules about using SPICE - links to useful resources SPICE announcements (by NAIF) http://naif.jpl.nasa.gov/mailman/listinfo/spice_announce SPICE discussion (by anyone) http://naif.jpl.nasa.gov/mailman/listinfo/spice_discussion
N IF
The remaining charts discuss where to find the various categories of SPICE kernel files
Operational flight project kernels for (mostly JPL) active flight projects PDS archived kernels those formally delivered to and accepted by NASAs Planetary Data System Generic kernels used by many flight projects and other endeavors some of these are also available in the other two categories
N IF
2a - Select the project name to get access to the kernels folder for that project. (see next page)
- or -
2b - Select the kernel type to get access to all kernels of that type for that project. The number tells how many kernels of that type are available. (see next page) 5
N IF
aareadme.txt
N IF
The best method for obtaining PDS archived kernels is directly from the NAIF server.
Complete SPICE data sets exist on the NAIF server fully expandednot bundled in a Zip or tar file Unless you have reason to do otherwise, download the entire archival data set using the ftp URL That way youll get all the latest data, the associated furnsh kernels, and the best documentation. If the data set is large and you need only a portion of it based on start/stop time, use the subsetter link to obtain the smaller amount of data needed.
N IF
If you select PDS Archive Area on the NAIF web page you can follow a path like this one. - You can use the ftp URL along with Unix wget
or the FileZilla tool, or some other equivalent, to download the entire data setrecommended, if not too large! Otherwise see the next page. - Or you can select specific kernels from the kernel folders, and/or furnsh meta- kernels and other items from the extras folder
8
N IF
For large data sets that might take a long time to download, if you really need just a subset of the data covering a limited amount of time you should use the Subsetter Link for the data set of interest. This process will automatically select just the kernels that fall within or overlap the time bounds you specify, construct a new FURNSH kernel(s) containing the names of this subset of kernels (thus making it easy for you to load the subset into your program), and create a custom wget script you may use to download these files to your computer. 9
N IF
Use GNUs wget or FileZilla or a similar utility to download the complete SPICE data set
Possible wget usage, and an example using Deep Impact wget -m -nH --cut-dirs=5 -nv (insert the URL of the "Volume FTP Link" for the SPICE data set here). For example:
wget -m -nH --cut-dirs=5 -nv ftp://naif.jpl.nasa.gov/pub/naif/pds/data/di-c-spice-6-v1.0/
disp_1000/
10
N IF
Horizons
Navigation and Ancillary Information Facility
Of primary interest to SPICE users is its ability to generate up-to-date SPK files for comets and asteroids
Horizons home: http://ssd.jpl.nasa.gov/?horizons Horizons web interface for manual generation of small bodies SPKs: http://ssd.jpl.nasa.gov/x/spk.html Horizons telnet interface for automated (programmatic) generation of small body SPKs: telnet ssd.jpl.nasa.gov 6775 For example script look at:
ftp://ssd.jpl.nasa.gov/pub/ssd/smb_spk
11
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
SPK: PCK:
For binary PCKs, only orientation is provided; use a text PCK to obtain size/shape
IK: Instrument field-of-view geometry (see also FK below) CK: Orientation of spacecraft or spacecraft structures that move FK: Definition and specification details for many reference frames, including instrument mounting alignments LSK: Time conversion: UTC (SCET) ET (TDB) SCLK and LSK: Time conversion: SCLK ET (TDB) DSK*: Tessellated plate shape model; digital elevation shape model
* DSK is under development; some test code is available
N IF
Which SPICE modules are most commonly called to use data obtained from a given kernel type?
SPK
SPKEZR, SPKPOS, SPKCOV, SPKOBJ SXFORM, PXFORM, SPKEZR, SPKPOS, BODVRD
FK
SXFORM, PXFORM, SPKEZR, SPKPOS STR2ET, TIMOUT, SCE2C, SCT2E, SCE2S, SCS2E SCS2E, SCE2S SXFORM, PXFORM, SPKEZR, SPKPOS
PCK
LSK
IK
GETFOV, G*POOL
SCLK
CK
DSK
Notes: FURNSH is used to load (provide access to ) all SPICE kernels. API names shown are for FORTRAN versions: - use lower case and add an _c when using C - use lower case and prepend cspice_ when using Icy (IDL) and Mice (MATLAB)
N IF
For a given high-level module, which kind(s) of kernel(s) will or may be needed?
Module Name
SPKEZR, SPKPOS SXFORM, PXFORM CKGP, CKGPAV GETFOV G*POOL STR2ET, TIMOUT SCS2E, SCE2S CHRONOS (time conversion app.)
SPK Y M
SCLK M M L
Y M
N IF
N IF
It depends on the mission or task you are working on If you're working with JPL mission data, there are three categories of kernel data available to you.
Mission operations kernels those used by the flight teams to fly the mission and prepare the archival science products PDS Archived kernels those that have been selected from (or made from) the mission ops kernels, and then are well organized and documented for the permanent PDS archive Generic kernels those that are used by many missions and are not tied to any one mission Relevant generic kernels are usually included in the PDS Archived and the Mission Operations kernels data sets mentioned above
The situation might be similar for non-JPL missions, but this is up to whatever agency/institution is producing the kernels.
N IF
Review the previous charts Look at the appropriate SPICE tutorial(s) Look at the Most Used xxx APIs document
mostused.html
/doc/html/info/
Read relevant portions of a SPICE required reading technical reference document (e.g. spk.req)
/doc/html/req/spk.html for the hyperlinked html version (best) /doc/spk.req for the plain text version
N IF
The primary user-oriented documentation about each module is found in the header located at the top of each source code file and in the modules HTML page in the API reference guide.
(More documentation is found at the additional entry points for those FORTRAN modules that have multiple entry points.)
Reference documentation for major subsystems is found in like-named required reading documents (e.g. spk.req, ck.req, etc.) The SPICE tutorials contain much helpful information. See SPICE Documentation Taxonomy in the tutorials collection for additional reading suggestions.
N IF
Nearly all module headers contain one or more working examples Most Useful SPICELIB Subroutines has code fragments /doc/html/info/mostused.html The required reading reference documents often contain examples /doc/html/req/index.html Some simple cookbook programs are found in the Toolkit /src/cookbook/ Make use of the SPICE Programming Lessons available from the NAIF server
ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Lessons/
Summary of Key Points
10
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
Introduction
Navigation and Ancillary Information Facility
First, let's go over the important steps in the process of writing a Icy-based program and putting it to work: Understand the geometry problem. Identify the set of SPICE kernels that contain the data needed to perform the computation. Formulate an algorithm to compute the quantities of interest using SPICE. Write and compile the program. Get actual kernel files and verify that they contain the data needed to support the computation for the time(s) of interest. Run the program. To illustrate these steps, let's write a program that computes the apparent intersection of the boresight ray of a given CASSINI science instrument with the surface of a given Saturnian satellite. The program will compute: Planetocentric and planetodetic (geodetic) latitudes and longitudes of the intercept point. Range from spacecraft to intercept point. Illumination angles (phase, solar incidence, and emission) at the intercept point.
N IF
Observation geometry
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
We want the boresight intercept on the surface, range from s/c to intercept, and illumination angles at the intercept point.
instrument fram e
inertial frame
When? TIME (UTC, TDB or TT) On what object? satnm In what frame? fixref
body-fixed frame sp acecraft frame spacecraft position
surface normal
instrument boresight
Phase angle
surface intersection
For which instrument? instnm For what spacecraft? scnm Using what model? setupf
Writing an Icy-based program
planetocentric longitude
planetocentric latitude
N IF
Needed Data
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
Time transformation kernels Orientation models Instrument descriptions Shapes of satellites, planets Ephemerides for spacecraft, Saturn barycenter and satellites.
Writing an Icy-based program
sp acecraft frame
instrument frame
inertial frame
surface intersection
planetocentric latitude
sun
N IF
Data required to compute vectors, rotations and other parameters shown in the picture are stored in the SPICE kernels listed below.
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
Parameter ----------------------time conversions satellite orientation satellite shape satellite position planet barycenter position spacecraft position spacecraft orientation instrument alignment instrument boresight
Kernel Type -------------generic LSK CASSINI SCLK CASSINI PCK CASSINI PCK planet/sat ephemeris SPK planet SPK spacecraft SPK spacecraft CK CASSINI FK Instrument IK
File name -----------naif0009.tls cas00084.tsc cpck05Mar2004.tpc cpck05Mar2004.tpc 020514_SE_SAT105.bsp 981005_PLTEPH-DE405S.bsp 030201AP_SK_SM546_T45.bsp 04135_04171pc_psiv2.bc cas_v37.tf cas_iss_v09.ti
N IF
Load kernels
Navigation and Ancillary Information Facility
The easiest and most flexible way to make these kernels available to the program is via cspice_furnsh. For this example we make a setup file (also called a metakernel or furnsh kernel) containing a list of kernels to be loaded:
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
\begindata KERNELS_TO_LOAD = ('naif0009.tls', 'cas00084.tsc', 'cpck05Mar2004.tpc',! '020514_SE_SAT105.bsp', '981005_PLTEPH-DE405S.bsp',! '030201AP_SK_SM546_T45.bsp', '04135_04171pc_psiv2.bc',! 'cas_v37.tf', 'cas_iss_v09.ti') \begintext
and we make the program prompt for the name of this setup file:
read, setupf, PROMPT='Enter setup file name > ' cspice_furnsh, setupf
N IF
Programming Solution
Navigation and Ancillary Information Facility
Prompt for setup file (metakernel) name; load kernels specified via setup file. (Done on previous chart.) Prompt for user inputs required to completely specify problem. Obtain further inputs required by geometry routines via Icy calls. Compute the intersection of the boresight direction ray with the surface of the satellite, presented as a triaxial ellipsoid. If there is an intersection, Convert Cartesian coordinates of the intersection point to planetocentric latitudinal and planetodetic coordinates Compute spacecraft-to-intercept point range Find the illumination angles (phase, solar incidence, and emission) at the intercept point Display the results. We discuss the geometric portion of the problem first.
Writing an Icy-based program
N IF
Compute the intercept point (point) of the boresight vector (insite) specified in the instrument frame (iframe) of the instrument mounted on the spacecraft (scnm) with the surface of the satellite (satnm) at the TDB time of interest (et) in the satellites body-fixed frame (fixref). This call also returns the light-time corrected epoch at the intercept point (trgepc), the spacecraft-to-intercept point vector (srfvec), and a flag indicating whether the intercept was found (found). We use "converged Newtonian" light time plus stellar aberration corrections to produce the most accurate surface intercept solution possible. We model the surface of the satellite as an ellipsoid.
cspice_sincpt, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, iframe, $ insite, point, trgepc, srfvec, found
The range we want is obtained from the outputs of cspice_sincpt. These outputs are defined only if a surface intercept is found. If found is true, the spacecraft-to-surface intercept range is the norm of the output argument srfvec. Units are km. We use the Icy function cspice_vnorm to obtain the norm:
cspice_vnorm( srfvec )
We'll write out the range data along with the other program results.
Writing an Icy-based program
N IF
Compute the planetocentric latitude (pclat) and longitude (pclon), as well as the planetodetic latitude (pdlat) and longitude (pdlon) of the intersection point.
if ( found ) then begin cspice_reclat, point, r, pclon, pclat ;; Let re, rp, and f be the satellite's longer equatorial ;; radius, polar radius, and flattening factor. re rp f = = = radii[0] radii[2] ( re rp ) / re;
The illumination angles we want are the outputs of cspice_illum. Units are radians.
cspice_ilumin, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, $ point, trgepc, srfvec, phase, solar, emissn
Writing an Icy-based program
10
N IF
;; Compute the boresight ray intersection with the surface of the ;; target body. cspice_sincpt, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, $ iframe, insite, point, trgepc, srfvec, found ;; If an intercept is found, compute planetocentric and planetodetic ;; latitude and longitude of the point. if ( found ) then begin cspice_reclat, point, r, pclon, pclat ;; Let re, rp, and f be the satellite's longer equatorial ;; radius, polar radius, and flattening factor. re = radii[0] rp = radii[2] f = ( re rp ) / re; cspice_recgeo, point, re, f, pdlon, pdlat, alt ;; Compute illumination angles at the surface point. cspice_ilumin, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, $ point, trgepc, srfvec, phase, solar, emissn ... endif else begin ...
Writing an Icy-based program
11
N IF
Get inputs - 1
Navigation and Ancillary Information Facility
The code above used quite a few inputs that we don't have yet: TDB epoch of interest ( et ); satellite and s/c names (satnm, scnm); satellite body-fixed frame name (fixref); satellite ellipsoid radii (radii); instrument fixed frame name (iframe); instrument boresight vector in the instrument frame (insite);
Some of these values are user inputs; others can be obtained via CSPICE calls once the required kernels have been loaded. Let's prompt for the satellite name (satnm), satellite frame name (fixref), spacecraft name (scnm), instrument name (instnm) and time of interest (time):
read, read, read, read, read, satnm , fixref, scnm , instnm, time , PROMPT='Enter PROMPT='Enter PROMPT='Enter PROMPT='Enter PROMPT='Enter satellite name satellite frame spacecraft name instrument name time > > > > > ' ' '
12
N IF
Get Inputs - 2
Navigation and Ancillary Information Facility
Then we can get the rest of the inputs from Icy calls: To get the TDB epoch (et) from the user-supplied time string (which may refer to the UTC, TDB or TT time systems):
cspice_str2et, time, et
To get the instrument boresight direction (insite) and the name of the instrument frame (iframe) in which it is defined:
cspice_bodn2c, instnm, instid, found if ( NOT found ) then begin print, "Unable to determine ID for instrument: ", instnm return endif cspice_getfov, instid, ROOM, shape, iframe, insite, bundry
13
N IF
;; Prompt for the user-supplied inputs for our program read, setupf, PROMPT='Enter setup file name > cspice_furnsh, setupf read, read, read, read, read, satnm , fixref, scnm , instnm, time , PROMPT='Enter PROMPT='Enter PROMPT='Enter PROMPT='Enter PROMPT='Enter satellite name satellite frame spacecraft name instrument name time > > > > > ' ' '
;; Get the epoch corresponding to the input time: cspice_str2et, time, et ;; Get the radii of the satellite. cspice_bodvrd, satnm, "RADII", 3, radii ;; Get the instrument boresight and frame name. cspice_bodn2c, instnm, instid, found cspice_getfov, instid, ROOM, shape, iframe, insite, bundry
14
N IF
Display results
Navigation and Ancillary Information Facility
;; Display results. Convert angles from radians to degrees for output. print print, 'Intercept planetocentric longitude (deg): ', $ cspice_dpr()*pclon print, 'Intercept planetocentric latitude (deg): ', $ cspice_dpr()*pclat print, 'Intercept planetodetic longitude (deg): ', $ cspice_dpr()*pdlon print, 'Intercept planetodetic latitude (deg): ', $ cspice_dpr()*pdlat print, 'Range from spacecraft to intercept point (km): ', $ cspice_vnorm(srfvec) print, 'Intercept phase angle (deg): ', $ cspice_dpr()*phase print, 'Intercept solar incidence angle (deg): ', $ cspice_dpr()*solar print, 'Intercept emission angle (deg): ', $ cspice_dpr()*emissn endif else begin print, 'No intercept point found at ' + time endelse END
15
N IF
To finish up the program we need to declare the variables we've used. We'll highlight techniques used by NAIF programmers Add remaining IDL code required to make a syntactically valid program
PRO PROG_GEOMETRY ABCORR ROOM setupf satnm fixref scnm instnm time R2D = = = = = = = = = CN+S' 10L '' '' '' '' '' '' cspice_dpr()
16
N IF
;; Prompt for the user-supplied inputs for our program. read, setupf, PROMPT='Enter setup file name > ' cspice_furnsh, setupf read, satnm , PROMPT='Enter satellite name > ' read, fixref, PROMPT='Enter satellite frame > ' read, scnm , PROMPT='Enter spacecraft name > ' read, instnm, PROMPT='Enter instrument name > ' read, time , PROMPT='Enter time > ' ;; Get the epoch corresponding to the input time: cspice_str2et, time, et ;; Get the radii of the satellite. cspice_bodvrd, satnm, 'RADII', 3, radii ;; Get the instrument boresight and frame name. cspice_bodn2c, instnm, instid, found if ( NOT found ) then begin print, "Unable to determine ID for instrument: ", instnm return endif cspice_getfov, instid, ROOM, shape, iframe, insite, bundry
17
N IF
;; Compute the boresight ray intersection with the surface of the ;; target body. cspice_sincpt, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, $ iframe, insite, point, trgepc, srfvec, found ;; If an intercept is found, compute planetocentric and planetodetic ;; latitude and longitude of the point. if ( found ) then begin cspice_reclat, point, r, pclon, pclat ;;Let re, rp, and f be the satellite's longer equatorial ;; radius, polar radius, and flattening factor. re = radii[0] rp = radii[2] f = ( re - rp ) / re cspice_recgeo, point, re, f, pdlon, pdlat, alt ;; Compute illumination angles at the surface point. cspice_ilumin, 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, $ point, trgepc, srfvec, phase, solar, emissn ;; Display results. Convert angles from radians to degrees ;; for output. print print, 'Intercept planetocentric longitude (deg): ', $ R2D*pclon
Writing an Icy-based program
18
N IF
print, print, print, print, print, print,
endif else begin print, 'No intercept point found at ' + time endelse ;; Unload the kernels and clear the kernel pool cspice_kclear END
19
N IF
Though IDL functions in a manner similar to interpreted languages, it does compile source files to a binary form. Ensure that both the Icy Toolkit, and an IDL installation are properly installed. IDL must load the Icy DLM, icy.dlm/icy.so(dll) to compile those scripts containing Icy calls. IDL loads DLMs from default locations and from the current directory when the user ran IDL. The user may also explicitly load a DLM with the dlm_register command. Now compile the code.
20
N IF
IDL>
.compile prog_geometry.pro
21
N IF
It looks like we have everything taken care of: We have all necessary kernels We made a setup file (metakernel) pointing to them We wrote the program We compiled the program Let's run it.
22
N IF
IDL> Enter Enter Enter Enter Enter Enter
prog_geometry setup file name satellite name satellite frame spacecraft name instrument name time
setup.ker PHOEBE IAU_PHOEBE CASSINI CASSINI_ISS_NAC 2004 jun 11 19:32:00 39.843719 4.1958778 39.843719 5.0480106 2089.1697 28.139479 18.247220 17.858309
Intercept planetocentric longitude (deg): Intercept planetocentric latitude (deg): Intercept planetodetic longitude (deg): Intercept planetodetic latitude (deg): Range from spacecraft to intercept point (km): Intercept phase angle (deg): Intercept solar incidence angle (deg): Intercept emission angle (deg):
23
N IF
Latitude definitions:
Backup
Navigation and Ancillary Information Facility
Planetocentric latitude of a point P: angle between segment from origin to point and x-y plane (red arc in diagram). Planetodetic latitude of a point P: angle between x-y plane and extension of ellipsoid normal vector N that connects x-y plane and P (blue arc in diagram).
P N
z-axis
Reference ellipsoid
Planetocentric latitude Planetodetic latitude
O
Writing an Icy-based program
x-y plane
24
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
Introduction
Navigation and Ancillary Information Facility
First, let's go over the important steps in the process of writing a Mice-based program and putting it to work: Understand the geometry problem. Identify the set of SPICE kernels that contain the data needed to perform the computation. Formulate an algorithm to compute the quantities of interest using SPICE. Write and compile the program. Get actual kernel files and verify that they contain the data needed to support the computation for the time(s) of interest. Run the program. To illustrate these steps, let's write a program that computes the apparent intersection of the boresight ray of a given CASSINI science instrument with the surface of a given Saturnian satellite. The program will compute: Planetocentric and planetodetic (geodetic) latitudes and longitudes of the intercept point. Range from spacecraft to intercept point. Illumination angles (phase, solar incidence, and emission) at the intercept point.
N IF
Observation geometry
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
We want the boresight intercept on the surface, range from s/c to intercept, and illumination angles at the intercept point.
instrument fram e
inertial frame
When? TIME (UTC, TDB or TT) On what object? satnm In what frame? fixref
body-fixed frame sp acecraft frame spacecraft position
surface normal
instrument boresight
Phase angle
surface intersection
For which instrument? instnm For what spacecraft? scnm Using what model? setupf
Writing a Mice-based program
planetocentric longitude
planetocentric latitude
N IF
Needed Data
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
Time transformation kernels Orientation models Instrument descriptions Shapes of satellites, planets Ephemerides for spacecraft, Saturn barycenter and satellites.
Writing a Mice-based program
sp acecraft frame
instrument frame
inertial frame
surface intersection
planetocentric latitude
N IF
Data required to compute vectors, rotations and other parameters shown in the picture are stored in the SPICE kernels listed below.
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
Parameter ----------------------time conversions satellite orientation satellite shape satellite position planet barycenter position spacecraft position spacecraft orientation instrument alignment instrument boresight
Kernel Type -------------generic LSK CASSINI SCLK CASSINI PCK CASSINI PCK planet/sat ephemeris SPK planet SPK spacecraft SPK spacecraft CK CASSINI FK Instrument IK
File name -----------naif0009.tls cas00084.tsc cpck05Mar2004.tpc cpck05Mar2004.tpc 020514_SE_SAT105.bsp 981005_PLTEPH-DE405S.bsp 030201AP_SK_SM546_T45.bsp 04135_04171pc_psiv2.bc cas_v37.tf cas_iss_v09.ti
N IF
Load kernels
Navigation and Ancillary Information Facility
The easiest and most flexible way to make these kernels available to the program is via cspice_furnsh. For this example we make a setup file (also called a metakernel or furnsh kernel) containing a list of kernels to be loaded:
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
\begindata KERNELS_TO_LOAD = ('naif0009.tls', 'cas00084.tsc', 'cpck05Mar2004.tpc',! '020514_SE_SAT105.bsp', '981005_PLTEPH-DE405S.bsp', ! '030201AP_SK_SM546_T45.bsp', '04135_04171pc_psiv2.bc',! 'cas_v37.tf', 'cas_iss_v09.ti')! \begintext
and we make the program prompt for the name of this setup file:
setupf = input('Enter setup file name > ', 's'); cspice_furnsh( setupf )
N IF
Programming Solution
Navigation and Ancillary Information Facility
Prompt for setup file (metakernel) name; load kernels specified via setup file. (Done on previous chart.) Prompt for user inputs required to completely specify problem. Obtain further inputs required by geometry routines via Mice calls. Compute the intersection of the boresight direction ray with the surface of the satellite, presented as a triaxial ellipsoid. If there is an intersection: Convert Cartesian coordinates of the intersection point to planetocentric latitudinal and planetodetic coordinates Compute spacecraft-to-intercept point range Find the illumination angles (phase, solar incidence, and emission) at the intercept point Display the results. We discuss the geometric portion of the problem first.
N IF
Compute the intercept point (point) of the boresight vector (insite) specified in the instrument frame (iframe) of the instrument mounted on the spacecraft (scnm) with the surface of the satellite (satnm) at the TDB time of interest (et) in the satellites body-fixed frame (fixref). This call also returns the light-time corrected epoch at the intercept point (trgepc), the spacecraft-to-intercept point vector (srfvec), and a flag indicating whether the intercept was found (found). We use "converged Newtonian" light time plus stellar aberration corrections to produce the most accurate surface intercept solution possible. We model the surface of the satellite as an ellipsoid.
[point, trgepc, srfvec, found] = cspice_sincpt( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, iframe, insite );
The range we want is obtained from the outputs of cspice_sincpt. These outputs are defined only if a surface intercept is found. If found is true, the spacecraft-to-surface intercept range is the norm of the output argument srfvec. Units are km. We use the MATLAB function norm to obtain the norm:
norm( srfvec )
We'll write out the range data along with the other program results.
Writing a Mice-based program
N IF
Compute the planetocentric latitude (pclat) and longitude (pclon), as well as the planetodetic latitude (pdlat) and longitude (pdlon) of the intersection point.
if ( found ) [r, pclon, pclat] = cspice_reclat( point ); % Let re, rp, and f be the satellite's longer equatorial % radius, polar radius, and flattening factor. re = radii(1); rp = radii(3); f = ( re - rp ) / re; [pdlat, pdlat, alt] = cspice_recgeo( point, re, f );
The illumination angles we want are the outputs of cspice_ilumin. Units are radians.
[trgepc, srfvec, phase, solar, emissn] = cspice_ilumin( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, point );
10
N IF
% Compute the boresight ray intersection with the surface of the % target body. [point, trgepc, srfvec, found] = cspice_sincpt( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, iframe, insite ); % If an intercept is found, compute planetocentric and planetodetic % latitude and longitude of the point. if ( found ) [r, pclon, pclat] = cspice_reclat( point ); % Let re, rp, and f be the satellite's longer equatorial % radius, polar radius, and flattening factor. re = radii(1); rp = radii(3); f = ( re - rp ) / re; [pdlon, pdlat, alt] = cspice_recgeo( point, re, f ); % Compute illumination angles at the surface point. [trgepc, srfvec, phase, solar, emissn] = cspice_ilumin( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, point ); ... else ...
Writing a Mice-based program
11
N IF
Get inputs - 1
Navigation and Ancillary Information Facility
The code above used quite a few inputs that we don't have yet: TDB epoch of interest ( et ); satellite and s/c names (satnm, scnm); satellite body-fixed frame name (fixref); satellite ellipsoid radii (radii); instrument fixed frame name (iframe); instrument boresight vector in the instrument frame (insite);
Some of these values are user inputs; others can be obtained via CSPICE calls once the required kernels have been loaded. Let's prompt for the satellite name (satnm), satellite frame name (fixref), spacecraft name (scnm), instrument name (instnm) and time of interest (time):
satnm fixref scnm instnm time
Writing a Mice-based program
= = = = =
N IF
Get Inputs - 2
Navigation and Ancillary Information Facility
Then we can get the rest of the inputs from Mice calls: To get the TDB epoch (et) from the user-supplied time string (which may refer to the UTC, TDB or TT time systems):
et = cspice_str2et( time );
To get the instrument boresight direction (insite) and the name of the instrument frame (iframe) in which it is defined:
[instid, found] = cspice_bodn2c( instnm ); if ( ~found ) txt = sprintf( 'Unable to determine ID for instrument: %d', ... instnm ); error(txt) end [shape, iframe, insite, bundry] = cspice_getfov( instid, ROOM );
Writing a Mice-based program
13
N IF
% Prompt for the user-supplied inputs for our program. setupf = input( 'Enter setup file name > ', 's'); cspice_furnsh( setupf ) satnm = input( 'Enter satellite name > ', 's'); fixref = input( 'Enter satellite frame > ', 's'); scnm = input( 'Enter spacecraft name > ', 's'); instnm = input( 'Enter instrument name > ', 's'); time = input( 'Enter time > ', 's'); % Get the epoch corresponding to the input time: et = cspice_str2et( time ); % Get the radii of the satellite. radii = cspice_bodvrd( satnm, 'RADII', 3 ); % Get the instrument boresight and frame name. [instid, found] = cspice_bodn2c( instnm ); if ( ~found ) txt = sprintf( 'Unable to determine ID for instrument: %d', ... instnm ); error(txt) end [shape, iframe, insite, bundry] = cspice_getfov( instid, ROOM );
Writing a Mice-based program
14
N IF
Display results
Navigation and Ancillary Information Facility
... % Display results. Convert angles from radians to degrees % for output. fprintf( 'Intercept planetocentric longitude (deg): %11.6f\n', R2D*pclon ) fprintf( 'Intercept planetocentric latitude (deg): %11.6f\n', R2D*pclat ) fprintf( 'Intercept planetodetic longitude (deg): %11.6f\n', R2D*pdlon ) fprintf( 'Intercept planetodetic latitude (deg): %11.6f\n', R2D*pdlat ) fprintf( 'Range from spacecraft to intercept point (km): %11.6f\n', norm(srfvec) ) fprintf( 'Intercept phase angle (deg): %11.6f\n', R2D*phase ) fprintf( 'Intercept solar incidence angle (deg): %11.6f\n', R2D*solar ) fprintf( 'Intercept emission angle (deg): %11.6f\n', R2D*emissn ) else disp( ['No intercept point found at ' time ] ) end
15
N IF
To finish up the program we need to declare the variables we've used. We'll highlight techniques used by NAIF programmers Add remaining MATLAB code required to make a syntactically valid program
ABCORR = 'CN+S'; ROOM = 10; R2D = cspice_dpr; % Prompt for the user-supplied inputs for our program. setupf = input( 'Enter setup file name > ', 's'); cspice_furnsh( setupf ) satnm fixref scnm instnm time
Writing a Mice-based program
= = = = =
N IF
% Get the epoch corresponding to the input time: et = cspice_str2et( time ); % Get the radii of the satellite. radii = cspice_bodvrd( satnm, 'RADII', 3 ); % Get the instrument boresight and frame name. [instid, found] = cspice_bodn2c( instnm ); if ( ~found ) txt = sprintf( 'Unable to determine ID for instrument: %d', ... instnm ); error(txt) end [shape, iframe, insite, bundry] = cspice_getfov( instid, ROOM );
17
N IF
% Compute the boresight ray intersection with the surface of the % target body. [point, trgepc, srfvec, found] = cspice_sincpt( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, iframe, insite ); % If an intercept is found, compute planetocentric and planetodetic % latitude and longitude of the point. if ( found ) [r, pclon, pclat] = cspice_reclat( point ); % Let re, rp, and f be the satellite's longer equatorial % radius, polar radius, and flattening factor. re = radii(1); rp = radii(3); f = ( re - rp ) / re; [pdlon, pdlat, alt] = cspice_recgeo( point, re, f ); % Compute illumination angles at the surface point. [trgepc, srfvec, phase, solar, emissn] = cspice_ilumin( ... 'Ellipsoid', satnm, et, fixref, 'CN+S', scnm, point );
Writing a Mice-based program
18
N IF
% Display results. Convert angles from radians to degrees % for output. fprintf( 'Intercept planetocentric longitude (deg): %11.6f\n',... R2D*pclon ) fprintf( 'Intercept planetocentric latitude (deg): %11.6f\n',... R2D*pclat ) fprintf( 'Intercept planetodetic longitude (deg): %11.6f\n',... R2D*pdlon ) fprintf( 'Intercept planetodetic latitude (deg): %11.6f\n',... R2D*pdlat ) fprintf( 'Range from spacecraft to intercept point (km): %11.6f\n',... norm(srfvec) ) fprintf( 'Intercept phase angle (deg): %11.6f\n',... R2D*phase ) fprintf( 'Intercept solar incidence angle (deg): %11.6f\n',... R2D*solar ) fprintf( 'Intercept emission angle (deg): %11.6f\n,... R2D*emissn ) else disp( ['No intercept point found at ' time ] end % Unload the kernels and clear the kernel pool cspice_kclear
Writing a Mice-based program
19
N IF
It looks like we have everything taken care of: We have all necessary kernels We made a setup file (metakernel) pointing to them We wrote the program Let's run it.
20
N IF
>> prog_geometry Enter setup file name Enter satellite name Enter satellite frame Enter spacecraft name Enter instrument name Enter time
setup.ker PHOEBE IAU_PHOEBE CASSINI CASSINI_ISS_NAC 2004 jun 11 19:32:00 39.843719 4.195878 39.843719 5.048011 2089.169724 28.139479 18.247220 17.858309
Intercept planetocentric longitude (deg): Intercept planetocentric latitude (deg): Intercept planetodetic longitude (deg): Intercept planetodetic latitude (deg): Range from spacecraft to intercept point (km): Intercept phase angle (deg): Intercept solar incidence angle (deg): Intercept emission angle (deg):
21
N IF
Latitude definitions:
Backup
Navigation and Ancillary Information Facility
Planetocentric latitude of a point P: angle between segment from origin to point and x-y plane (red arc in diagram). Planetodetic latitude of a point P: angle between x-y plane and extension of ellipsoid normal vector N that connects x-y plane and P (blue arc in diagram).
P N
z-axis
Reference ellipsoid
Planetocentric latitude Planetodetic latitude
O
Writing a Mice-based program
x-y plane
22
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
Introduction
Navigation and Ancillary Information Facility
First, let's go over the important steps in the process of writing a CSPICE-based program and putting it to work: Understand the geometry problem. Identify the set of SPICE kernels that contain the data needed to perform the computation. Formulate an algorithm to compute the quantities of interest using SPICE. Write and compile the program. Get actual kernel files and verify that they contain the data needed to support the computation for the time(s) of interest. Run the program. To illustrate these steps, let's write a program that computes the apparent intersection of the boresight ray of a given CASSINI science instrument with the surface of a given Saturnian satellite. The program will compute Planetocentric and planetodetic (geodetic) latitudes and longitudes of the intercept point. Range from spacecraft to intercept point and from spacecraft to target center. Illumination angles (phase, solar incidence, and emission) at the intercept point.
N IF
Observation geometry
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
We want the boresight intercept on the surface, range from s/c to intercept, and illumination angles at the intercept point.
instrument fram e
inertial frame
When? TIME (UTC, TDB or TT) On what object? satnm In what frame? fixref
body-fixed frame sp acecraft frame spacecraft position
surface normal
instrument boresight
Phase angle
surface intersection
For which instrument? instnm For what spacecraft? scnm Using what model? setupf
Writing a CSPICE-based program
planetocentric longitude
planetocentric latitude
N IF
Needed Data
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
Time transformation kernels Orientation models Instrument descriptions Shapes of satellites, planets Ephemerides for spacecraft, Saturn barycenter and satellites.
Writing a CSPICE-based program
sp acecraft frame
instrument frame
inertial frame
surface intersection
planetocentric latitude
sun
N IF
Data required to compute vectors, rotations and other parameters shown in the picture are stored in the SPICE kernels listed below.
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
Parameter ----------------------time conversions satellite orientation satellite shape satellite position planet barycenter position spacecraft position spacecraft orientation instrument alignment instrument boresight
Kernel Type -------------generic LSK CASSINI SCLK CASSINI PCK CASSINI PCK planet/sat ephemeris SPK planet SPK spacecraft SPK spacecraft CK CASSINI FK Instrument IK
File name -----------naif0009.tls cas00084.tsc cpck05Mar2004.tpc cpck05Mar2004.tpc 020514_SE_SAT105.bsp 981005_PLTEPH-DE405S.bsp 030201AP_SK_SM546_T45.bsp 04135_04171pc_psiv2.bc cas_v37.tf cas_iss_v09.ti
N IF
Load Kernels
Navigation and Ancillary Information Facility
The easiest and most flexible way to make required kernels available to the program is via furnsh_c. For this example we make a setup file (also called a metakernel or furnsh kernel) containing a list of kernels to be loaded:
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
\begindata KERNELS_TO_LOAD = ('naif0009.tls', 'cas00084.tsc', 'cpck05Mar2004.tpc',! '020514_SE_SAT105.bsp', '981005_PLTEPH-DE405S.bsp',! '030201AP_SK_SM546_T45.bsp', '04135_04171pc_psiv2.bc', ! 'cas_v37.tf', 'cas_iss_v09.ti') \begintext
and we make the program prompt for the name of this setup file:
prompt_c ( "Enter setup file name > ", FILESZ, setupf ); furnsh_c ( setupf );
N IF
Programming Solution
Navigation and Ancillary Information Facility
Prompt for setup file (metakernel) name; load kernels specified via setup file. (Done on previous chart.) Prompt for user inputs required to completely specify problem. Obtain further inputs required by geometry routines via CSPICE calls. Compute the intersection of the boresight direction ray with the surface of the satellite, presented as a triaxial ellipsoid. If there is an intersection, Convert Cartesian coordinates of the intercept point to planetocentric latitudinal and planetodetic coordinates Compute spacecraft-to-intercept point range Find the illumination angles (phase, solar incidence, and emission) at the intercept point Display the results. We discuss the geometric portion of the problem next.
Writing a CSPICE-based program
N IF
Compute the intercept point (point) of the boresight vector (insite) specified in the instrument frame (iframe) of the instrument mounted on the spacecraft (scnm) with the surface of the satellite (satnm) at the TDB time of interest (et) in the satellites body-fixed frame (fixref). This call also returns the light-time corrected epoch at the intercept point (trgepc), the spacecraft-to-intercept point vector (srfvec), and a boolean flag indicating whether the intercept was found (found). We use "converged Newtonian" light time plus stellar aberration corrections to produce the most accurate surface intercept solution possible. We model the surface of the satellite as an ellipsoid.
sincpt_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, iframe, insite, point, &trgepc, srfvec, &found );
The range we want is obtained from the outputs of sincpt_c. These outputs are defined only if a surface intercept is found. If found is true, the spacecraft-to-surface intercept range is the norm of the output argument srfvec. Units are km. We use the CSPICE function vnorm_c to obtain the norm:
vnorm_c ( srfvec )
We'll write out the range data along with the other program results.
Writing a CSPICE-based program
N IF
Compute the planetocentric latitude (pclat) and longitude (pclon), as well as the planetodetic latitude (pdlat) and longitude (pdlon) of the intersection point.
if ( found ) { reclat_c ( point, &r, &pclon, &pclat ); */ /* Let re, rp, and f be the satellite's longer equatorial radius, polar radius, and flattening factor. re = radii[0]; rp = radii[2]; f = ( re rp ) / re; recgeo_c ( point, re, f, &pdlon, &pdlat, &alt);
The illumination angles we want are the outputs of ilumin_c. Units are radians.
ilumin_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, point, &trgepc, srfvec, &phase, &solar, &emissn );
10
N IF
/* Compute the boresight ray intersection with the surface of the satellite. sincpt_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, iframe, insite, point, &trgepc, srfvec, &found );
/* If an intercept is found, compute planetocentric and planetodetic latitude and longitude of the point. */ if ( found ) { reclat_c ( point, &r, &pclon, &pclat ); /* Let re, rp, and f be the satellite's longer equatorial radius, polar radius, and flattening factor. re = radii[0]; rp = radii[2]; f = ( re rp ) / re; recgeo_c ( point, re, f, &pdlon, &pdlat, &alt ); /* Compute illumination angles at the surface point. ilumin_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, point, &trgepc, srfvec, &phase, &solar, &emissn ); ... } else { ...
*/
*/
}
11
N IF
Get Inputs - 1
Navigation and Ancillary Information Facility
The code above used quite a few inputs that we don't have yet: TDB epoch of interest ( et ); satellite and s/c names (satnm, scnm); satellite body-fixed frame name (fixref); satellite ellipsoid radii (radii); instrument fixed frame name (iframe); instrument boresight vector in the instrument frame (insite);
Some of these values are user inputs; others can be obtained via CSPICE calls once the required kernels have been loaded. Let's prompt for the satellite name (satnm), satellite frame name (fixref), spacecraft name (scnm), instrument name (instnm) and time of interest (time):
prompt_c prompt_c prompt_c prompt_c prompt_c
Writing a CSPICE-based program
( ( ( ( (
); ); ); ); );
12
N IF
Get Inputs - 2
Navigation and Ancillary Information Facility
Then we can get the rest of the inputs from CSPICE calls: To get the TDB epoch (et) from the user-supplied time string (which may refer to the UTC, TDB or TT time systems):
str2et_c ( time, &et );
To get the instrument boresight direction (insite) and the name of the instrument frame (iframe) in which it is defined:
bodn2c_c ( instnm, &instid, &found ); if ( !found ) { setmsg_c ( "Instrument name # could not be " "translated to an ID code." ); errch_c ( "#", instnm ); sigerr_c ( "NAMENOTFOUND" ); } getfov_c ( instid, ROOM, WORDSZ, WORDSZ, shape, iframe, insite, &n, bundry );
Writing a CSPICE-based program
13
N IF
/* Prompt for prompt_c ( furnsh_c ( prompt_c ( prompt_c ( prompt_c ( prompt_c ( prompt_c (
/* Get the epoch corresponding to the input time: str2et_c ( time, &et ); /* Get the radii of the satellite. */ bodvrd_c ( satnm, "RADII", 3, &i, radii ); /* Get the instrument boresight and frame name. */
bodn2c_c ( instnm, &instid, &found ); if ( !found ) { setmsg_c ( "Instrument name # could not be " "translated to an ID code." ); errch_c ( "#", instnm ); sigerr_c ( "NAMENOTFOUND" ); } getfov_c ( instid, ROOM, WORDSZ, WORDSZ, shape, iframe, insite, &n, bundry );
Writing a CSPICE-based program
14
N IF
Display Results
for output. */ %11.6f\n" %11.6f\n" %11.6f\n" %11.6f\n" %11.6f\n" %11.6f\n" %11.6f\n" %11.6f\n",
Navigation and Ancillary Information Facility /* Display results. Convert angles from radians to degrees printf ( "\n" "Intercept planetocentric longitude (deg): "Intercept planetocentric latitude (deg): "Intercept planetodetic longitude (deg): "Intercept planetodetic latitude (deg): "Range from spacecraft to intercept point (km): "Intercept phase angle (deg): "Intercept solar incidence angle (deg): "Intercept emission angle (deg): dpr_c() * pclon, dpr_c() * pclat, dpr_c() * pdlon, dpr_c() * pdlat, vnorm_c( srfvec ), dpr_c() * phase, dpr_c() * solar, dpr_c() * emissn } else { printf ( "No intercept point found at %s\n", time ); }
Writing a CSPICE-based program
);
15
N IF
To finish up the program we need to declare the variables we've used. We'll highlight techniques used by NAIF programmers Add remaining C code required to make a syntactically valid program
16
N IF
#include <stdio.h> #include "SpiceUsr.h" int main () { #define #define #define FILESZ WORDSZ ROOM 256 41 10
found; iframe[WORDSZ]; instnm[WORDSZ]; satnm [WORDSZ]; fixref[WORDSZ]; scnm [WORDSZ]; setupf[FILESZ]; shape [WORDSZ]; time [WORDSZ];
N IF
/* Prompt for the user-supplied inputs for our program prompt_c ( "Enter setup file name > ", FILESZ, setupf furnsh_c ( setupf ); prompt_c ( "Enter satellite name > ", WORDSZ, satnm prompt_c ( "Enter satellite frame > ", WORDSZ, fixref prompt_c ( "Enter spacecraft name > ", WORDSZ, scnm prompt_c ( "Enter instrument name > ", WORDSZ, instnm prompt_c ( "Enter time > ", WORDSZ, time /* Get the epoch corresponding to the input time: */ str2et_c ( time, &et ); /* Get the radii of the satellite. */ bodvrd_c ( satnm, "RADII", 3, &i, radii ); /* Get the instrument boresight and frame name. */ bodn2c_c ( instnm, &instid, &found ); if ( !found ) { setmsg_c ( "Instrument name # could not be " "translated to an ID code." ); errch_c ( "#", instnm ); sigerr_c ( "NAMENOTFOUND" ); } getfov_c ( instid, ROOM, WORDSZ, WORDSZ, shape, iframe, insite, &n, bundry );
Writing a CSPICE-based program
18
N IF
/* Compute the boresight ray intersection with the surface of the satellite. sincpt_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, iframe, insite, point, &trgepc, srfvec, &found );
/* If an intercept is found, compute planetocentric and planetodetic latitude and longitude of the point. */ if ( found ) { reclat_c ( point, &r, &pclon, &pclat ); /* Let re, rp, and f be the satellite's longer equatorial radius, polar radius, and flattening factor. */ re = radii[0]; rp = radii[2]; f = ( re rp ) / re; recgeo_c ( point, re, f, &pdlon, &pdlat, &alt ); /* Compute illumination angles at the surface point. */ ilumin_c ( "Ellipsoid", satnm, et, fixref, "CN+S", scnm, point, &trgepc, srfvec, &phase, &solar, &emissn ); /* Display results. Convert angles to degrees for output. */ printf ( "\n" "Intercept planetocentric longitude (deg): %11.6f\n" "Intercept planetocentric latitude (deg): %11.6f\n"
Writing a CSPICE-based program
19
N IF
20
N IF
First be sure that both the CSPICE Toolkit and a C compiler are properly installed.
A "hello world" C program must be able to compile, link, and run successfully in your environment. Any of the mkprodct.* scripts in the cspice/src/* paths of the CSPICE installation should execute properly.
21
N IF
Or, compile the program on the command line. The program must be linked against the CSPICE object library cspice.a (cspice.lib under MS Visual C++/C) and the C math library. On a PC running Linux and gcc, if The gcc compiler is in your path
As indicated by the response to the command "which gcc"
the Toolkit is installed in the path (for the purpose of this example) /myhome/cspice You've named the program demo.c then you can compile and link your program using the command gcc I/myhome/cspice/include \ -o demo \ demo.c /myhome/cspice/lib/cspice.a lm
Note: the preprocessor flag
-DNON_UNIX_STDIO
used in the mkprodct.csh script is needed for code generated by f2c, but is usually unnecessary for compiling user code.
22
N IF
Prompt> mkprodct.csh Setting default compiler: gcc Setting default compile options: -c -ansi -O2 -DNON_UNIX_STDIO Setting default link options: -lm Compiling and linking: demo.pgm Compiling and linking: demo.pgm Prompt>
23
N IF
It looks like we have everything taken care of: We have all necessary kernels We made a setup file (metakernel) pointing to them We wrote the program We compiled and linked it Let's run it.
24
N IF
Prompt> demo Enter setup file name Enter satellite name Enter satellite frame Enter spacecraft name Enter instrument name Enter time
setup.ker PHOEBE IAU_PHOEBE CASSINI CASSINI_ISS_NAC 2004 jun 11 19:32:00 39.843719 4.195878 39.843719 5.048011 2089.169724 28.139479 18.247220 17.858309
Intercept planetocentric longitude (deg): Intercept planetocentric latitude (deg): Intercept planetodetic longitude (deg): Intercept planetodetic latitude (deg): Range from spacecraft to intercept point (km): Intercept phase angle (deg): Intercept solar incidence angle (deg): Intercept emission angle (deg): Prompt>
25
N IF
Latitude definitions:
Backup
Navigation and Ancillary Information Facility
Planetocentric latitude of a point P: angle between segment from origin to point and x-y plane (red arc in diagram). Planetodetic latitude of a point P: angle between x-y plane and extension of ellipsoid normal vector N that connects x-y plane and P (blue arc in diagram).
P N
z-axis
Reference ellipsoid
Planetocentric latitude Planetodetic latitude
O
Writing a CSPICE-based program
x-y plane
26
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
Introduction
Navigation and Ancillary Information Facility
First, let's go over the important steps in the process of writing a SPICE-based Fortran program and putting it to work: Understand the geometry problem. Identify the set of SPICE kernels that contain the data needed to perform the computation. Formulate an algorithm to compute the quantities of interest using SPICE. Write and compile the program. Get actual kernel files and verify that they contain the data needed to support the computation for the time(s) of interest. Run the program. To illustrate these steps, let's write a program that computes the apparent intersection of the boresight ray of a given CASSINI science instrument with the surface of a given Saturnian satellite. The program will compute Planetocentric and planetodetic (geodetic) latitudes and longitudes of the intercept point. Range from spacecraft to intercept point and from spacecraft to target center. Illumination angles (phase, solar incidence, and emission) at the intercept point.
N IF
Observation geometry
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
We want the boresight intercept on the surface, range from s/c to intercept, and illumination angles at the intercept point.
instrument fram e
inertial frame
When? TIME (UTC, TDB or TT) On what object? SATNM In what frame? FIXREF
body-fixed frame sp acecraft frame spacecraft position
surface normal
instrument boresight
Phase angle
surface intersection
For which instrument? INSTNM For what spacecraft? SCNM Using what model? SETUPF
Writing a FORTRAN-based program
planetocentric longitude
planetocentric latitude
N IF
Needed Data
Navigation and Ancillary Information Facility
on-bo ard clock ephemeris time UTC time
Time transformation kernels Orientation models Instrument descriptions Shapes of satellites, planets Ephemerides for spacecraft, Saturn barycenter and satellites.
Writing a FORTRAN-based program sun
sp acecraft frame
instrument frame
inertial frame
surface intersection
planetocentric latitude
N IF
Data required to compute vectors, rotations and other parameters shown in the picture are stored in the SPICE kernels listed below.
Note: these kernels have been selected to support this presentation; they should not be assumed to be appropriate for user applications.
Parameter ----------------------time conversions satellite orientation satellite shape satellite position planet barycenter position spacecraft position spacecraft orientation instrument alignment instrument boresight
Kernel Type -------------generic LSK CASSINI SCLK CASSINI PCK CASSINI PCK planet/sat ephemeris SPK planet SPK spacecraft SPK spacecraft CK CASSINI FK Instrument IK
File name -----------naif0009.tls cas00084.tsc cpck05Mar2004.tpc cpck05Mar2004.tpc 020514_SE_SAT105.bsp 981005_PLTEPH-DE405S.bsp 030201AP_SK_SM546_T45.bsp 04135_04171pc_psiv2.bc cas_v37.tf cas_iss_v09.ti
N IF
Load Kernels
Navigation and Ancillary Information Facility
The easiest and most flexible way to make required kernels available to the program is via FURNSH. For this example we make a setup file (also called a metakernel or furnsh kernel) containing a list of kernels to be loaded:
Note: these kernels have been selected to support this presentation they should not be assumed to be appropriate for user applications.
\begindata KERNELS_TO_LOAD = ('naif0009.tls', 'cas00084.tsc', 'cpck05Mar2004.tpc',! '020514_SE_SAT105.bsp', '981005_PLTEPH-DE405S.bsp',! '030201AP_SK_SM546_T45.bsp', '04135_04171pc_psiv2.bc', ! 'cas_v37.tf', 'cas_iss_v09.ti') \begintext
and we make the program prompt for the name of this setup file:
CALL PROMPT ( 'Enter setup file name > ', SETUPF ) CALL FURNSH ( SETUPF )
N IF
Programming Solution
Navigation and Ancillary Information Facility
Prompt for setup file (metakernel) name load kernels specified via setup file. (Done on previous chart.) Prompt for user inputs required to completely specify problem. Obtain further inputs required by geometry routines via SPICELIB calls. Compute the intersection of the boresight direction ray with the surface of the satellite, presented as a triaxial ellipsoid. If there is an intersection, Convert Cartesian coordinates of the intercept point to planetocentric latitudinal and planetodetic coordinates Compute spacecraft-to-intercept point range Find the illumination angles (phase, solar incidence, and emission) at the intercept point Display the results. We discuss the geometric portion of the problem next.
Writing a FORTRAN-based program
N IF
Compute the intercept point (POINT) of the boresight vector (INSITE) specified in the instrument frame (IFRAME) of the instrument mounted on the spacecraft (SCNM) with the surface of the satellite (SATNM) at the TDB time of interest (ET) in the satellites body-fixed frame (FIXREF). This call also returns the light-time corrected epoch at the intercept point (TRGEPC), the spacecraft-to-intercept point vector (SRFVEC), and a flag indicating whether the intercept was found (FOUND). We use "converged Newtonian" light time plus stellar aberration corrections to produce the most accurate surface intercept solution possible. We model the surface of the satellite as an ellipsoid.
CALL SINCPT ( 'Ellipsoid', SATNM, ET, FIXREF, 'CN+S', SCNM, IFRAME, . INSITE, POINT, TRGEPC, SRFVEC, FOUND )
The range we want is obtained from the outputs of SINCPT. These outputs are defined only if a surface intercept is found. If FOUND is true, the spacecraft-to-surface intercept range is the norm of the output argument SRFVEC. Units are km. We use the SPICELIB function VNORM to obtain the norm:
VNORM ( SRFVEC )
We'll write out the range data along with the other program results.
Writing a FORTRAN-based program
N IF
Compute the planetocentric latitude (PCLAT) and longitude (PCLON), as well as the planetodetic latitude (PDLAT) and longitude (PDLON) of the intersection point.
IF ( FOUND ) THEN CALL RECLAT ( POINT, R, PCLON, PCLAT ) C C Let RE, RP, and F be the satellite's longer equatorial radius, polar radius, and flattening factor. RE = RADII(1) RP = RADII(3) F = ( RE - RP ) / RE CALL RECGEO ( POINT, RE, F, PDLON, PDLAT, ALT )
The illumination angles we want are the outputs of ILLUM. Units are radians.
CALL ILUMIN ( 'Ellipsoid', SATNM, ET, FIXREF, . 'CN+S', SCNM, POINT, TRGEPC, SRFVEC, . PHASE, SOLAR, EMISSN )
10
N IF
C C
Compute the boresight ray intersection with the surface of the satellite. CALL SINCPT ( 'Ellipsoid', SATNM, ET, FIXREF, 'CN+S', SCNM, IFRAME, . INSITE, POINT, TRGEPC, SRFVEC, FOUND )
C C
If an intercept is found, compute planetocentric and planetodetic latitude and longitude of the point. IF( FOUND ) THEN
C C
CALL RECLAT ( POINT, R, PCLON, PCLAT ) Let RE, RP, and F be the satellite's longer equatorial radius, polar radius, and flattening factor. RE = RADII(1) RP = RADII(3) F = ( RE - RP ) / RE CALL RECGEO ( POINT, RE, F, PDLON, PDLAT, ALT ) Compute illumination angles at the surface point. CALL ILUMIN ( 'Ellipsoid', SATNM, ET, FIXREF, 'CN+S', SCNM, . POINT, TRGEPC, SRFVEC, PHASE, SOLAR, EMISSN ) ... ELSE ...
11
N IF
Get Inputs - 1
Navigation and Ancillary Information Facility
The code above used quite a few inputs that we don't have yet: TDB epoch of interest ( ET ) satellite and s/c names (SATNM, SCNM)
N IF
Get Inputs - 2
Navigation and Ancillary Information Facility
Then we can get the rest of the inputs from SPICELIB calls: To get the TDB epoch (ET) from the user-supplied time string (which may refer to the UTC, TDB or TT time systems):
CALL STR2ET ( TIME, ET )
To get the instrument boresight direction (INSITE) and the name of the instrument frame (IFRAME) in which it is defined:
CALL BODN2C ( INSTNM, INSTID, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'Instrument name # could not be ' // . 'translated to an ID code.' ) CALL ERRCH ( '#', INSTNM ) CALL SIGERR ( 'NAMENOTFOUND' ) END IF CALL GETFOV ( INSTID, ROOM, SHAPE, . INSITE, N, BUNDRY
Writing a FORTRAN-based program
IFRAME, )
13
N IF
C
Prompt for the user-supplied inputs for our program. CALL PROMPT ( 'Enter setup file name > ', SETUPF ) CALL FURNSH ( SETUPF ) CALL PROMPT( 'Enter satellite name > ', SATNM ) CALL PROMPT( 'Enter satellite frame > ', FIXREF ) CALL PROMPT( 'Enter spacecraft name > ', SCNM ) CALL PROMPT( 'Enter instrument name > ', INSTNM ) CALL PROMPT( 'Enter time > ', TIME ) Get the epoch corresponding to the input time: CALL STR2ET ( TIME, ET ) Get the radii of the satellite. CALL BODVRD ( SATNM, 'RADII', 3, I, RADII ) Get the instrument boresight and frame name. CALL BODN2C ( INSTNM, INSTID, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'Instrument name # could not be ' // . 'translated to an ID code.' ) CALL ERRCH ( '#', INSTNM ) CALL SIGERR ( 'NAMENOTFOUND' ) END IF CALL GETFOV ( INSTID, ROOM, SHAPE, IFRAME, . INSITE, N, BUNDRY )
14
C C C
N IF
C C . . . . . . . . . .
Display Results
Navigation and Ancillary Information Facility degrees
Display results. Convert angles from radians to for output. WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetocentric longitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetocentric latitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetodetic longitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetodetic latitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Range from spacecraft to intercept point (km): VNORM(SRFVEC) WRITE ( *, '(1X,A,F12.6)' ) 'Intercept phase angle (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept solar incidence angle (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept emission angle (deg): DPR()*EMISSN
DPR()*PHASE DPR()*SOLAR
ELSE WRITE (*,*) 'No intercept point found at '// TIME END IF
Writing a FORTRAN-based program
15
N IF
To finish up the program we need to declare the variables we've used. We'll highlight techniques used by NAIF programmers Add remaining Fortran code required to make a syntactically valid program
16
N IF
PROGRAM PROG26 IMPLICIT NONE DOUBLE PRECISION DOUBLE PRECISION INTEGER PARAMETER INTEGER PARAMETER INTEGER PARAMETER
DPR VNORM FILESZ ( FILESZ = WORDSZ ( WORDSZ = ROOM ( ROOM = IFRAME INSTNM SATNM FIXREF SCNM SETUPF SHAPE TIME ALT BUNDRY(3, ROOM)
255 ) 40 ) 10 )
CHARACTER*(WORDSZ) CHARACTER*(WORDSZ) CHARACTER*(WORDSZ) CHARACTER*(WORDSZ) CHARACTER*(WORDSZ) CHARACTER*(FILESZ) CHARACTER*(WORDSZ) CHARACTER*(WORDSZ) DOUBLE PRECISION DOUBLE PRECISION
Writing a FORTRAN-based program
N IF
C
Prompt for the user-supplied inputs for our program. CALL PROMPT ( 'Enter setup file name > ', SETUPF ) CALL FURNSH ( SETUPF ) CALL PROMPT ( 'Enter satellite name > ', SATNM ) CALL PROMPT ( 'Enter satellite frame > ', FIXREF ) CALL PROMPT ( 'Enter spacecraft name > ', SCNM ) CALL PROMPT ( 'Enter instrument name > ', INSTNM ) CALL PROMPT ( 'Enter time > ', TIME ) Get the epoch corresponding to the input time: CALL STR2ET ( TIME, ET ) Get the radii of the satellite. CALL BODVRD ( SATNM, 'RADII', 3, I, RADII ) Get the instrument boresight and frame name. CALL BODN2C ( INSTNM, INSTID, FOUND ) IF ( .NOT. FOUND ) THEN CALL SETMSG ( 'Instrument name # could not be ' // . 'translated to an ID code.' ) CALL ERRCH ( '#', INSTNM ) CALL SIGERR ( 'NAMENOTFOUND' ) END IF CALL GETFOV ( INSTID, ROOM, SHAPE, IFRAME, . INSITE, N, BUNDRY )
C C C
18
N IF
C C
Compute the boresight ray intersection with the surface of the satellite. CALL SINCPT ( 'Ellipsoid', SATNM, ET, FIXREF, 'CN+S', SCNM, IFRAME, . INSITE, POINT, TRGEPC, SRFVEC, FOUND )
C C
C C
If an intercept is found, compute planetocentric and planetodetic latitude and longitude of the point. IF( FOUND ) THEN CALL RECLAT ( POINT, R, PCLON, PCLAT ) Let RE, RP, and F be the satellite's longer equatorial radius, polar radius, and flattening factor. RE = RADII(1) RP = RADII(3) F = ( RE - RP ) / RE CALL RECGEO ( POINT, RE, F, PDLON, PDLAT, ALT ) Compute illumination angles at the surface point. . CALL ILUMIN ( 'Ellipsoid', SATNM, ET, FIXREF, 'CN+S', SCNM, POINT, TRGEPC, SRFVEC, PHASE, SOLAR, EMISSN ) Display results. Convert angles from radians to degrees for output. WRITE ( *, * ) WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetocentric longitude (deg): ', DPR()*PCLON
19
C C
N IF
. . . . . . . . .
WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetocentric latitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetodetic longitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept planetodetic latitude (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Range from spacecraft to intercept point (km): VNORM(SRFVEC) WRITE ( *, '(1X,A,F12.6)' ) 'Intercept phase angle (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept solar incidence angle (deg): WRITE ( *, '(1X,A,F12.6)' ) 'Intercept emission angle (deg): DPR()*EMISSN
DPR()*PHASE DPR()*SOLAR
ELSE WRITE (*,*) 'No intercept point found at '// TIME END IF END
20
N IF
First be sure that both the SPICE Toolkit and a Fortran compiler are properly installed.
A "hello world" Fortran program must be able to compile, link, and run successfully in your environment. Any of the mkprodct.* scripts in the toolkit/src/* paths of the SPICE Toolkit installation should execute properly.
21
N IF
Or, compile the program on the command line. The program must be linked against the SPICELIB object library spicelib.a (spicelib.lib under MS Windows systems). On a PC running Linux and g77, if The g77 compiler is in your path
As indicated by the response to the command "which g77"
the Toolkit is installed in the path (for the purpose of this example) /myhome/toolkit You've named the program demo.f then you can compile and link your program using the command g77 -o demo demo.f \ /myhome/toolkit/lib/spicelib.a
22
N IF
Prompt> mkprodct.csh Using the g77 compiler. Setting default Fortran compile options: -c -C Setting default C compile options: -c Setting default link options: Compiling and linking: demo.pgm Compiling and linking: demo.pgm Prompt>
23
N IF
It looks like we have everything taken care of: We have all necessary kernels We made a setup file (metakernel) pointing to them We wrote the program We compiled and linked it Let's run it.
24
N IF
Prompt> demo Enter setup file name Enter satellite name Enter satellite frame Enter spacecraft name Enter instrument name Enter time
setup.ker PHOEBE IAU_PHOEBE CASSINI CASSINI_ISS_NAC 2004 jun 11 19:32:00 39.843719 4.195878 39.843719 5.048011 2089.169724 28.139479 18.247220 17.858309
Intercept planetocentric longitude (deg): Intercept planetocentric latitude (deg): Intercept planetodetic longitude (deg): Intercept planetodetic latitude (deg): Range from spacecraft to intercept point (km): Intercept phase angle (deg): Intercept solar incidence angle (deg): Intercept emission angle (deg): Prompt>
25
N IF
Latitude definitions:
Backup
Navigation and Ancillary Information Facility
Planetocentric latitude of a point P: angle between segment from origin to point and x-y plane (red arc in diagram). Planetodetic latitude of a point P: angle between x-y plane and extension of ellipsoid normal vector N that connects x-y plane and P (blue arc in diagram).
P N
z-axis
Reference ellipsoid
Planetocentric latitude Planetodetic latitude
O
Writing a FORTRAN-based program
x-y plane
26
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
Table of Contents
Navigation and Ancillary Information Facility
Purpose Scope Assumptions about users knowledge SPK overview Summary of SPK architecture Discussion applicable to all production methods
Recommended SPK types
Selecting the polynomial degree (for polynomial SPK types) SPK production methods
Using the Make SPK (MKSPK) program Using SPICELIB, CSPICE or IDL writer modules (subroutines) Adding comments Validation Merging
Special requirements for making SPKs to be used in DSN/SPS software for view period generation, scheduling, metric predicts generation, and related functions.
Applies only to those entities not making JPL NAV-style p-files
2
N IF
Purpose
Navigation and Ancillary Information Facility
This tutorial provides guidance for writing an SPK file using software provided by NAIF:
the MKSPK application program or SPK writer modules from the SPICELIB (FORTRAN) or CSPICE (C-language) library, or from the Icy (IDL) system Only partial implementation in Icy No SPK writers implemented in Mice
N IF
Scope
Navigation and Ancillary Information Facility
(Note: This tutorial does not address SPK production by JPL navigation teams using the NIOSPK application, which was specially built to process JPLs NAVIO-format ephemeris/trajectory files.)
Those NAV teams may simply learn how to use the NIOSPK program and any useful SPK-related utilities.
N IF
Background Assumptions
Navigation and Ancillary Information Facility
It is assumed the reader has some familiarity with the SPICE system, and with basic ideas of orbital mechanics.
The SPICE Overview tutorial is available at:
ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/
It is assumed the reader has read the SPK Tutorial that characterizes much of the SPK subsystem, but with emphasis on reading SPK files.
The SPK reading tutorial is available at:
ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/Tutorials/ (named 19_spk)
It is assumed the reader has available the SPK reference document entitled SPK Required Reading, supplied with each copy of the SPICE Toolkit (.../doc/spk.req)
SPK Required Reading is also available at:
http://naif.jpl.nasa.gov/naif/documentation.html
N IF
SPK References
Navigation and Ancillary Information Facility
N IF
Brief Overview - 1
Navigation and Ancillary Information Facility
Understand the physics of your data and how that relates to SPK type. For instance:
Type 5 implies an orbit well approximated by a sequence of one or more conic orbits. Types 9 and 13 fit data regardless of the expected physics. Caution: a good fit in the mathematical realm may not respect the physics of the trajectory. For example, fitting polynomials to an excessively sparse set of states for a planetary orbiter could result in an interpolated path that intersects the planet.
N IF
Brief Overview - 2
Navigation and Ancillary Information Facility
Ordinarily, use the NAIF MKSPK application to create SPKs from Cartesian state data or conic elements.
Depending on your source data, SPK types 5, 9, 10, and 13 will satisfy the requirements for most users. Type 5, yields compact SPK files when the trajectory is well approximated by piecewise two-body motion. May be the best choice for planetary or solar orbiters when available state data are sparse. Type 9, a good, general choice Type 13, when you have very accurate velocity data Type 10 applies ONLY to Two Line Element Sets (TLEs).
Alternatively, use the Toolkits SPK writing subroutines in your own production program. Caution: an SPK made for use by the NASA DSN has additional requirements, discussed later on.
Making an SPK File
N IF
Navigation and Ancillary Information Facility
N IF
Comment area
Always present
Segment 1
Segment n
Possibly present
- sometimes by choice - sometimes required
10
N IF
ID WORD ND NI
U*
D1 U U
I1
Segment 1
ID WORD: Indicates file architecture and type ND, NI: Number of d.p. and integer descriptor components IFNAME: Internal file name FWD, BWD: Forward and backward linked list pointers FREE: First free DAF address BFF: Binary file format ID FTP: FTP corruption test string
N/P/C: Next, previous record pointers and descriptor count Dn: Descriptor for segment n In: Segment ID for segment n U: Unused space U*: Possibly unused space
11
N IF
ID WORD ND NI
U*
D1 D2 I2
I25
D25
I1
Segment 1 Segment 2
... ...
Data segments: One or more records per segment. (Up to 25 segments.)
Segment 25
N/P/C D26
U*
Descriptor record: Contains 1 to 25 segment descriptors. One record. Segment ID record: Contains 1 to 25 segment IDs. One or more records.
D27
I26 I27
Segment 26 Segment 27
Making an SPK File
Diagram not to scale
U*
12
N IF
File record
Contents Internal file name (set by file creator) Architecture and binary file format identifiers File structure parameters FTP transmission corruption detection string Used by SPK reader and writer subroutines
Comment Area
A place where metadata (data about data) may be placed to help a user of the SPK file understand the circumstances of its production and any recommendations about for what uses it was intended
Segment[s]
Numerous SPK types may be used within an SPK file, but only one SPK type may appear within a given segment Segments of different types may be intermixed within a given SPK file
13
N IF
covering a specified, continuous period of time, and using a single SPK data type. Example: ephemeris for the Voyager 2 spacecraft, relative to the center of the Neptunian system (Neptunes barycenter), given in the J2000 inertial reference frame, covering a specific period of time, and using the Hermite interpolation with variable length intervals SPK type (type 13)
An SPK segment must contain enough data to yield an objects state at any epoch within the time bounds associated with the segment
This has implications that depend on the SPK type being produced
14
N IF
Navigation and Ancillary Information Facility
15
N IF
Type 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Modified divided difference arrays Chebyshev polynomials for position; fixed length time intervals. Chebyshev polynomials for position and velocity; fixed length time intervals Special form used only by Hubble Space Telescope Discreet states using weighted two-body propagation Special form of trigonometric expansion of elements for Phobos and Deimos Precessing elements Lagrange interpolation of position and velocity; fixed length intervals between states Lagrange interpolation of position and velocity; variable length intervals between states Weighted two-line element sets (Space Command) Not used Hermite interpolation; fixed length intervals between states Hermite interpolation; variable length intervals between states Chebyshev polynomials for position and velocity, variable length time intervals Precessing conic elements propagator Special form used by ESAs Infrared Space Observatory Equinoctial elements Emulation of ESOCs DDID format
Use Type 13 unless state spacing is truly uniform when measured in the TDB system. Versatile type; easy to use with MKSPK. Use for DSN support. The most flexible of the Chebyshev types.
Not available for general use. Used for some satellites. Used for SMART-1, MEX, VEX, and Rosetta
16
N IF
SPK type 2 (Chebyshev polynomials for position, velocity given by differentiation) Used at JPL for planetary ephemerides. SPK type 3 (Separate Chebyshev polynomials for position and velocity) Used at JPL for satellite ephemerides. SPK type 5 (Weighted two-body extrapolation) Often used for comets and asteroids, as well as for sparse data sets where a two-body approximation is acceptable. SPK types 9 and 13 (Sliding-window Lagrange and Hermite interpolation of unequally-spaced states) Often used by non-JPL ephemeris producers and by users of NAIFs Make SPK (MKSPK) application. SPK type 10 (weighted Space Command two-line element extrapolation) Often used for earth orbiters. SPK type 14 (Separate Chebyshev polynomials for position and velocity, with variable time steps) This is the most flexible Chebyshev data type. SPK type 15 (Precessing conic elements) Provides a very compact ephemeris representation; limited to orbits where this type of approximation is valid. SPK type 17 (Equinoctial elements) Most suited for representation of ephemerides of natural satellites in equatorial or near-equatorial orbits.
Making an SPK File
17
N IF
Each type has certain properties that may promote or limit its usefulness in a particular application. These properties include, but are not limited to the following.
Ability to model the actual ephemeris to be represented with the accuracy required for your application. Consistency between velocity and derivative of position. Evaluation speed (performance). Compactness (file size). Availability of SPICE software needed to write files of that type.
Users are encouraged to consult with NAIF about the suitability of an SPK type for a particular purpose.
18
N IF
Each SPK segment must have a single object, center of motion, reference frame and SPK data type. Limiting segment size to 10,000 states or packets of ephemeris data can improve performance when searching within a segment.
Absolute limits on segment size depend on the size of the INTEGER data type.
For good SPK reading performance, the total number of segments for any given body in a file should be kept under the dimension of the SPKBSR segment buffer, currently set to 50,000.
More details about reading efficiency are provided at the end of this tutorial. When reading data from multiple SPK files, a more stringent limit applies: the total number of loaded segments for any body, possibly contributed by multiple files, should be less than the SPKBSR segment buffer size. For best efficiency, the total number of segments loaded should be less than this buffer size.
One may elect to initiate a new segment (or more) as the means for modeling a propulsive maneuver.
This is because the SPK reader modules will NOT allow interpolation over a segment boundary.
When starting a new segment you may use a new segment identifier, for instance to indicate a new trajectory leg after a maneuver.
Can only be done if using SPK write modulesnot if using the MKSPK application.
19
N IF
If you make a type 8 or 9 (Lagrange interpolation) or a type 12 or 13 (Hermite interpolation) SPK file you must specify the degree of the interpolating polynomial that the SPK reader subroutine will use.
This choice needs some consideration about desired accuracy, file size and evaluation speed (performance). This choice is also affected by the smoothness of the orbit data you wish to represent with an SPK file. The allowed range of degree is 1-to-15. In addition, to ensure position and velocity continuity over the time span covered by the orbit data: for types 8 and 9, the polynomial degree must be odd. for types 12 and 13, the polynomial degree must be 3-mod-4, meaning degree 3, 7, 11 or 15.
20
N IF
Reference Frame
Navigation and Ancillary Information Facility
No matter the SPK type, all ephemeris data must be provided in a well identified reference frame. Any reference frame known to the SPICE system, whether built-in (hard coded) or defined at run time through a Frames Kernel (FK), may be used for ephemeris data placed in an SPK file. Some examples of typical reference frames used:
Inertial (non-rotating): Earth Mean Equator and Equinox of J2000 (EME2000, a.k.a. J2000) Ecliptic of J2000 Body fixed (non-inertial) ITRF93 (for Earth) MOON_ME (MOON_MeanEarth)
Making an SPK File
21
N IF
Navigation and Ancillary Information Facility
N IF
23
N IF
Using the MKSPK program provided in the Toolkit could be easiest for simple situations.
Provides considerable flexibility for accepting a wide assortment of input data formats. Does allow one to make multi-segment SPK files when the target, center of motion, reference frame, or SPK type changes, but not as straight forward as it could/should be. Best done through multiple program executions (although one could be tricky and accomplish this in a single execution). A future version of MKSPK may better accommodate this. Note: production of multiple segments in type 5, 8, 9, 12 and 13 files when the amount of input data requires so, is automatically handled.
24
N IF
Using the SPK writer modules found in SPICELIB, CSPICE, and Icy offers the greatest flexibility and user control.
Using these requires that you write your own program. Youll likely need to use some additional SPICE modules as well.
25
N IF
Navigation and Ancillary Information Facility
26
N IF
Setup file ASCII file of ephemeris data Optional comment file
SPK File
Suitable kinds of input ephemeris data are: - Table of Cartesian state vectors - Table of conic elements - One or more sets of equinoctial elements - One or more sets of Space Command twoline elements
Possible SPK data types produced are: - Type 05 - Type 08 - Type 09 - Type 10 - Type 12 - Type 13 - Type 15 - Type 17
27
N IF
This table indicates which SPK types can be made from the four kinds of input data accepted by MKSPK
SPK Type Produced by MKSPK --> Input Data Type Cartesian state vectors Conic elements Equinoctial elements Space Command Two-line elements
5 Y Y N N
8 Y Y N N
9 Y Y N N
10 N N N Y
12 Y Y N N
13 Y Y N N
15 Y Y N N
17 Y Y Y N
Y = Yes
N = No
28
N IF
You can use MKSPK to add a new segment to an existing SPK file. You can use SPKMERGE to merge two or more SPK files made from separate executions of MKSPK.
Its important to fully understand how SPKMERGE works if you do this.
29
N IF
MKSPK does not provide direct/specific means for including propulsive maneuvers within an SPK file.
Instead, use either of these two methods. Append a new SPK segment to an existing SPK file, using MKSPK. Merge a collection of SPK files, using SPKMERGE.
30
N IF
Navigation and Ancillary Information Facility
31
N IF
The next several charts outline how to use the SPK writer modules available in the Toolkit libraries.
SPICELIB (FORTRAN) CSPICE (C) All types supported except Type 1 Icy (IDL) All types supported except Type 1, 15, 18 Mice (MATLAB) Currently no SPK writer modules are supported
These routines could be embedded in your existing trajectory propagator program, or they could be used to build a separate conversion program analogous to MKSPK.
32
N IF
Open a new SPK file. (Use SPKOPA to append to existing file.) Write a segment of SPK type xx
33
N IF
SPKOPN, SPKOPA SPK14B SPK14A [SPK14A] SPK14E SPK14B SPK14A [SPK14A] SPK14E etc. SPKCLS
Making an SPK File
Open file to add data Begin a new segment Add data to segment Add more data End the segment Begin a new segment Add data to segment Add more data End the segment
Repeat as needed
N IF
Once you have completed the addition of all data to your SPK file, be sure to call the SPKCLS routine to close the file.
Failure to properly close an SPK file will result in a problem file having been produced.
35
N IF
Navigation and Ancillary Information Facility
Finishing Up
36
N IF
Youve now used either MKSPK or the appropriate SPK writer routines to produce an SPK file. To complete the job you should consider the following.
Add comments (metadata) to the comment area of the SPK file. This could have been done during execution of MKSPK. It can be done after the SPK has been created by using the Toolkits commnt utility program. Validate the file before sending it off to your customer. Consider if there is a need to merge this newly made SPK file with others.
See the next several charts for more information on these subjects.
Making an SPK File
37
N IF
It is recommended that the producer of an SPK file add to the file, in the comment area, appropriate descriptive information.
When, how and by whom the file was created. Intended use for the file. Cautions or restrictions on how the file is to be used.
38
N IF
Several means are available for adding comments (metadata) to an SPK file.
An option in the MKSPK program allows comments supplied in a separate text file to be added to the comment area during MKSPK execution. Use the COMMNT utility program from the SPICE Toolkit. This may be run as an interactive program or in command line mode within a script. If using FORTRAN, C or IDL you can use APIs. Not currently supported in MATLAB.
39
N IF
Consider writing your own validation program. Caution: successfully running an SPK summary program (e.g. BRIEF or SPACIT) or successfully running the format conversion program (TOXFR or SPACIT) is a positive sign, but is not a sufficient test.
40
N IF
When you first start producing SPK files, or when changing the SPK type used or the kind of mission (trajectory) to be represented, validation (or revalidation) of the overall process is advised.
Validation of not only SPKs, but of end products derived from SPKs, is advised.
Consider writing a program that compares states from your source data with states extracted from your new SPK file.
Do this using interpolated states from your source datanot only the states placed in the SPK file. Verify a uniformly good fit on the whole time interval covered by the file.
Making an SPK File
41
N IF
Sometimes it is helpful to customers if portions of two or more SPK files are merged into just one.
(Sometimes the opposite is true, so be careful!)
If youve made a merged SPK file, check to see that the included comments are appropriate.
42
N IF
Get Help
Navigation and Ancillary Information Facility
43
N IF
Navigation and Ancillary Information Facility
Backup
Making SPKs for use by the DSN SPK reading efficiency
44
N IF
SPKs prepared for use in the DSN/SPS may be used in one or more of four software sets:
Metric Predicts Generator (MPG) Used for view period generation, DSN scheduling and DSN metric predicts (antenna pointing and tuning of the transmitters and receivers) Telecomm Preditcs (UTP/TFP) Subsystem for prediction and analysis of telecommunications signal levels Radiometric Modeling and Calibration Subsystem (RMC) Used to calibrate atmospheric effects on radio waves Delta Differenced One-way Range (Delta-DOR) subsystem A special tracking data type providing additional precision to spacecraft navigation
All SPKs delivered to the SPS must pass through a frontend validation program that has some restrictions. SPK files intended for use in any of these software sets may face some restrictions. See the next pages.
(Note: The restrictions that apply as of October 2008 are far less than before this date, due to full retirement of the SPS predecessorthe NSS.)
Making an SPK File
45
N IF
46
N IF
The Metric Predicts Generator does not inherently place any restrictions on the SPK files used.
However, current rules of the SPS gateway restrict the SPK choice to only Type 1 or Type 13. Note: Only JPL NAV teams are able to produce Type 1 SPKs.
The telecommunications prediction software does not inherently place any restrictions on the SPK files used. The radiometric modeling and calibration software requires only Type 1 or Type 13 SPKs The delta-DOR software requires only Type 1 or Type 13 SPKs
47
N IF
SPK file creators should design files to support efficient read access.
This requires knowledge of how SPK file attributes impact efficiency.
When you store "large" amounts (>10^7 states or data packets) of ephemeris data in one or more SPK files, SPK reading efficiency may be affected by:
SPK segment size Number of segments for a body in one SPK file Number of segments for a body contributed by multiple SPK files The number of loaded segments for all bodies The number of loaded files
48
N IF
Segment size
When a segment contains more than 10,000 states or data packets, the SPK readers will generally take longer to search the segment for requested data. When the segment is larger than this size, more records are read to look up segment directory information. If these records are not buffered, more physical records are read from the SPK file. There is a trade-off between segment size and numbers of segments and files. It can be preferable to have large segments rather than have "too many" segments or files. (Read on)
49
N IF
Unsurprisingly, the system works best when all needed segment descriptors are buffered simultaneously.
Making an SPK File
50
N IF
The buffering algorithm can "make room" in the buffer by discarding unneeded, buffered descriptor data.
A "least cost" algorithm decides which buffered data to discard.
51
N IF
User applications can avoid buffer overflow if data are appropriately spread across multiple SPK files. Applications can avoid buffer overflow by:
loading only those files of immediate interest unloading files once they're no longer needed
52
N IF
Number of segments for all bodies, contributed by all loaded SPK files:
Buffer overflow does not result from loading SPK files contributing more than STSIZE segments for different bodies. However, if the total number of loaded segments for bodies of interest exceeds STSIZE, thrashing can occur as descriptor data are repeatedly discarded from the buffer and then re-read. Loaded segments for bodies for which data are not requested do not contribute to the problem. For best efficiency, load only files contributing fewer than a total of STSIZE segments for all bodies of interest. When more than STSIZE segments are needed, applications should process data in batches: unload files containing unneeded data in order to make room for new files.
53
N IF
Loading a large number of SPK files could result in a buffering problem if too many segments are loaded for bodies of interest.
54
N IF
Recommendations
Limit segment counts to avoid buffer overflow and thrashing Never have more than STSIZE segments for one body in an SPK file and never have more than STSIZE segments for one body loaded simultaneously. Don't require users to have more than STSIZE segments loaded at one time. If necessary, use larger segments to enable smaller segment counts. Consider distributing SPK data across multiple files: so as to make selective SPK loading convenient
facilitate processing data in batches
55
N IF
Navigation and Ancillary Information Facility
Making a CK file
July 2013
N IF
Summary
Navigation and Ancillary Information Facility
SPICE provides means to create CK files, either by packaging orientation computed elsewhere or by first computing orientation and then packaging it in a CK file Packaging of already existing orientation data can be done in two ways:
Use SPICE CK writer routines by calling them from within your own SPICE-based application Convert a text file containing attitude data to a CK using the Toolkits msopck program
Convert orientation rules and schedules to a CK using the prediCkt program available at the NAIF website
Making a CK File
N IF
CK Writer Routines
Navigation and Ancillary Information Facility
The SPICE toolkit provides the following CK writer routines for the FORTRAN, C, IDL and MATLAB toolkits, respectively:
For Type 1 CK CKW01 / ckw01_c / cspice_ckw01 For Type 2 CK CKW02 / ckw02_c / cspice_ckw02 For Type 3 CK CKW03 / ckw03_c / cspice_ckw03 For Type 4 CK CKW04B, CKW04A, CKW04E (no CSPICE, Icy, or Mice wrappers) For Type 5 CK CKW05 / ckw05_c (no Icy or Mice wrapper)
Making a CK File
N IF
The following C-language code fragment illustrates the creation of a Type 3 C-kernel having a single segment.
ckopn_c ( filename, my-ckernel, 0, &handle ); /* Insert code that properly constructs the sclkdp, quats, avvs, and starts arrays. */ ckw03_c ( handle, begtim, endtim, inst, reference_frame, avflag, segment_id, nrec, sclkdp, quats, avvs, nints, starts ); ckcls_c ( handle );
Making a CK File
N IF
handle - file handle for the newly created C-kernel. begtim, endtim - start and stop times in SCLK ticks for the segment. inst - ID code for the instrument for which the Ckernel is being made. ref - name of the base reference frame. Must be one known to SPICE during your program execution. avflag - a SpiceBoolean indicating whether or not to include angular velocity in the segment. segid - a string identifying the segment. It must be no more than 40 characters in length.
Making a CK File
N IF
nrec - number of records in sclkdp, quats, and avvs. sclkdp - monotonically increasing list of times, given in SCLK ticks, that identify when quats and avvs were sampled. quats - a list of SPICE quaternions that rotate vectors from the base frame specified by the ref argument to the inst frame.
m2q_c ( C_matrix, quaternion );
avvs - angular rate vectors given in the base frame specified by the ref argument. starts - a list of SCLK ticks indicating the start of interpolation intervals. They must correspond to entries in sclkdp. nints - number of entries in starts.
Making a CK File
N IF
One of the easiest ways to accomplish this is to assume a constant rotation rate between subsequent quaternions:
for(k=0; k<(nrec-1); k++ ) { q2m_c ( quats[k][0], init_rot ); q2m_c ( quats[k+1][0], final_rot ); mtxm_c ( final_rot, init_rot, rotmat ); raxisa_c ( rotmat, axis, &angle ); sct2e_c ( scid, sclkdp[k], &init_et ); sct2e_c ( scid, sclkdp[k+1], &final_et ); vscl_c ( angle/(final_et-init_et), axis, &avvs[k][0] );
Then copy the (nrec-1) value of avvs into the last element of avvs.
Making a CK File
N IF
Constructing angular rates in this fashion assumes that no more than a 180-degree rotation has occurred between adjacent quaternions. raxisa_c chooses the smallest angle that performs the rotation encapsulated in the input matrix. Other techniques exist, including differentiating quaternions. Care must be exercised when taking that particular approach, however.
Making a CK File
N IF
MSOPCK
Navigation and Ancillary Information Facility
msopck is a program for making CK files from orientation provided as a time tagged, space-delimited table in a text file msopck can process quaternions (SPICE and non-SPICE flavors), Euler angles, or matrixes, tagged with UTC, SCLK, or ET msopck requires all program directives be provided in a setup file that follows the SPICE text kernel syntax msopck has a simple command line interface with the following usage
msopck setup_file input_data_file output_ck_file
Making a CK File
N IF
Supporting Kernels/Files
Output CK Specifications
Input data Specifications Optional and conditional keywords are shown in green
Making a CK File
N IF
Input file:
Four Examples
INPUT_DATA_TYPE = 'SPICE QUATERNIONS' TIME1 [TIME2] QCOS QSIN1 QSIN2 QSIN3 [ARX ARY ARZ ] ..... ....... .... ..... ..... ..... ... ... ... TIME1 [TIME2] QCOS QSIN1 QSIN2 QSIN3 [ARX ARY ARZ ]
INPUT_DATA_TYPE = 'MSOP QUATERNIONS' Input file: TIME1 [TIME2] -QSIN1 -QSIN2 -QSIN3 QCOS [ARX ARY ARZ ] ..... ....... ..... ..... ..... .... ... ... ... TIME1 [TIME2] -QSIN1 -QSIN2 -QSIN3 QCOS [ARX ARY ARZ ]
INPUT_DATA_TYPE = 'EULER ANGLES' Input file: TIME1 [TIME2] ANG3 ANG2 ANG1 [ARX ARY ARZ ] ..... ...... .... .... .... ... ... ... TIME1 [TIME2] ANG3 ANG2 ANG1 [ARX ARY ARZ ]
INPUT_DATA_TYPE = 'MATRICES' Input file: TIME1 [TIME2] M11 M12 M13 M21 ... M33 [ARX ARY ARZ ] ..... ...... ... ... ... ... ... ... ... ... ... TIME1 [TIME2] M11 M12 M13 M21 ... M33 [ARX ARY ARZ ] 11
Making a CK File
N IF
Quaternions
INPUT_DATA_TYPE = SPICE QUATERNIONS indicates the quaternions being used follow the SPICE formation rules(*) INPUT_DATA_TYPE = MSOP QUATERNIONS indicates the quaternions being used follow the traditional AACS formation rules(*) Normally quaternions that come in telemetry are of this type QUATERNION_NORM_ERROR keyword may be used to identify and filter out input records with quaternions that are not unit vectors It is set a tolerance for comparing the norm of the input quaternion with 1
Euler angles
All three angles must be provided For the angles provided on the input as
TIME1 [TIME2] ANG3 ANG2 ANG1 [ ARX ARY ARZ ]
the matrix rotating vectors from base to the structure frame is computed as
Vinst = [ANG3]axis3 * [ANG2]axis2 * [ANG1]axis1 * Vref
12
N IF
Angular rates are an optional input. Their presence or absence must be indicated using the ANGULAR_RATE_PRESENT keyword
If angular rates are provided (ANGULAR_RATE_PRESENT = YES), they must be in the form of a 3d vector expressed either in the base frame (less common) or instrument frame (more common) The ANGULAR_RATE_FRAME keyword must be set to indicate which of the two is used If angular rates are not provided, the program can either make a CK without rates (ANGULAR_RATE_PRESENT = NO), or try to compute rates from the orientation data by using uniform rotation algorithm implemented in Type 3 CK, either with averaging (ANGULAR_RATE_PRESENT = MAKE UP) or without averaging (ANGULAR_RATE_PRESENT = MAKE UP/NO AVERAGING) of the rates computed for adjacent orientation data points ANGULAR_RATE_THRESHOLD may be used to identify and filter out input records with angular rate components that are too large to be real
Input data can be tagged with UTC, SCLK, SCLK ticks or ET, as specified using the INPUT_TIME_TYPE keyword
Making a CK File
13
N IF
Interpolation intervals are determined based on the threshold value specified in the MAXIMUM_VALID_INTERVAL keyword
The threshold interval is given in seconds A Type 3 CK will allow interpolation between all input points for which the duration between points is less than or equal to the threshold
An additional transformation to be combined with the input attitude may be specified using OFFSET_ROTATION_* keywords
The convention for specification of the offset rotation angles is the same as for the input Euler angles A vector defined in the base frame is first multiplied by the offset rotation
Vinst = [ROTinput] * [ROToffset] * Vref
Making a CK File
14
N IF
The time tags may be adjusted by a constant value specified in seconds using the TIME_CORRECTION keyword The output CK file contains one or more CK segments
Multiple segments are generated if the input data volume is large and does not fit into the programs internal buffer (100,000 pointing records) When the output file has many segments, each segments start time is equal to the stop time of the previous segment, i.e. there are no gaps at the segment boundaries
Making a CK File
15
N IF
$ more msopck_setup.example MSOPCK setup for predict M'01 CK generation. ============================================================================== \begindata PRODUCER_ID = NAIF/JPL' LSK_FILE_NAME = 'naif0007.tls' SCLK_FILE_NAME = 'ORB1_SCLKSCET.00001.tsc' COMMENTS_FILE_NAME = 'msopck_comments.example' INTERNAL_FILE_NAME = 'sample M01 SC Orientation CK File' CK_SEGMENT_ID = 'SAMPLE M01 SC BUS ATTITUDE' INSTRUMENT_ID = -53000 REFERENCE_FRAME_NAME = 'MARSIAU' CK_TYPE MAXIMUM_VALID_INTERVAL INPUT_TIME_TYPE INPUT_DATA_TYPE QUATERNION_NORM_ERROR ANGULAR_RATE_PRESENT \begintext $ = = = = = = 3 60 SCLK' 'MSOP QUATERNIONS' 1.0E-3 'MAKE UP'
Making a CK File
16
N IF
$ more msopck_comments.example Sample Mars Surveyor '01 Orbiter Spacecraft Orientation CK File =========================================================================== Orientation Data in the File -------------------------------------------------------This file contains sample orientation for the Mars Surveyor 01 Orbiter (M01) spacecraft frame, 'M01_SPACECRAFT', relative to the Mars Mean Equator and IAU vector of J2000, 'MARSIAU', inertial frame. The NAIF ID code for the 'M01_SPACECRAFT' frame is -53000. Status -------------------------------------------------------This file is a special sample C-Kernel file created by NAIF to illustrate MSOPCK program. This file should not be used for any other purposes. ...
Making a CK File
17
N IF
$ more msopck_input.example 0767491368.064 -0.24376335 0767491372.114 -0.24249471 0767491373.242 -0.24204185 0767491374.064 -0.24194814 0767491380.064 -0.24012676 0767491386.064 -0.23830473 0767491392.064 -0.23648008 0767491398.064 -0.23465389 0767491404.064 -0.23282999 0767491404.114 -0.23277293 0767491405.242 -0.23231585 0767491410.064 0767491416.064 0767491422.064 0767491428.064 0767491434.064 0767491436.114 0767491438.011 ... -0.23100059 -0.22917353 -0.22734161 -0.22551078 -0.22367453 -0.22300583 -0.22251770
Making a CK File
18
N IF
$ msopck msopck_setup.example msopck_input.example msopck_example_ck.bc MSOPCK Utility Program, Version 3.0.0, 2003-05-05; SPICE Toolkit Ver. N0057 ... <comment file contents> ... <setup file contents> ... ******************************************************************************** RUN-TIME OBTAINED META INFORMATION: ******************************************************************************** PRODUCT_CREATION_TIME = 2004-04-29T12:17:55 START_TIME = 2004-04-27T00:00:05.516 STOP_TIME = 2004-04-27T23:59:56.275 ******************************************************************************** INTERPOLATION INTERVALS IN THE FILE SEGMENTS: ******************************************************************************** SEG.SUMMARY: ID -53000, COVERG: 2004-04-27T00:00:05.516 2004-04-27T23:59:56.275 -------------------------------------------------------------------------------2004-04-27T00:00:05.516 2004-04-27T20:05:26.282 2004-04-27T20:11:20.278 2004-04-27T23:59:56.273
Making a CK File
19
N IF
PREDICKT
Navigation and Ancillary Information Facility
prediCkt is a program for making CK files from a set of orientation specification rules, and schedules defining when these rules are to be followed prediCkt has a simple command line interface prediCkt requires orientation and schedule specification to be provided in a setup file that follows the SPICE text kernel syntax prediCkt requires the names of all supporting kernels -SPK, PCK, etc -- be provided in a meta-kernel (a furnsh kernel) prediCkt is available only from the Utilities link of the NAIF webpages
Making a CK File
20
N IF
PREDICKT - Usage
Navigation and Ancillary Information Facility
-furnish, -spec and -ck are used to specify the input metakernel, input attitude specification file and output CK file -tol is used to specify the tolerance to which the orientation stored in the CK should match the specified attitude profile -sclk or -newsclk specify the name of an existing SCLK or the new fake SCLK to be created for use with the output CK
Making a CK File
21
N IF
A FURNSH kernel lists SPICE kernels that are to be used by prediCkt to determine geometry needed to compute orientations A prediCkt attitude specification (spec) file following the text kernel syntax is used to provide three types of information:
Specification of dynamic directions Specification of orientations based on these directions Specification of the schedules defining when those orientations should be followed
The contents of the FURNSH kernel and the spec file are included in the comment area of the output CK file
Making a CK File
22
N IF
PREDICKT - Directions
Navigation and Ancillary Information Facility
Example: these two sets of spec file keyword assignments specify nadir and spacecraft velocity directions for the M01 spacecraft
DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS += += += += += += ( 'ToMars = POSITION OF MARS ( 'FROM M01 ( 'CORRECTION NONE' ( 'scVelocity = VELOCITY OF M01 ( 'FROM MARS ( 'CORRECTION NONE' -' ) -' ) ) -' ) -' ) )
Making a CK File
23
N IF
PREDICKT - Orientations
Navigation and Ancillary Information Facility
Example: these spec file keyword assignments specify the nominal nadir orientation for the THEMIS instrument, flown on the M01 spacecraft
ORIENTATION_NAME PRIMARY SECONDARY BASE_FRAME += += += += 'CameratoMars' '+Z = ToMars' '+Y = scVelocity' 'J2000'
Making a CK File
24
N IF
A schedule is defined by specifying a series of time intervals during which a given orientation is to be followed
For each interval for a given CK ID the spec file defines the orientation name, start time, and stop time (as Ephemeris Times)
Example: these spec file keyword assignments specify a schedule with a single window during which M01 (Mars Odyssey) will yield nadir-pointed orientation for the THEMIS instrument
CK-SCLK CK-SPK CK-FRAMES CK-53000ORIENTATION CK-53000START CK-53000STOP = = += += += += 53 -53 -53000 'SOLUTION TO M01_THEMIS_IR = CameratoMars' @2004-FEB-10-00:00 @2004-FEB-15-00:00
Making a CK File
25
N IF
Making a CK File
26
N IF
$ cat m01_map_nadir.prediCkt \begindata DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS DIRECTION_SPECS ORIENTATION_NAME PRIMARY SECONDARY BASE_FRAME CK-SCLK CK-SPK CK-FRAMES CK-53000ORIENTATION CK-53000START CK-53000STOP \begintext
Making a CK File
+= ( 'ToMars += ( += (
+= ( 'scVelocity = VELOCITY OF M01 -' ) += ( 'FROM MARS -' ) += ( 'CORRECTION NONE' ) += 'CameratoMars' += '+Z = ToMars' += '+Y = scVelocity' += 'J2000' = = += += += += 53 -53 -53000 'SOLUTION TO M01_THEMIS_IR = CameratoMars' @2004-FEB-10-00:00 @2004-FEB-15-00:00
27
N IF
$ cat m01_map_nadir.furnsh \begindata KERNELS_TO_LOAD = ( 'naif0007.tls' 'm01_v26.tf' 'mar033-5.bsp' 'm01_map_rec.bsp' 'm01.tsc' ) \begintext $ prediCkt -furnish m01_map_nadir.furnsh -spec m01_map_nadir.prediCkt -ck m01_map_nadir.bc -tol 0.01 degrees -sclk m01.tsc Begin Segment: 1 --- SOLUTION TO M01_THEMIS_IR = CameratoMars Constructing Segment From: 2004 FEB 10 00:00:00.000 To : 2004 FEB 15 00:00:00.000 Percentage finished: 0.0% Percentage finished: 5.0 % ... Percentage finished: 95.0 % $
Making a CK File
28
N IF
Navigation and Ancillary Information Facility
July 2013
Note: the EK is infrequently used by NASA flight projects. Only a brief overview of the EK subsystem is provided.
N IF
Scope
Navigation and Ancillary Information Facility
This tutorial provides an overview of the entire Events Kernel subsystem, comprised of three components:
Science Plan Sequence Notebook ESP ESQ ENB
N IF
Assemble, archive and provide convenient and useful access to plans, commands and notes about the acquisition of space science observations:
For use by on-going project science and engineering team members For use by post-mission researchers
Accomplish the above with minimal impact on science and mission operations team members
Intro to EK Subsystem
N IF
Scientists Notebook
Logical View
Sequence Component
Notebook Component
Component View*
N IF
Sequence Component (ESQ)
Component View
Database Kernel
DBK
Web + DBK
Implementation*
N IF
Each entry is a statement of science objectives for a series of coordinated observations to be made over a stated period of time
Might include some information about the planned mechanics (observation design) for obtaining the data
This component could be implemented as a part of the SEQUENCE component (ESQ), or as a part of the NOTEBOOK component (ENB), or as a separate product using some other mechanism
Intro to EK Subsystem
N IF
Sequence - ESQ
Navigation and Ancillary Information Facility
Principal entries are instrument and spacecraft commands or macro calls that carry out the objectives of the Science Plan. These contain the lowest level of detail that could be helpful while also being practical for inclusion in the E-kernel product
Could include ground system events, such as tracking station status Could include announcements of the occurrence of geometric conditions of wide interest, such as equator crossing, occultation entry, etc. Could include state records that summarize the status of an instrument or subsystem or spacecraft at a given epoch. (If to be included, state records might be derived rather than actually stored as physical objects.)
Intro to EK Subsystem
N IF
Notebook - ENB
Navigation and Ancillary Information Facility
Entries are notes provided by scientists and flight team engineers about what happened as mission operations are conducted, including unplanned, unanticipated or unexplained occurrences Entries could also be general notes thought to be of interest to scientists Entries submitted using e-mail can include MIME attachments, such as GIF, JPEG, EXCEL, WORD, etc., in addition to plain ASCII text Entries submitted using WWW are limited to plain ASCII text
Intro to EK Subsystem
N IF
E-Kernel Status
Navigation and Ancillary Information Facility
The E-kernel is the least well developed and least used component of the SPICE system
Not of as much interest to flight project instrument and engineering teams as the other SPICE components Their perception is that EK information could be useful to future users of a missions data, but not so much to an active flight team, and since they are already very busy they have not enough time to contribute input to an EK
Unfortunately NAIF and other kernel producers seem unlikely to produce EK components in the future
Intro to EK Subsystem
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
N IF
WebGeocalc
Navigation and Ancillary Information Facility
NAIF is implementing a client-server GUI interface to a SPICE geometry engine All you need is a standard browserit connects to a server holding a SPICE-based geometry engine and a large set of SPICE kernels How might this be useful to you?
Check your own SPICE-based code under development Obtain a quick back-of-the-envelope calculation Diagnose geometry problems Opens SPICE capabilities to non-programmers
Version 1.0 release expected around October 2013 See next two pages for visuals
Plans and Possibilities for Further Development 3
N IF
Example: compute the angular separation of Phobos and Mars as seen from the Mars Odyssey spacecraft during the period from Mar 01 to June 01, 2011, using a 12 hour time step.
N IF
Angular separation of Phobos from Mars as seen from the Odyssey spacecraft. Both numeric and graphic results are provided.
N IF
Python
Considerable prototyping has been done Whether or not this effort will proceed, and when, is uncertain
N IF
Programmatic interface to the WebGeocalc geometry engine GUI tool for easier creation of a SPICE frame, and subsequent visualization thereof GUI tool that will contrast a set of SPK files, thus aiding you in selecting the one(s) of interest predict spk tool that makes it easy to construct an SPK file from simple rules More high-level computations, such as instrument footprint coverage More geometry finder computations Complete a star catalog subsystem initialed long ago
N IF
Additional target models: rings, gravity, atmosphere, magnetosphere, Develop a more flexible and extensible instrument modeling mechanism
N IF
N IF
Navigation and Ancillary Information Facility
July 2013
N IF
DSK
N IF
Example: image created from MGS laser altimeter (MOLA) Mars DEM
DSK
N IF
Surface of object is represented as a collection of triangular plates More flexible than digital elevation model: any arbitrary 3-D surface can be modeled
Surface could be a complicated shape with multiple surface points having the same latitude and longitude
Less efficient than digital elevation model of similar resolution in terms of storage and computational speed
DSK
Phobos
Itokowa
N IF
High-level functions include, but are not limited to, the following:
Compute sub-observer point on surface and height of observer above surface Compute intercept of ray with surface Determine whether a portion of a target bodys surface is within the FOV of specified instrument at specified time. Determine occultation/transit state of a point target Compute limb and terminator location Compute Illumination angles at a specified surface point
DSK
N IF
Create DSK files: import other surface shape data sets into SPICE DSK format Port DSK files Provide comment area access Summarize DSK file contents Subset or merge DSK files Down sample DSK files Convert one DSK data type to another Note: DSKs cannot be read if in non-native binary format
Use BINGO or TOXFR/TOBIN to change between binary formats
DSK
N IF
Other inputs: target body name, epoch, aberration correction, observer name. Outputs: sub-observer point in Cartesian coordinates, expressed in the body-fixed frame associated with the target, and altitude of the observer above the sub-point.
DSK
N IF
LAT/LON and height above ellipsoid or distance from center of frame
MKDSK Program
(SPICE Toolkit)
DSK
Digital shape kernel Digital Terrain Shape Model
MKDSK Program
(SPICE Toolkit)
Text editor
(Usually done by NAIF)
Some source of rotation state information (pole RA/DEC and prime meridian location)
DSK
Text editor
(Usually done by NAIF)
Y
PCK
Planetary constants kernel containing rotation data for the body, and possibly tri-axial shape
Orientation
N IF
DSK
Digital shape kernel Digital Terrain Shape Model Pick one* shape model
Shap e
* Sometimes the triaxial model is needed in addition to one of the other two
SPICE modules
PCK
Orientation
DSK
Planetary constants kernel containing rotation data for the body, and possibly tri-axial shape
N IF
History
A partial alpha-test DSK Toolkit was released in July, 2010 Available in Fortran, C, IDL and JNI Contains support only for the tessellated plate model data type The DSK File format used in this prototype has been finalized; the format will be supported by the official SPICE Toolkit. Work on the digital elevation model portion is ongoing now
Plans
Release date of a first official version of the DSK system is TBD Possibly towards the end of calendar 2013
DSK
10
July 2013
General Reading, including installing the SPICE Toolkit Document Name File Name Installing the SPICE Toolkit Instructions for getting the Toolkit components from NAIF's FTP server Preparing your computer for programming with SPICE Toolkit Contents New features and major changes Installing_toolkit README
Description/Comments A collection of viewgraph-style packages providing tutorial information on nearly all components of the SPICE system. Description of the files to be FTP'd in order to get, install and use the SPICE Toolkit.
TUTOR T T Describes the structure and contents of the Toolkit Describes significant new features added to the Toolkit since the last version.
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T= SPICE Toolkit, in the /doc subdirectory GETTK = Go to the desired language and then platform under ftp://naif.jpl.nasa.gov/pub/naif/toolkit
General SPICE Programming Document Name Must Useful SPICE Subroutines Permuted Index
File Name Mostused.html spicelib_idx.html, cspice_idx.html, icy_idx.html, mice_idx.html cspice icy mice summary_of_key_points *.f or *_c.c
Location T T
Description/Comments Practical but terse specifications, including examples, for many popular routines. Permuted index built from the Brief Abstract found in every routine. Helps focus your search for a routine that meets your needs. A discussion of how the product is produced and how to use it. (Note: only cspice is available in C toolkits; cspice and icy are available in IDL toolkits; cspice and mice are available in MATLAB toolkits.) Tips for getting started on programming with SPICE modules. Each module (subroutine) in SPICELIB and CSPICE contains an extensive "header" providing the detailed specifications for the routine needed by a programmer. Examples are included. IDL and MATLAB interface wrappers, providing some instructions on use of the named API. More detail is provided in the corresponding CSPICE header. A summary of numeric ID codes used throughout the SPICE system Reference for configuring and using the exception handling system built-in to SPICELIB and CSPICE A discussion of the most commonly encountered problems using SPICE
CSPICE Required Reading ICY Required Reading MICE Required Reading Summary of Key Points Module headers (Also wee "wrappers" below) ICY and MICE wrappers around corresponding CSPICE modules NAIF IDs Required Reading Error Required Reading Common Problems Required Reading
TUTOR T
T T T
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
Ephemerides for spacecraft and solar system bodies (SPK Subsystem) Document Name File Name Location SPK Tutorial Making an SPK Tutorial Using Frames Tutorial SPK Required Reading Frames Required Reading NAIF IDs Required Reading SPC Required Reading Kernel Required REading BRIEF User's Guide SPACIT User's Guide Convert User's Guide spk making_an_spk using_frames spk frames naif_ids spc kernel brief spacit conver TUTOR TUTOR TUTOR T T T T T T T T
Description/Comments Tutorial on using SPK files Tutorial on making an SPK file Tutorial on using frames, including in SPK routines Reference for the SPK subsystem Reference for working with reference frames Summarizes numeric ID codes used throughout the SPICE system Reference for use of the "comment area" in binary kernels Reference for general specifications of text kernels BRIEF produces a concise summary of the contents/coverage of an SPK file. SPACIT provides file conversion, detailed summarization and read access to internal comments (metadata). Describes use of the command line utilities named TOBIN and TOXFR used to convert binary kernels to transfer format and vice-versa. Comment is used to add, extract, read and delete comments (metadata) in binary kernels. SPKMERGE is a utility program used to merge two or more SPK files, or to subset a single SPK file. SPKDIFF computes differences between geometric states obtained from two SPK files and either displays these or shows statistics about them. SPY is a utility for validating, inspecting and analyzing SPKs. MKSPK is a utility for making an SPK file from a set of state vectors or conic elements or two-line elements.
Comment User's Guide SPK Merge User's Guide SPKDIFF Users Guide
T T T
spy.txt mkspk
UTIL T
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory UTIL = Utilities link on the NAIF website
Target body size, shape and orientation (PCK Subsystem) Document Name File Name PCK Tutorial High Accuracy Orientation and Body-fixed Frames for the Moon and Earth tutorial PCK Required Reading Frames Required Reading NAIF IDs Required Reading Kernel Required Reading pck lunar-earth_pck-fk
Description/Comments Tutorial viewgraphs on using PC-kernels Tutorial viewgraphs on special orientation files (binary PCKs) and body-fixed frames for the moon and the earth Reference for the PCK subsystem Reference for working with reference frames Summarizes numeric ID codes used throughout the SPICE system Reference for general specifications of text kernels
T T T T
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
Instrument Information Pertinent to SPICE (IK Subsystem) Document Name File Name IK Tutorial IK Required Reading n/a Frames Required Reading NAIF IDs Required Reading Kernel Required Reading ik ik *.ti frames naif_ids kernel
Location TUTOR -D T T T
Description/Comments Tutorial viewgraphs on using I-kernels (Not yet written!) Look at an existing I-kernel; these are text files that contain substantial internal documentation Reference for working with reference frames Summarizes numeric ID codes used throughout the SPICE system Reference for general specifications of text kernels
D= Project Data on NAIF web pages (http://naif.jpl.nasa.gov/naif/data.html) TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
Orientation of a Spacecraft or Structure (CK Subsystem) Document Name File Name CK Tutorial Using Frames Tutorial CK Required Reading Frames Required Reading NAIF IDs Required Reading SPC Required Reading Rotations Required Reading CKBRIEF User's Guide SPACIT User's Guide Convert User's Guide Comment User's Guide DAFCAT User's Guide CKslicer Users Guide CKsmrg MSOPCK Users Guide FRMDIFF Users Guide ck using_frames ck frames naif_ids spc rotation ckbrief spacit convert commnt dafcat ckslicer.txt chsmrg.txt msopck frmdiff
Description/Comments Tutorial viewgraphs on using C-kernels Tutorial on using frames, including in transformation modules Reference for the CK subsystem Reference for working with reference frames Summarizes numeric ID codes used throughout SPICE Reference for use of the "comment area" in binary kernels Reference for construction and use of rotation matrices within the SPICE context CKBRIEF produces a concise summary of the contents/coverage of an SPK file. SPACIT provides file conversion, detailed summarization and read access to internal comments (metadata). Describes use of the command line utilities TOBIN and TOXFR used to convert binary kernels to transfer format and vice-versa. COMMENT is used to add, extract, read and delete comments (metadata) in binary kernels. DAFCAT provides a very simple and simplistic file merge capability for CK files. CKSLICER subsets a CK into another CK file. CKSMRG merges segments in Type 3 CK files. MSOPCK is a utility for making a CK file from orientation data in the form of quaternions, Euler angles or rotation matrices. Provides a statistical comparison of the orientations of two frames, one or both of which might be specified using CK(s).
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory UTIL = Utilities link on the NAIF website
Connectivity of Reference Frames (FK Subsystem) Document Name File Name Frames Tutorial Using Frames Dynamic Frames n/a Frames Required Reading NAIF IDs Required Reading Rotations Required Reading Kernel Required Reading FRMDIFF Users Guide fk using_frames dynamic_frames *.tf frames naif_ids rotation kernel frmdiff
Description/Comments Tutorial viewgraphs on contents of a Frames kernel Tutorial viewgraphs on using Frames kernels Tutorial on defining/implementing custom so-called dynamic frames Look at an existing Frames kernel; these are text files and contain substantial internal documentation Reference for the Frames subsystem Summarizes numeric ID codes used throughout the SPICE system Reference for construction and use of rotation matrices within the SPICE context Reference for general specifications of text kernels Provides a statistical comparison of the orientations of two frames, one or both of which might be specified using CK(s).
D= Project Data on NAIF web pages (http://naif.jpl.nasa.gov/naif/data.html) TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
"EVENTS", broken down into three sub-products (EK Subsystem) Document Name File Name Location Introduction to EK subsystem EK Required Reading ek_intro ek TUTOR T
Description/Comments Tutorial Introduction to the Events subsystem Reference for the Events-kernel subsystem
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
Time Conversion Document Name Time Tutorial Time Required Reading SCLK Required Reading CHRONOS User's Guide Kernel Required Reading time time SCLK
File Name
Location TUTOR T T T T
Description/Comments Tutorial viewgraphs on time conversions Reference on time systems (excluding SCLK) Reference on spacecraft clock time CHRONOS is a full-featured, flexible time conversion utility program Reference for general specifications of text kernels
chronos kernel
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory
Geometry Finder (GF Subsystem) Document Name Geometry Finder Tutorial Geomeetry Finder Required Reading
Location TUTOR T
TUTOR = Tutorials on NAIF web pages (http://naif.jpl.nasa.gov/tutorials.html) T = SPICE Toolkit: Plain text, in the /doc subdirectory HTML under the /doc/html/ subdirectory