Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_spkw12

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_SPKW12 writes a type 12 SPK segment to an SPK file.

I/O


   Given:

      handle   a scalar integer referring to an SPK file opened with write
               access.

               help, handle
                  LONG = Scalar

      body     a scalar integer NAIF ID identifying the body trajectory to
               record in the SPK file.

               help, body
                  LONG = Scalar

      center   the scalar integer NAIF ID for the center of motion associated
               with body.

               help, center
                  LONG = Scalar

      frame    a string variable holding the reference frame name used to
               reference the states, e.g. "J2000".

               help, frame
                  STRING = Scalar

      first    the scalar double precision starting epoch, in TDB seconds past
               J2000, of the ephemeris data.

               help, first
                  DOUBLE = Scalar

      last     the double precision ending epoch, in TDB seconds past J2000, of
               the ephemeris data.

               help, last
                  DOUBLE = Scalar

      segid    a string variable holding to the segment identifier (an SPK
               segment identifier may contain up to 40 printing ASCII
               characters).

               help, segid
                  STRING = Scalar

      degree   the scalar integer value for the degree of the Hermite
               polynomial that interpolates the states.

               help, degree
                  LONG = Scalar

      n        the number of states in the input state vector array.

               help, n
                  LONG = Scalar

      states   an array of 6xN double precision values containing a
               time-ordered array of geometric states ( x, y, z, dx/dt, dy/dt,
               dz/dt, in kilometers and kilometers per second) of the `body'
               with respect to `center'.

               help, states
                  DOUBLE = Array[6,n]

      begtim   the double precision scalar value of the epoch corresponding to
               the first state in the state array; `begtim' normally precedes
               `first'.

               help, begtim
                  DOUBLE = Scalar

      step     the double precision scalar time step (or interval) in seconds
               separating the epochs of adjacent states in `states'.

               help, step
                  DOUBLE = Scalar

   the call:

      cspice_spkw12, handle, body,   center, frame,  first,  last,           $
                     segid,  degree, n,      states, begtim, step

   writes to the SPK file referred to by `handle' a type 12 SPK segment
   containing the data listed in `states'.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) This example demonstrates how to create an SPK type 12 kernel
      containing only one segment, given an evenly-spaced time-ordered
      set of discrete states.

      Example code begins here.


      PRO spkw12_ex1

         ;;
         ;; Define the segment identifier parameters.
         ;;
         BODY       = 3
         CENTER     = 10
         REF        = 'J2000'
         SPK12      = 'spkw12_ex1.bsp'
         N_DISCRETE = 9
         POLY_DEG   = 3

         ;;
         ;; A set of epochs.
         ;;
         DISCRETEEPOCHS = [ 100.d, 200.d, 300.d, 400.d, 500.d, $
                          600.d, 700.d, 800.d, 900.d           $
                          ]

         ;;
         ;; An array of discrete states to write to the SPK segment.
         ;;
         DISCRETESTATES = [                                           $
                        [ 101.d, 201.d, 301.d, 401.d, 501.d, 601.d ], $
                        [ 102.d, 202.d, 302.d, 402.d, 502.d, 602.d ], $
                        [ 103.d, 203.d, 303.d, 403.d, 503.d, 603.d ], $
                        [ 104.d, 204.d, 304.d, 404.d, 504.d, 604.d ], $
                        [ 105.d, 205.d, 305.d, 405.d, 505.d, 605.d ], $
                        [ 106.d, 206.d, 306.d, 406.d, 506.d, 606.d ], $
                        [ 107.d, 207.d, 307.d, 407.d, 507.d, 607.d ], $
                        [ 108.d, 208.d, 308.d, 408.d, 508.d, 608.d ], $
                        [ 109.d, 209.d, 309.d, 409.d, 509.d, 609.d ]  $
                        ]


         ;;
         ;; Create a segment identifier.
         ;;
         segid = 'SPK type 12 test segment'

         ;;
         ;; Open a new SPK file.
         ;;
         cspice_spkopn, SPK12, 'Type 12 SPK internal file name.', 4, handle

         step = DISCRETEEPOCHS[1] - DISCRETEEPOCHS[0]

         ;;
         ;; Test the type 12 segment writer.
         ;;
         cspice_spkw12, handle,                       $
                        BODY,                         $
                        CENTER,                       $
                        REF,                          $
                        DISCRETEEPOCHS[0],            $
                        DISCRETEEPOCHS[N_DISCRETE-1], $
                        segid,                        $
                        POLY_DEG,                     $
                        N_DISCRETE,                   $
                        DISCRETESTATES,               $
                        DISCRETEEPOCHS[0],            $
                        step

         ;;
         ;; Close the SPK file.
         ;;
         cspice_spkcls, handle

      END


      When this program is executed, no output is presented on
      screen. After run completion, a new SPK type 12 exists in
      the output directory.

Particulars


   This routine writes an SPK type 12 data segment to the open SPK
   file according to the format described in the type 12 section of
   the SPK Required Reading. The SPK file must have been opened with
   write access.

Exceptions


   If any of the following exceptions occur, this routine will return
   without creating a new segment.

   1)  If `frame' is not a recognized name, the error
       SPICE(INVALIDREFFRAME) is signaled by a routine in the call
       tree of this routine.

   2)  If the last non-blank character of `segid' occurs past index 40,
       the error SPICE(SEGIDTOOLONG) is signaled by a routine in the
       call tree of this routine.

   3)  If `segid' contains any nonprintable characters, the error
       SPICE(NONPRINTABLECHARS) is signaled by a routine in the call
       tree of this routine.

   4)  If `degree' is not at least 1 or is greater than MAXDEG, the
       error SPICE(INVALIDDEGREE) is signaled by a routine in the
       call tree of this routine.

   5)  If `degree' is not odd, the error SPICE(INVALIDDEGREE) is
       signaled by a routine in the call tree of this routine.

   6)  If the number of states `n' is not at least (degree+1)/2, the
       error SPICE(TOOFEWSTATES) is signaled by a routine in the call
       tree of this routine.

   7)  If `first' is greater than `last', the error SPICE(BADDESCRTIMES)
       is signaled by a routine in the call tree of this routine.

   8)  If `step' is non-positive, the error SPICE(INVALIDSTEPSIZE) is
       signaled by a routine in the call tree of this routine.

   9)  If the first epoch `begtim' is greater than `first', the error
       SPICE(BADDESCRTIMES) is signaled by a routine in the call tree
       of this routine.

   10) If the start time of the first record exceeds the descriptor
       begin time by more than a computed tolerance, or if the end
       time of the last record precedes the descriptor end time by
       more than a computed tolerance, the error SPICE(COVERAGEGAP)
       is signaled by a routine in the call tree of this routine. See
       the -Parameters section for a description of the tolerance.

   11) If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `degree', `n', `states',
       `begtim' or `step', is undefined, an error is signaled by the
       IDL error handling system.

   12) If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `degree', `n', `states',
       `begtim' or `step', is not of the expected type, or it does
       not have the expected dimensions and size, an error is
       signaled by the Icy interface.

Files


   A new type 12 SPK segment is written to the SPK file attached
   to `handle'.

Restrictions


   None.

Required_Reading


   ICY.REQ
   SPK.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.0, 10-AUG-2021 (JDR)

       Changed the input argument name "epoch0" to "begtim" for
       consistency with other routines.

       Edited the -Examples section to comply with NAIF standard. Added
       example's problem statement.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   write SPK type_12 ephemeris data segment



Fri Dec 31 18:43:07 2021