SPICE Tutorials All
SPICE Tutorials All
Welcome
to the
SPICE Tutorials
April 2023
N IF Objectives
Navigation and Ancillary Information Facility
Welcome to tutorials 2
N IF Tutorials Scope
Navigation and Ancillary Information Facility
• Broad coverage
– 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
– Does not cover Java Native Interface (JNISpice), or the Python
(e.g. SpiceyPy), Ruby, Swift and other 3rd party offerings.
• 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 3
N IF Repeated Material
Navigation and Ancillary Information Facility
Welcome to tutorials 4
N IF Your SPICE Odyssey Begins Here
Navigation and Ancillary Information Facility
• Don’t let this size bother you… just work your way
into it bit by bit
• Most customers use only a handful of these APIs
• Hundreds of others just like you are using SPICE
today
Welcome to tutorials 6
N IF The NAIF Team at JPL
Navigation and Ancillary Information Facility
April 2023
N IF Why Did NAIF Build SPICE?
Navigation and Ancillary Information Facility
- have the ability to revise the data and software tools used to
produce their own observation geometry data
SPICE Story 2
N IF What Existed Prior to SPICE ?
Navigation and Ancillary Information Facility
Scientist’s Data
Analysis Program
S/C
Orientation
Data
SEDR
Generation SEDR SEDR
Scientist’s
Software
Science
SEDR Modules Results
Parameters
Database Instrument
calibration
and other
data
SEDR
Commands Science
EDR* EDR EDR Instrument
Science Data
Telemetry
Generation
SPICE Story * EDR = Experiment Data Record = "raw" science instrument data 3
N IF SEDR System Characteristics
Navigation and Ancillary Information Facility
SPICE Story 4
N IF The SPICE Idea
Navigation and Ancillary Information Facility
Science
Telemetry
SPICE Story 5
N IF SPICE Benefits vs. SEDR
Navigation and Ancillary Information Facility
SPICE Story 6
N IF SPICE “Challenges” vs. SEDR
Navigation and Ancillary Information Facility
SPICE Story 8
N IF Space Agencies Using SPICE
Navigation and Ancillary Information Facility
CSA RSA
ESTEC DLR
GRC MIT
Ames ESAC
LASP APL ESOC
JPL
GSFC ASI
SWRI CNES KARI JAXA
Langley
JSC
Marshall UAESA
ISRO
NASA Field Centers European Space Agency Indian Space Research Organization
SPICE Story 10
N IF
Navigation and Ancillary Information Facility
An Overview of SPICE
NASA’s Observation Geometry System
for Space Science Missions
April 2023
N IF What Can One Do With SPICE?
Navigation and Ancillary Information Facility
• Positionsand velocities of
planets, satellites, comets,
asteroids and spacecraft
Overview of SPICE 2
N IF What One Can Do With SPICE
Navigation and Ancillary Information Facility
Examples
50
100
150
When is the spacecraft’s
When is an object
altitude within a given
in shadow (occultation) ?
range (say 50 to 100 km)?
When is an
When is an object in front of instrument
another, as seen from a pointing at
spacecraft (transit)? an object?
Overview of SPICE 3
N IF Examples of How SPICE Is Used
Navigation and Ancillary Information Facility
Evaluation of a
planned trajectory
Spacecraft Visibility
Angular size of Phobos
Station #1
as seen from the MEX spacecraft
Station #2 Mission engineering
Station #3 analyses
Time
Planning an instrument
pointing profile
Latitude
Science data archiving
and analysis
Longitude
Overview of SPICE 4
N IF SPICE Pictorial Summary
Navigation and Ancillary Information Facility
From assorted sources
Planet ephemeris
S/C trajectory
S/C orientation
Your Program
SPICE
Distances
Utility Your Velocities
Programs Modules
SPICE Altitudes
Kernels Latitudes
(Data) A Few Longitudes
SPICE Lighting Angles
Modules
etc., etc.
Text editor
Orientation
and
size/shape
of planet
The Solar System
Planet
Time Conversion
Calculations
Overview of SPICE 6
N IF How Use Ancillary Data?
Navigation and Ancillary Information Facility
• The text above uses past tense, but doing the same
functions for future times to support mission
planning is equally applicable
Overview of SPICE 7
N IF From Where do Ancillary Data Come?
Navigation and Ancillary Information Facility
Overview of SPICE 8
N IF Why Use SPICE?
Navigation and Ancillary Information Facility
Overview of SPICE 9
N IF SPICE System Components
Navigation and Ancillary Information Facility
Documentation ……….........
Tutorials ………......
S Spacecraft
P Planet
I Instrument
E Events
* Coined by Dr. Hugh Kieffer, USGS Astrogeology Branch, Flagstaff AZ, circa 1985
Overview of SPICE 11
N IF SPICE Data Overview
Navigation and Ancillary Information Facility
P
Planet
PcK Target body size,
shape and orientation
I
Instrument IK
Instrument field-of-view size,
shape and orientation
C CK
Orientation of space vehicle or
any articulating structure on it
Camera-matrix
Events information:
E EK - Science Plan (ESP)
- Sequence of events (ESQ)
Events ESP ESQ ENB - Experimenter’s Notebook (ENB)
Overview of SPICE 14
N IF SPICE System Data - 3
Navigation and Ancillary Information Facility
• Frames
FK - Definitions of and specification of relationships
between reference frames (coordinate systems)
- Both “fixed” and “dynamic” frames are available
UTC = Coordinated Universal Time TDB = Barycentric Dynamical Time ET = Ephemeris Time SCLK = Spacecraft Clock Time
Overview of SPICE 15
N IF SPICE System Data - 4
Navigation and Ancillary Information Facility
• Meta-kernel
MK - A means to conveniently specify a collection of
real kernels you would like to use together
Overview of SPICE 16
N IF SPICE Toolkit Software
Navigation and Ancillary Information Facility
Contents Versions
SPK
PcK
User’s Planning Program
Evaluation of a
IK planned orbit
PcK
User’s Geometry Program
IK Instrument
Data
CK User’s Own Modules
User’s
Derived Science
EK Observation Data
Geometry
Analysis
Selected Program
SCLK
SPICE Toolkit Instrument
Library Calibration
LSK Modules Data
FK
Wonderful
DSK Science
Results
Select kernel types and specific kernels as needed
Overview of SPICE 19
Using SPICE:
N IF Science Data Peer Review Example
Navigation and Ancillary Information Facility
SPK
PcK
CK Numeric Results
Internet
FK
Graphic Results
SCLK
LSK
DSK
Overview of SPICE 20
N IF SPICE System Characteristics - 1
Navigation and Ancillary Information Facility
Overview of SPICE 21
N IF SPICE System Characteristics - 2
Navigation and Ancillary Information Facility
Overview of SPICE 22
N IF Supported Environments
Navigation and Ancillary Information Facility
Overview of SPICE 23
N IF What “Vehicle” Types Can Be Supported?
Navigation and Ancillary Information Facility
• Cruise/Flyby • Landers
– Remote sensing – Remote sensing
– In-situ measurement – In-situ measurements
– Rover or balloon relay
– Instrument calibration
• Orbiters • Rovers
– Remote sensing – Remote sensing
– In-situ measurement – In-situ sensing
– Communications relay – Local terrain characterization
Overview of SPICE 25
N IF History
Navigation and Ancillary Information Facility
Overview of SPICE 26
N IF Original Purpose for SPICE
Navigation and Ancillary Information Facility
Science archive
preparation
Overview of SPICE 27
N IF Large Breadth of Use
Navigation and Ancillary Information Facility
Overview of SPICE 28
N IF Ancillary Data Archives
Navigation and Ancillary Information Facility
Overview of SPICE 29
N IF SPICE Users
Navigation and Ancillary Information Facility
Overview of SPICE 30
N IF Building Blocks for Your Applications
Navigation and Ancillary Information Facility
I C
S P E
Overview of SPICE 31
N IF
Navigation and Ancillary Information Facility
Fundamental Concepts
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Preface
• Time
• Reference Frames
• Coordinate Systems
• Positions and States
• Aberration Corrections
Fundamental Concepts 2
N IF Preface
Navigation and Ancillary Information Facility
Fundamental Concepts 3
N IF Time
Navigation and Ancillary Information Facility
Fundamental Concepts 4
N IF Atomic Time and UTC
Navigation and Ancillary Information Facility
Fundamental Concepts 5
N IF Astronomical Time – UT1
Navigation and Ancillary Information Facility
UT1
Fundamental Concepts 6
N IF Tying UTC to Earth’s Rotation (UT1)
Navigation and Ancillary Information Facility
Ideally, UTC noon and astronomical noon at Greenwich (UT1) should occur
simultaneously. However, the earth’s rotation is not uniform. Eventually,
UTC noon and astronomical noon at Greenwich get out of sync.
UTC
UT1
Fundamental Concepts 8
N IF Barycentric Dynamical Time
Navigation and Ancillary Information Facility
Fundamental Concepts 9
N IF Terrestrial Dynamical Time
Navigation and Ancillary Information Facility
TDT-TDB
Magnified by 1000 As magnified amplitude
views show, slopes are
actually non-zero and non-
constant: clocks in
different time systems
generally run at slightly
different rates, and the
TAI-TDB differences in rates may be
time-varying.
Actual amplitude of Magnified by 1000
periodic term =
~1.6e-3 seconds Differences at TDB = J2000
are non-zero: the epoch
UTC-TDB “J2000” = 2000 JAN 1
12:00:00 in different time
systems occurs at different
TDB times.
Magnified by 1000
Fundamental Concepts 11
N IF Spacecraft Clocks
Navigation and Ancillary Information Facility
Fundamental Concepts 13
SPICE Definitions:
N IF Reference Frames & Coordinate Systems
Navigation and Ancillary Information Facility
Fundamental Concepts 14
N IF Reference Frame Center
Navigation and Ancillary Information Facility
Fundamental Concepts 15
N IF Types of Reference Frames
Navigation and Ancillary Information Facility
• 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
» Instrument
» Dynamic frames
• For example, frames defined by time-dependent vectors
Fundamental Concepts 16
N IF J2000 Frame
Navigation and Ancillary Information Facility
Equatorial plane
Plane normal to the earth’s
spin axis, Z
Ecliptic plane
Plane defined by movement
of the earth around the sun
eg
.4 d
~23 YJ2000
Y = Z cross X
Intersection of
XJ2000 equatorial and
ecliptic planes,
called vernal
equinox
*Caution: The name “J2000” is also used to refer to the zero epoch of the ephemeris time system (ET, also known as TDB).
Fundamental Concepts 17
N IF The ICRF Frame
Navigation and Ancillary Information Facility
Fundamental Concepts 20
N IF Topocentric Frames
Navigation and Ancillary Information Facility
Fundamental Concepts 25
N IF Transforming States
Navigation and Ancillary Information Facility
SB(t) = TA to B(t)SA(t)
where
Si(t) =
( ) Pi(t)
dPi(t)/dt i = A or B
and
( )
RA to B(t) 0
TA to B(t) =
dRA to B(t)/dt RA to B(t)
Fundamental Concepts 27
N IF Aberration Corrections: Introduction
Navigation and Ancillary Information Facility
Saturn
+ Cassini spacecraft
during interplanetary
cruise
Sun
Fundamental Concepts 29
N IF Example: Predicted vs Actual Photo
Navigation and Ancillary Information Facility
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 LT LT+S
Predicted images using Predicted images using light Predicted images using light
uncorrected target position time-corrected target time and stellar aberration-
and orientation and position and orientation and corrected target position, light
uncorrected star direction uncorrected star direction time-corrected target
vector vector orientation, and stellar
aberration-corrected star
direction vector
Fundamental Concepts 30
N IF Prediction Without Corrections
Navigation and Ancillary Information Facility
Body motion
Actual relative to solar
star system barycenter
image
Actual
body
image
Fundamental Concepts 31
N IF Light Time Corrections
Navigation and Ancillary Information Facility
Target’s
velocity Target’s angular
vector velocity vector
Target’s (geometric) position
and orientation at time ET Target’s position and
Target travels this orientation at time ET-LT
path (along the black (light time corrected
Note: The angular separation of
the geometric and light time arc) in LT seconds position and orientation)
corrected positions as seen by
the observer has been
exaggerated for readability.
At time ET, the observer’s 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 32
N IF Prediction Using Light Time Corrections
Navigation and Ancillary Information Facility
Body motion
relative to solar
Actual system barycenter
star
image
Actual
body
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 33
N IF Stellar Aberration Correction
Navigation and Ancillary Information Facility
Velocity component
orthogonal to
observer-target
position
To the observer, light appears to travel this path
Observer’s velocity
relative to Solar System Observer’s position at time ET
Barycenter
At time ET, the observer’s 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 34
N IF Prediction Using "LT+S" Corrections
Navigation and Ancillary Information Facility
Actual
star
image
Actual
body
image
Using the light time and stellar aberration-corrected target position, light time-
corrected 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 35
N IF Newtonian Stellar Aberration Effect
Navigation and Ancillary Information Facility
Camera
Photon
Photon
emission
reception
from Target
at ET
Photon path length = c * LT at ET - LT
Observer at
ET-LT Solar System Barycentric Reference Frame
Fundamental Concepts 37
N IF Effect of Aberration Corrections - 2
Navigation and Ancillary Information Facility
Fundamental Concepts 38
N IF Effect of Aberration Corrections - 3
Navigation and Ancillary Information Facility
Fundamental Concepts 39
N IF Effect of Aberration Corrections - 4
Navigation and Ancillary Information Facility
Fundamental Concepts 40
N IF
Navigation and Ancillary Information Facility
SPICE Conventions
April 2023
N IF SPICE Lexicon - 1
Navigation and Ancillary Information Facility
• Text kernel
– 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
– Any set of text kernels, excepting MKs, 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
SPICE Conventions 4
N IF SPICE Lexicon - 4
Navigation and Ancillary Information Facility
• “Command file”
– Many SPICE application and utility programs either require, or
optionally accept, an input file containing program directives,
and sometimes input data.
– The following names are used synonymously:
» setup file
» preferences file
» command file
» specifications file
» definitions file
• “Found flag”
– A Boolean output (“True” or “False”) from a SPICE API that
informs your program whether or not data were found that
match your request
• Database Kernel (DBK)
– A SPICE kernel that, in conjunction with Toolkit DBK software,
provides a self-contained SQL-like database capability.
SPICE Conventions 5
N IF SPICE Lexicon - 5
Navigation and Ancillary Information Facility
• Coverage
– The period(s) of time for which a time-based kernel contains data
• Deprecated software
– Toolkit code that, while still useable, has been superseded with a
newer and presumably better version
– We encourage you to not use deprecated SPICE software
– Deprecated modules are so marked in their headers
• Toolkit version naming
– "Nxxxx" e.g. N0066 is Version 66
» Often shortened to just Nxx (e.g. N66)
– Used for all instances of a given toolkit release
» Fortran (“Toolkit”), C (“CSPICE”), IDL (“Icy”), MATLAB (“Mice”)
• “Satellite” is used to refer only to a natural satellite,
never to a spacecraft.
• “Run-time” occurs when you execute a program
SPICE Conventions 6
N IF SPICE Lexicon - 6
Navigation and Ancillary Information Facility
Names used synonymously
• Kernel, SPICE file, SPICE kernel, SPICE kernel file
• Meta-kernel, Furnsh Kernel
• Module, routine, subroutine, procedure, function, application program interface (API)
• Application, program, utility, executable
• Metadata, comments
• Time, Epoch
• Encoded SCLK, ticks*
• Frame, Reference Frame** ( ≠ Coordinate System) (See the "Frames & Coordinate Systems tutorial)
• Fixed offset frame, constant offset frame, TK frame, class 4 frame
• Ephemeris, trajectory
• Rectangular coordinates, Cartesian coordinates**
• Geodetic, Planetodetic (coordinate system)
• Ephemeris time (ET), Barycentric Dynamical Time (TDB)
• Attitude, orientation
• International Celestial Reference Frame (ICRF) and Earth Mean Equator and Equinox of 2000
reference frame (J2000)
• “Body”, “solar system object,” “ephemeris object”
* Encoded SCLK always refers to absolute time; “ticks” is used to refer to both durations and absolute times.
** 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) within a
frame, and to use “frame” in the sense of a set of three orthogonal vectors that define an orientation.
SPICE Conventions 7
N IF Kernel File Names
Navigation and Ancillary Information Facility
• Common usage within NAIF for SPICE kernel file name extensions
is listed on the next page, with the following general style used:
t* text format (e.g. pck00010.tpc)
b* binary format (e.g. de430.bsp)
x* transfer format (e.g. de430.xsp)
SPICE Conventions 8
Common SPICE Kernel
N IF File Name Extensions
Navigation and Ancillary Information Facility
SPK: SCLK:
.bsp binary SPK file .tsc text SCLK file
.xsp transfer format SPK file MK:
PcK: .tm text meta-kernel file (“FURNSH kernel”)
.tpc text PcK file
(The most common type PcK)
DSK:
.bpc binary PcK file .bds binary DSK file
(Very few instances of this)
.xpc transfer format PcK file DBK:
.bdb binary database kernel
IK: .xdb transfer format database kernel
.ti text IK file EK Family (ESP, ESQ, ENB)
FK: ESP:
.tf text FK file .bep binary Science Plan EK file
LSK: .xep transfer format Science Plan EK file
.tls text LSK file ESQ:
CK: .bes binary Sequence Component EK file
.bc binary CK file .xes transfer format Sequence Component EK file
.xc transfer format CK file
ENB:
.ten text Experimenter’s Notebook EK file
SPICE Conventions These are strong suggestions but not requirements 9
N IF Common Document Name Extensions
Navigation and Ancillary Information Facility
SPICE Conventions 10
N IF Public and Private Modules
Navigation and Ancillary Information Facility
SPICE Conventions 12
N IF Quaternions
Navigation and Ancillary Information Facility
SPICE Conventions 13
N IF Names and IDs
Navigation and Ancillary Information Facility
SPICE Conventions 14
N IF Use of Quotes
Navigation and Ancillary Information Facility
SPICE Conventions 15
N IF Pluto is a Special Case in SPICE
Navigation and Ancillary Information Facility
SPICE Conventions 16
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Topics
Navigation and Ancillary Information Facility
– In text kernels
» Normally used to define name/ID mappings for instruments, their
subsystems/detectors and spacecraft structures
• See comments and the actual data sections in a text kernel for the complete
listing of the names/IDs defined in that kernel
» These assignments exist most often in FKs (e.g. MER, MEX,
JUNO, MSL), sometimes in IKs (e.g. CASSINI, MGS), but could be
placed in any text kernel
– Mappings defined in text kernels take precedence over those defined
in Toolkit source code
N IF Planets
Navigation and Ancillary Information Facility
NAIF_BODY_NAME += ( 'my_spacecraft_name' )
NAIF_BODY_CODE += ( my_spacecraft_ID )
• Note: SPICE users will rarely if ever need to call these routines
– To get the surface ID for a given surface name and body ID:
CALL SRFSCC( SRFSTR, BODYID, CODE, FOUND )
– To get the surface name for a given surface ID and body name:
CALL SRFCSS( CODE, BODSTR, SRFSTR, FOUND )
– To get the surface name for a given surface ID and body ID:
CALL SRFC2S( CODE, BODYID, SRFSTR, FOUND )
• CK IDs
– Historically IDs used in CKs are called structure IDs but in reality they
are much more closely related to frames than to 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 simply the spacecraft ID. This SCLK ID is used by SPICE
APIs. Caution: the negative of the SCLK ID is used in SCLK kernel
keywords.
– 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 35
N IF Name/IDs Example -- CASSINI (1)
Navigation and Ancillary Information Facility
structures
-82791 ‘CASSINI_CDA_ART’
-82792 ‘CASSINI_CDA_BASE’
April 2023
N IF Getting the Toolkit
Navigation and Ancillary Information Facility
• You now have the expanded toolkit (or cspice or icy or mice or
JNISpice) package. In it the APIs are already compiled into
object modules, the needed libraries have been assembled,
and the several Toolkit utility executables have been built. In
most cases you need NOT re-do any of this build work! But
read on about some special circumstances.
Installing the SPICE Toolkit 3
N IF Configuring Your Computer
Navigation and Ancillary Information Facility
* According to modern SPICE conventions, the file name extension ".tsp" seen above
should be “.xsp”. The “.tsp” extension is kept for historical reasons.
April 2023
N IF Topics (1)
Navigation and Ancillary Information Facility
• Toolkit Architecture
• Toolkit Architecture Pictorial
• Fortran Toolkit
• C Toolkit
• IDL Toolkit
• Matlab Toolkit
• Toolkit Contents
• Toolkit Characteristics
• Toolkit Versions
• Supported Environments
• Supported Environments – Fortran – N0067
• Supported Environments – C – N0067
• Supported Environments - IDL
• Supported Environments - MATLAB
• Status for Other Environments
• Bibliography
Application Application
and Application Application Application
f2c and and and and
Utility Utility Utility Utility Utility
Programs Programs Programs Programs Programs
• Icy Documentation
– Icy Reference Guide
» Principal documentation showing how to call Icy wrappers.
» Each Icy wrapper has an HTML page containing usage
examples serving as the Icy “module header”.
– Icy Required Reading
– Provides background information essential for programming
with Icy.
• See the “IDL_Interface” tutorial for details
• Mice Documentation
– Mice Reference Guide
» Principal documentation showing how to call Mice
wrappers
– Each Mice wrapper script has a documentation header
containing usage examples, serving as SPICE “module
header”, available from the help command. This
documentation also exists as an HTML page.
• Mice Required Reading
– Provides background information essential for programming
with Mice
• See the “Matlab_Interface” tutorial for details
• Software
– Subroutine libraries, with source code
» SPICELIB (Fortran)
» CSPICE (C)
» Icy (C)
» Mice (C and Matlab scripts)
– Executable programs
» Application and utility programs
» A few example programs (called “cookbook” programs)
– Installation/build scripts (normally you do NOT need to use these)
• Documentation
– Available in plain text and HTML
• Example Data
– Sample kernel files (supplied only for use with cookbook example programs, not
valid for general use).
• Toolkit Version
– SPICE Toolkits have an associated Version number
» Example: “N0067” (also written as “N67”)
– The version number applies to all language implementations for
all supported platforms.
• 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
• 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: spicelib.idx
• C: cspice.idx
• IDL: icy.idx and cspice .idx
• Matlab: 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 34
N IF Toolkit Documentation (4)
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.
– What’s New in SPICE
» Describes new features and bug fixes in each Toolkit release,
covering the last 20 years.
» Plain text version is “doc/whats.new”.
» HTML version is accessible using the “What’s 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
• You can also use Google to view any of the Toolkit documents
– E.g., search on the API name (e.g. spkezr, spkezr_c, or cspice_spkezr (for Icy and
Mice) in combination with naif and spice
– E.g. search on the document name (e.g. CK Required Reading, spkdiff user’s guide)
Backup
PC, Linux, Intel FORTRAN, 64bit Red Hat Linux (RHE7) Intel Fortran 13.1
PC, Linux, g77, 32bit Red Hat Linux (RHE6) g77 3.4
PC, Linux, gfortran, 32bit Red Hat Linux (RHE7) gfortran 7.3
PC, Linux, gfortran, 64bit Red Hat Linux (RHE7) gfortran 7.3
PC, Windows, Intel FORTRAN, 32bit Windows 10 Intel Fortran 2021.4.0
PC, Windows, Intel FORTRAN, 64bit Windows 10 Intel Fortran 2021.4.0
Sun/SPARC, Solaris, SUN FORTRAN, 32bit Solaris 10 Sun FORTRAN 95 8.8
The OS and compiler versions listed above were used to build and test N0067
Fortran SPICE Toolkit distribution packages. These packages are expected to
work on/with newer OS and compiler versions.
The OS and compiler versions listed above were used to build and test N0067
CSPICE Toolkit distribution packages. These packages are expected to work
on/with newer OS and compiler versions.
The OS, compiler, and IDL versions listed above were used to build and test
N0067 Icy Toolkit distribution packages. These packages are expected to work
on/with newer OS, compiler, and IDL versions.
The OS, compiler, and Matlab versions listed above were used to build and test
N0067 MiceToolkit distribution packages. These packages are expected to work
on/with newer OS, compiler, and Matlab versions.
• The Mice package has been successfully built against the octave
environment (version > 3.4) on Linux and OS X. Contact NAIF if
you have questions concerning use with Octave.
“Icy”
The IDL© Interface to CSPICE
April 2023
© Harris Geospatial
N IF Topics
Navigation and Ancillary Information Facility
• Icy Benefits
• How does it work?
• Distribution
• Icy Operation
• Vectorization
• Simple Icy Example
• 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
– 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'
– Copy icy.dlm and icy.so or icy.dll to IDL's binary directory:
{The IDL install directory}/bin/bin.user_architecture
» Examples (Unix and Windows):
» cp icy.dlm icy.so /Applications/exelis/idl/bin/bin.darwin.x86_64/
» cp icy.dlm icy.dll C:\Program Files\Exelis\idl83\bin\bin.x86_64\
Warning: 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 IDL_DLM_PATH
to the directory. This directory contains an “icy.dlm” but no “icy.so.”
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…
state_i = state[*,i]
– 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]
;; Load the generic kernels using the meta kernel, and a Cassini spk.
;; Define the number of divisions of the time interval and the time interval.
STEP = 10000
cspice_str2et, [ 'Jun 20, 2004', 'Dec 1, 2005' ] , et
times = dindgen(STEP)*(et[1]-et[0])/STEP + et[0]
cspice_kclear
z
y
Trajectory of the Cassini spacecraft, in the J2000 frame, from June 20 2004 to Dec 1 2005
“Mice”
The MATLAB© Interface to CSPICE
April 2023
• Mice Benefits
• How does it work?
• Distribution
• Mice Operation
• Vectorization
• Simple Mice Examples
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
– 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
utcstr_i = utcstr(i,:)
% Construct a meta kernel, "standard.tm", which will be used to load the needed
% generic kernels: "naif0011.tls", "de421.bsp", and "pck00010.tpc".
% Load the generic kernels using the meta kernel, and a Cassini spk.
plot3(x,y,z)
cspice_kclear
% 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.
plot3(x,y,z)
cspice_kclear
Trajectory of the Cassini spacecraft, in the J2000 frame, from June 20 2004 to Dec 1 2005
April 2023
N IF Setting Path to Toolkit Executables (1)
Navigation and Ancillary Information Facility
Replace my_directory with the path in which you installed the toolkit on your computer.
Replace drive:\my_directory with the path in which you installed the toolkit on your
computer.
Preparing for Programming 3
N IF Unix: Build a SPICE Executable
Navigation and Ancillary Information Facility
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.
» For Unix, X86 architecture
• 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.:
Warning: do not invoke IDL from the Icy source directory, icy/src/icy, nor
register that directory, and do not append that directory to
IDL_DLM_PATH. This directory contains an “icy.dlm” but not “icy.so.”
• Windows specific:
– Set environment variable IDL_DLM_PATH from the Advanced pane
of the System Control Panel.
• Once registered as specified on earlier pages, confirm IDL
recognizes and can access Icy.
– Using the help command:
» Appearance of the words “not loaded” might suggest something is wrong, but
this is expected state until you execute an Icy command.
– Execute a trivial Icy command:
IDL> print, cspice_icy('version')
% Loaded DLM: ICY.
Icy 1.4.20 25-DEC-2008 (EDW)
• Use the IDL IDE’s preferences panel to set the current working
directory to the location where you will be developing your
code.
• Optional: Place your dlm_register command in a start up
script. Specify the script using the IDL IDE’s preferences panel.
– On Unix/Linux:
>> addpath('/naif/mice/lib')
>> addpath('/naif/mice/src/mice')
Backup
;; 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_kclear
Trajectory of the Cassini vehicle in the J2000 frame, for June 20, 2004 to Dec 1, 2005
% Load the generic kernels using the meta kernel, and a Cassini spk.
% 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);
plot3(x,y,z)
cspice_kclear
Trajectory of the Cassini vehicle in the J2000 frame, for June 20, 2004 to Dec 1, 2005
Introduction to Kernels
April 2023
N IF Agenda
Navigation and Ancillary Information Facility
• Overview
• Kernel architecture
• Producing kernels
• Using kernels
Introduction to Kernels 2
N IF What is a SPICE “Kernel”
Navigation and Ancillary Information Facility
Introduction to Kernels 3
N IF The Family of SPICE Kernels
Navigation and Ancillary Information Facility
• SPK • FK
– Spacecraft and Planet Ephemeris – Reference frame specifications
• PCK • SCLK
– Planetary Constants, for natural bodies – Spacecraft clock correlation data
» Orientation • LSK
» Size and shape – Leapseconds
• IK
• MK
– Instrument
– Meta-Kernel (a.k.a. “FURNSH kernel”)
• CK – Mechanism for aggregating and easily
– Orientation (“Camera-matrix”) loading a collection of kernel files
• EK
• DSK
– Events, up to three distinct components
– Digital shape kernel
» ESP: science plan
» Tesselated plate model
» ESQ: sequence » Digital elevation model (under
» ENB: experimenter’s notebook development)
• DBK
– Database mechanism
EK is rarely used » Primarily used to support the ESQ
Introduction to Kernels 4
N IF SPICE Kernel Forms
Navigation and Ancillary Information Facility
• Binary form
– Files containing mostly data encoded in binary form
» They also contain a small amount of ASCII text
– Provide rapid access to large amounts of numeric data
– Require the use of SPICE Toolkit software to produce them
– Require the use of SPICE Toolkit software to utilize their contents
• Text form
– Files containing only printing characters (ASCII values 32-126), i.e.
human-readable text.
– Produced using a text editor
– Require the use of SPICE Toolkit software to utilize their contents
Introduction to Kernels 6
N IF
Navigation and Ancillary Information Facility
Kernel Architecture
- Text kernels
- Binary kernels
- Comments in kernels
Introduction to Kernels 7
N IF Text Kernel Contents
Navigation and Ancillary Information Facility
variable_name = value(s)
Introduction to Kernels 8
N IF Example Text Kernel
Navigation and Ancillary Information Facility
KPL/<kernel type>
<some comments about the data >
An initial “comments” block
\begindata (Doesn't need a \begintext marker)
NAME = 'Sample text value'
NaMe = 'Keywords are case sensitive'
START = @2011-JAN-1
\begintext
A “comments” block
< some comments about the data >
\begindata
\begintext
< etc., etc. > Another “comments” block
Introduction to Kernels 9
N IF Text Kernel Formatting
Navigation and Ancillary Information Facility
• KPL/<text kernel type>
- Its use is optional, but is highly recommended
- Must appear on the first line, starting in column 1
- Tells SPICE software what kind of kernel it is
- Text kernel types are FK, IK, PCK, SCLK, MK
Introduction to Kernels 11
N IF Variable Names and Values
Navigation and Ancillary Information Facility
• Variable names
– Max of 32 characters
– Are case sensitive (recommendation: use only upper case)
– Cannot include space, comma, parenthesis, equals sign or tab
– Recommendation: don’t use the “+” sign as the last character
• Values
– Numeric: integer, fixed point and scientific notation are allowed
– String:
» enclosed in single quotes
» maximum length of 80 characters on a given line
• SPICE has means to concatenate multiple string values to allow for values exceeding 80
characters
» string values may contain any printing ASCII character, including blank
– Time: identified by the “@” character
– Any of these three types can be provided as an n-dimensional vector of values
» Components are separated by commas or white space (but not TABs)
» Parentheses are used to enclose the vector
» Each string value in a vector is contained in single quotes
» Values in a vector must all be of the same type (numeric, string or time)
• See “Kernel Required Reading” for more information
Introduction to Kernels 12
N IF Variable Names and Values
Navigation and Ancillary Information Facility
132 max characters, with the non-printing system-dependent end-of-line indicator at the end*
32 max characters 80 max characters, not including the single quotes at each end
Introduction to Kernels 14
N IF Comments In SPICE Kernels
Navigation and Ancillary Information Facility
Introduction to Kernels 15
N IF
Navigation and Ancillary Information Facility
Producing Kernels
Introduction to Kernels 16
N IF Making a Text Kernel
Navigation and Ancillary Information Facility
Introduction to Kernels 18
N IF
Navigation and Ancillary Information Facility
Using Kernels
Introduction to Kernels 19
N IF Loading Kernels - 1
Navigation and Ancillary Information Facility
Introduction to Kernels 20
N IF Loading Kernels - 2
Navigation and Ancillary Information Facility
• Use the FURNSH routine to load all kernels – text and binary
– CALL FURNSH ( 'name.ext' ) (Fortran)
– furnsh_c ( "name.ext" ); (C)
– cspice_furnsh, 'name.ext' (IDL)
– cspice_furnsh ( 'name.ext' ) (MATLAB)
– spiceypy.furnsh ( 'name.ext' ) (Python using SpiceyPy)
Introduction to Kernels 22
N IF
Navigation and Ancillary Information Facility
Meta-Kernels
These help make kernel management easy!
Introduction to Kernels 23
N IF What is a “Meta-Kernel”
Navigation and Ancillary Information Facility
Introduction to Kernels 24
N IF Sample Meta-Kernel
Navigation and Ancillary Information Facility
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',
All the commas
'/home/mydir/kernels/c-kernel.bc', are optional
'/home/mydir/kernels+',
'/custom/kernel_data/p_constants.tpc',
)
Introduction to Kernels 25
N IF Sample Meta-Kernel
Navigation and Ancillary Information Facility
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',
All the commas
'/home/mydir/kernels/c-kernel.bc', are optional
'/home/mydir/kernels+',
'/custom/kernel_data/p_constants.tpc',
)
• See the next two pages for some important OS-specific details!
Introduction to Kernels 26
Unix/Mac
N IF Sample Meta-Kernel
Navigation and Ancillary Information Facility
Introduction to Kernels 29
N IF Kernel Precedence Rule
Navigation and Ancillary Information Facility
Introduction to Kernels 30
N IF Unloading Kernels
Navigation and Ancillary Information Facility
Introduction to Kernels 32
N IF How Kernels are Made and Used at JPL
Navigation and Ancillary Information Facility
How Made? How Used? How Made? The EK family How Used?
1 3
Text editor or Web browser or
SBP* SPK SBP* existing file, input ESP SBP*, depending
(e.g. MKSPK) via ESQ or ENB on implementation
2
Text editor 3
for text versions
PCK SBP* SBP* ESQ SBP*
SBP*
for binary versions
2 2
Browser or
Text editor IK SBP*
e-mail ENB SBP*
2 2
Who usually makes the kernels at JPL? *SBP = SPICE-based program that uses modules from the SPICE
1
NAV and NAIF This represents current practice for Toolkit. In some cases the Toolkit contains such a program already
built. In some cases NAIF may have such a ready-built program
2
NAIF most JPL missions, but is by no means a
that is not in the SPICE Toolkit. Names of a few programs
requirement. Anyone can make SPICE files. commonly used to make kernels are shown in parentheses.
3
NAIFtoorKernels
Introduction other 33
N IF Why & How Kernels are “Modified” - 1
Navigation and Ancillary Information Facility
File Type Why Modified How Modified
-To add comments - COMMNT, SPACIT or SPICELIB module
SPK -To merge files or subset a file - SPKMERGE, DAFCAT
-To correct/revise an object ID - BSPIDMOD
Meta-kernel
(FURNSH) - To add or remove kernels to be used - Text editor
in a program
Introduction to Kernels 35
N IF SPICE Data Structures Hierarchy
Navigation and Ancillary Information Facility
EK Family
Meta-kernel
SPK CK PCK IK FK SCLK LSK (FURNSH) DSK ENB ESP ESQ
High OR AND
Level OR
Mid
Level DLA DBK
MIME
Low including
Level DAF TEXT plain text DAS
Binary Text Binary
DAF = Double Precision Array File DSK = Digital Shape Kernel (under development)
DBK = Data Base Kernel DLA = DAS Linked Array (under development)
DAS = Direct Access, Segregated
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.
Introduction to Kernels 36
N IF Problems Making Text Kernels
Navigation and Ancillary Information Facility
Introduction to Kernels 37
N IF Some Useful Tools - 1
Navigation and Ancillary Information Facility
Introduction to Kernels 38
N IF Some Useful Tools - 2
Navigation and Ancillary Information Facility
• More information
In Wikipedia, search on “newline” or “unix2dos”
Introduction to Kernels 39
N IF
Navigation and Ancillary Information Facility
April 2023
N IF What are Comments?
Navigation and Ancillary Information Facility
\begintext
Some comments
\begindata
Some data
• Binary Kernels
– Use the commnt utility program, available in the Toolkit
– Include comment information at the time of kernel creation using SPICE
APIs (subroutines)
• Text Kernels
– Use a text editor
» Begin comment sections with a “\begintext” marker, placed alone on
a line
• (The marker is not needed for comments occurring before any data)
» End comment sections with a “\begindata” marker, placed alone on a
line
• (The marker is not needed if there are no data following the comments)
• 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
– For text kernels
» Refer to “Kernel Required Reading” (kernel.req) for details
Comments in SPICE Kernels 4
N IF Viewing Comments in Kernels
Navigation and Ancillary Information Facility
• 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.
...
This SPK file was released on February 13, 2008 by the Solar System
Dynamics Group of JPL's Guidance, Navigation, and Control section.
--More--
Terminal Window
prompt> more naif0008.tls
KPL/LSK
Modifications:
--------------
2005, Aug. 3 NJB Modified file to account for the leapsecond
that will occur on December 31, 2005.
…etc.
-More--(19%)
--More--(19%)
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• HTML versions:
– <path to SPICELIB>/toolkit/doc/html/spicelib/index.html
• HTML versions:
– <path to CSPICE>/cspice/doc/html/cspice/index.html
April 2023
N IF Topics
Navigation and Ancillary Information Facility
– Encoded Spacecraft Clock, expressed as clock ticks since the clock start
• SPICE provides routines to convert between these string and
numeric representations.
• A time string used as an argument in a SPICE API must be provided
in quotes.
– Fortran, Matlab, IDL and Python: use single quotes
– C and JNI: use double quotes
Time Conversion and Formats 3
N IF Converting Time Strings (1)
Navigation and Ancillary Information Facility
SCE2C SCT2E
TIMOUT
ET2UTC
SCDECD
ETCAL
Spacecraft
Encoded
Clock
Spacecraft Clock
(SCLK)
(Ticks)
STR2ET
TDB string in SCENCD
calendar format
Time Conversion and Formats = Time APIs mentioned in this tutorial 10
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Backup
Ephemeris Time, ET and Barycentric Dynamical Time, TDB, are the same
LSK & SCLK 3
N IF The Leapseconds Kernel (LSK)
Navigation and Ancillary Information Facility
KPL/LSK
. . . <comments> . . .
\begindata
DELTET/DELTA_T_A = 32.184
DELTET/K = 1.657D-3
DELTET/EB = 1.671D-2
DELTET/M = ( 6.239996D0 1.99096871D-7 )
35, @2012-JUL-1
36, @2015-JUL-1
37, @2017-JAN-1 )
\begintext
• 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 project server.
» 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.
. . . <comments> . . .
\begindata
SCLK_KERNEL_ID = ( @2009-12-07/18:03:04.00 )
SCLK_DATA_TYPE_74 = ( 1 )
SCLK01_TIME_SYSTEM_74 = ( 2 )
SCLK01_N_FIELDS_74 = ( 2 )
SCLK01_MODULI_74 = ( 4294967296 256 )
SCLK01_OFFSETS_74 = ( 0 0 )
SCLK01_OUTPUT_DELIM_74 = ( 1 )
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 8
N IF Forms of SCLK Time Within SPICE
Navigation and Ancillary Information Facility
1/1609504792.123
• Related documents
– Kernel Required Reading
– CK Required Reading
* 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
1972-JAN-1
1972-JUL-1
1973-JAN-1
1974-JAN-1
1975-JAN-1 • New leapseconds become
1976-JAN-1
1977-JAN-1
effective only on January 1st or
1978-JAN-1
1979-JAN-1
July 1st.
1980-JAN-1
1981-JUL-1 • NAIF announces every new
1982-JUL-1
1983-JUL-1 leapsecond using the
1985-JUL-1
1988-JAN-1
"spice_announce" Mailman
1990-JAN-1 system
1991-JAN-1
1992-JUL-1
1993-JUL-1
• NAIF provides a new
1994-JUL-1
1996-JAN-1
leapseconds kernels* (LSK)
1997-JUL-1
1999-JAN-1
several months before the new
2006-JAN-1 leapsecond becomes effective
2009-JAN-1
2012-JUL-1
2015-JUL-1 + Current as of April 2023
2017-JAN-1
* NAIF provides both Linux/OSX and Windows versions of the LSK
LSK & SCLK 20
N IF
Navigation and Ancillary Information Facility
An Overview of
Reference Frames
and
Coordinate Systems
in the SPICE Context
April 2023
N IF Purpose of this Tutorial
Navigation and Ancillary Information Facility
Reference Frames
N IF Reference Frame Conventions
Navigation and Ancillary Information Facility
• Inertial
– Non-rotating with respect to stars
– Non-accelerating origin
» Velocity is typically non-zero, but acceleration is negligible
– Examples:
» J2000 (also known as EME 2000, and is generally used in
SPICE to refer to the ICRF)
» ECLIPJ2000
• Non-Inertial
– Accelerating, including by rotation
– Examples
» Body-fixed
• Associated with a natural body (e.g. planets, satellites)
» Topocentric
• Associated with an object on or near the surface of a natural
body (e.g. DSN station, rover)
» Spacecraft
• Associated with the main spacecraft structure (the “bus”)
» Instrument
• One or more frames are usually associated with each instrument
• Also applicable to a spacecraft antenna, solar array, etc.
» Dynamic
• A special family of frames unique to SPICE
• These have time-dependent orientation
– But this category does not include frames for which the orientation is
provided using a C-kernel (CK) or a PC-kernel (PCK)
Equatorial plane
Plane normal to the earth’s
spin axis, Z
Ecliptic plane
Plane defined by movement
of the earth around the sun
eg
.4 d
~23 YJ2000
Y = Z cross X
Intersection of
XJ2000 equatorial and
ecliptic planes,
called vernal
equinox
*Caution: The name “J2000” is also used to refer to the zero epoch of the ephemeris time system (ET, also known as TDB).
Fundamental Concepts 10
N IF The ICRF Inertial Frame
Navigation and Ancillary Information Facility
Ecliptic Plane
Vsun relative to earth
Y = component of Vsun perpendicular to X
Coordinate Systems
N IF SPICE Coordinate Systems
Navigation and Ancillary Information Facility
•
“Observer” is an Ephemeris Object
Point of
• interest
• “Target” is an Ephemeris Object
“Center” is an
Center Ephemeris Object •
longitude
– Increases positively eastward (-180 to +180)
• Planetodetic latitude P
Distant Observer
Frames and Coordinate Systems *The dwarf planets are: Ceres, Eris, Haumea, Makemake, Pluto 25
N IF Spherical Coordinates
Navigation and Ancillary Information Facility
• Longitude:
- angle from +X axis to projection of
Position Vector
position vector on X-Y plane of an object of
- increases in counter-clockwise
direction
Z interest
- see the API header for
restrictions on ranges
Colatitude
• Colatitude:
- Angle between +Z axis and Y
position vector (0 to 180)
- Other names used elsewhere are
zenith angle, inclination angle and
polar angle.
Longitude
• Toolkit spherical APIs :
– SPHREC, RECSPH,
DRDSPH, DSPHDR, XFMSTA X
• Elevation:
- Angle between position
vector and x-y plane, measured Y
positive towards +Z or -Z (-90 to
+90)
- In this example, elevation is
positive towards +Z.
Elevation
• Toolkit Azimuth-Elevation
APIs : Azimuth X
– AZLREC, RECAZL, DRDAZL,
DAZLDR, AZLCPO
– These APIs allow users to
indicate directions of increasing
azimuth and elevation
Frames and Coordinate Systems 27
Summary of SPICE
N IF Coordinate Transformation APIs
Navigation and Ancillary Information Facility
Ephemeris Subsystem
SPK
Focused on reading SPK files
April 2023
N IF First… clear your mind!
Navigation and Ancillary Information Facility
SPK Subsystem 2
N IF
Navigation and Ancillary Information Facility
Overview of
SPICE Ephemeris Data
SPK Subsystem 3
N IF A Picture is worth …
Navigation and Ancillary Information Facility
SPK Subsystem 4
N IF SPICE Ephemeris Data
Navigation and Ancillary Information Facility
SPK Subsystem 5
N IF Examples of SPICE Ephemeris Objects
Navigation and Ancillary Information Facility
Asteroid
Comet
Spacecraft
Earth
.... Lander or
rover
*A barycenter is the center •
of mass of a system of
Communications
•
bodies, such as Saturn
plus all of Saturn's Station
satellites, or, the sun and Satellite
all the planets, satellites,
comets and asteroids in Planet's
the solar system. Planetary mass
system center
SPK Subsystem barycenter* 6
N IF Imagine Some Ephemeris Data
Navigation and Ancillary Information Facility
SPK Subsystem 7
N IF Imagine a Simple Ephemeris File
Navigation and Ancillary Information Facility
SPK Subsystem 8
N IF Imagine a Simple Ephemeris File
Navigation and Ancillary Information Facility
SPK Subsystem 9
N IF An SPK “Segment”
Navigation and Ancillary Information Facility
– what is the object this ephemeris is for – SPICE calls this the “target”
– what is the ID of the reference frame in which the data are given
– what is the center of motion for the target
– the start and stop times of the file, Tstart and Tstop
» meaning, what are “epoch_1” and “epoch_n”
SPK Subsystem 10
N IF A Simple SPK File
Navigation and Ancillary Information Facility
Target, Ref Frame ID, Center of Motion, T1, T2, Type 13 • Each segment can contain a
different type of ephemeris data
epoch_1, x1, y1, z1, vx1, vy1, vz1 (as long as it’s been built into
epoch_2, x2, y2, z2, vx2, vy2, vz2
epoch_3, x3, y3, z3, vx3, vy3, vz3 the SPK subsystem). Examples:
epoch_4, x4, y4, z4, vx4, vy4, vz4 – Discrete state vectors
– Chebyshev polynomials
– Difference lines (unique to JPL)
Target, Ref Frame ID, Center of Motion, T3, T4, Type 2 – Etc., etc.
MID, RADIUS, X coefs, Y coefs, Z coefs • Each segment has the SPK Type
MID, RADIUS, X coefs, Y coefs, Z coefs stored in its meta-data record
MID, RADIUS, X coefs, Y coefs, Z coefs (a.k.a. segment descriptor)
(some time tag info)
• Toolkit software knows how to
Target, Ref Frame ID, Center of Motion, T5, T6, Type 1 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
SPK Data are Continuous
N IF Within a Segment
Navigation and Ancillary Information Facility
SPK Subsystem 15
N IF Chaining and Frame Transformation
Navigation and Ancillary Information Facility
SPK Subsystem 16
N IF Your Question
Navigation and Ancillary Information Facility
Huygens Probe
Titan
SPK Subsystem 17
N IF Your Dilemma
Navigation and Ancillary Information Facility
Huygens Probe
Saturn
Earth Barycenter
Earth
Solar System Barycenter
Sun
SPK Subsystem 18
N IF Not a Problem
Navigation and Ancillary Information Facility
Huygens Probe
You could carefully add
together the A, B, C, D, E
A and F vectors to obtain
the DSS14-Probe vector.
But it's easier if you let
SPICE do this for you.
B Titan
Saturn
F
Earth Barycenter
C
E
D
Earth
Solar System Barycenter
Sun
SPK Subsystem 19
N IF SPICE Chains SPK Data
Navigation and Ancillary Information Facility
Probe
Huygens Probe
SPK File
Titan-centered position
≈
DSN Stations
DSS-63 DSS-62 DSS-61 DSS-15 DSS-14 DSS-13 DSS-12 SPK File
Earth-centered positions
≈
Satellite
Titan Tethys Enceladus Mimas SPK File
Saturn barycenter-centered positions
≈
Planet
Uranus BC Saturn BC Earth BC Earth Venus BC Mercury BC
SPK File
Solar system barycenter-centered positions,
except for Earth, which is centered on the
Earth barycenter
Solar System
Barycenter
20
N IF Maybe It's Not "Simple Addition"
Navigation and Ancillary Information Facility
SPK Subsystem 21
SPICE Automates
N IF Frame Transformation
Navigation and Ancillary Information Facility
tax
n syn
Earth barycenter
Fortra re
he
used A single SPKPOS API does it all for positions! SPKEZR API does it for states.
CALL SPKPOS ('HUYGENS_PROBE', t, 'DSS-14_TOPO', 'CN+S', 'DSS-14', POSITION, LT)
22
N IF SPK Segment Order and Priority
Navigation and Ancillary Information Facility
SPK Subsystem 23
N IF Details
Navigation and Ancillary Information Facility
SPK Subsystem 24
Reading an SPK:
N IF Observers and Targets
Navigation and Ancillary Information Facility
Observer Target
Target Observer
SPK Subsystem 25
N IF SPK File Coverage - 1
Navigation and Ancillary Information Facility
• 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 file’s 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 file containing data for one object with no
data gaps
FILE START FILE END
• For any request time within any time interval comprising the
coverage for an object (i.e. the three green stripes shown
below), the SPK subsystem can return a vector representing
the state of that object relative to its center of motion.
– The SPK system will automatically interpolate ephemeris data to
produce a Cartesian state vector at the request time.
– To a user’s 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.
– Data gaps can only occur between segments.
“Results” will be returned by the SPK reader API for
any request time falling within these three intervals.
SPK Subsystem 28
N IF SPK Data Type Concept
Navigation and Ancillary Information Facility
SPK Subsystem 30
N IF Widely Used SPK Data Types
Navigation and Ancillary Information Facility
• Type 1 (Modified divided difference arrays)
– Used by JPL orbit determination software for spacecraft ephemerides
• For planets
– A planet and its satellites orbit the planet system’s barycenter
» For example, the planet Jupiter (599) and each of Jupiter’s satellites (501 - 5xx)
orbit the Jupiter system barycenter (5)
– 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)
» Starting in 2013 with the JPL planetary ephemeris named DE430 this is
no longer the case; there is a very small offset of about 20 cm
SPK Subsystem 32
N IF Barycenter Offset Magnitude
Navigation and Ancillary Information Facility
SPK Subsystem 34
Examples of Generic
N IF SPK File Contents
Navigation and Ancillary Information Facility
10 Sun
0 Solar System BC 2000001 Ceres 5 Jupiter BC 5
1 Merc. BC 34 Earth BC
1991 Mercury Notes: 104 Sun
2 Venus BC (1) Mercury and Venus planet
locations are included in planet
3994 Earth
2991 Venus ephemerides since there are no 501 Io
3 Earth BC satellite ephemerides for these 502 Europa
planets.
3012 Moon (2) The Moon and Earth locations are 503 Ganymede
3992 Earth included in each planetary 504 Callisto
ephemeris because of historical
4 Mars BC ephemeris production techniques. 505 Amalthea
5 Jupiter BC (3) The Sun’s location is included in 514 Thebe
6 Saturn BC each planetary ephemeris because
of historical ephemeris production
515 Adrastea
7 Uranus BC techniques. 516 Metis
8 Neptune BC (4) For user convenience, NAIF often
merges into a planet’s satellite
599 Jupiter
9 Pluto BC* ephemeris files the locations of the
103 Sun earth, the earth barycenter and the
sun.
(5) Jupiter BC is the center of motion
* For ephemeris purposes, Pluto only for Jovian satellites, not for
is still treated as a planet. Earth BC, Sun, or Earth.
The objects in blue italic font are the center of motion for the remaining objects in
each file. There is no ephemeris data present for these centers of motion.
SPK Subsystem 35
Examples of a
N IF Flight Project's SPK File Contents
Navigation and Ancillary Information Facility
This made-up example shows four collections of SPK files for the Cassini mission
-82 = Cassini S/C -150 = Huygens Probe 3 = Earth barycenter 601 = Mimas
6 = Saturn barycenter 602 = Enceladus
399 = Earth mass center 603 = Tethys
301 = Moon 604 = Dione
605 = Rhea
606 = Titan
607 = Hyperion
608 = Iapetus
One object Multiple objects 609 = Phoebe
699 = Saturn mass center
One object
Multiple objects
610 = Janus
611 = Epimetheus
:
• The user’s program must “load” as many of these SPK files 617 = Pandora
as needed to satisfy her/his requirements. 699 = Saturn mass center
Multiple objects
• Sometimes a project NAV team combines (merges) several of
these collections before releasing them, making the user’s job easier.
Satellites - 2
• Objects in blue font are the centers of motion for the remaining objects;
these don’t have ephemeris data included in the file.
See the next page for a graphical representation of this collection of SPKs
SPK Subsystem 36
Possible* SPK File Time Coverages
N IF for the Previous Example
Navigation and Ancillary Information Facility
Satellite - 1:
(Major satellites)
Satellite - 2:
(Minor satellites)
Orbiter :
Huygens Probe :
• 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; the PCK is needed to
rotate body-fixed vectors to the J2000 frame
SPK Subsystem 38
N IF
Navigation and Ancillary Information Facility
SPK Subsystem 39
N IF Retrieving Position or State Vectors
Navigation and Ancillary Information Facility
SPK Subsystem 40
N IF Retrieving a State Vector
Navigation and Ancillary Information Facility
tax
n syn
Initialization…typically done once per program execution Fortra re
he
used
Tell your program which SPICE files to use (“loading” files)
CALL FURNSH ('spk_file_name') It’s better to replace these
CALL FURNSH ('leapseconds_file_name') two calls with a single call to
a “furnsh kernel” containing
the names of all kernel files
to load.
Loop... do as many times as you need to
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 41
N IF Arguments of SPKEZR - 1
Navigation and Ancillary Information Facility
INPUTS
• 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 the observer
to the target.
• TDB: The time at the observer’s location 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 the
output state vector is to be given. SPK software will automatically
convert ephemeris data to the frame you specified, if needed.
SPICE must know the named frame, either built-in or specified
using a Frames Kernel.
* 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 enclosed in quotes.
SPK Subsystem 42
N IF Arguments of SPKEZR - 2
Navigation and Ancillary Information Facility
(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 Cassini spacecraft 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. The state vector has been corrected for both light time and stellar aberration (LT+S).
The one-way light time (LT) is also returned, just in case it could be useful.
SPK Subsystem 44
N IF Retrieving a Position Vector
Navigation and Ancillary Information Facility
SPK Subsystem 45
A Slightly More Complex Example
N IF Kernel Data Needed
Navigation and Ancillary Information Facility
SPK Subsystem 46
A Slightly More Complex Example
N IF Retrieving a State Vector
Navigation and Ancillary Information Facility
Obtain the state of Titan relative to Cassini in the Titan body-fixed reference frame
Initialization...typically once per program execution
tax
n syn
Fortra re
Tell your program which SPICE files to use (“loading” files) used
he
SPK Subsystem 48
N IF Manipulating and Using SPK Files
Navigation and Ancillary Information Facility
• You can read data from just one, or many* SPK files in
your application program
– Don’t forget the precedence rule: data in a later loaded file take
precedence over data from an earlier loaded file
SPK Subsystem 50
N IF SPK Utility Programs
Navigation and Ancillary Information Facility
SPK Subsystem 51
N IF Summarizing an SPK File - 1
Navigation and Ancillary Information Facility
• A summary of the contents and time coverage of an SPK file can be made
using the SPICE Toolkit utility “brief”
– See the brief User’s Guide for details
% brief 070413BP_SCPSE_07097_07121.bsp
SPK Subsystem 52
N IF Summarizing an SPK File - 2
Navigation and Ancillary Information Facility
• Use of the “-c” option when using the brief utility will show
you the center of motion for each object
– This is often useful in diagnosing an SPK chaining problem
» See the “Problems” section at the end of this tutorial for more information
% brief -c 070413BP_SCPSE_07097_07121.bsp
--------------------------------------------------------------------------------
Segment ID : SAT240
Target Body : Body 601, MIMAS
Center Body : Body 6, SATURN BARYCENTER
Reference frame: Frame 1, J2000
SPK Data Type : Type 3
Description : Fixed Width, Fixed Order Chebyshev Polynomials: Pos, Vel
UTC Start Time : 1969 DEC 31 00:00:00.000
UTC Stop Time : 2019 DEC 02 00:00:00.000
ET Start Time : 1969 DEC 31 00:00:41.183
ET Stop time : 2019 DEC 02 00:01:05.183
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Segment ID : SAT240
Target Body : Body 602, ENCELADUS
Center Body : Body 6, SATURN BARYCENTER
Reference frame: Frame 1, J2000
SPK Data Type : Type 3
Description : Fixed Width, Fixed Order Chebyshev Polynomials: Pos, Vel
UTC Start Time : 1969 DEC 31 00:00:00.000
UTC Stop Time : 2019 DEC 02 00:00:00.000
ET Start Time : 1969 DEC 31 00:00:41.183
ET Stop time : 2019 DEC 02 00:01:05.183
--------------------------------------------------------------------------------
:
(This is a partial output; not all data could be displayed on this chart)
SPK Subsystem 54
N IF Summarizing an SPK File - 4
Navigation and Ancillary Information Facility
SPK Subsystem 55
N IF Additional Information on SPK
Navigation and Ancillary Information Facility
SPK Subsystem 56
N IF Backup
Navigation and Ancillary Information Facility
SPK Subsystem 57
N IF Problems Using SPK Files - 1
Navigation and Ancillary Information Facility
• 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 doesn’t
– 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
– This could occur if you’ve been given a file coverage summary in
calendar ET form and you mistook this for UTC
( ET = UTC + DELTAET, where DELTAET is about 69 seconds as of 1/20)
– 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 light-
time away* from your ET epoch of interest
» * Earlier, for the receive case; later, for the transmission case
• In the above situations you’ll 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 58
N IF Problems Using SPK Files - 2
Navigation and Ancillary Information Facility
SPICE(SPKINSUFFDATA) - -
Insufficient ephemeris data has been loaded to
compute the state of xxx relative to yyy.
SPK Subsystem 59
N IF Problems Using SPK Files – 3a
Navigation and Ancillary Information Facility
Titan
SPK Subsystem 62
N IF Problems Using SPK Files - 5
Navigation and Ancillary Information Facility
SPK Subsystem 63
N IF Problems Using SPK Files - 6
Navigation and Ancillary Information Facility
SPK Subsystem 64
N IF Problems Using SPK Files - 7
Navigation and Ancillary Information Facility
SPK Subsystem 65
N IF Problems Using SPK Files - 8
Navigation and Ancillary Information Facility
SPK Subsystem 66
N IF Don’t Mix Planet Ephemerides-1
Navigation and Ancillary Information Facility
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
Mars
SPK Subsystem 67
N IF Don’t Mix Planet Ephemerides-2
Navigation and Ancillary Information Facility
S.S.Barycenter
• SPICE allows you to “load”
different planetary
ephemerides (or portions
of them)
» You can potentially
subtract the solar system
barycenter-relative
positions from different Result of mixing
ephemerides to get ephemerides
relative states
• Don’t mix planetary
ephemerides
• For JPL flight projects, a
consistent set of Earth
Mars
ephemerides is provided to
the mission team
SPK Subsystem 68
N IF Effect of Aberration Corrections - 1
Navigation and Ancillary Information Facility
SPK Subsystem 69
N IF Effect of Aberration Corrections - 2
Navigation and Ancillary Information Facility
SPK Subsystem 70
N IF Examples of Retrieving State Vectors – 1
Navigation and Ancillary Information Facility
SPK Subsystem 71
N IF Examples of Retrieving State Vectors – 2
Navigation and Ancillary Information Facility
SPK Subsystem 72
N IF Examples of Retrieving State Vectors – 3
Navigation and Ancillary Information Facility
SPK Subsystem 73
N IF SPK File Structure
Navigation and Ancillary Information Facility
SPK Subsystem 74
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Overview
• Text PCK Orientation Models
• Binary PCK Orientation Models
• PCK reference frames
• PCK Shape Models
• Using PCKs
• Interface Routines
• PCK Precedence Rules
• PCK Utility Programs
PCK Subsystem 2
N IF Overview
Navigation and Ancillary Information Facility
PCK Subsystem 3
N IF Text PCKs - 1
Navigation and Ancillary Information Facility
PCK Subsystem 7
N IF Text PCK Orientation Models - 3
Navigation and Ancillary Information Facility
• Body-fixed frames provided in text PCKs have +Z axes
consistent with planetocentric coordinate systems. The +X
axes of these frames coincide with planetocentric longitude 0.
• 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
PCK Subsystem 9
Location of Text PCK
N IF Reference Frame Specifications
Navigation and Ancillary Information Facility
PCK Subsystem 11
N IF PCK Shape Models
Navigation and Ancillary Information Facility
• PCK shape models are nominally triaxial ellipsoids
– For many bodies, the two equatorial axes have the same value;
these bodies have a spheroidal shape.
– For some bodies, one or more radii have not been determined.
– See the DSK tutorial for information about other kinds of shape
models available within SPICE.
PCK Subsystem 13
N IF Interface Routines - 1
Navigation and Ancillary Information Facility
PCK Subsystem 14
N IF Interface Routines - 2
Navigation and Ancillary Information Facility
ran
Fort ples
m
exa
• 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 15
N IF PCK Precedence Rules
Navigation and Ancillary Information Facility
PCK Subsystem 17
N IF Additional Information on PCK
Navigation and Ancillary Information Facility
• Related documents:
– Frames Required Reading
– Kernel Required Reading
– NAIF_IDS Required Reading
– Time Required Reading
PCK Subsystem 18
N IF
Navigation and Ancillary Information Facility
“Camera-matrix” Kernel
CK
(Orientation or Attitude Kernel)
April 2023
N IF CK File Contents - 1
Navigation and Ancillary Information Facility
C-Kernel 2
N IF CK File Contents - 2
Navigation and Ancillary Information Facility
C-Kernel 3
N IF C-Kernel 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
– Most often used for science observation planning, quick-look
science data analysis, engineering assessments and software
testing
» If of known high quality, it might be used to substitute for
any data gaps in reconstruction CKs
» In some cases the predict meets the reconstruction accuracy
requirements; thus a true reconstruction CK is not generally
produced
C-Kernel 4
N IF C-Kernel Varieties - 2
Navigation and Ancillary Information Facility
• Knowledge of CK variety–“reconstruction” or
“predict”–might be implicit in the file naming
schema, and/or might be provided in the comment
section, but is not available using a SPICE API
C-Kernel 5
N IF CK Data Types
Navigation and Ancillary Information Facility
CK CK CK CK CK
Type 1* Type 2 Type 3 Type 4* Type 5 6
Discrete Piecewise Constant Linear Chebyshev ESOC
Points Angular Velocity Interpolation Polynomials DDID
– SCLK and LSK contain time correlation coefficients used to convert between
encoded spacecraft clock time (SCLK) and ephemeris time (ET).
» Sometimes an LSK is not needed in this conversion, but it’s best to have
it available as it is usually needed for other purposes.
C-Kernel 7
N IF What SPICE Routines Access CKs?
Navigation and Ancillary Information Facility
C-Kernel 9
N IF Sample* CK File Coverage - 1
Navigation and Ancillary Information Facility
Cassini
orbiter CK:
Huygens
probe CK:
Cassini
instrument
mirror CK:
cruise phase orbit phase
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 very often contain gaps in coverage! An
example of this is depicted below.
Time
a CK file:
as appears in file name/comments
CK file segments:
as appears in ckbrief/spacit summary
C-Kernel 13
N IF Obtaining Coverage of a CK File
Navigation and Ancillary Information Facility
C-Kernel 15
N IF Determine Coverage Using Utilities
Navigation and Ancillary Information Facility
C-Kernel 16
N IF Summarizing a CK File - 1
Navigation and Ancillary Information Facility
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
Segment No.: 1
Object: -82000
Interval Begin ET Interval End ET AV
------------------------ ------------------------ ---
2007-APR-12 00:01:06.462 2007-APR-12 05:58:02.576 Y
2007-APR-12 05:58:22.576 2007-APR-12 21:34:26.221 Y
. . .
C-Kernel continued on next page 18
N IF Summarizing a CK File - 3
Navigation and Ancillary Information Facility
continued from previous page
% frmdiff -t dumpg \
–k cas_v40.tf naif0008.tls cas00106.tsc \
-f 'YYYY-DOYTHR: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
--------------------------------------------------------------
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 CK Utility Programs
Navigation and Ancillary Information Facility
C-Kernel 21
N IF Additional Information on CK
Navigation and Ancillary Information Facility
C-Kernel 23
N IF The Meaning of Tolerance - 1
Navigation and Ancillary Information Facility
SCLKDP TOL
\ /
| |
|/ \
“+” marks your request [---+---]
. . .
Available data (0----0--0--0--0--0---0--0--0--0-----0--0--0)
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 (your
request time is outside of interpolation intervals)
• One of the high-level routines (SPKEZR, SPKPOS,
SXFORM, PXFORM, SINCPT) signals an error
– These 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 CK-
based 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
C-Kernel 30
N IF Problems using CK - 4
Navigation and Ancillary Information Facility
C-Kernel 31
N IF Problems using CK - 5
Navigation and Ancillary Information Facility
C-Kernel 32
N IF One Example of How To Read a CK File
Navigation and Ancillary Information Facility
Get rotation matrix, or rotation matrix and angular velocity at requested time
or
CALL CKGP (instid,sclkdp,tol,'ref_frame',cmat, clkout,found)
CALL CKGPAV (instid,sclkdp,tol,'ref_frame',cmat,av,clkout,found)
inputs outputs
* 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 Arguments of CKGPAV
Navigation and Ancillary Information Facility
Inputs
instid 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!
Frames Kernel
FK
April 2023
N IF Background
Navigation and Ancillary Information Facility
Frames Subsystem 2
N IF What is a Reference Frame?
Navigation and Ancillary Information Facility
Frames Subsystem 3
N IF What is a Coordinate System?
Navigation and Ancillary Information Facility
Frames Subsystem 4
N IF Introduction
Navigation and Ancillary Information Facility
Topocentric
ISS NAC Frame at the
instrument landing site
frame
Fixed offset
transformation
Cassini
spacecraft
frame
Frames Subsystem 6
N IF Frame Names
Navigation and Ancillary Information Facility
Frames Subsystem 7
N IF Where to Find the Names of Frames?
Navigation and Ancillary Information Facility
Frames Subsystem 8
N IF Frame Classes and Examples
Navigation and Ancillary Information Facility
Frame class Frame Examples (with real frame names)
Dynamic • Geomagnetic
• Geocentric Solar Equatorial
• Planet true equator and equinox of date
CK based FK CK
Fixed offset FK FK
Frames Subsystem 10
N IF Frames Kernel File Overview
Navigation and Ancillary Information Facility
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
Frames Subsystem 12
N IF Frame Definition Details - 2
Navigation and Ancillary Information Facility
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
• These keywords
FRAME_<name> = <id>
FRAME_<id>_NAME = <name>
establish the association between the name and the ID
of the frame.
Frames Subsystem 13
N IF Frame Definition Details - 3
Navigation and Ancillary Information Facility
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
Frames Subsystem 16
N IF Frame Definition Details - 6
Navigation and Ancillary Information Facility
Frame definition for the DAWN spacecraft Frame definition for the DAWN Framing Camera #1
FRAME_DAWN_SPACECRAFT = -203000 FRAME_DAWN_FC1 = -203110
FRAME_-203000_NAME = 'DAWN_SPACECRAFT' FRAME_-203110_NAME = 'DAWN_FC1'
FRAME_-203000_CLASS = 3 FRAME_-203110_CLASS = 4
FRAME_-203000_CLASS_ID = -203000 FRAME_-203110_CLASS_ID = -203110
FRAME_-203000_CENTER = -203 FRAME_-203110_CENTER = -203
CK_-203000_SCLK = -203 TKFRAME_-203110_RELATIVE = 'DAWN_SPACECRAFT'
CK_-203000_SPK = -203 TKFRAME_-203110_SPEC = 'ANGLES'
TKFRAME_-203110_UNITS = 'DEGREES'
TKFRAME_-203110_ANGLES = ( 0.0, 0.0, 0.0 )
TKFRAME_-203110_AXES = ( 1, 2, 3 )
Frames Subsystem 17
N IF APIs Using the Frames Subsystem
Navigation and Ancillary Information Facility
Frames Subsystem 18
N IF CK-Based Frames “Must Know”
Navigation and Ancillary Information Facility
These are VERY IMPORTANT points you must understand!
Frames Subsystem 19
Frame Tree Example:
N IF ASPERA Instrument on Mars Express
Navigation and Ancillary Information Facility
"J2000" <-inertial
|
+-----------------------------------------------------+
| | |
|<-pck | |<-pck
| | |
V | V
"IAU_MARS" | "IAU_EARTH"
MARS BODY-FIXED |<-ck EARTH BODY-FIXED
--------------- | ----------------
V
"MEX_SPACECRAFT"
+-----------------------------------------------------+
| |
|<-fixed |<-fixed
| |
V V
"MEX_ASPERA_URF" "MEX_ASPERA_IMA_URF"
----------------- --------------------
| |
|<-ck |<-fixed
| |
V V
"MEX_ASPERA_SAF" "MEX_ASPERA_IMA"
--------------------------------------------- ... ----------------
| | |
|<-fixed |<-fixed |<-fixed
| | |
V V V
"MEX_ASPERA_ELS" "MEX_ASPERA_NPI" "MEX_ASPERA_NPD1"
---------------- ---------------- ----------------
Frames Subsystem 21
N IF Additional Information on FK
Navigation and Ancillary Information Facility
April 2023
N IF What is the Power of Frames?
Navigation and Ancillary Information Facility
Required Kernels:
Misalignment •Generic LSK
angle between ISS •Mission FK
ISS NAC camera boresights •Camera IK(s)
CASSINI Frame
NAC Boresight
C Retrieve the matrix that transforms vectors from NAC to WAC frame
CALL PXFORM( 'CASSINI_ISS_NAC', 'CASSINI_ISS_WAC', ET, MAT )
C Transform NAC boresight to WAC frame and find separation angle
ran
CALL MXV ( MAT, NAC_BORESIGHT_nac, NAC_BORESIGHT_wac ) Fort ple
ANGLE = VSEP( NAC_BORESIGHT_wac , WAC_BORESIGHT_wac ) exam
Using Frames 3
N IF Angular Constraints
Navigation and Ancillary Information Facility
Required Kernels:
J2000 •Generic LSK
Sun Frame
Sun direction •Mission FK
CASSINI Solar System
in the NAC frame •Spacecraft SCLK
Barycenter
ISS NAC
Frame
•Camera IK
•Planetary
Angle between
NAC Boresight
Ephemeris SPK
S/C
Frame
and Sun direction •Spacecraft SPK
•Spacecraft CK
Saturn System
Barycenter
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 )
ran
IF ( ANGLE .LE. CONSTRAINT ) WRITE(*,*) 'WE ARE IN TROUBLE!' Fort ple
xam e
Using Frames 4
N IF Angles at the Surface
Navigation and Ancillary Information Facility
J2000 Solar System Barycenter Required Kernels:
Frame •Generic LSK
Saturn System
Barycenter •Generic PCK
Sun •Mission FK
•Planetary
Solar Saturn Ephemeris SPK
Sun Direction EL •Satellite
In Local Level Solar Ephemeris SPK
Frame AZ •Landing Site SPK
Titan
Local Level
Titan‘s IAU Cassini
Frame at the Spacecraft
probe Landing Body-fixed
Site frame
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 RECAZL( SUNVEC, .TRUE., .FALSE., RANGE, AZ, EL )
ran
Fort ple
exam
Using Frames 5
N IF Relative Position of Sensors
Navigation and Ancillary Information Facility
Required Kernels:
MAG+Y •Generic LSK
frame •Mission FK
MAG-Y position relative to MAG+Y •Structure
Locations SPK
•Spacecraft SCLK
•Solar Array CK
+Y Gimbal
frame
MAG-Y
frame S/C Frame
-Y Hinge -Y Gimbal
frame frame
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 SPKPOS('MGS_MAG-Y', ET, 'MGS_SPACECRAFT', 'NONE', 'MGS_MAG+Y’, POSVEC, LT)
CALL PXFORM('MGS_MAG_+Y_SENSOR', 'MGS_MAG_-Y_SENSOR', ET, MAT) rtran Fo p le
exam
Using Frames 6
N IF Manipulators - 1
Navigation and Ancillary Information Facility
MGS
Required Kernels:
•Generic LSK
•Mission FK
S/C Frame •Spacecraft SCLK
•HGA IK
HGA Hinge HGA •Planetary
frame frame Ephemeris SPK
Mars HGA Gimbal
frame •Spacecraft SPK
J2000 MGS HGA •Spacecraft CK
Frame off-pointing •HGA CK
angle
Sun
SSB Earth
J2000 HGA = High Gain Antenna
Frame
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 )
ran
Fort ple
exam
Using Frames 7
N IF Manipulators - 2
Navigation and Ancillary Information Facility
RA J2
Dig Location SSI Frame Required Kernels:
Frame in SSI Frame •Generic LSK
SSI Camera •Mission FK
RA Scoop head Frame
Frame •Lander SCLK
•Structure
RA J1 Locations SPK
Dig Location Frame
MVACS •Lander SPK
in Surface fixed
frame Frame •Lander CK
•SSI CK
•RA CK
Surface-fixed
Frame
Compute the soil digging location in the MPL surface-fixed and ran
Fort ple
camera left eye frames: exam
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Introduction
• Earth binary PCKs
• Lunar binary PCKs
• Lunar Frames Kernel
– Frame specifications
– Frame alias names
• Binary PCK file format
• Using Binary PCKs
– Precedence rules
– Utilities
• Backup
– Earth and Moon frame association kernels
• NAIF provides “high accuracy” orientation data for the Earth and
the 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 upon release of an official new JPL
“Developmental Ephemeris” (DE).
» Contains accurate historical and predictive lunar orientation data
• To use these kernels:
– Select binary PCK(s) having properties and time coverage that meet your needs
» Unlike text PCKs, the time span covered by binary PCKs is limited
– 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
– Reference a lunar body-fixed frame using one of these names:
» ‘MOON_ME’ (Moon Mean Earth/Rotation axis frame)
» ‘MOON_PA’ (Moon Principal Axes frame)
» CAUTION: ‘IAU_MOON’ cannot be used to reference high-accuracy lunar orientation data
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.
Difference between the IAU_Moon frame and the Moon_ME frame (equivalent
to the Moon_ME_DE421 frame)
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.
Lunar Generic
Kernel(s) Lunar text
needed binary FK
PCK PCK
Frame name to be
used in SPICE MOON_PA MOON_ME IAU_MOON
software
Usually a bad
choice for the
Special PCK and FK for Earth and Moon Moon! 22
N IF
Navigation and Ancillary Information Facility
Backup
Association Frames Kernels
for the Earth and the Moon
N IF Association FKs: Introduction
Navigation and Ancillary Information Facility
• 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 is known as the default body-fixed frame
• This was a bad assumption… at least for the Earth and the Moon!
– Multiple body-fixed frames exist for the Earth and the Moon
– The default body-fixed frames for the Earth and the Moon, for which the defining
data are provided in a generic text PCK (taken from an IAU report), are inaccurate
(for the Moon) and very inaccurate (for the Earth) representations of the actual
orientations of these bodies
• 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
• 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 other–not both)
» moon_assoc_me.tf
» moon_assoc_pa.tf
• These kernels are available on the NAIF server
– For the Earth:
» https://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/planets/
– For the Moon:
» https://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites/
Usually a bad
File name moon_assoc_me.tf choice for the
moon_assoc_pa.tf Moon!
PA ME no
Association Association additional
FK** FK** kernels
* LSPCN, ET2LST, ILLUM, SRFXPT, SUBPT, SUBSOL But best to use the
replacements for these
(and their C, Icy and Mice equivalents) four, which don’t use a
default body-fixed frame:
• ILUMIN, ILLUMF, ILLUMG
• SINCPT
**Any version of one or the other of these kernels is good indefinitely; • SUBPNT
you do not need to use the latest instance offered on the NAIF server. • SUBSLR
April 2023
N IF Topics
Navigation and Ancillary Information Facility
Dynamic Frames 3
N IF Examples of Dynamic Frames
Navigation and Ancillary Information Facility
Dynamic Frames 6
N IF Examples of Using Dynamic Frames
Navigation and Ancillary Information Facility
• 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 )
• You can use dynamic frames any place in SPICE where a frame
name is used.
– However, some restrictions apply to use of dynamic frames in
SPICE kernels (see “Limitations” in the backup slides).
Dynamic Frames 7
N IF Terminology - 1
Navigation and Ancillary Information Facility
Dynamic Frames 8
N IF Terminology - 2
Navigation and Ancillary Information Facility
Dynamic Frames 10
Creating a Frames Kernel
N IF Defining Dynamic Frames
Navigation and Ancillary Information Facility
Dynamic Frames 11
N IF Types of Dynamic Frames
Navigation and Ancillary Information Facility
Dynamic Frames 12
N IF Parameterized Dynamic Frames
Navigation and Ancillary Information Facility
Dynamic Frames 13
N IF Defining Parameterized Dynamic Frames
Navigation and Ancillary Information Facility
– Rotation state
» Possible states are 'ROTATING' and 'INERTIAL'.
• A frame is treated as rotating or inertial for the purpose of velocity transformations.
Dynamic Frames 15
N IF What’s Next?
Navigation and Ancillary Information Facility
Dynamic Frames 16
N IF Two-Vector Frame Concepts - 1
Navigation and Ancillary Information Facility
Dynamic Frames 17
N IF Two-Vector Frame Concepts - 2
Navigation and Ancillary Information Facility
• 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:
Y
-X
Primary Vector
Z
Dynamic Frames 18
N IF Two-Vector Frame Concepts - 3
Navigation and Ancillary Information Facility
• 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.
-X Y
Primary Vector
Secondary Vector
Z
Component of secondary
X vector orthogonal to primary
vector
Dynamic Frames 19
N IF Two-Vector Frame Concepts - 4
Navigation and Ancillary Information Facility
Dynamic Frames 21
N IF Two-Vector Frame Concepts - 6
Navigation and Ancillary Information Facility
Dynamic Frames 26
N IF Two-Vector Frame Examples - 1
Navigation and Ancillary Information Facility
See the next page for the FK specifications for this frame.
Dynamic Frames 27
N IF Two-Vector Frame Examples - 2
Navigation and Ancillary Information Facility
The -Z axis points from the spacecraft toward the closest point on Mars.
The +Y axis is the cross product of the +Z axis and the +X axis.
\begindata
Dynamic Frames 28
N IF Two-Vector Frame Examples - 3
Navigation and Ancillary Information Facility
Z
Primary vector: spacecraft
Y velocity relative to center of
motion in J2000 frame. Aligned
Normalized component of secondary with view frame's +Z axis in
vector orthogonal to primary vector
frame kernel. ("Down track"
is aligned with the view frame's +Y
direction)
axis. ("In plane" direction)
See the next page for the FK specifications for this frame.
Dynamic Frames 29
N IF Two-Vector Frame Examples - 4
Navigation and Ancillary Information Facility
The +X axis is the cross product of the +Y axis and the +Z axis.
Definitions
\begindata
<frame_ID> = integer frame ID
FRAME_<frame_name> = <frame_ID> code
FRAME_<frame_ID>_NAME = <frame_name> <frame_name> = user-specified
FRAME_<frame_ID>_CLASS = 5 frame name
FRAME_<frame_ID>_CLASS_ID = <frame_ID> <orbiter_ID> = NAIF ID code of
FRAME_<frame_ID>_CENTER = <orbiter_ID> spacecraft
FRAME_<frame_ID>_RELATIVE = 'J2000' <orbiter_ID/name> = NAIF ID code or
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED' name of spacecraft
FRAME_<frame_ID>_FAMILY = 'TWO-VECTOR'
FRAME_<frame_ID>_PRI_AXIS = 'Z'
FRAME_<frame_ID>_PRI_VECTOR_DEF = 'OBSERVER_TARGET_VELOCITY'
FRAME_<frame_ID>_PRI_OBSERVER = 'MARS'
FRAME_<frame_ID>_PRI_TARGET = <orbiter_ID/name>
FRAME_<frame_ID>_PRI_ABCORR = 'NONE'
FRAME_<frame_ID>_PRI_FRAME = 'J2000'
FRAME_<frame_ID>_SEC_AXIS = 'Y'
FRAME_<frame_ID>_SEC_VECTOR_DEF = 'OBSERVER_TARGET_POSITION'
FRAME_<frame_ID>_SEC_OBSERVER = 'MARS'
FRAME_<frame_ID>_SEC_TARGET = <orbiter_ID/name>
FRAME_<frame_ID>_SEC_ABCORR = 'NONE'
Dynamic Frames 30
N IF Two-Vector Frame Examples - 5
Navigation and Ancillary Information Facility
Z = X x Y,
completing the
right-handed frame
X
Y
Normalized component
of secondary vector
Secondary vector: velocity of sun orthogonal to primary
relative to earth in J2000 frame. vector is aligned with the
Associated with GSE frame's +Y axis in
GSE frame’s +Y axis.
frame kernel.
Dynamic Frames
See the next page for the FK specifications for this frame.
31
N IF Two-Vector Frame Examples - 6
Navigation and Ancillary Information Facility
Geocentric Solar Ecliptic (GSE) frame:
\begindata
Dynamic Frames 32
N IF Two-Vector Frame Examples - 7
Navigation and Ancillary Information Facility
Normalized
Z component of
secondary vector
orthogonal to
primary vector is
aligned with the
Primary vector: position of sun relative to earth. GSM frame’s +Z
Aligned with GSM frame's +X axis. axis
Y = Z x X,
completing the
right-handed frame
See the next page for the FK specifications for this frame.
Dynamic Frames 33
N IF Two-Vector Frame Examples - 8
Navigation and Ancillary Information Facility
Geocentric Solar Magnetospheric (GSM) frame:
\begindata
FRAME_GSM = <frame_ID>
FRAME_<frame_ID>_NAME = 'GSM' Definition
FRAME_<frame_ID>_CLASS = 5 <frame_ID> = integer frame
FRAME_<frame_ID>_CLASS_ID = <frame_ID> ID code
FRAME_<frame_ID>_CENTER = 399
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'TWO-VECTOR'
FRAME_<frame_ID>_PRI_AXIS = 'X'
FRAME_<frame_ID>_PRI_VECTOR_DEF = 'OBSERVER_TARGET_POSITION'
FRAME_<frame_ID>_PRI_OBSERVER = 'EARTH'
FRAME_<frame_ID>_PRI_TARGET = 'SUN'
FRAME_<frame_ID>_PRI_ABCORR = 'NONE'
FRAME_<frame_ID>_SEC_AXIS = 'Z'
FRAME_<frame_ID>_SEC_VECTOR_DEF = 'CONSTANT'
FRAME_<frame_ID>_SEC_FRAME = 'IAU_EARTH'
FRAME_<frame_ID>_SEC_SPEC = 'LATITUDINAL'
FRAME_<frame_ID>_SEC_UNITS = 'DEGREES'
FRAME_<frame_ID>_SEC_LONGITUDE = 288.43
FRAME_<frame_ID>_SEC_LATITUDE = 79.54
Dynamic Frames 34
N IF Two-Vector Frame Examples - 9
Navigation and Ancillary Information Facility
Normalized
component of
X secondary vector
orthogonal to
primary vector is
aligned with the SCR
frame’s +X axis
Primary vector: position of earth relative to
spacecraft. Aligned with Roll-Celestial frame's
+Z axis. Y = Z x X,
completing the
right-handed frame
Dynamic Frames See the next page for the FK specifications for this frame. 35
N IF Two-Vector Frame Examples - 10
Navigation and Ancillary Information Facility
Spacecraft-centered roll-celestial frame:
Dynamic Frames 37
N IF "Of-Date" Frames - 2
Navigation and Ancillary Information Facility
Dynamic Frames 38
N IF "Of-Date" Frames - 3
Navigation and Ancillary Information Facility
Dynamic Frames 39
N IF "Of-Date" Frames - 4
Navigation and Ancillary Information Facility
\begindata Definitions
<frame_ID> = integer frame ID
FRAME_<frame_name> = <frame_ID> code
FRAME_<frame_ID>_NAME = <frame_name> <frame_name> = user-specified
FRAME_<frame_ID>_CLASS = 5 frame name
FRAME_<frame_ID>_CLASS_ID = <frame_ID>
FRAME_<frame_ID>_CENTER = 399
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'MEAN_EQUATOR_AND_EQUINOX_OF_DATE'
FRAME_<frame_ID>_PREC_MODEL = 'EARTH_IAU_1976'
FRAME_<frame_ID>_ROTATION_STATE = 'ROTATING'
This is currently the
only allowed value for
precession model.
Dynamic Frames 40
N IF "Of-Date" Frames - 5
Navigation and Ancillary Information Facility
Dynamic Frames 41
N IF "Of-Date" Frames - 6
Navigation and Ancillary Information Facility
\begindata Definitions
<frame_ID> = integer frame ID
FRAME_<frame_name> = <frame_ID> code
FRAME_<frame_ID>_NAME = <frame_name> <frame_name> = user-specified
FRAME_<frame_ID>_CLASS = 5 frame name
FRAME_<frame_ID>_CLASS_ID = <frame_ID>
FRAME_<frame_ID>_CENTER = 399
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'TRUE_EQUATOR_AND_EQUINOX_OF_DATE'
FRAME_<frame_ID>_PREC_MODEL = 'EARTH_IAU_1976'
FRAME_<frame_ID>_NUT_MODEL = 'EARTH_IAU_1980'
FRAME_<frame_ID>_ROTATION_STATE = 'ROTATING' These are currently the
only allowed values for
precession model and
nutation model.
Dynamic Frames 42
N IF "Of-Date" Frames - 7
Navigation and Ancillary Information Facility
Dynamic Frames 43
N IF "Of-Date" Frames - 8
Navigation and Ancillary Information Facility
Dynamic Frames 44
N IF Euler Frames - 1
Navigation and Ancillary Information Facility
Dynamic Frames 45
N IF Euler Frames - 2
Navigation and Ancillary Information Facility
• Five examples
– 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 47
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:
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.
\begindata
FRAME_IAU_MARS_EULER = <frame_ID>
FRAME_<frame_ID>_NAME = 'IAU_MARS_EULER' Definition
FRAME_<frame_ID>_CLASS = 5 <frame_ID> = integer frame ID
FRAME_<frame_ID>_CLASS_ID = <frame_ID> code
FRAME_<frame_ID>_CENTER = 499
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'EULER'
FRAME_<frame_ID>_EPOCH = @2000-JAN-1/12:00:00
FRAME_<frame_ID>_AXES = ( 3 1 3 )
FRAME_<frame_ID>_UNITS = 'DEGREES'
FRAME_<frame_ID>_ANGLE_1_COEFFS = ( -47.68143 0.33621061170684714E-10 )
FRAME_<frame_ID>_ANGLE_2_COEFFS = ( -37.1135 -0.19298045478743630E-10 )
FRAME_<frame_ID>_ANGLE_3_COEFFS = ( -176.630 -0.40612497946759260E-02 )
Dynamic Frames 48
N IF Product Frames - 1
Navigation and Ancillary Information Facility
Dynamic Frames 49
N IF Product Frames - 2
Navigation and Ancillary Information Facility
Dynamic Frames 50
N IF Product Frames - 3
Navigation and Ancillary Information Facility
FRAME_<frame_ID>_FAMILY = 'PRODUCT'
FRAME_<frame_ID>_FROM_FRAMES = ( '<from_frame_1>'
'<from_frame_2>'
…
'<from_frame_N>' )
FRAME_<frame_ID>_TO_FRAMES = ( '<to_frame_1>'
'<to_frame_2>'
…
'<to_frame_N>' )
Dynamic Frames 51
N IF Frozen Dynamic Frames - 1
Navigation and Ancillary Information Facility
Dynamic Frames 52
N IF Frozen Dynamic Frames - 2
Navigation and Ancillary Information Facility
\begindata Definitions
<frame_ID> = integer frame ID
FRAME_<frame_name> = <frame_ID> code
FRAME_<frame_ID>_NAME = <frame_name> <frame_name> = user-specified
FRAME_<frame_ID>_CLASS = 5 frame name
FRAME_<frame_ID>_CLASS_ID = <frame_ID>
FRAME_<frame_ID>_CENTER = 399
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'MEAN_EQUATOR_AND_EQUINOX_OF_DATE'
FRAME_<frame_ID>_PREC_MODEL = 'EARTH_IAU_1976'
FRAME_<frame_ID>_FREEZE_EPOCH = @1949-DEC-31/22:09:46.861901
Dynamic Frames 53
N IF Inertial Dynamic Frames - 1
Navigation and Ancillary Information Facility
R(t) | 0
-------|------
Derivative
block
0 | R(t)
Dynamic Frames 55
N IF Inertial Dynamic Frames - 3
Navigation and Ancillary Information Facility
\begindata Definitions
<frame_ID> = integer frame ID
FRAME_<frame_name> = <frame_ID> code
FRAME_<frame_ID>_NAME = <frame_name> <frame_name> = user-specified
FRAME_<frame_ID>_CLASS = 5 frame name
FRAME_<frame_ID>_CLASS_ID = <frame_ID>
FRAME_<frame_ID>_CENTER = 399
FRAME_<frame_ID>_RELATIVE = 'J2000'
FRAME_<frame_ID>_DEF_STYLE = 'PARAMETERIZED'
FRAME_<frame_ID>_FAMILY = 'TRUE_EQUATOR_AND_EQUINOX_OF_DATE'
FRAME_<frame_ID>_PREC_MODEL = 'EARTH_IAU_1976'
FRAME_<frame_ID>_NUT_MODEL = 'EARTH_IAU_1980'
FRAME_<frame_ID>_ROTATION_STATE = 'INERTIAL' These are currently the
only allowed values for
precession model and
nutation model.
Dynamic Frames 56
N IF Backup
Navigation and Ancillary Information Facility
• Numerical Issues
• Limitations
Dynamic Frames 57
N IF Numerical Issues - 1
Navigation and Ancillary Information Facility
Dynamic Frames 58
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 59
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.
» 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 60
N IF Limitations - 2
Navigation and Ancillary Information Facility
• Run-time efficiency:
– Dynamic frame evaluation typically requires more computation
than is needed for CK- or PCK-based 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 61
N IF
Navigation and Ancillary Information Facility
Instrument Kernel
IK
April 2023
N IF Purpose
Navigation and Ancillary Information Facility
\begindata
Keyword = Value(s) Assignment
Keyword = Value(s) Assignment
\begintext
\begindata
Keyword = Value(s) Assignment
\begintext
Instrument Kernel 4
N IF I-Kernel Contents (2)
Navigation and Ancillary Information Facility
Instrument Kernel 5
N IF I-Kernel Interface Routines
Navigation and Ancillary Information Facility
INS#_BORESIGHT = ( X, Y, Z )
INS#_FOV_CLASS_SPEC = 'CORNERS'
INS#_FOV_BOUNDARY_CORNERS = ( X(1), Y(1), Z(1),
… … …
X(n), Y(n), Z(n) )
2) By providing half angular extents of the FOV (possible only for circular,
elliptical or rectangular FOVs)
INS#_FOV_CLASS_SPEC = 'ANGLES'
INS#_FOV_REF_VECTOR = ( X, Y, Z )
INS#_FOV_REF_ANGLE = halfangle1
INS#_FOV_CROSS_ANGLE = halfangle2
INS#_FOV_ANGLE_UNITS = 'DEGREES' or
'RADIANS' or …
Instrument Kernel 9
N IF FOV Definition Keywords (4)
Navigation and Ancillary Information Facility
Instrument Kernel 10
N IF Circular Field of View
Navigation and Ancillary Information Facility
14.03 O
X
Boundary (0,1,4)
Subtended field of Corner
view angle Vector
14.03 = arc tan (1/4) Z
Y
Boresight
X
Vector
(0,0,0)
Instrument
focal point
Instrument Kernel 11
N IF Circular FOV Definition
Navigation and Ancillary Information Facility
Instrument Kernel 12
N IF Elliptical Field of View
Navigation and Ancillary Information Facility
14.03 O
X 26.57 O
Boresight
Boundary Vector
Corner (0,1,4)
Subtended field of Vectors
view angle Z
14.03 = arc tan (1/4) Y
26.57 = arc tan (2/4)
(-2,0,4)
X
(0,0,0)
Instrument
focal point
Instrument Kernel 13
N IF Elliptical FOV Definition
Navigation and Ancillary Information Facility
Instrument Kernel 14
N IF Rectangular Field of View
Navigation and Ancillary Information Facility
14.03 O
X 26.57 O
Boundary (2,1,4)
Corner
(-2,1,4)
Subtended field of Vectors
view angle Y Z
14.03 = arc tan (1/4)
26.57 = arc tan (2/4)
X Boresight
Vector
(2,-1,4) (-2,-1,4)
(0,0,0)
Instrument
focal point
Instrument Kernel 15
N IF Rectangular FOV Definition
Navigation and Ancillary Information Facility
Boundary
Corner (1,1,4) (-1,1,4)
Vectors
Y Z
X Boresight
Vector
(2,-1,4) (-2,-1,4)
(0,0,0)
Instrument
focal point
Instrument Kernel 17
N IF Polygonal FOV Definition
Navigation and Ancillary Information Facility
Instrument Kernel 18
N IF IK Utility Programs
Navigation and Ancillary Information Facility
Instrument Kernel 19
N IF Additional Information on IK
Navigation and Ancillary Information Facility
Instrument Kernel 20
N IF Backup
Navigation and Ancillary Information Facility
• IK file example
Instrument Kernel 21
N IF Sample IK Data
Navigation and Ancillary Information Facility
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
\ |
\ |
\|
continues
Instrument Kernel 22
N IF Sample IK Data
Navigation and Ancillary Information Facility
INS-82762_FOV_FRAME = 'CASSINI_MIMI_LEMMS1'
INS-82762_FOV_SHAPE = 'CIRCLE'
INS-82762_BORESIGHT = (
)
INS-82762_FOV_BOUNDARY_CORNERS = (
\begintext
Instrument Kernel 23
N IF Circular FOV Angular Size
Navigation and Ancillary Information Facility
C EXAMPLE
Instrument Kernel 24
N IF Elliptical FOV Angular Size - 1
Navigation and Ancillary Information Facility
Instrument Kernel 25
N IF Elliptical FOV Angular Size - 2
Navigation and Ancillary Information Facility
C EXAMPLE
Instrument Kernel 26
N IF Rectangular FOV Angular Size - 1
Navigation and Ancillary Information Facility
Bisectors
sml_ang
lrg_ang
(0,0,0)
Subtended field of view
Instrument angles
Instrument Kernel 27
N IF Rectangular FOV Angular Size - 2
Navigation and Ancillary Information Facility
FORTRAN EXAMPLE
Instrument Kernel 28
N IF Rectangular FOV Angular Size - 3
Navigation and Ancillary Information Facility
C EXAMPLE
April 2023
N IF See The Real Stuff
Navigation and Ancillary Information Facility
• 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:
– https://naif.jpl.nasa.gov/pub/naif/pds/data/di-c-spice-6-v1.0/disp_1000/data/fk/
– https://naif.jpl.nasa.gov/pub/naif/pds/data/di-c-spice-6-v1.0/disp_1000/data/ik/
• CASSINI:
– https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/
– https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/
• MESSENGER:
– https://naif.jpl.nasa.gov/pub/naif/pds/data/mess-e_v_h-spice-6-v1.0/messsp_1000/data/fk/
– https://naif.jpl.nasa.gov/pub/naif/pds/data/mess-e_v_h-spice-6-v1.0/messsp_1000/data/ik/
• MARS EXPRESS:
– https://naif.jpl.nasa.gov/pub/naif/pds/data/mex-e_m-spice-6-v2.0/mexsp_2000/DATA/FK/
– https://naif.jpl.nasa.gov/pub/naif/pds/data/mex-e_m-spice-6-v2.0/mexsp_2000/DATA/IK/
Derived Quantities
April 2023
N IF What are Derived Quantities?
Navigation and Ancillary Information Facility
DSK
CK
PCK Altitude = 138.3
Phase = 22.4
SPK Toolkit APIs LAT = 56
LON = 129
• Geometric Parameter
– Determine a geometric quantity or condition at a specified time.
Derived Quantities 3
N IF Examples of Geometric Parameters - 1
Navigation and Ancillary Information Facility
Derived Quantities 5
N IF Examples of Geometric Conditions
Navigation and Ancillary Information Facility
• Ray in field-of-view?
– FOVRAY
• Ephemeris object within field-of-view?
– FOVTRG
• Determine occultation condition
– OCCULT
Derived Quantities 6
N IF Examples of Geometry Finder Searches
Navigation and Ancillary Information Facility
Function Routine
• Ellipsoids
– nearest point – NEARPT, DNEARP
– surface ray intercept – SURFPT
– surface normal – SURFNM, EDNMPT
– point on surface – EDPNT
– limb – EDLIMB
– slice with a plane – INELPL
– altitude of ray w.r.t. to ellipsoid – NPEDLN
• Planes
– intersect ray and plane – INRYPL
• Ellipses
– project onto a plane – PJELPL
– find semi-axes of an ellipse – SAELGV
• Lines
– nearest point on line or segment – NPLNPT, NPSGPT
Derived Quantities 8
N IF Position Coordinate Transformations
Navigation and Ancillary Information Facility
Derived Quantities 11
N IF Vectors
Navigation and Ancillary Information Facility
• Function • Routine
– <v,w> – VDOT, DVDOT
– vxw – VCROSS, DVCRSS
– v/||v|| – VHAT, DVHAT
– v x w / || v x w|| – UCROSS, DUCRSS
– v+w – VADD, VADDG
– v-w – VSUB, VSUBG
– av [+ bw [+ cu]] – VSCL, [VLCOM, [VLCOM3]]
– angle between v and w – VSEP
– ||v|| – VNORM
v |
v
||
w VPROJ, VPERP
v
v TWOVEC, FRAME
w
Derived Quantities 12
N IF Matrices
Navigation and Ancillary Information Facility
• Function • Routine
– Mxv – MXV
– MxM – MXM
– Mt x v – MTXV
– Mt x M – MTXM
– M x Mt – MXMT
– vt x M x v – VTMV
– Mt – XPOSE
– M-1 – INVERT, INVSTM
M = Matrix
V = Vector
X = Multiplication
T = Transpose
Derived Quantities 13
N IF Matrix Conversions
Navigation and Ancillary Information Facility
Function Routines
ax ay az
bx by bz EUL2M, M2EUL
Transform between cx cy cz
ax ay az
bx by bz
RAXISA, AXISAR
cx cy cz ROTATE, ROTMAT
Transform between
Rotation axis 3x3 rotation matrix
and angle
ax ay az
(Q0,Q1,Q2,Q3) bx by bz
cx cy cz
Q2M, M2Q
SPICE Style Transform between
3x3 rotation matrix
Quaternion
Derived Quantities 14
Examples of Computing
N IF Derived Quantities
Navigation and Ancillary Information Facility
Derived Quantities 15
N IF Computing Illumination Angles
Navigation and Ancillary Information Facility
Derived Quantities 16
N IF Computing Illumination Angles
Navigation and Ancillary Information Facility
Derived Quantities 17
N IF Computing Tangent Point
Navigation and Ancillary Information Facility
Tangent
point
• CALL GETFOV to obtain
Nearest
surface
boresight direction vector
instrument point
boresight • CALL TANGPT to find the
direction
tangent point on the ray and
•
Observer target-observer the point on the surface
vector
nearest to it
Derived Quantities 18
N IF Computing Ring Plane Intercepts
Navigation and Ancillary Information Facility
Derived Quantities 19
N IF Computing Ring Plane Intercepts-2
Navigation and Ancillary Information Facility
Derived Quantities 20
N IF Computing Ring Plane Intercepts-3
Navigation and Ancillary Information Facility
• 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
An
used to represent the ring plane.
alternate
• Use SINCPT to find the intercept of the Earth-Cassini ray with the
approach 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
Saturn’s 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 21
N IF Computing Occultation Events
Navigation and Ancillary Information Facility
Spacecraft
Direction to motion
the observer
A body
such as
a satellite
Derived Quantities 22
N IF Find Occultation Ingress/Egress
Navigation and Ancillary Information Facility
• Select a start epoch, stop epoch and
step size.
– Start and stop epochs can bracket multiple
occultation events
– Step size should be smaller than the shortest
occultation duration of interest, and smaller
than the minimum interval between
occultation events that are to be
distinguished, but large enough to solve the
problem with reasonable speed.
• Insert search interval into a SPICE
window. This is the “confinement
Direction to
Spacecraft window.”
motion
the observer • CALL GFOCLT to find occultations, if any.
A body The time intervals, within the confinement
such as window, over which occultations occur will
a satellite be returned in a SPICE window.
– GFOCLT can treat targets as ellipsoids, DSK
shapes, or points (but at least one must be an
ellipsoid or DSK shape, and DSK shapes can
be used only with point targets).
– GFOCLT can search for different occultation
or transit geometries: full, partial, annular, or
“any.”
Derived Quantities 23
N IF
Navigation and Ancillary Information Facility
April 2023
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
Other Useful Functions * The text file must be in native text format for your computer
4
N IF Text I/O (2)
Navigation and Ancillary Information Facility
Filename? mydata.file
You specified the file: mydata.file
CALL RDTEXT ( NAME, LINE, EOF )
END DO
• 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.
• Extracting numeric and time data
– [F] NPARSD, NPARSI, DXTRCT, TPARTV
– [F,C,I] PRSDP, PRSINT,
– [F,C,I,M] TPARSE
• Heavy duty parsing
– [F] SCANIT
Other Useful Functions 8
N IF String Manipulation - Parsing (3)
Navigation and Ancillary Information Facility
'a dog'
lparse or
'a dog, a cat, and a cow' lparsm 'a cat'
'and a cow'
Split on a comma
• 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
– [F] LJUCRS: left-justify, upper-case and compress
• Sorting arrays
– [F,C] SHELLC, SHELLI, SHELLD, ORDERI, ORDERC, ORDERD,
REORDC, REORDI, REORDD, REORDL
• Searching ordered arrays
– [F,C] BSRCHC, BSRCHI, BSRCHD, LSTLEC, LSTLEI, LSTLED,
LSTLTC, LSTLTI, LSTLTD, BSCHOI
• Searching unordered arrays
– [F,C] ISRCHC, ISRCHI, ISRCHD, ESRCHC
• Moving portions of arrays
– [F] CYCLAC, CYCLAD, CYCLAI
• Inserting and removing array elements
– [F] INSLAC, INSLAD, INSLAI, REMLAC, REMLAD, REMLAI
Sorted
Body A.U.1 Body A.U.1
sun 00.0 04 earth 00.983
mercury 00.455 06 jupiter 05.440
venus 00.720 05 mars 01.531
earth 00.983 02 mercury 00.455
mars 01.531 09 neptune 30.091
jupiter 05.440 orderc 10 reordc,d pluto 31.052
saturn 09.107 07 saturn 09.107
uranus 20.74 01 sun 00.000
neptune 30.091 08 uranus 20.74
pluto 31.052 03 venus 00.720
Union
Intersection
Difference
NAIF
Cassini
Boris MGS Other
Chuck Boris
Ed Chuck Boris Lee
Nat Ed Ed
Lee Nat
• 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
April 2023
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
GF Subsystem Overview
100
A SPICE Window
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 B and C. Then
use window intersection to obtain the confinement window with known data
availability.
GF Search Examples
MEX
Mars
Mars-MEX position
vector
API: GFDIST
Geometry Finder Subsystem 17
N IF Distance Within a Range
Navigation and Ancillary Information Facility
MRO
.. .
Opportunity
rover
Mars
API: GFDIST
Geometry Finder Subsystem 18
N IF Range Rate Extremum
Navigation and Ancillary Information Facility
Find the time periods when the range rate of a lunar reflector,
as seen by an Earth station, attains an absolute extremum.
Lunar
Reflector
Station
Moon
Earth
API: GFRR
Geometry Finder Subsystem 19
N IF Angular Separation Inequality Search -1
Navigation and Ancillary Information Facility
Find the time periods 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.
MRO
API: GFSEP
Geometry Finder Subsystem 20
N IF Angular Separation Inequality Search -2
Navigation and Ancillary Information Facility
Sun
Moon
API: GFSEP
Geometry Finder Subsystem 21
N IF Occultation/Transit Search
Navigation and Ancillary Information Facility
Point target
Phobos in in occultation Phobos in
annular partial transit
transit
Point target
in transit
Mars Earth
Phobos in full
Phobos in occultation
partial
occultation API: GFOCLT
Geometry Finder Subsystem 22
N IF Target in Field of View
Navigation and Ancillary Information Facility
Find the time periods when Titan appears in the FOV of the
Cassini ISS Narrow Angle Camera (NAC). The target shape is
modeled as an ellipsoid. (Point targets are also supported.)
Titan
API: GFTFOV
Geometry Finder Subsystem 23
N IF Ray in FOV Search
Navigation and Ancillary Information Facility
Find the time periods when a star 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.
API: GFRFOV
Geometry Finder Subsystem 24
N IF Position Coordinate Local Extremum Search
Navigation and Ancillary Information Facility
J2000 Z
Earth-Sun direction
Point of
Unit sphere max latitude
Planetocentric
Latitude
Path of sub-solar point
on unit sphere (in red)
J2000 X
J2000 Y
API: GFPOSC
Geometry Finder Subsystem 25
N IF Position Coordinate Equality Search
Navigation and Ancillary Information Facility
J2000 Z
API: GFPOSC
Geometry Finder Subsystem 26
N IF Position Coordinate Inequality Search -1
Navigation and Ancillary Information Facility
DSS-13_TOPO Z
DSS-13_TOPO X
Direction to MRO
6 deg. elevation
DSS-13_TOPO Y
API: GFPOSC
Geometry Finder Subsystem 27
N IF Position Coordinate Inequality Search -2
Navigation and Ancillary Information Facility
API: GFPOSC
Geometry Finder Subsystem 28
N IF Sub-Observer Point Coordinate Equality Search
Navigation and Ancillary Information Facility
Outward surface
Path of sub-spacecraft normal direction at
Spacecraft
point (in red) sub-spacecraft point
Planetocentric
latitude = 25 deg.
Body-fixed Y
Body-fixed X
API: GFSUBC
Geometry Finder Subsystem 29
N IF Surface Intercept Coordinate Equality Search
Navigation and Ancillary Information Facility
Spacecraft
Path of boresight
intercept (in red) Camera boresight
direction at epoch of
meridian crossing
Body-fixed Y
Planetographic
Body-fixed X longitude = 45 deg.
API: GFSNTC
Geometry Finder Subsystem 30
N IF Surface Intercept “Box” Search
Navigation and Ancillary Information Facility
Find the time periods when the planetographic longitude of a 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
Path of boresight
Planetographic Latitude intercept (in red) Camera boresight
0 to 30 deg. direction
Body-fixed Y
Planetographic Longitude
Body-fixed X -45 to -70 deg.
API: GFSNTC
Geometry Finder Subsystem 31
N IF Surface Intercept Coordinate Equality Search
Navigation and Ancillary Information Facility
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 Cassini orbiter
IAU_SATURN X s
iu
ra
d Cassini to DSS-13
t
cep radiation direction
ter
In
IAU_SATURN Y
“Ring plane” ellipsoid: 1cm
thick, radius 600000 km,
Path of radiation centered at Saturn’s center
Earth intercept (in red)
DSS-13
API: GFSNTC
Geometry Finder Subsystem 32
N IF User-Defined Quantity Extremum Search
Navigation and Ancillary Information Facility
Apparent position of
Titan, computed using
LT+S correction
Geometric
Angular separation of
position of Cassini orbiter
Titan position vectors
API: GFUDS
Geometry Finder Subsystem 33
N IF
Navigation and Ancillary Information Facility
Confinement
Window [ ]
D = f(t)
Distance
D0
Result
Window
[t0, t0] Time[t1, t1] [t2, t2] [t3, t3]
Time
Geometry Finder Subsystem 38
N IF Solve Distance < Inequality
Navigation and Ancillary Information Facility
Confinement
Window [ ]
D = f(t)
Distance
D0
Result
Window
[t0, Time t1] [t2, t3]
Time
Geometry Finder Subsystem 39
N IF Solve Distance > Inequality
Navigation and Ancillary Information Facility
Confinement
Window [ ]
D = f(t)
Distance
D0
Result
Window
[t0, t1] Time [t2, t3] [t4,t5]
Time
Geometry Finder Subsystem 40
N IF Find Local Minima
Navigation and Ancillary Information Facility
Confinement
Window [ ]
Distance
D = f(t)
Result
[t0,t0] [t1,t1] Window
Time
Geometry Finder Subsystem 41
N IF Find Local Maxima
Navigation and Ancillary Information Facility
Confinement
Not
Window [ ] Solutions
interior of the
D = f(t) confinement
window,
never on the
boundary
Result
[t0,t0] Window
Time
Geometry Finder Subsystem 42
N IF Find Absolute Minimum
Navigation and Ancillary Information Facility
Confinement
Window [ ]
Distance
D = f(t)
DMIN
Result
[t0,t0] Window
Time
Geometry Finder Subsystem 43
N IF Find Absolute Maximum
Navigation and Ancillary Information Facility
Confinement
Window [ ]
DMAX
Distance
D = f(t)
Result
[t0,t0] Window
Time
Geometry Finder Subsystem 44
N IF Find Adjusted Absolute Minimum
Navigation and Ancillary Information Facility
Confinement
Window [ ]
D = f(t)
Distance
DADJ
ADJ0
DMIN Result
Window
[ t0, t1 ] [ t 2 , t3 ]
Time
Geometry Finder Subsystem 45
N IF Find Adjusted Absolute Maximum
Navigation and Ancillary Information Facility
Confinement
Window [ ]
DMAX
ADJ0
DADJ
Distance
D = f(t)
[ t0, t1 ]
Result
[ t2, t3 ]
Window
Time
Geometry Finder Subsystem 46
N IF
Navigation and Ancillary Information Facility
More Details
• GF mid-level APIs
• Root Finding, including step
size selection
• Workspace
• API Example: GFDIST
Root Finding
D = f(t)
Distance
D0
Time
Geometry Finder Subsystem 52
N IF Monotone Windows-2
Navigation and Ancillary Information Facility
D = f(t)
Distance
D0
[ t0, t1 ]
Time
Geometry Finder Subsystem 53
N IF Bracketing Interval Endpoints
Navigation and Ancillary Information Facility
• 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.
step size
“delta”
t1 t2 t3 t4 t5 t6 t7
Workspace
INTEGER LBCELL
PARAMETER ( LBCELL = -5 ) Choose a “large” value for window size (called “MAXWIN”
INTEGER MAXWIN here), if you’re not sure what size is required. The actual
requirement depends on underlying geometry, confinement
PARAMETER ( MAXWIN = 200000 ) window, and search step size.
DOUBLE PRECISION CNFINE ( LBCELL : MAXWIN )
DOUBLE PRECISION RESULT ( LBCELL : MAXWIN )
DOUBLE PRECISION WORK ( LBCELL : MAXWIN, NWDIST )
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:
CALL STR2ET ( 'utc_start', tdb_0)
CALL STR2ET ( 'utc_stop', tdb_1)
• 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: DON’T 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.
* 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 68
N IF Arguments of GFDIST - 2
Navigation and Ancillary Information Facility
INPUTS
• RELATE, REFVAL, ADJUST: parameters specifying a constraint to be met
by the distance.
– RELATE may be any of ‘=‘, ‘>’, ‘<‘, ‘LOCMAX’, ‘LOCMIN’, ‘ABSMAX’, ‘ABSMIN’
– If RELATE is an equality or inequality operator, REFVAL is the corresponding
double precision reference value. Units are km.
» For example, if the constraint is “distance = 4.D5 km,” then RELATE is ‘=‘
and REFVAL is 4.D5.
– If RELATE specifies an absolute maximum or minimum, ADJUST is the
adjustment value. Units are km.
» Set ADJUST to 0.D0 for a simple absolute maximum or minimum.
» Set ADJUST to a positive value ADJ for either DISTANCE > absolute max -
ADJ or DISTANCE < absolute min + ADJ.
• 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 69
N IF
Navigation and Ancillary Information Facility
Toolkit Applications
April 2023
N IF Toolkit Applications
Navigation and Ancillary Information Facility
Toolkit Applications 2
N IF Using Toolkit Apps
Navigation and Ancillary Information Facility
Toolkit Applications 3
N IF CHRONOS
Navigation and Ancillary Information Facility
Toolkit Applications 5
N IF CHRONOS - Miscellaneous
Navigation and Ancillary Information Facility
Toolkit Applications 6
N IF CHRONOS - Usage
Navigation and Ancillary Information Facility
Terminal Window
$ chronos
...
CHRONOS Usage
------------------------------------------------------------------
Toolkit Applications 7
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 8
N IF MKSPK
Navigation and Ancillary Information Facility
Toolkit Applications 9
N IF SPKMERGE
Navigation and Ancillary Information Facility
Toolkit Applications 10
N IF SPKMERGE - Precedence Rule
Navigation and Ancillary Information Facility
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 = naif0007.tls
spk_kernel = output.bsp
bodies = -82, 10, 301, 399, 3
source_spk_kernel = de403s.bsp
source_spk_kernel = 990825A_SCEPH_EM52_JP0.bsp
$ spkmerge
SPKMERGE -- SPK Merge Tool, Version 3.2, SPICE Toolkit N0057
> spkmerge_cas_example.cmd
Creating output.bsp
Toolkit Applications 12
N IF SPKDIFF
Navigation and Ancillary Information Facility
Toolkit Applications 13
N IF SPKDIFF - Usage
Navigation and Ancillary Information Facility
Terminal Window
% spkdiff
Toolkit Applications 14
N IF SPKDIFF – Basic Output Example
Navigation and Ancillary Information Facility
Terminal Window
$ 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
Toolkit Applications 15
N IF SPKDIFF – Dump Output Example
Navigation and Ancillary Information Facility
Terminal Window
$ 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 -8.0803561182349E-08
-1.0394439243989E-07 -3.9614350816493E-05
2.2866028283812E+08 +4.2172435702119E-02 +2.3672255851626E-06 -1.1475679619731E-04 +1.3970238250217E-07
+1.4080506259574E-07 -3.9250157214024E-05
2.2866290049059E+08 +4.4830247467488E-02 +9.1590974014175E-05 -7.3802870365833E-04 +5.7800410436763E-07
-1.1724240528272E-07 -4.2099832045985E-05
2.2866551814305E+08 +4.5968515669515E-02 -1.3529652839857E-04 -7.5686845133612E-05 -4.7565892258325E-07
+3.4127364997784E-08 -4.2529268294482E-05
--More--
Toolkit Applications 16
N IF MSOPCK
Navigation and Ancillary Information Facility
Toolkit Applications 17
N IF FRMDIFF
Navigation and Ancillary Information Facility
Toolkit Applications 19
N IF FRMDIFF – Sampling Example
Navigation and Ancillary Information Facility
Terminal Window
$ 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 seco...
# to '2009 JAN 28 00:01:05.346' TDB (286372865.34683 TDB seco...
#
# 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 -6.1...
2.8628543776953E+08 +6.9350851552324E-01 +3.7594215798843E-01 -6.1...
Toolkit Applications 20
N IF FRMDIFF – Comparison Example
Navigation and Ancillary Information Facility
Terminal Window
$ 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 MKDSK
Navigation and Ancillary Information Facility
Toolkit Applications 23
N IF Kernel Summary Applications
Navigation and Ancillary Information Facility
Toolkit Applications 24
N IF BRIEF
Navigation and Ancillary Information Facility
Toolkit Applications 25
N IF BRIEF - Usage
Navigation and Ancillary Information Facility
Terminal Window
$ brief
...
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:
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.
Toolkit Applications 26
N IF BRIEF - Example
Navigation and Ancillary Information Facility
Terminal Window
$ brief de405s.bsp m01_cruise.bsp
Toolkit Applications 27
N IF CKBRIEF
Navigation and Ancillary Information Facility
Time
Sample Type 3
CK Segment Instances of
Available
Coverage Gaps Pointing Data
Toolkit Applications 29
N IF CKBRIEF – Usage
Navigation and Ancillary Information Facility
Terminal Window
$ ckbrief
...
CKBRIEF is a command-line utility program that displays a summary for
one or more binary CK files. The program usage is:
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.
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 30
N IF CKBRIEF – Example
Navigation and Ancillary Information Facility
Terminal Window
$ ckbrief -sclk 981116_981228pa.bc sclk.ker
Object: -82000
Interval Begin SCLK Interval End SCLK AV
------------------------ ------------------------ ---
1/1289865849.116 1/1293514473.118 N
Object: -82000
Interval Begin UTC Interval End UTC AV
------------------------ ------------------------ ---
1999-AUG-17 17:30:01.418 1999-AUG-17 23:05:42.039 N
1999-AUG-17 23:05:45.289 1999-AUG-18 06:06:05.874 N
1999-AUG-18 06:06:09.124 1999-AUG-18 11:52:17.741 N
1999-AUG-18 11:52:20.991 1999-AUG-18 13:30:00.953 N
Toolkit Applications 31
N IF CKBRIEF - ‘-dump’ Example
Navigation and Ancillary Information Facility
Terminal Window
$ ckbrief mgs_spice_c_kernel_2004-099.bc MGS_SCLKSCET.00053.tsc naif0007.tls -dump
-rel -utc
Segment No.: 1
Object: -94000
Toolkit Applications 32
N IF DSKBRIEF
Navigation and Ancillary Information Facility
Toolkit Applications 33
N IF DSKBRIEF - Usage
Navigation and Ancillary Information Facility
Terminal Window
$ dskbrief -u
...
DSKBRIEF is a command-line utility program that displays a summary of
one or more binary DSK files. The program usage is:
% dskbrief [options] file [file...]
The available options are shown below. The order of options is not
significant. The option keys must be lowercase as shown below.
-a Treat all DSK files as a single file.
-gaps Display coverage gaps. Applies only when -a is used.
-ext Display extended summaries: these include data type, data
class, and time bounds. This option applies to summaries
of groups of DSK segments.
-tg Require segment time bounds to match when grouping
segments.
-seg Display a segment-by-segment summary.
-full Display a detailed summary for each segment, including
data-type-specific parameters. This option implies a
segment-by-segment summary.
-d <n> Display n significant digits of floating point values.
-v Display the version of this program.
-h Display help text.
-u Display usage text.
Toolkit Applications 34
N IF DSKBRIEF - Example
Navigation and Ancillary Information Facility
Terminal Window
$ dskbrief ROS_CG_M004_NSPCESA_N_V1.BDS ROS_LU_M003_OSPCLAM_N_V1.BDS ../FK/ROS_V25.TF
...
Summary for: ROS_CG_M004_NSPCESA_N_V1.BDS
Toolkit Applications 35
N IF SPACIT
Navigation and Ancillary Information Facility
Toolkit Applications 36
N IF Comment Manipulation Tools
Navigation and Ancillary Information Facility
Toolkit Applications 37
N IF COMMNT
Navigation and Ancillary Information Facility
Toolkit Applications 38
N IF COMMNT - Command Line Example
Navigation and Ancillary Information Facility
Terminal Window
$ commnt -r de405.bsp | more
; de405.bsp LOG FILE
;
; Created 1999-10-03/14:31:58.00.
;
; BEGIN NIOSPK COMMANDS
LEAPSECONDS_FILE = /kernels/gen/lsk/naif0007.tls
SPK_FILE = de405.bsp
SOURCE_NIO_FILE = /usr2/nio/gen/de405.nio
BODIES = 1 2 3 4 5 6 7 8 9 10 301 399 199 299 499
BEGIN_TIME = CAL-ET 1950 JAN 01 00:00:41.183
END_TIME = CAL-ET 2050 JAN 01 00:01:04.183
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 39
N IF COMMNT – Interactive Example
Navigation and Ancillary Information Facility
Terminal Window
$ commnt
COMMNT Options
( Q ) Quit.
( A ) Add comments to a binary file.
( R ) Read the comments in a binary file.
( E ) Extract comments from a binary file.
( D ) Delete the comments in a binary file.
Option: E
Filename? de405.bsp
Filename? de405_comments.txt
Toolkit Applications 40
N IF File Format Conversion Tools
Navigation and Ancillary Information Facility
Toolkit Applications 41
N IF
Navigation and Ancillary Information Facility
Non-Toolkit Applications
April 2023
N IF Summary
Navigation and Ancillary Information Facility
• NAIF makes available a set of applications not included in the
Toolkits. This set includes programs for:
– making, modifying, validating, inspecting, and converting SPK files:
» pinpoint, dafcat, bspidmod, dafmod, spy, oem2spk, spk2oem
– making and modifying CK files
» prediCkt, ckslicer, ckspanit, dafcat, cksmrg, dafmod
– making SCLK files
» makclk
– merging and modifying DSK files
» dlacat, dskmod
– computing derived quantities
» orbnum, optics, spy
– determining SPICE kernel type and binary format, and converting between
native and non-native formats
» archtype, bff, bingo
• Executables and User’s Guides are on the NAIF server at:
– https://naif.jpl.nasa.gov/naif/utilities.html
Non-Toolkit Applications 2
N IF Using Non-Toolkit Apps
Navigation and Ancillary Information Facility
Non-Toolkit Applications 3
N IF PINPOINT
Navigation and Ancillary Information Facility
$ brief mer1_meridiani.bsp
Brief. Version: 2.2.0 (SPICE Toolkit N0057)
Non-Toolkit Applications 5
N IF DAFCAT
Navigation and Ancillary Information Facility
Non-Toolkit Applications 6
N IF DAFCAT Example: SPK
Navigation and Ancillary Information Facility
Terminal Window
$ dafcat m01_merged.bsp
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
Concatenating files:
spk_m_od32371-32458_rec_v1.bsp
...
to:
m01_merged_2.bsp
Non-Toolkit Applications 7
N IF DAFCAT Example: CK
Navigation and Ancillary Information Facility
Terminal Window
$ dafcat m01.bc
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
Concatenating files:
m01_sc_2004-04-20.bc
m01_sc_2004-04-21.bc
to:
m01.bc
Non-Toolkit Applications 8
N IF DLACAT
Navigation and Ancillary Information Facility
Non-Toolkit Applications 9
N IF DLACAT Example: DSK
Navigation and Ancillary Information Facility
Terminal Window
$ dlacat phoebe_shape.bds
phoebe_shape_part1.bds
phoebe_shape_part2.bds
^D
Concatenating files:
phoebe_shape_part1.bds
phoebe_shape_part2.bds
to:
phoebe_shape.bds
Concatenating files:
phoebe_shape_part1.bds
phoebe_shape_part2.bds
to:
phoebe_shape_2.bds
Non-Toolkit Applications 10
N IF BSPIDMOD
Navigation and Ancillary Information Facility
• bspidmod is a program for altering the object IDs in a binary SPK file
– It can be used to modify IDs in an SPK file(s) produced with a “bogus” spacecraft ID (or a
simulation spacecraft ID)
– It can be used to replace “official” 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, such as is done by spkdiff)
– Works only in kernels in “native” binary format
• bspidmod has the following usage:
bspidmod -spki inpspk -idi inpid -ido outid -mod item -oflg
– “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 be in the 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 11
N IF BSPIDMOD Example
Navigation and Ancillary Information Facility
Terminal Window
$ brief mer2_crus_sim_id.bsp
Brief. Version: 2.2.0 (SPICE Toolkit N0057)
Body: -255
Start of Interval (ET) End of Interval (ET)
-------------------------------- --------------------------------
2003 JUL 09 00:15:00.000 2004 JAN 04 04:25:42.557
$ 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 (SPICE Toolkit N0057)
Non-Toolkit Applications 12
N IF DSKMOD
Navigation and Ancillary Information Facility
Non-Toolkit Applications 13
N IF DSKMOD Example
Navigation and Ancillary Information Facility
Terminal Window
$ dskbrief phobos_2014_09_22.bds
...
Summary for: phobos_2014_09_22.bds
$ dskmod -dskin phobos_2014_09_22.bds -mod SURFACE -from 401 -to 1001 -overwrite
$ dskbrief phobos_2014_09_22.bds
...
Summary for: phobos_2014_09_22.bds
Non-Toolkit Applications 14
N IF DAFMOD
Navigation and Ancillary Information Facility
Non-Toolkit Applications 15
N IF DAFMOD Example: SPK
Navigation and Ancillary Information Facility
Terminal Window
$ brief mer2_crus_sim_id.bsp
Body: -255
...
$ dafmod
$ brief mer2_crus_sim_id.bsp
Non-Toolkit Applications 16
N IF DAFMOD Example: CK
Navigation and Ancillary Information Facility
Terminal Window
$ ckbrief -rel mro_sc_pred.bc mro.tsc naif0009.tls
$ dafmod
Non-Toolkit Applications 17
N IF SPY
Navigation and Ancillary Information Facility
Non-Toolkit Applications 18
N IF SPY: Selected Features
Navigation and Ancillary Information Facility
• Operating modes
– Interactive, batch, shell command line
• Auxiliary files
– Start-up file, command files, log file, save file
• Interactive command support
– Command history: recall, repetition, and command editing; editor selection;
command error detection; (limited) automatic command error correction
• User default support
– Set, show, reset default values
• 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
• Online help: command language summary
Non-Toolkit Applications 19
N IF SPY Example: Dump SPK Data
Navigation and Ancillary Information Facility
Terminal Window
Spy > dump data spk testspk.bsp segment index 13 stop packet 2;
Non-Toolkit Applications 20
N IF SPY Example: Sample State Vectors
Navigation and Ancillary Information Facility
Terminal Window
Non-Toolkit Applications 21
N IF SPY Example: Check SPK Integrity
Navigation and Ancillary Information Facility
Terminal Window
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 22
N IF OEM2SPK and SPK2OEM
Navigation and Ancillary Information Facility
Non-Toolkit Applications 24
N IF CKSLICER
Navigation and Ancillary Information Facility
Terminal Window
$ dir mgs_sc_ab1_v2.bc
-rw-rw-r-- 1 naifuser 195535872 Jul 17 1999 mgs_sc_ab1_v2.bc
$ dir mgs_sc_ab1_970915.bc
-rw-rw-rw- 1 naifuser 480256 Apr 25 10:23 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 26
N IF CKSPANIT
Navigation and Ancillary Information Facility
Non-Toolkit Applications 28
N IF CKSMRG
Navigation and Ancillary Information Facility
• cksmrg is a command line program that merges data from Type 3
CK segments provided in a single CK file, having the same ID and
base frame
• cksmrg is used for eliminating gaps between segments (that
cannot be removed by ckspanit) and removing duplicate data
points contained in different segments
• cksmrg has 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>]
Non-Toolkit Applications 30
N IF MAKCLK
Navigation and Ancillary Information Facility
Non-Toolkit Applications 31
N IF MAKCLK Example
Navigation and Ancillary Information Facility
Terminal Window
$ more makclk.setup
SCLKSCET_FILE = flc_sclkscet.00007
OLD_SCLK_KERNEL = flc_template.tsc
FILE_NAME = flc_sclkscet.00007.tsc
NAIF_SPACECRAFT_ID = -77
LEAPSECONDS_FILE = naif0009.tls
PARTITION_TOLERANCE = 10
LOG_FILE = flc_sclkscet.00007.log
$ more flc_sclkscet.00007
(... SCLKSCET SFDU header ...)
CCSD3RE00000$$scet$$NJPL3IS00613$$data$$
*____SCLK0_____ ________SCET0________ _DUT__ __SCLKRATE__
0.000 2000-001T11:58:55.816 64.184 1.000000000
189345665.000 2006-001T00:00:00.816 64.184 0.000010000
189345666.000 2006-001T00:00:00.817 65.184 1.000000000
268620868.000 2008-188T12:53:23.211 65.184 0.999998631
276588129.000 2008-280T18:00:53.314 65.184 0.999999788
281552200.000 2008-338T04:55:23.270 65.184 1.000000029
284040077.000 2009-001T00:00:00.341 65.184 0.000010000
284040078.000 2009-001T00:00:00.342 66.184 1.000000029
287261113.000 2009-038T06:43:55.535 66.184 1.000000131
291848718.000 2009-091T09:04:01.136 66.184 1.000000166
CCSD3RE00000$$data$$CCSD3RE00000$$sclk$$
Non-Toolkit Applications 32
N IF MAKCLK Example (continued)
Navigation and Ancillary Information Facility
Terminal Window
$ more flc_template.tsc
KPL/SCLK
\begindata
SCLK_KERNEL_ID = ( @2009-04-07/12:00 )
SCLK_DATA_TYPE_77 = ( 1 )
SCLK01_TIME_SYSTEM_77 = ( 2 )
SCLK01_N_FIELDS_77 = ( 2 )
SCLK01_MODULI_77 = ( 4294967296 256 )
SCLK01_OFFSETS_77 = ( 0 0 )
SCLK01_OUTPUT_DELIM_77 = ( 1 )
SCLK_PARTITION_START_77 = ( 0.0000000000000E+00 )
SCLK_PARTITION_END_77 = ( 1.0995116277750E+12 )
SCLK01_COEFFICIENTS_77 = ( 0.E+00 0.E+00 1.E+00 )
\begintext
$ makclk
.....
Enter the name of the command file
> flc_sclkscet.00007.setup
flc_sclkscet.00007.tsc created.
Non-Toolkit Applications 33
N IF ORBNUM
Navigation and Ancillary Information Facility
• orbnum is a program for generating a SPICE orbit number file containing
orbit numbers and corresponding orbit start/stop times, 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 position’s Z-coordinate, or min or max value of the s/c’s latitude
• orbnum is a command line program with the following usage
orbnum -pref pref_file -num init_orbit -file orbnum_file –d –v –audit –tdb –verbose
optional
– “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
– “orbnum_file” is the name of the orbit number file to be created
Non-Toolkit Applications 35
N IF OPTIKS
Navigation and Ancillary Information Facility
Non-Toolkit Applications 37
N IF ARCHTYPE
Navigation and Ancillary Information Facility
$ 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 39
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 40
N IF BFF Examples
Navigation and Ancillary Information Facility
Terminal Window
$ bff mer2_surf_rover.bsp
BIG-IEEE
Non-Toolkit Applications 41
N IF BINGO
Navigation and Ancillary Information Facility
Non-Toolkit Applications 42
N IF BINGO Examples
Navigation and Ancillary Information Facility
Terminal Window
--- DAF-based binary kernel conversions:
Non-Toolkit Applications 43
N IF
Navigation and Ancillary Information Facility
Exception Handling
April 2023
N IF Topics
Navigation and Ancillary Information Facility
Exception Handling 2
N IF Exceptions Are… - 1
Navigation and Ancillary Information Facility
Exception Handling 3
N IF Exceptions Are… - 2
Navigation and Ancillary Information Facility
Exception Handling 4
N IF SPICE “Errors”
Navigation and Ancillary Information Facility
Exception Handling 5
N IF Language Dependencies
Navigation and Ancillary Information Facility
Exception Handling 6
N IF Fortran and C Error Handling Features - 1
Navigation and Ancillary Information Facility
Exception Handling 7
N IF Fortran and C Error Handling Features - 2
Navigation and Ancillary Information Facility
• 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)
• Retrieve error information
– Get status and error messages via subroutine calls
• Customize error response---actions taken when an error
occurs.
– Set error handling mode (“action”)
– Set error output device
– Set message selection
• Inhibit tracing
– To improve run-time performance (only for thoroughly debugged code)
Exception Handling 8
N IF Error Messages
Navigation and Ancillary Information Facility
• Short message
– Up to 25 characters.
– Can easily be compared with expected value.
» Example: SPICE(FILEOPENFAILED).
• 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.
» Don’t need a “crash” to obtain a traceback.
Exception Handling 9
N IF Error Handling Actions - 1
Navigation and Ancillary Information Facility
• 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.
Exception Handling 10
N IF Error Handling Actions - 2
Navigation and Ancillary Information Facility
Exception Handling 11
N IF Error Device
Navigation and Ancillary Information Facility
Exception Handling 12
N IF Customize Error Handling - 1
Navigation and Ancillary Information Facility
• 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 14
N IF Get Error Status - 1
Navigation and Ancillary Information Facility
Exception Handling 15
N IF Get Error Status - 2
Navigation and Ancillary Information Facility
Exception Handling 16
N IF Signal Errors - 1
Navigation and Ancillary Information Facility
Exception Handling 17
N IF Signal Errors - 2
Navigation and Ancillary Information Facility
• Signal error
– 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
• Reset error status after handling error
– CALL RESET()
– reset_c()
Exception Handling 18
N IF Icy Error Handling
Navigation and Ancillary Information Facility
• 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 library’s 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 19
N IF Mice Error Handling
Navigation and Ancillary Information Facility
• 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 library’s 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…
Exception Handling 21
N IF
Navigation and Ancillary Information Facility
SPICE Toolkit
Common Problems
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Prevention
• Useful Documentation
• Reporting a Problem to NAIF
Common Problems 2
N IF Prevention - 1
Navigation and Ancillary Information Facility
• Use a Toolkit obtained directly from NAIF and intended for your
specific environment (platform/OS/compiler/compiler options)
– Be extra careful about 32-bit versus 64-bit hardware
• Use a current Toolkit
– Newer Toolkits may have bug fixes and new features you need
» Toolkits are always backwards compatible, so you should have no problem re-
linking your “old” application to the latest Toolkit
• Read the pertinent documentation
– Tutorials, module headers, Required Reading technical reference documents,
comments inside kernels
Common Problems 4
N IF Useful Documentation
Navigation and Ancillary Information Facility
Common Problems 5
N IF Reporting a Problem to NAIF
Navigation and Ancillary Information Facility
Common Problems 6
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Overview
Navigation and Ancillary Information Facility
NAIF Server 4
N IF Getting Operational Project Kernels - 1
Navigation and Ancillary Information Facility
1 – Select Data
4a - Select the project name to get access to the 4b - Select the kernel type to get access to all kernels of
kernels folder for that project with sub-folders for all -or- that type for that project. The number tells how many
kernel types (see next page) kernels of that type are available. (see next page)
NAIF Server 5
N IF Getting Operational Project Kernels - 2
Navigation and Ancillary Information Facility
Access to all kernels for Access to kernels of the selected
the named project type for the named project
...
NAIF Server 6
N IF Getting PDS Archived Kernels - 1
Navigation and Ancillary Information Facility
NAIF Server 7
N IF Getting PDS Archived Kernels - 2
Navigation and Ancillary Information Facility
1 – Select Data
4a – Copy link to get the whole archive using “wget” 4b - Select archive link to browse archive directory tree
https://naif.jpl.nasa.gov/pub/naif/pds/ -or- and access individual kernels, meta-kernels, and
data/co-s_j_e_v-spice-6-v1.0/cosp_1000 archive documentation (see next pages)
NAIF Server 8
N IF Getting Archived Kernels – PDS3
Navigation and Ancillary Information Facility
Top level directory on a
PDS3 SPICE archive Select “aareadme.htm”
to access PDS3 archive
description document
Select a
kernel-type
folder to
Select “data” to access
kernel-type folders access
kernels
Select “extras” to
access “mk” folder
Select “mk” to
access meta-
kernels
NAIF Server 9
N IF Getting Archived Kernels – PDS4
Navigation and Ancillary Information Facility
Select “document” to
access PDS4 archive
description document
Select a
kernel-type
folder to
access
kernels
Select
“spice_kernels” Select “mk” to
to access kernel- access meta-
type and “mk” kernels
folders
NAIF Server 10
N IF Obtaining Archived Kernels - Subsetter
Navigation and Ancillary Information Facility
NAIF Server
N IF Downloading Archived Kernels – wget
Navigation and Ancillary Information Facility
NAIF Server 12
N IF Getting Generic Kernels
Navigation and Ancillary Information Facility
1 – Select Data
NAIF Server 13
N IF Direct Access to Server Directory Tree
Navigation and Ancillary Information Facility
Toolkit documentation,
Toolkit utilities Tutorials and Lessons
NAIF Server 14
N IF Horizons
Navigation and Ancillary Information Facility
April 2023
N IF Which Pieces of SPICE Must I Use?
Navigation and Ancillary Information Facility
Yes = is needed
Likely = very likely needed
Maybe = may be needed
WebGeocalc (WGC)
April 2023
N IF Overview
Navigation and Ancillary Information Facility
WebGeocalc 2
N IF Architecture
Navigation and Ancillary Information Facility
Internet
WebGeocalc 3
N IF Using WebGeocalc
Navigation and Ancillary Information Facility
WebGeocalc 5
N IF Computations
Navigation and Ancillary Information Facility
• See the WGC “menu” on the next page for some details
WebGeocalc 6
N IF Computation Menu*
Navigation and Ancillary Information Facility
WebGeocalc * Current as of March 2023; more computations will be added in the future 7
Illustrations of Three
N IF Available Computations
Navigation and Ancillary Information Facility
Solar
Incidence
Phase
Emission
Z Surface
intercept
point
Tstop-search
X
Geometry Calculator
• 30o
Illumination Angles
Geometry Calculator Y
Angular Size
Tstart-search
Camera scanning
The GREEN trace shows when the latitude of the across the
instrument boresight surface intercept is greater than planet’s surface
30 degrees, within the time range Tstart-search to Tstop-search.
WebGeocalc 9
N IF Typical Geometry Calculator Output
Navigation and Ancillary Information Facility
Angular size of
Phobos as seen
from the Mars
rover “SPIRIT”
Tabular results
WebGeocalc 10
N IF Typical Geometry Calculator Plot
Navigation and Ancillary Information Facility
WebGeocalc 11
N IF Another Geometry Calculator Plot
Navigation and Ancillary Information Facility
WebGeocalc 13
N IF Typical Geometric Event Finder Output
Navigation and Ancillary Information Facility
When is Phobos
occulted by Mars
as seen from
Mars Odyssey?
Tabular results
WebGeocalc 14
N IF Typical Geometric Event Finder Plot
Navigation and Ancillary Information Facility
Between June 1, 2010 and June 2, 2010, find times when Phobos is
occulted by Mars, as viewed from the Mars Odyssey spacecraft
WebGeocalc 15
N IF Example of Time Conversion
Navigation and Ancillary Information Facility
Convert a spacecraft clock string to UTC
Calendar (year/month/day)
Calendar (year/day-of-year)
Julian date
Seconds past J2000
Custom format
UTC
TDB
TDT
Spacecraft clock
Calendar (year/month/day)
Calendar (year/day-of-year)
Julian date
Seconds past J2000
WebGeocalc 17
N IF Categories of Available Data
Navigation and Ancillary Information Facility
A scrollable drop-down
Solar System Kernels
Latest Leapseconds Kernel menu is used to select the
Latest Planetary Constants Kernel
Ground Stations Kernels kernel set(s) to be used in
Cassini Huygens
Clementine your calculation.
Dawn
Deep Impact (Primary mission)
Deep Impact (EPOXI mission)
Deep Space 1
GRAIL Use the menu to select:
Hayabusa
JUNO
- generic kernel sets
Lunar Reconnaissance Orbiter - archived mission kernel sets
MAVEN
MER1 Rover (Opportunity) (includes relevant generic kernels)
MER2 Rover (Spirit)
MESSENGER
- manual selection of individual
Mars Express kernels from operations collections
.
.
Manual
WebGeocalc 19
N IF “Tooltip” Feature
Navigation and Ancillary Information Facility
WebGeocalc 21
N IF Auto-complete Feature
Navigation and Ancillary Information Facility
BERGELMIR
MIMAS
YMIR
WebGeocalc 22
N IF Downloading Results
Navigation and Ancillary Information Facility
WebGeocalc 23
N IF Saving Results for Use as New Inputs
Navigation and Ancillary Information Facility
WebGeocalc 24
N IF WGC Programmatic Interface
Navigation and Ancillary Information Facility
WebGeocalc 25
N IF Getting Help
Navigation and Ancillary Information Facility
• WGC users must read the “About the Data” web page to
understand the kinds of SPICE kernels (data) available to the
WGC tool
WebGeocalc 26
N IF Usage Rules
Navigation and Ancillary Information Facility
WebGeocalc 27
N IF Limited Capability
Navigation and Ancillary Information Facility
WebGeocalc 28
N IF Feedback
Navigation and Ancillary Information Facility
WebGeocalc 29
N IF Problems Using WGC
Navigation and Ancillary Information Facility
WebGeocalc 30
N IF Missing Input
Navigation and Ancillary Information Facility
WebGeocalc 31
N IF Request is Too Large
Navigation and Ancillary Information Facility
WebGeocalc 32
N IF SPICE Error Messages
Navigation and Ancillary Information Facility
WebGeocalc 33
N IF Unusable Time Tag(s) - 1
Navigation and Ancillary Information Facility
WebGeocalc 34
N IF Unusable Time Tag(s) - 2
Navigation and Ancillary Information Facility
WebGeocalc 35
N IF Unusable Time Tag(s) - 3
Navigation and Ancillary Information Facility
» The Spacecraft clock ID value is 0, which is not a valid clock ID. Either you did
not load an archival kernel set (containing the mission SCLK kernel) or you did
not manually load a SCLK kernel.
WebGeocalc 36
Incorrect Use of
N IF or Interpretation of Time Tags
Navigation and Ancillary Information Facility
WebGeocalc 37
N IF Time out of Bounds - 1
Navigation and Ancillary Information Facility
WebGeocalc 39
N IF Missing Data - 1
Navigation and Ancillary Information Facility
CK file:
CK START Time CK END Time
» See the next page for some options to deal with this.
WebGeocalc 40
N IF Missing Data - 2
Navigation and Ancillary Information Facility
WebGeocalc 41
N IF Incomplete Data
Navigation and Ancillary Information Facility
WebGeocalc 42
N IF Mixed Up Target and Observer
Navigation and Ancillary Information Facility
WebGeocalc 43
N IF Limitation – One at a Time
Navigation and Ancillary Information Facility
WebGeocalc 44
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Topics
Navigation and Ancillary Information Facility
• Kernel load/unload/info:
– FURNSH, UNLOAD, KCLEAR, KTOTAL, KINFO, KDATA
• Geometry:
– Ray-surface intercept: SINCPT, DSKXV, DSKXSI
– Sub-observer point: SUBPNT
– Sub-solar point: SUBSLR
– Illumination angles at surface point: ILLUMF, ILLUMG, ILUMIN
– Longitude-latitude pairs to surface points: LATSRF
– Find occultation state at a given time: OCCULT
– Find occultation or transit of point target behind/across DSK
shape: GFOCLT
– Generate limb points: LIMBPT
– Generate terminator points: TERMPT
– Compute outward normal vector at surface point: SRFNRM
• Low-level access:
– DLA segment traversal: DLABFS, DLABBS, DLAFNA, DLAFPA
– Fetch type 2 counts/plates/vertices/normals: DSKZ02, DSKP02,
DSKV02, DSKN02
– Fetch all type 2 data structure contents: DSKI02, DSKD02
– Fetch DSK segment descriptor: DSKGD
• Plate utilities:
– PLTVOL, PLTAR, PLTEXP, PLTNP, PLTNRM
• Create DSK files:
– DSKOPN, DSKW02, DSKCLS, DSKMI2, DSKRB2
• Summary routines:
– DSKOBJ, DSKSRF
• Surface name-code translation:
– SRFS2C, SRFSCC, SRFC2S, SRFCSS
API: SINCPT
Intercept nearest to
observer’s location
Input ray
Observer’s location
Observer is external to object
API: SUBPNT
Reference ellipsoid
Sub-observer point
(nadir definition)
Outward normal to
reference ellipsoid
Sub-observer point
(target center definition)
Observer to sub-
observer point vector
Observer to sub- (nadir definition)
observer point vector
(target center definition)
Observer location
API: SUBSLR
Reference ellipsoid
Sub-solar point (target
center definition)
Observer to sub-
observer point vector Sub-solar point (nadir
(target center definition) definition)
Observer location
Outward normal to
reference ellipsoid
Observer to sub-
observer point vector
(target center definition)
Sun location
Also returned:
- target epoch (corrected for light time),
- observer visibility flag,
- illumination source visibility flag
API: LATSRF
Ray emanating from Exterior bounding
sphere point, pointing sphere for target object
toward center of body-
fixed, body-centered
reference frame
•
•
•
Surface intercept
Point on bounding point corresponding
to point on bounding
sphere, specified by
• sphere:
planetocentric • • planetocentric
longitude and longitude and
latitude, and by latitude of intercept
radius of exterior • match those of the
bounding sphere. • • sphere point. An
This grid contains 9 intercept is
such points. computed for each
input sphere point.
API: LIMBPT
Observer location
Axis: observer-target center vector
API: LIMBPT
Rays emanating from
observer, lying in half-
plane, and tangent to
target body
Limb points---each is
tangent point of a ray
in the selected half
plane
Specified half-plane
bounded by observer-
target center line
(axis): contains ray
Observer location
Angular search step
Axis: observer-target
must be less than
center vector
this angle
Digital Shape Kernel 18
N IF Plate Model Terminator-Umbral
Navigation and Ancillary Information Facility
API: TERMPT
Ray tangent to sun
and target body Specified half-plane
bounded by sun center- Umbral terminator
target center line (axis): point: lies on a tangent
contains ray ray in the specified
half-plane (for some
shapes, multiple tangents will
exist for a given axis and half-
plane). Terminator point
and ray vertex are on
same side of axis.
•
Sun center
API: TERMPT
Axis: sun center-target
center vector
Penumbral terminator
point: lies on a tangent
• ray in the specified
Sun center half-plane (for some
shapes, multiple tangents will
exist for a given axis and half-
Specified half-plane bounded plane). Terminator point
by sun center-target center
line (axis): contains semi-
lies in half-space on
infinite portion of ray opposite side of axis
from ray’s vertex.
Terminator tangent ray angle
relative to axis
• Data class
– Data class is a “hook” to differentiate kinds of data for different
applications
» Distinct from concept of “data type”
– Existing classes indicate geometric characteristics of surface data
» Class 1: shape is single-valued function of domain coordinates.
Example, for latitudinal coordinates:
• Every ray emanating from the origin of the body-fixed reference frame
associated with the body passes through the surface once
• Such surfaces cannot have features such as cliffs or caves
• DEMs can represent class 1 surfaces
» Class 2: arbitrary shape
• Not required to be convex, closed, or connected
• Plate models are the only DSK data type that can be used for class 2
Digital Shape Kernel surfaces 24
N IF DSK Concepts-2
Navigation and Ancillary Information Facility
• Kernel priority
– Unlike SPK, CK, and binary PCK files, the concept of segment “priority” does not
apply to all DSK applications
» Not applicable to data sets including segments of class 2
• Concept simply doesn’t make sense when multiple heights can correspond to a single
longitude/latitude coordinate pair
» Can apply to data sets containing only class 1 segments
• Coordinate systems
– Associated with segments
» Segment coverage is described in terms of a coordinate system associated
with that segment
– Can be any of
» Planetocentric (latitudinal)
» Planetodetic
» Cartesian
• Segment coverage
– The spatial “coverage” of a segment is a region of space within which the segment
provides valid surface data
» Characterized by three coordinate ranges
• For example: min, max longitude; min, max latitude; min, max radius
» “Padding” data may be provided outside of a segment’s coverage region
Axes dimensions
for tri-axial Text editor
ellipsoid
(Usually done by
NAIF) Triaxial Ellipsoid
Shape Model
Z
Some source of
rotation state
information (pole Text editor X
Text PCK
RA/DEC and Planetary constants
prime meridian (Usually done by
NAIF) Y kernel containing
location) Orientation rotation data for the
body, and possibly
tri-axial shape
Digital Shape Kernel 26
N IF Using Shape and Orientation Kernels
Navigation and Ancillary Information Facility
DSK
Digital
shape kernel
Digital Terrain
Shape Model
Your Application Program
Pick one
shape model
Shap
e
Tessellated Plates
Shape Model
SPICE
modules
n
tio
Triaxial Ellipsoid nta
ie
Shape Model Or
Z
Your other
X
PCK data, as
needed
Planetary constants SPICE modules for
obtaining rotation
Y kernel containing state and shape,
Orientation rotation data for the and then
body, and possibly computing derived
quantities
tri-axial shape
Digital Shape Kernel 27
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Viewing This Tutorial
Navigation and Ancillary Information Facility
First, let's go over the important steps in the process of writing an Icy-based
program and putting it to work:
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:
We want the boresight on-bo ard clock ephemeris time UTC time
sp acecraft boresight
emission angle
frame
On what object? satnm spacecraft solar incidence angle
position
In what frame? fixref Phase angle
surface
intersection
body-fixed
For which instrument? instnm frame
planetocentric
latitude
planetocentric
For what spacecraft? scnm longitude
instrument
Orientation models sp acecraft
frame
boresight emission angle surface normal
body-fixed
frame
planetocentric
Shapes of satellites, planets planetocentric
latitude
longitude
Note: these kernels have been selected to support this presentation; they should not be assumed to be
appropriate for user applications.
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
and we make the program prompt for the name of this setup file:
• Prompt for setup file (“metakernel”) name; load kernels specified via setup
file. (Done on previous chart.)
• Compute the intersection of the boresight direction ray with the surface of
the satellite, presented as a triaxial ellipsoid.
If there is an intersection,
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
satellite’s 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_vnorm( srfvec )
We'll write out the range data along with the other program results.
re = radii[0]
rp = radii[2]
f = ( re – rp ) / re;
The illumination angles we want are the outputs of cspice_ilumin. Units are
radians.
The code above used quite a few inputs that we don't have yet:
Some of these values are user inputs; others can be obtained via Icy 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):
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:
PRO PROG_GEOMETRY
ROOM = 10L
setupf = ''
satnm = ''
fixref = ''
scnm = ''
instnm = ''
time = ''
R2D = cspice_dpr()
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.
Terminal Window
Terminal Window
IDL> prog_geometry
Enter setup file name > setup.ker
Enter satellite name > PHOEBE
Enter satellite frame > IAU_PHOEBE
Enter spacecraft name > CASSINI
Enter instrument name > CASSINI_ISS_NAC
Enter time > 2004 jun 11 19:32:00
• Latitude definitions:
– 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
Planetodetic
latitude
latitude
O x-y plane
Writing an Icy-based program 24
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Viewing This Tutorial
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:
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:
We want the boresight on-bo ard clock ephemeris time UTC time
sp acecraft boresight
emission angle
frame
On what object? satnm spacecraft solar incidence angle
position
In what frame? fixref Phase angle
surface
intersection
body-fixed
For which instrument? instnm frame
planetocentric
latitude
planetocentric
For what spacecraft? scnm longitude
instrument
Orientation models sp acecraft
frame
boresight emission angle surface normal
body-fixed
frame
planetocentric
Shapes of satellites, planets planetocentric
latitude
longitude
Note: these kernels have been selected to support this presentation; they should not be assumed to be
appropriate for user applications.
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
and we make the program prompt for the name of this setup file:
• Prompt for setup file (“metakernel”) name; load kernels specified via setup
file. (Done on previous chart.)
• 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
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
satellite’s 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.
norm( srfvec )
We'll write out the range data along with the other program results.
if ( found )
[r, pclon, pclat] = cspice_reclat( point );
The illumination angles we want are the outputs of cspice_ilumin. Units are
radians.
The code above used quite a few inputs that we don't have yet:
Some of these values are user inputs; others can be obtained via Mice 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):
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:
...
% Display results. Convert angles from radians to degrees
% for output.
fprintf( 'Intercept planetocentric longitude (deg): %11.6f\n', ...
cspice_dpr()*pclon )
fprintf( 'Intercept planetocentric latitude (deg): %11.6f\n', ...
cspice_dpr()*pclat )
fprintf( 'Intercept planetodetic longitude (deg): %11.6f\n', ...
cspice_dpr()*pdlon )
fprintf( 'Intercept planetodetic latitude (deg): %11.6f\n', ...
cspice_dpr()*pdlat )
fprintf( 'Range from spacecraft to intercept point (km): %11.6f\n', ...
norm(srfvec) )
fprintf( 'Intercept phase angle (deg): %11.6f\n', ...
cspice_dpr()*phase )
fprintf( 'Intercept solar incidence angle (deg): %11.6f\n', ...
cspice_dpr()*solar )
fprintf( 'Intercept emission angle (deg): %11.6f\n', ...
cspice_dpr()*emissn )
else
disp( ['No intercept point found at ' time ] )
end
ROOM = 10;
R2D = cspice_dpr;
Terminal Window
>> prog_geometry
Enter setup file name > setup.ker
Enter satellite name > PHOEBE
Enter satellite frame > IAU_PHOEBE
Enter spacecraft name > CASSINI
Enter instrument name > CASSINI_ISS_NAC
Enter time > 2004 jun 11 19:32:00
• Latitude definitions:
– 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
Planetodetic
latitude
latitude
O x-y plane
Writing a Mice-based program 22
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Viewing This Tutorial
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:
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
We want the boresight on-bo ard clock ephemeris time UTC time
sp acecraft boresight
emission angle
frame
On what object? satnm spacecraft solar incidence angle
position
In what frame? fixref Phase angle
surface
intersection
body-fixed
For which instrument? instnm frame
planetocentric
latitude
planetocentric
For what spacecraft? scnm longitude
instrument
Orientation models sp acecraft
frame
boresight emission angle surface normal
body-fixed
frame
planetocentric
Shapes of satellites, planets planetocentric
latitude
longitude
Note: these kernels have been selected to support this presentation; they should not be assumed to be
appropriate for user applications.
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
and we make the program prompt for the name of this setup file:
• Prompt for setup file (“metakernel”) name; load kernels specified via setup
file. (Done on previous chart.)
• Compute the intersection of the boresight direction ray with the surface of
the satellite, presented as a triaxial ellipsoid.
If there is an intersection,
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
satellite’s 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.
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.
if ( found )
{
reclat_c ( point, &r, &pclon, &pclat );
The illumination angles we want are the outputs of ilumin_c. Units are radians.
The code above used quite a few inputs that we don't have yet:
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):
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):
To get the instrument boresight direction (insite) and the name of the
instrument frame (iframe) in which it is defined:
}
else
{
printf ( "No intercept point found at %s\n", time );
}
Terminal Window
Prompt> mkprodct.csh
Setting default compiler:
gcc
Prompt>
Terminal Window
Prompt> demo
Enter setup file name > setup.ker
Enter satellite name > PHOEBE
Enter satellite frame > IAU_PHOEBE
Enter spacecraft name > CASSINI
Enter instrument name > CASSINI_ISS_NAC
Enter time > 2004 jun 11 19:32:00
• Latitude definitions:
– 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
Planetodetic
latitude
latitude
O x-y plane
Writing a CSPICE-based program 26
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Viewing This Tutorial
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:
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
We want the boresight on-bo ard clock ephemeris time UTC time
sp acecraft boresight
emission angle
frame
On what object? SATNM spacecraft solar incidence angle
position
In what frame? FIXREF Phase angle
surface
intersection
body-fixed
For which instrument? INSTNM frame
planetocentric
latitude
planetocentric
For what spacecraft? SCNM longitude
instrument
Orientation models sp acecraft
frame
boresight emission angle surface normal
body-fixed
frame
planetocentric
Shapes of satellites, planets planetocentric
latitude
longitude
Note: these kernels have been selected to support this presentation; they should not be assumed to be
appropriate for user applications.
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
and we make the program prompt for the name of this setup file:
• Prompt for setup file (“metakernel”) name load kernels specified via setup
file. (Done on previous chart.)
• Compute the intersection of the boresight direction ray with the surface of
the satellite, presented as a triaxial ellipsoid.
If there is an intersection,
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
satellite’s 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.
VNORM ( SRFVEC )
We'll write out the range data along with the other program results.
IF ( FOUND ) THEN
CALL RECLAT ( POINT, R, PCLON, PCLAT )
C Let RE, RP, and F be the satellite's longer equatorial
C radius, polar radius, and flattening factor.
RE = RADII(1)
RP = RADII(3)
F = ( RE - RP ) / RE
The illumination angles we want are the outputs of ILUMIN. Units are radians.
The code above used quite a few inputs that we don't have yet:
Some of these values are user inputs others can be obtained via SPICELIB 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):
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):
To get the instrument boresight direction (INSITE) and the name of the
instrument frame (IFRAME) in which it is defined:
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept planetocentric latitude (deg): ', DPR()*PCLAT
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept planetodetic longitude (deg): ', DPR()*PDLON
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept planetodetic latitude (deg): ', DPR()*PDLAT
WRITE ( *, '(1X,A,F12.6)' )
. 'Range from spacecraft to intercept point (km): ',
. VNORM(SRFVEC)
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept phase angle (deg): ', DPR()*PHASE
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept solar incidence angle (deg): ', DPR()*SOLAR
WRITE ( *, '(1X,A,F12.6)' )
. 'Intercept emission angle (deg): ',
. DPR()*EMISSN
ELSE
WRITE (*,*) 'No intercept point found at '// TIME
END IF
END
Terminal Window
Prompt> mkprodct.csh
Using the g77 compiler.
Prompt>
Terminal Window
Prompt> demo
Enter setup file name > setup.ker
Enter satellite name > PHOEBE
Enter satellite frame > IAU_PHOEBE
Enter spacecraft name > CASSINI
Enter instrument name > CASSINI_ISS_NAC
Enter time > 2004 jun 11 19:32:00
• Latitude definitions:
– 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
Planetodetic
latitude
latitude
O x-y plane
Writing a FORTRAN-based program 26
N IF
Navigation and Ancillary Information Facility
April 2023
N IF Table of Contents
Navigation and Ancillary Information Facility
• Purpose
• Scope
• Assumptions about user’s 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 (APIs)
• Finishing up, applicable to all methods
– 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.
• Issues affecting performance (reading efficiency) and usability
Making an SPK File 2
N IF Purpose
Navigation and Ancillary Information Facility
Comment area
Always present
… Segment 1
Possibly present
- sometimes by your choice
- sometimes required
Segment n
ID WORD: Indicates file architecture and type N/P/C: Next, previous record pointers and descriptor count
ND, NI: Number of d.p. and integer descriptor components Dn: Descriptor for segment n
IFNAME: Internal file name In: Segment ID for segment n
FWD, BWD: Forward and backward linked list pointers
FREE: First free DAF address U: Unused space
BFF: Binary file format ID U*: Possibly unused space
FTP: FTP corruption test string
Segment 1
Segment 2 Data segments: One or more records per
segment. (Up to 25 segments.)
...
...
Segment 25 U*
N/P/C D26 D27 U Descriptor record: Contains 1 to 25
segment descriptors. One record.
Segment 26
Data segments: One or more records per
segment. (Up to 25 segments.)
Segment 27
U*
Making an SPK File Diagram not to scale 12
N IF SPK File Structure - Description
Navigation and Ancillary Information Facility
• 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
• Descriptor record and Segment ID record
– One of each of these is needed for every collection of 1-to-25 segments
• Segment[s]
– Collection[s] of ephemeris data
» Minimum of one segment
» Maximum:
• The practical maximum is a few thousand segments
• Serious performance degradation occurs above 100000 segments for a single body
• Absolute limits are imposed by the range of the INTEGER data type for your computer
– Numerous SPK types may be used within an SPK file, but only one SPK
type may appear within a given segment
Making an SPK File
– Segments of different types may be intermixed within a given SPK file
13
N IF What is an SPK Segment?
Navigation and Ancillary Information Facility
Making an SPK File 21 Modified divided difference arrays Same as Type 1 except allows greater number of coefficients.
16
N IF Recommended SPK Data Types - 1
Navigation and Ancillary Information Facility
Using NAIF’s
MKSPK
Application Program
Setup file
Y = Yes N = No
• The next several charts outline how to use the “SPK writer”
modules available in the Toolkit libraries. The types
available in the supported Toolkits are summarized below.*
SPK Types 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Supported
✔✔ ✔ ✔✔✔ ✔✔ ✔ ✔✔ ✔
CSPICE
(C)
✔✔ ✔ ✔✔✔ ✔✔ ✔
ICY
(IDL)
✔✔✔ ✔
MICE
(MATLAB)
= 4, 6, 7, 16: made for special circumstances; not available for general use
= 11: ID was not used
These routine names are for the FORTRAN (SPICELIB) Toolkit. For CSPICE
the names are the same but are in lower case and have an “_c” appended. For Icy
and Mice, module names are case-insensitive and have "cspice_" prepended.
Finishing Up
Backup
• 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)
• 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
» so that loading very large numbers of SPK files at once is
unnecessary
Making a CK file
April 2023
N IF Summary
Navigation and Ancillary Information Facility
Making a CK File 2
N IF CK Writer Routines
Navigation and Ancillary Information Facility
Making a CK File 3
N IF Type 3 Writer Example - 1
Navigation and Ancillary Information Facility
ckcls_c ( handle );
Making a CK File 4
N IF Type 3 Writer Example - 2
Navigation and Ancillary Information Facility
Making a CK File 5
N IF Type 3 Writer Example - 3
Navigation and Ancillary Information Facility
Making a CK File 6
N IF Type 3 writer - Making Up Rates
Navigation and Ancillary Information Facility
Making a CK File
continued on next page 7
N IF Type 3 Writer - Making Up Rates (2)
Navigation and Ancillary Information Facility
Making a CK File 8
N IF MSOPCK
Navigation and Ancillary Information Facility
Making a CK File 9
MSOPCK
N IF List of Setup File Keywords
Navigation and Ancillary Information Facility
Supporting LSK_FILE_NAME = 'LSK file'
SCLK_FILE_NAME = 'SCLK file' (or MAKE_FAKE_SCLK='new SCLK file')
Kernels/Files FRAMES_FILE_NAME = 'FRAMES file'
COMMENTS_FILE_NAME = 'file containing comments'
PRODUCER_ID = 'producer group/person name'
INTERNAL_FILE_NAME = 'internal file name string'
CK_SEGMENT_ID = 'segment ID string'
Output CK CK_TYPE = 1, 2, or 3
INSTRUMENT_ID = CK ID
Specifications REFERENCE_FRAME_NAME = 'reference frame name'
MAXIMUM_VALID_INTERVAL = interval length, seconds
INPUT_TIME_TYPE = 'SCLK', 'UTC', 'TICKS', 'DPSCLK', or 'ET'
TIME_CORRECTION = bias to be applied to input times, seconds
INPUT_DATA_TYPE = 'MSOP QUATERNIONS', 'SPICE QUATERNIONS',
'EULER ANGLES', or 'MATRICES'
QUATERNION_NORM_ERROR = maximum normalization error
EULER_ANGLE_UNITS = 'DEGREES' or 'RADIANS'
EULER_ROTATIONS_ORDER = ( 'axis3', 'axis2', 'axis1' )
EULER_ROTATIONS_TYPE = 'BODY' or 'SPACE'
Input data ANGULAR_RATE_PRESENT = 'YES', 'NO', 'MAKE UP', 'MAKE UP/NO AVERAGING'
Specifications ANGULAR_RATE_FRAME = 'REFERENCE' or 'INSTRUMENT'
ANGULAR_RATE_THRESHOLD = ( max X rate, max Y rate, max Z rate )
OFFSET_ROTATION_ANGLES = ( angle3, angle2, angle1 )
Optional and OFFSET_ROTATION_AXES = ( 'axis3', 'axis2', 'axis1' )
conditional OFFSET_ROTATION_UNITS = 'DEGREES' or 'RADIANS'
keywords are DOWN_SAMPLE_TOLERANCE = down sampling tolerance, radians
shown in green INCLUDE_INTERVAL_TABLE = 'YES' or 'NO' (default 'YES')
CHECK_TIME_ORDER = 'YES' or 'NO' (default 'NO')
Making a CK File 10
N IF MSOPCK - Input Details (1)
Navigation and Ancillary Information Facility
Four Examples
INPUT_DATA_TYPE = 'SPICE QUATERNIONS'
Input file: TIME1 [TIME2] QCOS QSIN1 QSIN2 QSIN3 [ARX ARY ARZ ]
..... ....... .... ..... ..... ..... ... ... ...
TIME1 [TIME2] QCOS QSIN1 QSIN2 QSIN3 [ARX ARY ARZ ]
Input file: TIME1 [TIME2] -QSIN1 -QSIN2 -QSIN3 QCOS [ARX ARY ARZ ]
..... ....... ..... ..... ..... .... ... ... ...
TIME1 [TIME2] -QSIN1 -QSIN2 -QSIN3 QCOS [ARX ARY ARZ ]
Input file: TIME1 [TIME2] ANG3 ANG2 ANG1 [ARX ARY ARZ ]
..... ...... .... .... .... ... ... ...
TIME1 [TIME2] ANG3 ANG2 ANG1 [ARX ARY ARZ ]
Input file: TIME1 [TIME2] M11 M12 M13 M21 ... M33 [ARX ARY ARZ ]
..... ...... ... ... ... ... ... ... ... ... ...
TIME1 [TIME2] M11 M12 M13 M21 ... M33 [ARX ARY ARZ ]
Making a CK File 11
N IF MSOPCK - Input Details (2)
Navigation and Ancillary Information Facility
• 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 to 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 ]
and rotation axes specified in the setup as
EULER_ROTATIONS_ORDER = ( 'axis3', 'axis2', 'axis1' )
the matrix rotating vectors from base to the structure frame is computed as
Vinst = [ANG3]axis3 * [ANG2]axis2 * [ANG1]axis1 * Vref
– Angles can be provided in degrees or radians
(*) NAIF prepared a “white paper” explaining differences between various quaternion styles:
Making a CK File https://naif.jpl.nasa.gov/pub/naif/misc/Quaternion_White_Paper/Quaternions_White_Paper.pdf 12
N IF MSOPCK - Input Details (3)
Navigation and Ancillary Information Facility
Making a CK File 15
N IF MSOPCK - Example (1)
Navigation and Ancillary Information Facility
Terminal Window
$ 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 = 3
MAXIMUM_VALID_INTERVAL = 60
INPUT_TIME_TYPE = 'SCLK'
INPUT_DATA_TYPE = 'MSOP QUATERNIONS'
QUATERNION_NORM_ERROR = 1.0E-3
ANGULAR_RATE_PRESENT = 'MAKE UP'
\begintext
$
Making a CK File 16
N IF MSOPCK - Example (2)
Navigation and Ancillary Information Facility
Terminal Window
$ more msopck_comments.example
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
--------------------------------------------------------
...
Making a CK File 17
N IF MSOPCK - Example (3)
Navigation and Ancillary Information Facility
Terminal Window
$ more msopck_input.example
0767491368.064 -0.24376335 0.68291384 0.28475901 0.62699316
0767491372.114 -0.24249471 0.68338563 0.28591829 0.62644323
0767491373.242 -0.24204185 0.68355329 0.28633291 0.62624605
0767491374.064 -0.24194814 0.68358228 0.28641744 0.62621196
0767491380.064 -0.24012676 0.68424169 0.28807922 0.62543010
0767491386.064 -0.23830473 0.68489895 0.28973563 0.62464193
0767491392.064 -0.23648008 0.68555126 0.29139303 0.62384833
0767491398.064 -0.23465389 0.68620253 0.29304524 0.62304745
0767491404.064 -0.23282999 0.68684150 0.29470173 0.62224580
0767491404.114 -0.23277293 0.68686688 0.29475362 0.62221455
0767491405.242 -0.23231585 0.68702790 0.29516507 0.62201253
0767491410.064 -0.23100059 0.68748174 0.29634561 0.62143935
0767491416.064 -0.22917353 0.68811325 0.29799308 0.62062853
0767491422.064 -0.22734161 0.68874177 0.29963482 0.61981412
0767491428.064 -0.22551078 0.68936246 0.30128030 0.61899473
0767491434.064 -0.22367453 0.68998299 0.30291779 0.61816987
0767491436.114 -0.22300583 0.69021050 0.30351804 0.61786298
0767491438.011 -0.22251770 0.69037871 0.30395477 0.61763631
...
Making a CK File 18
N IF MSOPCK - Example (4)
Navigation and Ancillary Information Facility
Terminal Window
$ 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
Making a CK File 20
N IF PREDICKT - Usage
Navigation and Ancillary Information Facility
Making a CK File 21
N IF PREDICKT - Furnsh and Spec Files
Navigation and Ancillary Information Facility
Making a CK File 22
N IF PREDICKT - Directions
Navigation and Ancillary Information Facility
Making a CK File 23
N IF PREDICKT - Orientations
Navigation and Ancillary Information Facility
Making a CK File 24
N IF PREDICKT - Schedules (1)
Navigation and Ancillary Information Facility
Making a CK File 25
N IF PREDICKT - Schedules (2)
Navigation and Ancillary Information Facility
– the CK-SPK keyword specifies the ID of the object, the position of which
is used in applying light time correction when orientation is computed
Making a CK File 26
N IF PREDICKT - Example (1)
Navigation and Ancillary Information Facility
Terminal Window
$ cat m01_map_nadir.prediCkt
\begindata
DIRECTION_SPECS += ( 'ToMars = POSITION OF MARS -' )
DIRECTION_SPECS += ( 'FROM M01 -' )
DIRECTION_SPECS += ( 'CORRECTION NONE' )
ORIENTATION_NAME += 'CameratoMars'
PRIMARY += '+Z = ToMars'
SECONDARY += '+Y = scVelocity'
BASE_FRAME += 'J2000'
CK-SCLK = 53
CK-SPK = -53
CK-FRAMES += -53000
CK-53000ORIENTATION += 'SOLUTION TO M01_THEMIS_IR = CameratoMars'
CK-53000START += @2004-FEB-10-00:00
CK-53000STOP += @2004-FEB-15-00:00
\begintext
Making a CK File 27
N IF PREDICKT - Example (2)
Navigation and Ancillary Information Facility
Terminal Window
$ 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
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 % (50 quaternions)
...
Percentage finished: 95.0 % (925 quaternions)
$
Making a CK File 28
N IF
Navigation and Ancillary Information Facility
April 2023
Intro to EK Subsystem 2
N IF E-Kernel Subsystem Objectives
Navigation and Ancillary Information Facility
Intro to EK Subsystem 3
N IF Nominal E-kernel Composition*
Navigation and Ancillary Information Facility
Objectives Mission
for Commands Scientist’s Logical
Operations Component
Science and Activities Notebook
Logs View
Observations
Intro to EK Subsystem 6
N IF Sequence - ESQ
Navigation and Ancillary Information Facility
Intro to EK Subsystem 8
N IF E-Kernel Status
Navigation and Ancillary Information Facility
Intro to EK Subsystem 9
N IF
Navigation and Ancillary Information Facility
April 2023
N IF SPICE 2.0
Navigation and Ancillary Information Facility
– Unfortunately NAIF has no real target date in mind for this work
• Python interface
– 3rd party SpiceyPy enjoys wide adoption and use,
fulfilling the needs of the community
– Because of that, NAIF does not plan to do its own
Python work in the foreseeable future
Porting Kernels
April 2023
N IF Porting Issues - 1
Navigation and Ancillary Information Facility
Porting Kernels 3
N IF Porting Issues - 3
Navigation and Ancillary Information Facility
On a Unix/Linux/OSX box you can easily see what kind of line terminator
is being used in a text file using the Unix “cat –et” command on your
text file.
Porting Kernels 5
Compatible Environments
N IF for Binary Kernels
Navigation and Ancillary Information Facility
Porting Kernels 6
N IF Caution Using Email
Navigation and Ancillary Information Facility
Porting Kernels 7
N IF Binary Kernels - Caveats
Navigation and Ancillary Information Facility
Porting Kernels 8
Binary Kernels
N IF Allowed Operations
Navigation and Ancillary Information Facility
Porting Kernels 9
N IF Text Kernels - Caveats
Navigation and Ancillary Information Facility
Porting Kernels 10
N IF
Navigation and Ancillary Information Facility
SPICE-Enhanced
Cosmographia
April 2023
N IF Cosmographia Overview - 1
Navigation and Ancillary Information Facility
Cosmographia 2
N IF Cosmographia Overview - 2
Navigation and Ancillary Information Facility
Cosmographia 3
N IF Cosmographia History
Navigation and Ancillary Information Facility
Cosmographia 4
N IF Cosmographia Capabilities
Navigation and Ancillary Information Facility
Top Menu
Object Context
Menu (invoked
with right click)
Left Toolbar
Cosmographia 6
N IF Setting up for a New Mission
Navigation and Ancillary Information Facility
Cosmographia 9