spiceinit
Update SPICE data (kernels, pointing, and position) for a camera cube
This program searches the ISIS data areas in order to discern the SPICE kernels required for the camera cube. Cubes which have supported camera models in the ISIS system require spacecraft position, pointing, body shape and orientation, sun position, and other information in order to compute ground positions (latitude/longitude) and photometric viewing angles. This information is stored in SPICE kernels.
The program uses the "SpacecraftName", "InstrumentId", "TargetName", "StartTime", and "StopTime" keywords from the cube's label to determine which kernels to use. It attempts to find kernel files for the following keywords and writes them to the Kernels group:
- Leap Second (LS)
- Spacecraft Clock (SCLK)
- Target Position (TSPK)
- Target AttitudeShape (PCK)
- Instrument (IK)
- Instrument Addendum (IAK)
- Frame (FK)
- Spacecraft Position (SPK)
- Instrument Pointing (CK)
- Shape Model (DEM)
The program modifies the kernels group and writes the name of the SPICE files that need to be loaded by the camera models. It has the option of pre-reading the data from the SPICE kernels and loading it as a binary table attached to the cube. This can faciliate faster load times and allows the instrument pointing to be easily updated.
As kernels are loaded they override the data in previously loaded kernels. The order in which kernels are loaded is:
- Target Position
- Instrument Position
- Instrument Pointing
- Frame
- Target Attitude Shape
- Instrument
- Instrument Addendum
- Leap Second
- Spacecraft Clock
- Extra
- Smithed This is considered the best quality kernel and will be used first when selected. Smithed kernels have been improved or adjusted for accuracy by a mission team or for the purpose of a cartographic product. Consider the source, content and completeness of Smithed kernels when selecting this level of quality.
- Reconstructed These kernels are typically produced by a mission a few weeks after the target has been reached.
- Predicted These are preliminary kernels produced by a mission and are the best-estimates of where the spacecraft will be at any given time.
- Nadir This is the worst quality kernel and is used as a last resort because it assumes the spacecraft is always nadir-looking.
The InstrumentPositionQuality and InstrumentPointingQuality keywords are added to the Kernels group to indicate the level of quality of the loaded kernels. At least one of the parameters CKPREDICTED, CKNADIR, CKRECON, or CKSMITHED must be entered. Furthermore, at least one of the parameters SPKPREDICTED, SPKRECON, or SPKSMITHED must be entered.
Please note: Kernel Files specified that reside in the current working directory will not have their paths expanded. This is to allow variables like $msg/ to work correctly.
The spiceinit program will also add the RayTraceEngine, OnError, and Tolerance keywords to the Kernels group if specified in the IsisPreferences file. If included, these keywords specify the ray-tracing engine to use and how to use it for shapemodels. Please see the IsisPreferences file for more details.
Troubleshooting: If spiceinit is failing with the error "No Camera Kernel found for the image ..." then try enabling the "CKPREDICTED" or "CKNADIR" option. A similar error exists for SPK kernels, and you can enable "SPKPREDICTED" to get past that error. "PREDICTED" and "NADIR" options typically have less accuracy than reconstructed and smithed kernels which is why they are disabled by default.
Issues running HRSC using ISIS SPICE Web Service: Currently HRSC images cannot be spiceinit'd using ISIS SPICE web services. This is due to the HRSC camera model relying on cube data to process line scan times. When using the SPICE server, only the label is returned causing the camera model to fail initialization. In order to run spiceinit on HRSC images, download the MEX data locally. See download instructions at https://github.com/DOI-USGS/ISIS3/blob/dev/README.md#mission-specific-data-downloads.
Categories
Related Applications to Previous Versions of ISIS
This program replaces the following applications existing in previous versions of ISIS:- levinit
- naiflab
- spicelab
History
| Debbie A. Cook | 2000-06-08 | Original Version |
| Stuart Sides | 2003-11-05 | Complete rewrite under ISIS 3.0 conversion. |
| Stuart Sides | 2004-01-14 | Modified to use an existing "Kernels" group instead of creating a new one. This was because the mission specific import program (e.g., moc2isis) was modified to create the "kernels" group and put the "NaifFrameCode" into it. |
| Stuart Sides | 2004-01-23 | Added new parameter "TEST." This parameter controls the testing of the final kernel list. If false the kernels will not be tested for completeness by creating a camera model. |
| Stuart Sides | 2004-02-23 | Added elevation model DEM capabilities. |
| Stuart Sides | 2004-02-24 | Completed capabilities to search for kernels of different qualities such as PREDICTED, NADIR, RECONSTRUCTED, and C-SMITHED. |
| Stuart Sides | 2005-11-08 | Added fix for framing cameras, so they would not need a stop time in the instrument group of the labels. |
| Elizabeth Miller | 2005-11-14 | Added appTest |
| Jacob Danton | 2005-12-22 | Added support for multiple files within the kernels |
| Jacob Danton | 2005-12-27 | Added a progress bar |
| Jacob Danton | 2006-01-03 | Fixed the xml description |
| Jacob Danton | 2006-01-25 | Changed the mission translation file name |
| Jacob Danton | 2006-01-25 | Changed the appTest to comply with changes in the String class. |
| Jeff Anderson | 2006-03-27 | Modified to write InstrumentPointing, InstrumentPosition, SunPosition, and BodyRotation information to SPICE tables in the cube. |
| Brendan George | 2006-09-19 | Added call to modify the history of the cube |
| Brendan George | 2006-10-19 | Modifed to remove label entries for SPICE tables, if ATTACH is unchecked, and the input cube already has them. |
| Steven Lambright | 2007-07-10 | Combined Frame and InstrumentPointing. Changed to support new version of KernelDb. Cleaned up the code. |
| Steven Lambright and Steve Koechle | 2007-07-10 | Fixed problem where the allowed kernels were being set improperly. |
| Steven Lambright | 2007-08-10 | Fixed so that when no spacecraft pointing is found, but frame kernels are, and Nadir is allowed it still adds the Nadir keyword. |
| Steven Koechle | 2007-10-05 | Added a check to see if the cube had an existing polygon, if so delete it. |
| Steven Koechle | 2007-10-25 | Fixed Smithed enum, changed from C-Smithed. |
| Steven Koechle | 2007-12-14 | Added error handling logic. If the user chose to use Nadir CK and another type, and the system found a file where the image falls in a gap (no pointing is available) Nadir would never be calculated. Fixed. |
| Steven Lambright | 2008-02-13 | Added time padding options |
| Steven Lambright | 2008-02-21 | Added additional explanation of time padding options |
| Steven Lambright | 2008-02-22 | Split the CK parameter into FK and CK, they are still combined in the label as InstrumentPointing. |
| Steven Lambright | 2008-04-14 | All found CK kernels will now be tested before giving an error |
| Christopher Austin | 2008-05-02 | Fixed the propagation of the EXTRA Kernel. |
| Steven Lambright | 2008-05-12 | Removed references to CubeInfo |
| Steven Lambright | 2008-05-19 | Fixed documentation |
| Christopher Austin | 2008-06-03 | Furthered documentation. |
| Steven Koechle | 2008-06-17 | Added CK check and throw more appropriate error |
| Christopher Austin | 2008-09-12 | Added the removal of StartPadding and EndPadding keywords from previous spiceinit runs, and added some double inited tests. NOTE: Whenever adding new keywords, run spiceinit twice on the same cube in your test, dumping out both labels to verify that the keyword is not being duplicated. |
| Tracie Sucharski | 2009-03-12 | If spice is put into a Table, append the kernel name to the Kernel group keyword to keep track of original spice kernels. |
| Steven Koechle | 2009-05-12 | Added CameraVersion into the Kernel labels |
| Steven Lambright | 2009-07-09 | Error messages from the camera are now reported |
| Steven Lambright | 2009-07-21 | Fixed handling of user-entered CK kernels |
| Janet Barrett and Steven Lambright | 2011-05-25 | Added support for storing text spice kernel values in the cube labels |
| Steven Lambright and Jai Rideout | 2011-08-30 | Added support for using a spiceinit web service |
| Steven Lambright | 2011-10-05 | As a result of our test and review team, I have updated the documentation to match the recommendations of Laz Kestay and Ken Edmundson. Fixes #423. |
| Jai Rideout | 2011-11-18 | Fixed bug in writing tables to the cube that were retrieved from the web service. |
| Debbie A. Cook | 2012-07-06 | Updated Spice members to be more compliant with ISIS coding standards. References #972. |
| Jeannie Backer | 2013-02-26 | Added ability to load multiple ck database files from the system using a conf file. Changed methods to lower camel case to comply with Isis3 standards. Added web example. References #924. |
| Tammy Becker | 2014-03-31 | Made a few documentation modifications regarding kernel quality keywords and shapemodel keyword. References #1849. |
| Kimberly Oyama | 2014-04-27 | Added assets directory for web example. Updated Documentation. Fixes #1849. |
| Tyler Wilson | 2016-12-19 | Changed the URL for the spice server to https://services.isis.astrogeology.usgs.gov/cgi-bin/spiceinit.cgi and the default port to 443 (it was originally 80). This is due to the recent https migration implementation from within the Department of the Interior, which was causing people on the outside of the DOI network to get an unrecognized server response error when attempting to download spice data. Fixes #4552. |
| Christopher Combs | 2017-06-01 | Removed examples with links leading to missing images. Created two new examples: one with default settings and another with a user-chosen ShapeModel. |
| Kristin Berry | 2017-06-06 | Updated spiceinit to retain ShapeModel-related keywords set by the ShapeModelFactory and add them to the kernel group. Like other keywords in the kernels group, if they are present at the beginning of a spiceinit run (if we are re-spiceiniting) they are removed. |
| Kristin Berry | 2017-08-06 | Updated spiceinit to remove code dealing with the CubeSupported Pvl Keyword, from the ShapeModel group in the IsisPreferences file, which has been removed. |
| Christopher Combs | 2018-01-11 | Made change to camera construction error throw for better reporting on uninstantiated cameras. Fixes #5163. |
| Jesse Mapel | 2020-02-26 | Changed PCK selection to use the same qualities as CK so that target body parameters derived from bundle adjustment can be used alongside CKs derived from bundle adjustment. Fixes #3669. |
| Jesse Mapel | 2020-12-10 | Modified to remove state string and model information from the csminit application. |
| Kaitlyn Lee | 2020-12-21 | Updated shape model keyword in the kernels group when shape=user and web=true with the user specified model. Fixes #1986 |
| Kaitlyn Lee | 2020-12-22 | Moved writeHistory() call to main function because a history entry was only being written to the cube when using a data area for kernels (not using the web service). Fixes #4040. |
| Adam Paquette | 2021-08-10 | Fixed the NaifKeywords PvlObject not being updated/replaced when spiceinit with web=true was run on a cube that was already spiceinit'd. |
Parameters
Input Files
| Type | cube |
|---|---|
| File Mode | input |
| Filter | *.cub |
Spice Data
| Type | boolean |
|---|---|
| Default | false |
| Exclusions |
|
| Inclusions |
|
| Type | boolean |
|---|---|
| Default | TRUE |
Instrument Orientation Kernel (CK) quality
| Type | boolean |
|---|---|
| Default | FALSE |
| Type | boolean |
|---|---|
| Default | TRUE |
| Type | boolean |
|---|---|
| Default | FALSE |
| Type | boolean |
|---|---|
| Default | FALSE |
Instrument Position Kernel (SPK) quality
| Type | boolean |
|---|---|
| Default | FALSE |
| Type | boolean |
|---|---|
| Default | TRUE |
| Type | boolean |
|---|---|
| Default | FALSE |
User Override of System Kernels
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $base/kernels/lsk/ |
| Internal Default | none |
| Filter | *.tls |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $base/kernels/pck/ |
| Internal Default | none |
| Filter | *.tpc |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $base/kernels/spk/ |
| Internal Default | none |
| Filter | *.bsp |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.ti |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.tsc |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.bc |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.tf |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.bsp |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
| Filter | *.ti |
| Type | filename |
|---|---|
| File Mode | input |
| Default Path | $ISISDATA |
| Internal Default | none |
Shape Model Parameters
| Type | string | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Default | SYSTEM | |||||||||||||||
| Option List: |
|
| Type | cube |
|---|---|
| File Mode | input |
| Default Path | $base//dems/ |
| Filter | *.cub *.bds |
Time Parameters
| Type | double |
|---|---|
| Default | 0.0 |
| Minimum | 0.0 (inclusive) |
| Type | double |
|---|---|
| Default | 0.0 |
| Minimum | 0.0 (inclusive) |
Spice Service Parameters
| Type | string |
|---|---|
| Default | https://astrogeology.usgs.gov/apis/ale/v0.9.1/spiceserver/ |
| Type | integer |
|---|---|
| Default | 443 |
| Minimum | 0 (inclusive) |
Example 1
Example of spiceinit using default parameters.
Command Line
spiceinit
from=v1545949478_1.cub
GUI Screenshot
Example GUI
Example of GUI commandAn example of how to run this program using the GUI. Note, the updated Kernel group can be seen in the log window.
Data File
Links open in a new window.| Cube labels after spiceinit. |
This is the label of the input cube after spiceinit has been
run. The following groups were added to the cube's labels:
Group = Kernels
NaifFrameCode = -82370
LeapSecond = $base/kernels/lsk/naif0012.tls
TargetAttitudeShape = ($base/kernels/pck/pck00009.tpc,
$cassini/kernels/pck/cpck27Mar2017.tpc)
TargetPosition = (Table, $base/kernels/spk/de405.bsp)
InstrumentPointing = (Table, $cassini/kernels/ck/06357_06362ra.bc,
$cassini/kernels/fk/cas_v40_usgs.tf)
Instrument = Null
SpacecraftClock = $cassini/kernels/sclk/cas00170.tsc
InstrumentPosition = (Table,
$cassini/kernels/spk/070208R_SCPSE_06356_0700-
8.bsp)
InstrumentAddendum = $cassini/kernels/iak/vimsAddendum03.ti
ShapeModel = Null
InstrumentPositionQuality = Reconstructed
InstrumentPointingQuality = Reconstructed
CameraVersion = 1
End_Group
Object = Table
Name = InstrumentPointing
StartByte = 6373579
Bytes = 4352
Records = 68
ByteOrder = Lsb
TimeDependentFrames = (-82000, 1)
ConstantFrames = (-82370, -82000)
ConstantRotation = (0.99991568332482, 0.0014510663863786,
-0.012904287946602, 0.012904407824453,
-7.32810212777781e-05, 0.99991673197751,
0.0014499999195506, -0.99999894451756,
-9.19999948958952e-05)
CkTableStartTime = 220528381.47991
CkTableEndTime = 220529079.47551
CkTableOriginalSize = 4096
FrameTypeCode = 3
Description = "Created by spiceinit"
Kernels = ($cassini/kernels/ck/06357_06362ra.bc,
$cassini/kernels/fk/cas_v40_usgs.tf)
Record Information
.
.
.
End_Object
Object = Table
Name = InstrumentPosition
StartByte = 6377931
Bytes = 6496
Records = 116
ByteOrder = Lsb
CacheType = HermiteSpline
SpkTableStartTime = 220528381.47991
SpkTableEndTime = 220529079.47551
SpkTableOriginalSize = 4096.0
Description = "Created by spiceinit"
Kernels = $cassini/kernels/spk/070208R_SCPSE_06356_07008.bsp
Record Information
.
.
.
End_Object
Object = Table
Name = BodyRotation
StartByte = 6384427
Bytes = 128
Records = 2
ByteOrder = Lsb
TimeDependentFrames = (10044, 1)
CkTableStartTime = 220528381.47991
CkTableEndTime = 220529079.47551
CkTableOriginalSize = 2
FrameTypeCode = 2
PoleRa = (39.4827, 0.0, 0.0)
PoleDec = (83.4279, 0.0, 0.0)
PrimeMeridian = (186.5855, 22.5769768, 0.0)
PoleRaNutPrec = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
PoleDecNutPrec = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
PmNutPrec = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
SysNutPrec0 = (353.32, 28.72, 177.4, 300.0, 316.45, 345.2, 29.8,
706.64, 57.44)
SysNutPrec1 = (75706.7, 75706.7, -36505.5, -7225.9, 506.2, -1016.3,
-52.1, 151413.4, 151413.4)
Description = "Created by spiceinit"
Kernels = ($base/kernels/spk/de405.bsp,
$base/kernels/pck/pck00009.tpc,
$cassini/kernels/pck/cpck27Mar2017.tpc)
SolarLongitude = 312.76943291256
Record Information
.
.
.
End_Object
Object = Table
Name = SunPosition
StartByte = 6384555
Bytes = 112
Records = 2
ByteOrder = Lsb
CacheType = Linear
SpkTableStartTime = 220528381.47991
SpkTableEndTime = 220529079.47551
SpkTableOriginalSize = 2.0
Description = "Created by spiceinit"
Kernels = $base/kernels/spk/de405.bsp
Record Information
.
.
.
End_Object
Object = NaifKeywords
BODY606_RADII = (2575.0, 2575.0, 2575.0)
BODY_FRAME_CODE = 10044
CLOCK_ET_-82_1545949478_COMPUTED = 802c35fdfd49aa41
CLOCK_ET_-82_1545950172_COMPUTED = d3ea3269034aaa41
INS-82370_TRANSX = (0.0, 1.0, 0.0)
INS-82370_TRANSY = (0.0, 0.0, 1.0)
INS-82370_ITRANSS = (0.0, 1.0, 0.0)
INS-82370_ITRANSL = (0.0, 0.0, 1.0)
End_Object
End
|
|---|
Example 2
Example of spiceinit using a ShapeModel chosen by the user.
Command Line
spiceinit
from=hi2isis_RED0.cub shape=user model=$ISISDATA/base/dems/ulcn2005_lpo_0005.cub
GUI Screenshot
Example GUI
Example of GUI commandAn example of how to run this program using the GUI. Note, the updated Kernel group can be seen in the log window.
Data File
Links open in a new window.| Cube labels after spiceinit. |
This is the label of the input cube after spiceinit has been
run. The following groups were added to the cube's labels:
Object = Table
Name = InstrumentPointing
StartByte = 3343625
Bytes = 1152
Records = 18
ByteOrder = Lsb
TimeDependentFrames = (-74000, -74900, 1)
ConstantFrames = (-74690, -74000)
ConstantRotation = (0.9999703083413, 0.0, -0.0077059999872177,
8.81584889031119e-06, 0.99999934560434,
0.0011439900269605, 0.0077059949444447,
-0.0011440239949305, 0.99996965396507)
CkTableStartTime = 217006138.39688
CkTableEndTime = 217006140.07063
CkTableOriginalSize = 5001
FrameTypeCode = 3
Description = "Created by spiceinit"
Kernels = ($mro/kernels/ck/mro_sc_psp_061114_061120.bc,
$mro/kernels/fk/mro_v15.tf)
Record Information
.
.
.
End_Object
Object = Table
Name = InstrumentPosition
StartByte = 3344777
Bytes = 168
Records = 3
ByteOrder = Lsb
CacheType = HermiteSpline
SpkTableStartTime = 217006138.39688
SpkTableEndTime = 217006140.07063
SpkTableOriginalSize = 5001.0
Description = "Created by spiceinit"
Kernels = $mro/kernels/spk/mro_psp1.bsp
Record Information
.
.
.
End_Object
Object = Table
Name = BodyRotation
StartByte = 3344945
Bytes = 128
Records = 2
ByteOrder = Lsb
TimeDependentFrames = (10014, 1)
CkTableStartTime = 217006138.39688
CkTableEndTime = 217006140.07063
CkTableOriginalSize = 2
FrameTypeCode = 2
PoleRa = (317.68143, -0.1061, 0.0)
PoleDec = (52.8865, -0.0609, 0.0)
PrimeMeridian = (176.63, 350.89198226, 0.0)
Description = "Created by spiceinit"
Kernels = ($base/kernels/spk/de405.bsp,
$base/kernels/pck/pck00009.tpc)
SolarLongitude = 136.5654319332
Record Information
.
.
.
End_Object
Object = Table
Name = SunPosition
StartByte = 3345073
Bytes = 112
Records = 2
ByteOrder = Lsb
CacheType = Linear
SpkTableStartTime = 217006138.39688
SpkTableEndTime = 217006140.07063
SpkTableOriginalSize = 2.0
Description = "Created by spiceinit"
Kernels = $base/kernels/spk/de405.bsp
Record Information
.
.
.
End_Object
Object = NaifKeywords
BODY499_RADII = (3396.19, 3396.19, 3376.2)
BODY_FRAME_CODE = 10014
INS-74699_FOCAL_LENGTH = 11994.9988
INS-74699_PIXEL_PITCH = 0.012
CLOCK_ET_-74999_848201292:03460_COMPUTED = 7549cb7480dea941
INS-74602_TRANSX = (-96.9459, -3.4e-05, 0.012)
INS-74602_TRANSY = (60.0469, -0.012, -3.4e-05)
INS-74602_ITRANSS = (4981.07, -0.2353, -83.333)
INS-74602_ITRANSL = (8092.92, 83.333, -0.2353)
INS-74699_OD_K = (-0.0048509, 2.41312e-07,
-1.62369e-13)
End_Object
End
|
|---|

