Index Page MKSPK User's Guide

## Table of Contents

       MKSPK User's Guide
          Abstract
          Summary
          Usage
             Setup, Input, and Output File Options
             Append Option
             Information Options
             Setup File Template Options
          Execution of MKSPK
          Setup File Format and Contents
             Required Assignments
             Conditional Assignments
             Optional Assignments
          Detailed Description of Setup File Keywords
          ICRF vs J2000
          Description of Input Data Format
          Description of Input Data Parameters
          Description of Input Data Types and Content
             Input Type STATES
             Input Type ELEMENTS
             Input Type EQ_ELEMENTS
             Input Type TL_ELEMENTS
          Relation Between Number of Input Records and Output Types
          Examples of Input Data and Setup Files
             Data Order and Data Delimiters
             Example 1
             Example 2
             Example 3
             Example 4
          Using Time Wrappers
          Complete Examples
             Input Data Type STATES / Output SPK Type 05
             Input Data Type STATES / Output SPK Type 08
             Input Data Type STATES / Output SPK Type 09
             Input Data Type STATES / Output SPK Type 12
             Input Data Type STATES / Output SPK Type 13
             Input Data Type STATES / Output SPK Type 15
             Input Data Type STATES / Output SPK Type 17
             Input Data Type ELEMENTS / Output SPK Type 05
             Input Data Type ELEMENTS / Output SPK Type 08
             Input Data Type ELEMENTS / Output SPK Type 09
             Input Data Type ELEMENTS / Output SPK Type 12
             Input Data Type ELEMENTS / Output SPK Type 13
             Input Data Type ELEMENTS / Output SPK Type 15
             Input Data Type ELEMENTS / Output SPK Type 17
             Input Data Type EQ_ELEMENTS / Output SPK Type 17
             Input Data Type TL_ELEMENTS / Output SPK Type 10
             Skipping Input Data Record Tokens
             Two Epochs in the Input Data Records

Top

# MKSPK User's Guide

Last revised on 2021 DEC 31 by B. V. Semenov.

Top

## Abstract

MKSPK is a program that creates an SPK file from a text file containing trajectory information.

Top

## Summary

MKSPK is a NAIF Toolkit utility program that generates a new, or appends data to an existing, spacecraft or target body's ephemeris file in SPICE SPK format using one of the following SPK types: 5, 8, 9, 10, 12, 13, 15, 17. This SPK file is a binary file constructed according to the SPICE DAF (Double Precision Array File) architecture, containing one or more SPK data segments.

The MKSPK program accepts one ASCII text file containing descriptions of input data (setup file) and a second ASCII text file (input file) containing the source ephemeris data to be processed.

Source ephemeris data can be time ordered lists of states (positions and velocities), sets of conic elements, sets of two-line elements, or a single set of equinoctial elements. All input data must be defined in a reference frame and relative to a body center both of which are specified in the setup file.

The program allows the user to optionally specify some descriptive text in a separate file (comment file) to be placed into the ``comment area'' of the SPK ephemeris file. (Doing this is highly recommended.)

For archival documentation purposes the content of the MKSPK setup file is automatically placed at the end of the ``comment area'' of the SPK file.

Top

## Usage

Program usage:

          > mkspk [-setup <setup file name>]
                  [-input <input data file name>]
                  [-output <output SPK file name>]
                  [-append]
                  [-u|-usage]
                  [-h|-help]
                  [-t|-template] [<input data type> <output spk type>]

Command lines options can be provided in any order. Option keys must be strictly lowercase.

Top

### Setup, Input, and Output File Options

If a setup file name isn't provided on the command line using the -setup key, the program will prompt for it. It will not prompt for the input or output file names -- these must be provided on the command line using the -input and -output keys or using the setup file keywords. If input and output file names are provided on the command line, any file names assigned using setup file keywords are ignored.

The input file must already exist.

The output must not exist unless the -append key or the corresponding setup file keyword tells the program to run in the append mode.

Top

### Append Option

If the -append key or the corresponding setup file keyword is not specified, the output file must not exist prior to running the program.

If the -append key or the corresponding setup file keyword is provided and the SPK file specified after the -output key exists, then new data will be appended to it.

If the -append key or the corresponding setup file keyword is provided but the SPK file specified after the -output key doesn't exist, then a new SPK file with the name specified after the -output key will be created.

Caution: if the program fails for any reason, it, in most cases, deletes the output file, even if it was appending data to an existing SPK file. Therefore, users should always make a backup copy of an SPK file to which new data is going to be appended before running the program in append mode.

Also, the program cannot append data to an existing SPK file if its format is not native to the platform on which the program is running. Refer to the CONVERT User's Guide (convert.ug) for details.

Top

### Information Options

If one of the information keys -- -u, -usage, -h, or -help -- is specified the program displays requested information, ignores all file options, and exits.

If -u or -usage is specified, the program displays the usage information.

If -h or -help is specified, the program displays a brief summary of its functionality.

Top

### Setup File Template Options

If -t or -template is specified by itself or followed by an input data type/output SPK type combination, the program displays either the complete setup file template or a type-specific setup file template, ignores all file options, and exits.

If -t or -template is specified by itself, the program displays the complete setup file template including all required, optional, and conditional setup file keywords. Since the total number of recognized setup keywords is rather large and some of the keywords are specific for just one input data type or output SPK type, using this complete template as the starting point in creating a setup for the case at hand may be cumbersome and inefficient.

To display a more concise, type-specific template, the input data type -- ``states'', ``elements'', ``eq_elements'', or ``tl_elements'' -- and the output SPK type -- 5, 8, 9, 10, 12, 13, 15, or 17 -- can be specified following the -t or -template key. Such templates will include only keywords applicable for the specified type combination.

For example, to display a template with keywords applicable to creating a type 13 SPK file from a table of states, use this option:

          > mkspk -t states 13

To display a template with keywords applicable to creating a type 10 SPK file from a table of two-line elements, use this option:

          > mkspk -t tl_elements 10

Top

## Execution of MKSPK

You will need a setup file to execute the MKSPK utility program. The format for the setup file is described below.

As it executes, the program will display a brief summary of its action.

Only one SPK ephemeris file using a single SPK type and containing one or more segments may be generated during a single MKSPK session.

Top

## Setup File Format and Contents

Other than the input and output file names, which may occur on the command line, the program requires all inputs such as object and body names or ID, frame name or ID, types of input and output data, list and order of input parameters, constants, etc. to be provided in a setup file. The format of this file must conform to the SPICE text kernel specification since the data from the setup file will be loaded into a kernel pool. This means that input values must be assigned to keyword variables using the format

          KEYWORD = VALUE

Each assignment is restricted to a single line. Sets of these assignments must be enclosed between

          \begindata
          \begintext

tokens, each of which must also be placed on a line by itself. Free-form descriptive/explanatory text may occur after the

          \begintext

token. Still more assignments could follow another

          \begindata

token.

The names of the setup file keywords must be strictly uppercase while the standard value of keywords may be upper, lower or mixed case. Any white space preceding or following keyword names, values and equal sign is ignored.

All character string values and time strings must be enclosed in single quotes, provided on a single line and be no longer than 80 characters. When multiple value are allowed and used, enclose the complete set in the "()" characters: KEYWORD = ( 'value1' 'value2' 'value3' ... )

All assignments are either required, conditional or optional as described below.

A setup file may contain blank lines. Non-printing characters including TAB should not be used in setup file lines containing keyword assignments or blank lines separating them within the data sections of a setup file. The program may not be able to parse correctly any of the setup file lines that contain non-printing characters and will signal a setup file parsing error on some computer platforms.

Top

### Required Assignments

The following assignments must be present in a setup file:

          INPUT_DATA_TYPE   = 'STATES' or 'ELEMENTS' or 'EQ_ELEMENTS'
                              or 'TL_ELEMENTS'
          OUTPUT_SPK_TYPE   = 5 or 8 or 9 or 10 or 12 or 13 or 15 or 17

          OBJECT_ID         = Numeric code assigned to the object, or
                              TLE s/c code ('TL_ELEMENTS'/SPK 10 only)
            or
          OBJECT_NAME       = 'NAIF supported object name'
            or
          TLE_INPUT_OBJ_ID  = code of the object to look for in the
                              input TLE file
          TLE_SPK_OBJ_ID    = NAIF ID to use in the output TLE-based
                              SPK file

          CENTER_ID         = Numeric code assigned to the body which
                              is the center of motion for the object
            or
          CENTER_NAME       = 'NAIF supported body name'

          REF_FRAME_NAME    = 'reference frame name'
          PRODUCER_ID       = 'producer identifier'
          DATA_ORDER        = 'ordered list of input parameter names'
          DATA_DELIMITER    = 'delimiter separating input data items'
          LEAPSECONDS_FILE  = 'leapseconds file name'

The following assignments are required in the setup file if their values are not provided on the command line:

          INPUT_DATA_FILE   = 'input data file name'
          OUTPUT_SPK_FILE   = 'output SPK file name'

Top

### Conditional Assignments

One or more of the following assignments may be needed depending on the kind of input data being used and other conditions. See the definitions that follow for details.

          PCK_FILE          = ( 'PCK_1 file name'
                                'PCK_2 file name'
                                  ...
                                'PCK_n file name' )
          FRAME_DEF_FILE    = 'frame definition file name'
          COMMENT_FILE      = 'comment file name'
          INPUT_DATA_UNITS  = ( 'ANGLES = angle unit'
                                'DISTANCES= distance unit' )
          EPOCH_STR_LENGTH  = length of epoch string
          IGNORE_FIRST_LINE = number of initial lines to be ignored while
                              reading input file
          LINES_PER_RECORD  = number of lines in one input record
          TIME_WRAPPER      = '# time wrapper'

          START_TIME        = 'start time'
        or
          TLE_START_PAD     = 'duration units'

          STOP_TIME         = 'stop time'
        or
          TLE_STOP_PAD      = 'duration units'

          PRECESSION_TYPE   = 'NO PRECESSION' or
                              'APSIDE PRECESSION ONLY' or
                              'NODE PRECESSION ONLY' or
                              'APSIDE AND NODE PRECESSION'
          POLYNOM_DEGREE    = polynomial degree of Lagrange or Hermite
                              interpolation
          CENTER_GM         = center GM value
          CENTER_POLE_RA    = the right ascension of the center's north
                              pole given with respect to the reference
                              frame
          CENTER_POLE_DEC   = the declination of the center's north pole
                              given with respect to the reference frame
          CENTER_J2         = center's J2 value
          CENTER_EQ_RADIUS  = center's equatorial radius

Top

### Optional Assignments

          SEGMENT_ID        = 'segment identifier'
          APPEND_TO_OUTPUT  = flag indicating whether new segments should
                              or shouldn't be appended to an existing SPK
                              file

Top

## Detailed Description of Setup File Keywords

INPUT_DATA_TYPE
  type of input data. Only one of four allowed values may be used as shown above.

OUTPUT_SPK_TYPE
  type of output SPK file. Only one of eight allowed values may be used as shown above.

OBJECT_ID
  numeric ID code of the object.

  For all input data type/output SPK type combinations except 'TL_ELEMENTS'/SPK 10 (called 'TL_ELEMENTS'/SPK 10 case elsewhere in the text) this is the NAIF ID code of the object (which for spacecraft or other vehicles must be a negative number). If NAIF has not assigned an ID code (based on DSN assignments) the user may select a temporary ID, avoiding the range of -0 through -512. (It might be useful to contact NAIF for assignment of a temporary code.) If this keyword is absent the OBJECT_NAME keyword must be used.

  For the 'TL_ELEMENTS'/SPK 10 case this is the TLE spacecraft code. Because the NAIF ID for a spacecraft must be a negative number while the TLE ID is a positive number, the spacecraft ID that will appear in the output SPK file is constructed from the TLE ID using the following rule:

                                     NAIF_ID = -100000 - TLE_ID

  Alternatively, the TLE_INPUT_OBJ_ID and TLE_SPK_OBJ_ID keywords can be used to explicitly specify the input TLE spacecraft code and the output SPK NAIF ID. Specifying the OBJECT_ID keyword and the TLE_INPUT_OBJ_ID and TLE_SPK_OBJ_ID keywords at the same time is not allowed.

OBJECT_NAME
  name of the object. This is one of the NAIF supported names for the object.

  For all input data type/output SPK type combinations except 'TL_ELEMENTS'/SPK 10 this keyword is required if the OBJECT_ID keyword is absent. If both keywords are present, the MKSPK program uses the OBJECT_ID and ignores this assignment.

  For the 'TL_ELEMENTS'/SPK 10 case using this keyword is also supported but impractical because in general SPICE does not assign names to TLE objects. Instead of using this keyword, the TLE_INPUT_OBJ_ID and TLE_SPK_OBJ_ID keywords can be used to explicitly specify the input TLE spacecraft code and the output SPK NAIF ID. Specifying the OBJECT_NAME keyword and the TLE_INPUT_OBJ_ID and TLE_SPK_OBJ_ID keywords at the same time is not allowed.

TLE_INPUT_OBJ_ID
  TLE spacecraft code. This is the numeric code of the object, data for which should be extracted from the input TLE file. This keyword must be specified together with the TLE_SPK_OBJ_ID keyword. Specifying it and the OBJECT_ID and/or OBJECT_NAME keywords at the same time is not allowed.

TLE_SPK_OBJ_ID
  NAIF ID for the TLE object. This is the NAIF ID to be used in the output TLE-based SPK file for the TLE object of interest. This keyword must be specified together with the TLE_INPUT_OBJ_ID keyword. Specifying it and the OBJECT_ID and/or OBJECT_NAME keywords at the same time is not allowed.

CENTER_ID
  NAIF ID of the center. This is the NAIF reserved code of the center of motion for the object. If this keyword is absent, the CENTER_NAME keyword must be used. For the 'TL_ELEMENTS'/SPK 10 case this keyword must have the value 399 (NAIF ID for Earth mass center.)

CENTER_NAME
  name of the center. This is one if the NAIF supported names for the center of motion. This keyword is required if the CENTER_ID keyword is absent. If both keywords are present the MKSPK program uses the CENTER_ID and ignores this assignment. If this keyword is provided for the 'TL_ELEMENTS'/SPK 10 case, it must have the value 'Earth'.

REF_FRAME_NAME
  name of the reference frame. If this is not a standard frame supported by NAIF, the definition for this frame must be present in a frame definitions kernel file specified in the FRAME_DEF_FILE keyword. For the 'TL_ELEMENTS'/SPK 10 case this keyword must have the value 'J2000'. If input data is referenced to ICRF and SPK created from it is intended to be used as described below in the section ``ICRF vs J2000'', this keyword should be set to the value 'J2000'.

PRODUCER_ID
  producer identifier. This is a name identifying the producer of this SPK file. This value will appear in the comment area of the SPK.

DATA_ORDER
  ordered list of input parameter names as they appear in the input data records. The names are delimited with white space.

DATA_DELIMITER
  delimiter used to separate data items. This is picked from the following set: 'TAB' , 'EOL' , comma (',') , semicolon (';') or white space (' '). Only one of these values can be used. If your data does not use one of these delimiters the data must be modified before being processed through MKSPK.

LEAPSECONDS_FILE
  leapseconds file name. This is the SPICE LSK file name, including full or relative path specification.

INPUT_DATA_FILE
  input data file name. This keyword must be used if the input data file name is not provided on the command line. Include path if needed.

OUTPUT_SPK_FILE
  output data file name. This keyword must be used if the output SPK file name is not provided on the command line. Include path if needed.

PCK_FILE
  SPICE Planetary Constants file name. One or more files can be used. This keyword may be absent in the case when you do not need PCK constants or when these constants are defined with other setup keywords. Include path(s) if needed. For the 'TL_ELEMENTS'/SPK 10 case a PCK file containing Earth geophysical constants must be provided using this keyword.

FRAME_DEF_FILE
  frame definition file name. This keyword is required if the reference frame specified in the REF_FRAME_NAME keyword is not one defined in SPICE Toolkit Software. In this case the frame must be defined in a frames definition kernel file. Include path if needed.

COMMENT_FILE
  comment file name. This keyword is used if you want to include comments provided in this file in the comment area of the SPK file. Include path if needed.

INPUT_DATA_UNITS
  angle and distance units. The values of this keyword define the units used for angles and distances appearing in the input data if these are not RADIANS or KM. All angle and distance units supported by SPICE may be used. The value fields take the form of an assignment, such as 'ANGLES=DEGREES' and 'DISTANCES=NAUTICAL_MILES'. The complete list of angle and distance units that are recognized by MKSPK is:

                                     RADIANS
                                     DEGREES        ARCMINUTES
                                     ARCSECONDS     HOURANGLE
                                     MINUTEANGLE    SECONDANGLE

                                     METERS         KM
                                     CM             MM
                                     FEET           INCHES
                                     YARDS          STATUTE_MILES
                                     NAUTICAL_MILES AU
                                     PARSECS        LIGHTSECS
                                     LIGHTYEARS

  Note that MKSPK assumes that the time units of any input data parameters or constants specified in the setup file are seconds.

EPOCH_STR_LENGTH
  length (number of characters, including white space) of input data record epoch strings, from the first through the last non blank character. This length must be provided to the program in order to enable parsing of the input data records containing two epoch strings and using data delimiter characters which are also allowed in SPICE time strings -- white space (' ') or comma (',').

IGNORE_FIRST_LINE
  number of lines to be ignored at the beginning of the input file. If this keyword is absent or is set to an integer number less than or equal to 0, the program starts data processing from the first line of the input file.

LINES_PER_RECORD
  number of lines in each input record. This keyword must be present if EPOCH_STR_LENGTH is absent and the data delimiter is one also allowed in SPICE time strings -- white space (' ') or comma (',').

TIME_WRAPPER
  the specification of alphanumeric characters that are used to either complete and/or further define the "EPOCH" strings (and the "EPOCHP" string, if this is also used) provided in the input data and processed by the program using the SPICE's time conversion routine STR2ET . Such characters may be added at the front (prefix), the end (suffix), or both of the epoch (and epochp, if used) data items. The location of the epoch (and epochp) data relative to prefix or suffix characters is specified with the

                                     "#"

  character. As example,

                                     TIME_WRAPPER = '# TDT'

  would add the characters ' TDT' to the end of every epoch value (and to the epochp value, if present).

  If the "EPOCH" (and "EPOCHP") time tags are provided as ET seconds past J2000 this keyword must be set to the following special value:

                                     TIME_WRAPPER = '# ETSECONDS'

  See "Using Time Wrappers" later in this document for more details.

START_TIME
  start time. This keyword defines the first valid epoch of the output SPK file. This value is always required for output SPK Types 15 and 17. If this value is absent for other output types, the MKSPK program calculates it using input data.

  This keyword also applies when making 'TL_ELEMENTS'/SPK 10 SPK files. For such cases it is not allowed to specify this keyword together with the TLE_START_PAD keyword. If neither START_TIME nor TLE_START_PAD is specified the output TLE-based SPK coverage start time is automatically set to be 12 hours before the time of the first input two-line elements set.

TLE_START_PAD
  TLE-based SPK coverage start pad. This keyword specifies the pad to be applied to the time of the first input two-line elements set to expand the coverage of the output TLE-based SPK file. The value of this keyword must be a string specifying positive or zero duration and units, for example '6 hours', '3 days'. The following units are supported and can be specified in lower, upper, or mixed case: ``seconds'', ``minutes'', ``hours'', and ``days''. Positive durations expand the coverage of the output SPK file -- the SPK coverage start time will be earlier as compared to the time of the first input two-line elements set -- while zero durations set the start of the coverage of the output SPK file to be exactly the time of the first input two-line elements set.

  This keyword applies only when making 'TL_ELEMENTS'/SPK 10 SPK files and is ignored in all other cases. It is not allowed to specify this keyword together with the START_TIME keyword. If neither START_TIME nor TLE_START_PAD is specified the output TLE-based SPK coverage start time is automatically set to be 12 hours before the time of the first input two-line elements set, equivalent to TLE_START_PAD = '12 hours'.

STOP_TIME
  stop time. This keyword defines the last valid epoch of the output SPK file. This value is always required for output SPK Types 15 and 17. If this value is absent for other output types, the MKSPK program calculates it using input data.

  This keyword also applies when making 'TL_ELEMENTS'/SPK 10 SPK files. For such cases it is not allowed to specify this keyword together with the TLE_STOP_PAD keyword. If neither STOP_TIME nor TLE_STOP_PAD is specified the output TLE-based SPK coverage stop time is automatically set to be 12 hours after the time of the last input two-line elements set.

TLE_STOP_PAD
  TLE-based SPK coverage stop pad. This keyword specifies the time pad to be applied to the time of the last input two-line elements set to expand the coverage of the output TLE-based SPK file. The value of this keyword must be a string specifying positive or zero duration and units, for example '6 hours', '3 days'. The following units are supported and can be specified in the lower, upper, or mixed case: ``seconds'', ``minutes'', ``hours'', and ``days''. Positive durations expand the coverage of the output SPK file -- the SPK coverage stop time will be later as compared to the time of the last input two-line elements set -- while zero durations set the start of the coverage of the output SPK file to be exactly the time of the last input two-line elements set.

  This keyword applies only when making 'TL_ELEMENTS'/SPK 10 SPK files and is ignored in all other cases. It is not allowed to specify this keyword together with the STOP_TIME keyword. If neither STOP_TIME not TLE_STOP_PAD is specified the output TLE-based SPK coverage stop time is automatically set to be 12 hours after the time of the last input two-line elements set, equivalent to TLE_STOP_PAD = '12 hours'.

PRECESSION_TYPE
  J2 processing flag for output type 15. Only one of four values may be specified using this keyword: 'NO PRECESSION', 'APSIDE PRECESSION ONLY', 'NODE PRECESSION ONLY', 'APSIDE AND NODE PRECESSION'

POLYNOM_DEGREE
  polynomial degree of Lagrange interpolation for output SPK Type 8 or 9, or polynomial degree of Hermite interpolation for output SPK type 12 or 13. The polynomial degree of Hermite interpolation must be an odd number. Also, to ensure continuity of the polynomials over the time span covered by an SPK segment the degree for SPK types 8 and 9 should be odd while the degree for SPK types 12 and 13 should be equivalent to 3 mod 4 (3, 7, 11, etc.)

CENTER_GM
  center GM. This keyword specifies the GM of the central body. If it is absent, the MKSPK program attempts to find this value in a PCK file. You do not need this keyword when input type is STATE and output type is 8, 9, 12 or 13 and when input type is EQ_ELEMENTS and output type is 17.

CENTER_POLE_RA
  the right ascension of the central body's north pole. This keyword is used for output types 15 and 17. If it is absent, the MKSPK program attempts to compute this value using loaded PCK constants. The value must in units specified in the keyword INPUT_DATA_UNITS and with respect to the frame specified in the keyword REF_FRAME_NAME.

CENTER_POLE_DEC
  the declination of the central body's north pole. This keyword is used for output types 15 and 17. If it is absent, the MKSPK program attempts to compute this value using loaded PCK constants. The value must in units specified in the keyword INPUT_DATA_UNITS and with respect to the frame specified in the keyword REF_FRAME_NAME.

CENTER_J2
  central body's J2 coefficient. This keyword is needed only for output type 15. If it is absent, the MKSPK program attempts to find its value in a PCK file.

CENTER_EQ_RADIUS
  equatorial radius of central body. This keyword is needed only for output type 15. If it is absent, the MKSPK program attempts to find its value in a PCK file.

SEGMENT_ID
  segment identifier. The value assigned to this keyword can be up to 40 characters long. If this keyword is absent, the MKSPK program will use the first 40 characters on the INPUT_FILE_NAME value as the segment identifier.

APPEND_TO_OUTPUT
  optional flag specifying whether it's permitted to append new segments to an existing SPK file. This keyword can have one of these two values: 'YES' if segments can be appended and 'NO' if appending segments is not permitted. If this keyword is not present, the program assumes the value 'NO'. An -append flag specified on the command line overrides either value of this keyword.

Top

## ICRF vs J2000

The International Celestial Reference System (ICRS) defines coordinate axes that are closely aligned with those of the J2000 (aka EME2000) reference frame. The International Celestial Reference Frame (ICRF) and later versions of it (ICRF1, etc.) are realizations of the ICRS. For brevity, we'll simply refer to ``the ICRF'' below.

The rotational offset between the J2000 frame and the ICRS has magnitude of under 0.1 arcseconds.

Certain JPL data products are referenced to the ICRF or later versions of it. These include, but are not limited to,

`--` DE4xx series planetary ephemerides

`--` Satellite ephemerides compatible with DE4xx planetary ephemerides

`--` Small body ephemerides compatible with DE4xx planetary ephemerides

`--` Orientation of the terrestrial frame ITRF93

`--` Orientation of the lunar principal axes frame

Rotation models provided by the IAU are referenced to the ICRF.

Modern spacecraft ephemerides and attitude data, other than those for Earth orbiters, are likely referenced to the ICRF. Users should consult documentation or data providers to verify this for data sets of interest.

SPK and binary PCK files produced by NAIF from the data sources listed above are referenced to the same version of the ICRF as the corresponding data sources. For historical and backward compatibility reasons, these data products are labeled as being referenced to the J2000 frame.

No transformation is required to convert state vectors or orientation data from the J2000 frame to the ICRF (or later version), if the vectors or orientation data are computed using SPICE kernels created from the data sources listed above. For example:

`--` A call to spkezr_c with the input frame name J2000 will return a state vector referenced to the ICRF, if the SPK data are from a JPL planetary ephemeris SPK, or from any other SPK in which data are referenced to the ICRF and labeled as referenced to the J2000 frame.

`--` A call to pxform_c with the input ``from'' frame name J2000 and input ``to'' frame name ITRF93 will return a 3x3 matrix that transforms position vectors from the ICRF to the ITRF93 terrestrial frame, if the Earth orientation data are provided by a NAIF high-precision, binary Earth PCK.

`--` A call to pxform_c with the input ``from'' frame name J2000 and input ``to'' frame name IAU_MARS will return a 3x3 matrix that transforms position vectors from the ICRF to the Mars body-fixed, body-centered IAU_MARS frame, if the orientation data are provided by a NAIF generic text PCK.

`--` A call to pxform_c with the input ``from'' frame name J2000 and an input ``to'' CK frame name will return a 3x3 matrix that transforms position vectors from the ICRF to the specified CK frame, if the CK data used by this call are referenced to the ICRF and labeled as referenced to the J2000 frame.

SPICE kernel creators intending to support use of data referenced to the ICRF, as shown above, should write the data without first converting it to the J2000 frame. Segments of such SPK, CK, or binary PCK files should indicate the frame is J2000. It is strongly recommended that kernel creators add comments to the files to explain the actual characteristics of the data.

SPICE users who export kernel data to non-SPICE file formats may need to transform the data, depending on the frame to which the SPICE data are actually referenced (as opposed to the frame to which the kernel indicates the data are referenced), and depending on the desired output frame.

Top

## Description of Input Data Format

MKSPK requires the input data file to be an ASCII text file containing states, conic elements or equinoctial elements, or Space Command two-line elements. Any two-line elements file has fixed format and is processed as a special case; an input file containing any other type of input data must comply with the rules described in this section and the section immediately following it.

All lines in the input file, including the last line, must be terminated with the line terminators native to the computer platform on which the program is run. If the lines are terminated with a non-native terminator, the program will not be able to process the input file correctly. If the last line of the input file is not terminated with the proper line terminator, the program will ignore it causing the data written to the output SPK file be incomplete.

The input file must contain a number of data records sufficient to generate an SPK file of a specified type (see subsection below). Each of the records must occupy the same number of non-blank lines and contain the same set of input data items, provided in the same order. Blank lines can appear anywhere between non-blank record lines and are not taken into account by the program.

The data set contained in each record must correspond to a single epoch. Data records in an input file must be provided in strictly increasing time order based on the values of the data item EPOCH. Data records with duplicate EPOCHs are not allowed.

An input file may also contain one or more initial lines that do not represent a valid data record (for example a table header). These lines can be ignored by specifying their count in the IGNORE_FIRST_LINE setup file keyword.

The order of the data items in each input data record must be specified in the DATA_ORDER keyword.

Input data items within each data record must be separated by one of the following delimiters:

          'TAB' or  'EOL' or  ';' or  ','  or  ' '

The delimiter is not required but is permitted after the last data item on a line. Any spaces between the delimiter and preceding or following data items are ignored. In the case when white space is used as the delimiter, multiple spaces between data items are treated as a single space.

If tabulation ('TAB'), end-of-line ('EOL') or semicolon (';') is used as the data delimiter then only two setup file keywords are required for MKSPK in order to parse input data -- DATA_ORDER and DATA_DELIMITER.

If comma (',') or white space (' '), which are also allowed in SPICE time strings, is used as the data delimiter and the input data records contain only one time parameter (EPOCH), then the number of lines in each input data record must be specified using the setup file keyword LINES_PER_RECORD. The DATA_ORDER and DATA_DELIMITER keywords must also be used.

If comma (',') or white space (' ') is used as the data delimiter and the input data records contain two times (EPOCH and EPOCHP), then both input times must have the same width, from the first though the last non-blank character, and this width must be specified in the setup file keyword EPOCH_STR_LENGTH. The DATA_ORDER and DATA_DELIMITER keywords must also be used.

Top

## Description of Input Data Parameters

The MKSPK program gains considerable flexibility by accepting several forms of ephemeris information and epochs. Further flexibility is achieved by allowing the user to tell MKSPK how those input data are organized, and, by allowing the user to clearly identify the time system and format used for time tags (epochs).

Listed below are the names of all the input data known to MKSPK--you would use just a subset of these in any one MKSPK session. How you use these parameter names to tell MKSPK what kind of input data are to be processed is described below. Note that one parameter name, "SKIP", is used to indicate that some item(s) in your input data file are to be ignored by MKSPK.

EPOCH
  epoch of the data, given in any time format allowed by the SPICE's time conversion routine STR2ET (for details, see section ``STR2ET'' of the Time Required Reading document, time.req) or as a DP number representing ET seconds past J2000. Note that the setup file keyword TIME_WRAPPER, which is optionally used to modify input times processed by STR2ET, must be set to the value

                          '# ETSECONDS'

  to process times given as ET seconds past J2000. This keyword is described below in the section ``Using Time Wrappers.''

X
  X position coordinate of state vector

Y
  Y position coordinate of state vector

Z
  Z position coordinate of state vector

VX
  X velocity coordinate of state vector

VY
  Y velocity coordinate of state vector

VZ
  Z velocity coordinate of state vector

A
  semi-major axis

E
  eccentricity

RP
  radius of periapsis

T
  orbital period

P
  semi-latus rectum

INC
  inclination

PER
  argument of periapsis

NOD
  longitude of ascending node

MEAN
  mean anomaly

EXAN
  eccentric anomaly

TRAN
  true anomaly

EPOCHP
  epoch of periapsis, given in any time format allowed by the SPICE's time conversion routine STR2ET (for details, see section ``STR2ET'' of the Time Required Reading document, time.req) or as a DP number representing ET seconds past J2000. Note that the setup file keyword TIME_WRAPPER, which is optionally be used to modify input periapsis times processed by STR2ET, must be set to the value

                          '# ETSECONDS'

  to process times given as ET seconds past J2000. This keyword is described below in the section ``Using Time Wrappers.''

TAU
  time interval between EPOCH and periapsis (EPOCH-EPOCHP) in seconds

EQ_A
  1-st equinoctial element. This is the semi-major axis of the orbit

EQ_H
  2-nd equinoctial element. This is the value of (E*SIN(PER+NOD)) at the specified epoch.

EQ_K
  3-rd equinoctial element. This is the value of (E*COS(PER+NOD)) at the specified epoch

EQ_ML
  4-th equinoctial element. This is the mean longitude (MEAN+PER+NOD) at the specified epoch

EQ_P
  5-th equinoctial element. This is the value of (TAN(INC/2)*SIN(NOD)) at the specified epoch

EQ_Q
  6-th equinoctial element. This is the value of (TAN(INC/2)*COS(NODE)) at the specified epoch

DPER/DT
  7-th equinoctial element. This is the rate of the longitude of periapsis (dPER/dt) at the specified epoch

DMPN/DT
  8-th equinoctial element. This is the derivative of the mean longitude (dM/dt + dPER/dt + dNOD/dt) at the specified epoch.

DNOD/DT
  9-th equinoctial element. This is the rate of the longitude of the ascending node (dNOD/dt) at the specified epoch

SKIP
  input data record parameter to be ignored. This parameter is used to identify the location in the input data records of any data items, or parts of a data item if a complete data item includes the delimiter within its value, that are not needed by MKSPK and therefore should be ignored. This string may be used as many times as needed. Note that sometimes more than one SKIP may be needed to ignore an additional time tag in an input record if the delimiter is comma or white space.

Top

## Description of Input Data Types and Content

Four types of input data can be processed by the program:

          STATES, ELEMENTS, EQ_ELEMENTS, TL_ELEMENTS

If input type is STATES, you can create an SPK of output types: 5, 8, 9, 12, 13, 15 and 17.

If input type is ELEMENTS, you can create an SPK of output types: 5, 8, 9, 12, 13, 15 and 17.

If input type is EQ_ELEMENTS, you can create only an SPK of output type 17.

If input type is TL_ELEMENTS, you can create only an SPK of output type 10.

Top

### Input Type STATES

An input file of the STATES type must contain records consisting of EPOCH and a full set of state vector parameters X, Y, Z, VX, VY, Vz.

If you use the STATES input type to produce an SPK of Type 17, you must also include three equinoctial parameters:

          DPER/DT, DMPN/DT, DNOD/DT

in addition to the state vector.

Any other allowed parameters in the DATA_ORDER value for the input type STATES are treated by the program program as SKIP.

Top

### Input Type ELEMENTS

An input file of the ELEMENTS type must contain records consisting of EPOCH, E, INC, PER, NOD and one of A, RP, T, P, as well as one of MEAN, EXAN, TRAN, EPOCHP, TAU.

If you use the ELEMENTS input type to produce an SPK of Type 17, you must also include three equinoctial parameters:

          DPER/DT, DMPN/DT, DNOD/DT

in addition to the base elements.

Any other allowed parameters in the DATA_ORDER value for the input type ELEMENTS are treated by the program program as SKIP.

Top

### Input Type EQ_ELEMENTS

An input file of the EQ_ELEMENTS type must contain EPOCH and nine equinoctial elements EQ_A, EQ_H, EQ_K, EQ_ML, EQ_P, EQ_Q, DPER/DT, DMPN/DT, DNOD/DT.

Any other allowed parameters in the DATA_ORDER value for the input type EQ_ELEMENTS are treated by the program program as SKIP.

Top

### Input Type TL_ELEMENTS

An input file of the TL_ELEMENTS type has a pre-defined format and is processed by the program in a special way. Therefore, the program does not need specification of the record data order and ignores all setup file keywords describing input data format.

Top

## Relation Between Number of Input Records and Output Types

An SPK of Type 5 requires one or more input records of time ordered STATES or ELEMENTS. If the input file contains only one record, the program can formally create an SPK of Type 5 but this file will not be useful for real applications.

An SPK of Types 8, 9 requires input records of time ordered STATES or ELEMENTS. The degree of Lagrange polynomial specified by the keyword POLYNOM_DEGREE must be less than the number of the data records.

An SPK of Type 10 requires one or more input records of time ordered TL_ELEMENTS for the spacecraft with the TLE ID specified in the OBJECT_ID setup file keyword.

An SPK of Types 12, 13 requires input records of time ordered STATES or ELEMENTS. The degree of Hermite polynomial specified by the keyword POLYNOM_DEGREE must be an odd number and less than the number of the data records times 2.

An SPK of Type 15 requires only one input record of STATES or ELEMENTS. If the input file contains more than one record, only the first is used by the program.

An SPK of Type 17 requires only one input record of EQ_ELEMENTS or one input record of STATES or ELEMENTS with DPER/DT, DMNP/DT, DNOD/DT added. If the input file contains more than one record, only the first is used by the program.

Top

## Examples of Input Data and Setup Files

Top

### Data Order and Data Delimiters

To use an input data file you must describe the order of data items in its data records and the delimiter used to separate these data items. You do this using appropriate keyword=value assignments in the setup file:

          DATA_ORDER     = '<param1> <param2> ... <paramN>'
          DATA_DELIMITER = '<selection>'

In some situations it is necessary to use the keyword EPOCH_STR_LENGTH to define input epoch string length, or the keyword LINES_PER_RECORD to define the number of lines used for each input record. One of these assignments may be needed to allow MKSPK to determine which characters are part of the epoch parameter as opposed to being one of the state or elements parameters.

Top

### Example 1

The input type is STATES. We first consider the case when the delimiter separating data items is one of those also allowed as a delimiter in SPICE time strings.

Case 1. ------

It this example the data delimiter is the comma.

You have a time ordered set of states with each record consisting of one line.

          epoch1, x1, y1, z1, vx1, vy1, vz1 [,]    (record 1)
          epoch2, x2, y2, z2, vx2, vy2, vz2 [,]    (record 2)
          epoch3, x3, y3, z3, vx3, vy3, vz3 [,]    (record 3)
          epoch4, x4, y4, z4, vx4, vy4, vz4 [,]    (record 4)
          .....................................    ..........
          .....................................    ..........

Note that the data delimiter at the end of each line ( record ) is optional (as indicated by the square brackets) and may be omitted.

Let the format of each epoch string be:

          1998 DEC 12 10:23:20

You can define this input data using the following specifications in the setup file:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'epoch x y z vx vy vz'
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 20

Alternatively we can use this set of specifications:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'epoch x y z vx vy vz '
          DATA_DELIMITER        = ','
          LINES_PER_RECORD      = 1

This alternative method is possible because MKSPK is told that there are seven data items per line, of which the last six are the state. Therefore all other character strings are part of the epoch.

Case 2. ------

The epoch can occur in any position on the input line. For example, the input line could contain:

          x, y, z, epoch, vx, vy, vz [,]

Relative to case 1 you need to change only the order of parameters in DATA_ORDER:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'x y z epoch vx vy vz'
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 20

or

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'x y z epoch vx vy vz'
          DATA_DELIMITER        = ','
          LINES_PER_RECORD      = 1

Case 3. ------

The input data use a blank (white space) as the delimiter. For example, the input line could contain:

          x y z epoch vx vy vz

You need to change only the value of DATA_DELIMITER:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'x y z epoch vx vy vz'
          DATA_DELIMITER        = ' '
          EPOCH_STR_LENGTH      = 20

or

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'x y z epoch vx vy vz'
          DATA_DELIMITER        = ' '
          LINES_PER_RECORD      = 1

If the delimiter used to separate input data items is one that is not allowed as a delimiter in SPICE time strings (white space or comma), then the specifications needed in the setup file are fewer -- neither EPOCH_STR_LENGTH nor LINE_PER_RECORD is needed.

Case 4. ------

The input data use one of 'TAB', 'EOL' or ';' as delimiter. For example, if an input line contains:

          x; y; z; epoch; vx; vy; vz [;]

You should change the value of DATA_DELIMITER and omit the keyword EPOCH_STR_LENGTH or LINES_PER_RECORD:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'x y z  epoch vx vy vz'
          DATA_DELIMITER        = ';'

Top

### Example 2

This is a more general example of input data.

The input type is STATES and the delimiter is ',' which is also allowed in SPICE time strings.

You have a time ordered set of states with epochs, and each input record consists of a few lines. There are some unused parameters ('not_used') between input data values and there are blank lines between significant lines. Each input record consists of 2 significant lines with none to several intervening blank lines:

          epoch1, not_used, not_used  [,]
          blank line
          x1, y1, z1, vx1, vy1, vz1   [,]        (record 1)
          epoch2, not_used, not_used  [,]
          x2, y2, z2, vx2, vy2, vz2   [,]        (record 2)
          epoch3,  not_used, not_used [,]
          x3, y3, z3, vx3, vy3, vz3   [,]        (record 3)
          epoch4,  not_used, not_used [,]
          blank line
          blank line
          x4, y4, z4, vx4, vy4, vz4   [,]        (record 4)
          ..............................       ..........
          ..............................       ..........

The delimiter at the end of each line (record) is optional (as indicated by the square brackets) and may be omitted.

Let the format of each epoch string look like this:

          1998 DEC 12 10:23:20.617

You can define this input data using the following specification in the setup file:

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'epoch skip skip x y z vx vy vz'
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 24

or

          INPUT_DATA_TYPE       = 'STATES'
          DATA_ORDER            = 'epoch skip skip x y z vx vy vz'
          DATA_DELIMITER        = ','
          LINES_PER_RECORD      = 2

Note that the LINES_PER_RECORD assignment specifies the number of ``significant'' data lines per record -- it does not need to account for any number of intervening blank lines.

All modifications like the cases of Example 1 are possible.

Top

### Example 3

Case 1: -------

The input type is ELEMENTS. We consider the case when the data delimiter is one of those also allowed in SPICE time strings -- white space (' ') or comma (',').

For example assume the delimiter is the comma character.

You have a time ordered set of conic elements with epochs and each input record consists of a few lines. There are some unused parameters ('not_used') between input data values and occasionally some blank lines between significant lines. Each input record consists of 2 significant lines:

          epoch1, not_used, not_used     [,]
          blank line
          e1,a1,inc1, per1, nod1, mean1  [,]        (record 1)
          epoch2, not_used, not_used     [,]
          e2,a2,inc2, per2, nod2, mean2  [,]        (record 2)
          epoch3,  not_used, not_used    [,]
          e3,a3,inc3, per3, nod3, mean   [,]        (record 3)
          epoch4,  not_used, not_used    [,]
          blank line
          blank line
          e4,a4,inc4, per4, nod4, mean4  [,]        (record 4)
          ..............................            ..........
          ..............................            ..........

The delimiter at the end of each line (record) is optional (as indicated by the square brackets) and may be omitted.

Let the format of each epoch string look like this:

          1998 DEC 12 10:23:20.3

You can define this input data using the following specification in the setup file:

          INPUT_DATA_TYPE       = 'ELEMENTS'
          DATA_ORDER            = 'epoch skip skip e a inc per nod mean'
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 22

or

          INPUT_DATA_TYPE       = 'ELEMENTS'
          DATA_ORDER            = 'epoch skip skip e a inc per nod mean'
          DATA_DELIMITER        = ','
          LINES_PER_RECORD      = 2

You could use, by the same rules, other elements included in the list of parameters for input type ELEMENTS, except the case when the existing epoch of periapsis is also included in the input data.

Case 2: -------

In this example you need epoch of periapsis as an additional input data item and the data delimiter is one of those also allowed in SPICE time strings -- white space (' ') or comma (','):

          epoch1, not_used, not_used        [,]
          blank line
          e1,a1,inc1, per1, nod1, epochp1   [,]        (record 1)
          epoch2, not_used, not_used        [,]
          e2,a2,inc2, per2, nod2, epochp2   [,]        (record 2)
          epoch3,  not_used, not_used       [,]
          e1,a1,inc1, per1, nod1, epochp3   [,]        (record 3)
          epoch4,  not_used, not_used       [,]
          blank line
          blank line
          e1,a1,inc1, per1, nod1, epochp4   [,]        (record 4)
          ..............................               ..........
          ..............................               ..........

The value of epochp must use the same format as for the epoch string:

          1998 DEC 12 09:12:34.9

and the length of the time string (must be the same for epoch and epochp) must be defined using the keyword EPOCH_STR_LENGTH:

          INPUT_DATA_TYPE       = 'ELEMENTS'
          DATA_ORDER            = 'epoch skip skip e a per nod epochp'
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 22

All other modifications like the cases of Example 1 are possible.

Top

### Example 4

Input type is EQ_ELEMENTS. We consider the case when the delimiter is one of those also allowed in SPICE time strings -- white space (' ') or comma (',').

For example assume the delimiter is the comma character.

Each data record consists of two lines. There are some not used parameters ('not_used') between some of the input data values of nine equinoctial elements.

          epoch1, eq(1), eq(2), eq(3), eq(4), eq(5), eq(6) [,]
          not_used, not_used, eq(7), eq(8), eq(9), no_used [,]

The delimiter at the end of each line (record) is optional (as indicated by the square brackets) and may be omitted.

Let the format of each epoch string look like this:

          1998 DEC 12 10:23

You can define this input data using the following specification in the setup file:

          INPUT_DATA_TYPE       = 'EQ_ELEMENTS'
          DATA_ORDER            = 'epoch eq_a eq_h eq_k eq_ml
             eq_p eq_q skip skip dper/dt dmnp/dt dnod/dt skip'  (*)
          DATA_DELIMITER        = ','
          EPOCH_STR_LENGTH      = 17

or

          INPUT_DATA_TYPE       = 'EQ_ELEMENTS'
          DATA_ORDER            = 'epoch eq_a eq_h eq_k eq_ml
             eq_p eq_q skip skip dper/dt dmnp/dt dnod/dt skip' (*)
          DATA_DELIMITER        = ','
          LINES_PER_RECORD      = 2

(*) In a real setup file the assignment for the DATA_ORDER keywords must be on a single line. It was split to be on two lines only to fit onto the page in this document.

Top

## Using Time Wrappers

The TIME_WRAPPER keyword allows you to modify occurrences of time strings (either "epoch" or "epochp") in an input data file, either to add a time system identifier known to SPICE or some missing but fixed additional characters. The modifier alphanumeric characters are prefixed and/or suffixed around the given time string; enter the additional alphanumeric characters needed as the value for this keyword while using the

       "#"

character to indicate where the given time string data are to be placed relative to the characters being added.

As an example of providing a time string identifier, suppose the input data has ET Julian Date epoch values that look like this:

          2554617.231

The SPICE's time conversion routine STR2ET will not be able to process these tags unless a modifier known to the SPICE system is added. You must indicate to STR2ET that these values are Julian Dates in ET (now called Barycentric Dynamical Time, abbreviated as TDB) using the following assignment:

          TIME_WRAPPER = '# JD TDB'

As another example suppose the time strings are given in calendar format Pacific Standard Time and look like this:

          1999 MAR 10 14:31:22.376

You must then use the TIME_WRAPPER assignment as follows:

          TIME_WRAPPER = '# PST'

to add ``PST'' to each time string so that SPICE time parsing software inside MKSPK will properly interpret these time tags.

You can also use this assignment to add missing information. Suppose your data look like this:

          MAR 10 14:31:22.376

You should use the following TIME_WRAPPER assignment:

          TIME_WRAPPER = '1999 # UTC'

This will prefix your data with '1999 ' and suffix your data with ' UTC' so the input to the time parsing software inside MKSPK will look like:

          1999 MAR 03 10:14:22.376 UTC

A special value must be assigned to the TIME_WRAPPER keyword when input times are given as DP numbers representing ET seconds past J2000. Such time tags are not processed by STR2ET; instead, they are buffered directly as DP numbers. To process this kind of input times the TIME_WRAPPER keyword must be set as follows:

          TIME_WRAPPER = '# ETSECONDS'

Top

## Complete Examples

Examples in this section illustrate which ``keywords=value'' assignments must be specified in a MKSPK setup file for particular combinations of the input data type and format and output SPK type. Although most of the examples create an SPK file containing trajectory of the Jovian satellite AMALTHEA with respect to Jupiter, which is a not very likely application for this program, the guidelines for creating setup files demonstrated by these examples apply to the situation when an SPK file for a spacecraft needs to be made.

If you cut and paste one of these examples to help construct your own setup file be sure to change all values that need to be updated for your particular situation.

Top

### Input Data Type STATES / Output SPK Type 05

The Type 05 SPK represents a continuous ephemeris using a discrete set of unevenly spaced states and a two body propagation method.

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM value will be stored in the output SPK file together with the states. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 5
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_STATES_05'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 08

The Type 08 SPK represents a continuous ephemeris using a discrete set of evenly spaced states and a Lagrange interpolation method.

The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 8. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

To ensure the continuity of the interpolating polynomials over the time span covered by an SPK Type 08 segment the degree of the polynomial should be odd.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 8
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 9
       SEGMENT_ID        = 'SPK_STATES_08'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 09

The Type 09 SPK represents a continuous ephemeris using a discrete set of unevenly spaced states and a Lagrange interpolation method.

The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 9. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

To ensure the continuity of the interpolating polynomials over the time span covered by an SPK Type 09 segment the degree of the polynomial should be odd.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 9
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 9
       SEGMENT_ID        = 'SPK_STATES_09'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 12

The Type 12 SPK represents a continuous ephemeris using a discrete set of evenly spaced states and a sliding window Hermite interpolation method.

The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 12 and its value must be an odd number. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

To ensure the continuity of the interpolating polynomials over the time span covered by an SPK Type 12 segment the degree of the polynomial should be equivalent to 3 mod 4 (3, 7, 11, etc.)

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 12
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'B.V.Semenov, NAIF/JPL'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 7
       SEGMENT_ID        = 'SPK_STATES_12'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 13

The Type 13 SPK represents a continuous ephemeris using a discrete set of unevenly spaced states and a sliding window Hermite interpolation method.

The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 13 and its value must be an odd number. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

To ensure the continuity of the interpolating polynomials over the time span covered by an SPK Type 13 segment the degree of the polynomial should be equivalent to 3 mod 4 (3, 7, 11, etc.)

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 13
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'B.V.Semenov, NAIF/JPL'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 7
       SEGMENT_ID        = 'SPK_STATES_13'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 15

The Type 15 SPK represents a continuous ephemeris using a compact analytic model. The object is modeled as orbiting a central body under the influence of a central mass plus first order secular effects of the J2 term in harmonic expansion of the central body gravitational potential.

The PCK file, e.g. 'Gravity.tpc', containing GM and J2 of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM and J2 can be specified using the CENTER_GM and CENTER_J2 keywords. The CENTER_POLE_RA and CENTER_POLE_DEC keywords contain Jupiter's pole RA and DEC with respect to the reference frame specified in the REF_FRAME_NAME keyword -- in this case B1950. If these keywords wouldn't be present in the setup file the program would compute these values from data present in the PCK file 'pck00005.tpc' provided using the keyword PCK_FILE. The START_TIME and STOP_TIME keywords specifying the file coverage interval, and the PRECESSION_TYPE keyword specifying the type of precession due to J2 are required for the output SPK Type 15. Also The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 15
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1979 MAR 05'
       STOP_TIME         = '1979 MAR 06'
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc' )
       PRECESSION_TYPE   = 'NO PRECESSION'
       CENTER_POLE_RA    = 268.001
       CENTER_POLE_DEC   = 64.504
       SEGMENT_ID        = 'SPK_STATES_15'
       \begintext

Though the input file in this example contains multiple records, only the first of them will used to create the output SPK file.

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V
       -------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
       1979 MAR 05 00:02:00
        -178337.419 -30878.143 -18771.071 5.186043 -23.421245 -10.996084
       1979 MAR 05 00:04:00
        -177688.033 -33683.859 -20087.682 5.636786 -23.339517 -10.946873
       ...

Top

### Input Data Type STATES / Output SPK Type 17

The SPK data Type 17 represents a continuous ephemeris using a compact analytic model. The object is following an elliptic orbit with precessing line of nodes and argument of periapsis relative to the equatorial frame of some central body. The orbit is modeled via equinoctial elements.

The PCK file, e.g. 'Gravity.tpc', containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM value is required to convert states from the input file to a set of equinoctial elements stored in the output SPK file. The CENTER_POLE_RA and CENTER_POLE_DEC keywords contain Jupiter's pole RA and DEC with respect to the reference frame specified in the REF_FRAME_NAME keyword -- in this case B1950. If these keywords wouldn't be present in the setup file the program would compute these values from data present in the PCK file 'pck00005.tpc' provided using the PCK_FILE keyword. The START_TIME and STOP_TIME keywords specifying file coverage interval are required for the output SPK Type 17. The IGNORE_FIRST_LINE keyword is used to the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file (In this example the value of DATA_ORDER is line-wrapped due to document formatting restrictions; it must be contained on a single line in an actual MKSPK setup file):

       \begindata
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 17
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH X Y Z VX VY VZ DPER/DT
       DMPN/DT DNOD/DT'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1979 MAR 05'
       STOP_TIME         = '1979 MAR 06'
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 3
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc')
       CENTER_POLE_RA    = 268.001
       CENTER_POLE_DEC   = 64.504
       SEGMENT_ID        = 'SPK_STATES_17'
       \begintext

Since only one state is needed to create an output SPK file of type 17, the input file in this example contains a just one record.

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, R,V, EQ_EL(7), EQ_EL(8), EQ_EL(9)
       ------------------------------------
       1979 MAR 05 00:00:00
        -178932.619 -28063.045 -17448.755 4.733702 -23.495860 -11.041956
        2.912548790268837E-05 8.363793086428307E-03 -2.898889191844143E-05

Top

### Input Data Type ELEMENTS / Output SPK Type 05

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM is needed to convert elements to states and it is also contained in the output SPK file. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 5
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_ELEMENTS_05'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 08

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM is needed to convert elements to states. The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 8. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 8
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 8
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_ELEMENTS_08'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 09

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM is needed to convert elements to states. The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 9. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 9
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 8
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_ELEMENTS_09'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 12

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM is needed to convert elements to states. The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 12 and its value must be an odd number. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 12
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'B.V.Semenov, NAIF/JPL'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 7
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_ELEMENTS_12'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 13

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM is needed to convert elements to states. The POLYNOM_DEGREE keyword is used to specify the polynomial degree that will be used to interpolate over discreet states stored in the output SPK file; this parameter is required for SPK Type 13 and its value must be an odd number. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 13
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       POLYNOM_DEGREE    = 7
       PCK_FILE          = 'Gravity.tpc'
       SEGMENT_ID        = 'SPK_ELEMENTS_13'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 15

The PCK file 'Gravity.tpc' containing GM and J2 of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM and J2 can be specified using the CENTER_GM and CENTER_J2 keywords. The CENTER_POLE_RA and CENTER_POLE_DEC keywords contain Jupiter's pole RA and DEC with respect to the reference frame specified in the REF_FRAME_NAME keyword -- in this case B1950. If these keywords wouldn't be present in the setup file, the program would compute these value from data present in the PCK file 'pck00005.tpc' provided using the keyword PCK_FILE. The START_TIME and STOP_TIME keywords specifying the file coverage interval and the PRECESSION_TYPE keyword specifying the type of precession due to J2 are required for the output SPK Type 15. The IGNORE_FIRST_LINE keyword is used to skip the header (three lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies two lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 15
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1979 MAR 05'
       STOP_TIME         = '1979 MAR 06'
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc' )
       PRECESSION_TYPE   = 'NO PRECESSION'
       CENTER_POLE_RA    = 268.001
       CENTER_POLE_DEC   = 64.504
       SEGMENT_ID        = 'SPK_ELEMENTS_15'
       \begintext

Though the input file in this example contains multiple records, only the first of them will used to create the output SPK file.

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0
       -------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
       1979 MAR 05 00:02:00
        181814.040 0.001008 25.415 357.216 115.117 78.678 -657287829.8
       1979 MAR 05 00:04:00
        181824.846 0.000949 25.415 357.216 115.809 78.990 -657287709.8
       ...

Top

### Input Data Type ELEMENTS / Output SPK Type 17

The PCK file 'Gravity.tpc' containing GM of the central body (Jupiter) is specified using the PCK_FILE keyword. Alternatively, Jupiter's GM can be specified using the CENTER_GM keyword. The GM value is required to convert elements from the input file to a set of equinoctial elements stored in the output SPK file. The CENTER_POLE_RA and CENTER_POLE_DEC keywords contain Jupiter's pole RA and DEC with respect to the reference frame specified in the REF_FRAME_NAME keyword -- in this case B1950. If these keywords wouldn't be present in the setup file, the program would compute these values from data present in the PCK file 'pck00005.tpc' provided using the keyword PCK_FILE. The START_TIME and STOP_TIME keywords specifying the file coverage interval are required for the output SPK Type 17. The IGNORE_FIRST_LINE keyword is used to the header of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies three lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file (In this example the value for DATA_ORDER is wrapped due to document formatting; it must be on a single line in the actual setup file):

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 17
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH RP E INC NOD PER MEAN SKIP
       DPER/DT DMPN/DT DNOD/DT'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1979 MAR 05'
       STOP_TIME         = '1979 MAR 06'
       DATA_DELIMITER    = ' '
       LINES_PER_RECORD  = 3
       IGNORE_FIRST_LINE = 3
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc' )
       CENTER_POLE_RA    = 268.001
       CENTER_POLE_DEC   = 64.504
       SEGMENT_ID        = 'SPK_ELEMENTS_17'
       \begintext

Input data file:

       Test: 505 relative to 599 in frame B1950. GM= 126686536.75178
       JD, RP, ECC, INC, LNODE, ARGP, M0, T0, EQ_EL(7), EQ_EL(8), EQ_EL(9)
       ------------------------------------------------------------------
       1979 MAR 05 00:00:00
        181803.245 0.001067 25.415 357.216 114.445 78.346 -657287949.8
        2.912548790268837E-05 8.363793086428307E-03 -2.898889191844143E-05

Top

### Input Data Type EQ_ELEMENTS / Output SPK Type 17

The CENTER_POLE_RA and CENTER_POLE_DEC keywords contain Jupiter's pole RA and DEC with respect to the reference frame specified in the REF_FRAME_NAME keyword -- in this case B1950. If these keywords wouldn't be present in the setup file, the program would compute these values from data present in the PCK file 'pck00005.tpc' that will have to be provided using the keyword PCK_FILE. The START_TIME and STOP_TIME keywords specifying the file coverage interval are required for the output SPK Type 17. The IGNORE_FIRST_LINE keyword is used to skip the header (six lines) of the input file and the LINES_PER_RECORD keyword is used to specify that each record of the input file occupies ten lines, which the program must know because the input data delimiter ' ' is one that can be used in a SPICE time string.

Setup file (In this example the value of DATA_ORDER is wrapped due to document formatting; it must be on a single line in actual setup file):

       \begindata
       INPUT_DATA_TYPE   = 'EQ_ELEMENTS'
       OUTPUT_SPK_TYPE   = 17
       OBJECT_ID         = 505
       OBJECT_NAME       = 'AMALTHEA'
       CENTER_ID         = 599
       CENTER_NAME       = 'JUPITER'
       REF_FRAME_NAME    = 'B1950'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'EPOCH EQ_A EQ_H EQ_K EQ_ML EQ_P
       EQ_Q DPER/DT DMPN/DT DNOD/DT'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1979 MAR 05'
       STOP_TIME         = '1979 MAR 06'
       DATA_DELIMITER    = ','
       IGNORE_FIRST_LINE = 6
       LINES_PER_RECORD  = 10
       LEAPSECONDS_FILE  = 'naif0007.tls'
       TIME_WRAPPER      = '# JD'
       CENTER_POLE_RA    = 268.001
       CENTER_POLE_DEC   = 64.504
       SEGMENT_ID        = 'SPK_EQ_ELEMENTS_17'
       \begintext

Input data file:

         LABEL = 'Astrometric and Voyager data solution - JUP101',
         RCKEQX        =   2.433282500000000E+06,
         RCKNAM(01)    = 'AMALTH',
         RCKNUM(01)    = 505,
         RCKCTR(01)    = 'JUPITE',
         RCKTYP(01)    = 'EQUIN ',
           2443937.5,
           1.813655610000000E+05,
           1.713267736805066E-03,
           2.975197760058551E-03,
           1.920818611670669E+02,
          -2.939839894519083E-03,
          -7.170730998150093E-04,
           2.912548790268837E-05,
           8.363793086428307E-03,
          -2.898889191844143E-05,

Top

### Input Data Type TL_ELEMENTS / Output SPK Type 10

The TLE_INPUT_OBJ_ID keyword contains the TLE spacecraft ID for the Hubble Space Telescope (HST); this ID is used to locate data in the input two-line elements file. The TLE_SPK_OBJ_ID keyword contains the NAIF ID for HST; this ID is used in the output SPK file. The CENTER_ID and REF_FRAME_NAME contain required values of 399 and 'J2000' correspondingly. The PCK_FILE keyword contains the name of an Earth geophysical constants PCK file; a copy of such file is usually provided with the SPICE toolkit under the ``/data'' directory. The TLE_START_PAD and TLE_STOP_PAD keywords specify that the output SPK coverage should start two days before the time of the first input TLE set and should extend two days past the time of the last TLE set. Note that no keywords describing input data format are present in the setup file. These keywords are not needed for 'TL_ELEMENTS'/SPK 10 program runs because two-line elements files have fixed format and are processed by the program as a special case.

Setup file:

       \begindata
       INPUT_DATA_TYPE   = 'TL_ELEMENTS'
       OUTPUT_SPK_TYPE   = 10
       TLE_INPUT_OBJ_ID  = 20580
       TLE_SPK_OBJ_ID    = -48
       CENTER_ID         = 399
       REF_FRAME_NAME    = 'J2000'
       TLE_START_PAD     = '2 days'
       TLE_STOP_PAD      = '2 days'
       LEAPSECONDS_FILE  = 'naif0010.tls'
       INPUT_DATA_FILE   = 'hst.tle'
       OUTPUT_SPK_FILE   = 'hst.bsp'
       PCK_FILE          = 'geophysical.ker'
       SEGMENT_ID        = 'HST TLE-based Trajectory'
       PRODUCER_ID       = 'Boris Semenov, NAIF/JPL'
       \begintext

Input data file (the first two characters on each line of the sample two-line elements record -- '1 ' for the lines '20580U ...' and '2 ' for the line '20580 ...' -- were taken out to fit the sample records into the page width):

       HST
       20580U 90037B   11314.94749233  .00003090  00000-0  21896-3 0  8850
       20580 028.4690 137.5655 0003283 242.5328 117.5009 15.01775268981733
       20580U 90037B   11315.94434408  .00003238  00000-0  23007-3 0  8867
       20580 028.4688 131.0487 0003214 253.7100 106.3240 15.01782439981885
       20580U 90037B   11317.87157937  .00003609  00000-0  25771-3 0  8873
       20580 028.4683 118.4462 0003166 275.3438 084.7068 15.01797410982177
       20580U 90037B   11320.79562259  .00003707  00000-0  26491-3 0  8885
       20580 028.4689 099.3382 0003154 305.4602 054.5787 15.01818525982619
       20580U 90037B   11321.79244620  .00003773  00000-0  26982-3 0  8894
       20580 028.4692 092.8211 0003105 314.0907 045.9515 15.01826226982768
       20580U 90037B   11322.78926485  .00003833  00000-0  27427-3 0  8904
       20580 028.4692 086.3040 0003046 325.5674 034.4772 15.01833969982915
       20580U 90037B   11324.71643569  .00003868  00000-0  27677-3 0  8914
       20580 028.4696 073.7054 0003038 348.1091 011.9461 15.01848383983203
       20580U 90037B   11326.31132196  .00003790  00000-0  27084-3 0  8928
       20580 028.4700 063.2810 0003036 006.5468 353.5081 15.01859302983446
       20580U 90037B   11328.63717918  .00003484  00000-0  24790-3 0  8938
       20580 028.4709 048.0757 0003427 034.0326 326.0183 15.01873175983799
       20580U 90037B   11330.29849794  .00003476  00000-0  24722-3 0  8948
       20580 028.4707 037.2200 0003253 052.9678 307.1201 15.01883931984047
       20580U 90037B   11331.29528001  .00003398  00000-0  24132-3 0  8953
       20580 028.4706 030.7027 0003373 062.5805 297.5054 15.01889630984199

Top

### Skipping Input Data Record Tokens

The next example demonstrates how ``SKIP'' can be used in the definition of the input record contents specified using the DATA_ORDER keyword. In this example ``SKIP'' is used to ignore zero-length tokens present in the input data records. The IGNORE_FIRST_LINE keyword is used to skip one line of the header information.

Setup file:

       \begindata
       INPUT_DATA_FILE   = 'good_inputs/states:commas'
       OUTPUT_SPK_FILE   = 'good_outputs/states_commas.bsp'
       INPUT_DATA_TYPE   = 'STATES'
       OUTPUT_SPK_TYPE   = 5
       OBJECT_ID         = -557
       OBJECT_NAME       = 'GRANAT'
       CENTER_ID         = 399
       CENTER_NAME       = 'EARTH'
       REF_FRAME_NAME    = 'J2000'
       PRODUCER_ID       = 'B.V. Semenov'
       DATA_ORDER        = 'X Y Z VX VY VZ SKIP SKIP EPOCH SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       DATA_DELIMITER    = ','
       LINES_PER_RECORD  = 2
       IGNORE_FIRST_LINE = 1
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc')
       SEGMENT_ID        = 'TEST'
       \begintext

Input data file:

       X,Y,Z,VX,VY,VZ,,,Epoch,,
       -79376.312,94802.228,152149.381,-.537457,.057167,.299857,
       ,,1990-01-01 00:00:00.000,,
       -111902.474,71404.027,136526.217,.031594,-.434385,-.559425,
       ,,1990-01-02 09:02:02.774,,
       -70048.213,14411.561,47294.006,1.324262,-.933652,-1.728348,
       ,,1990-01-03 09:23:15.101,,
       ...

Top

### Two Epochs in the Input Data Records

The next example demonstrates use of the EPOCH_STR_LENGTH keyword in cases where two epoch strings -- epoch, and epoch of periapsis -- provided in input records have to be used to compute data for the output SPK file. The IGNORE_FIRST_LINE keyword is used to skip one line of the header information.

Setup file (in this example the value of DATA_ORDER is wrapped due to document formatting; it must be on a single line in the actual setup file):

       \begindata
       INPUT_DATA_TYPE   = 'ELEMENTS'
       OUTPUT_SPK_TYPE   = 5
       OBJECT_ID         = -557
       OBJECT_NAME       = 'GRANAT'
       CENTER_ID         = 399
       CENTER_NAME       = 'EARTH'
       REF_FRAME_NAME    = 'J2000'
       PRODUCER_ID       = 'N.G.Khavenson, IKI RAS, Russia'
       DATA_ORDER        = 'SKIP EPOCH E RP INC NOD PER EPOCHP
       SKIP SKIP SKIP SKIP SKIP SKIP'
       INPUT_DATA_UNITS  = ('ANGLES=DEGREES' 'DISTANCES=km')
       START_TIME        = '1998 JAN 01'
       STOP_TIME         = '1999 JAN 01'
       DATA_DELIMITER    = ','
       TIME_WRAPPER      = '# TDB'
       EPOCH_STR_LENGTH  = 30
       IGNORE_FIRST_LINE = 1
       LEAPSECONDS_FILE  = 'naif0007.tls'
       PCK_FILE          = ('pck00005.tpc' 'Gravity.tpc')
       SEGMENT_ID        = 'TEST'
       \begintext

Input data file:

       JDTDB, T, e, q, i, LAN, APF, ToP, n, MA, TA, a, AD, PER
       2450819.000000000, A.D. 1998-Jan-05 12:00:00.0000,
       0.9998547684834859E+00, 0.3450736825384300E+08,
       0.1249344272957001E+03, 0.1880167631634887E+03,
       0.1301649235108716E+03,A.D. 1998-JUL-05 12:00:00.0000,
       0.1802195911346396E-09, 0.9563896596356295E-02,
       0.1601180118692756E+03, 0.2376024783190921E+12,
       0.4751704492699304E+12, 0.1997563071436828E+13,