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_spkw05

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


Abstract


   CSPICE_SPKW05 writes an SPK segment of type 5 given a time-ordered
   set of discrete states and epochs, and the gravitational parameter
   of a central body.

I/O


   Given:

      handle   the file handle of an SPK file opened for writing.

               help, handle
                  LONG = Scalar

      body     the NAIF ID for the body whose states are to be recorded in an
               SPK file.

               help, body
                  LONG = Scalar

      center   the NAIF ID for the center of motion associated with `body'.

               help, center
                  LONG = Scalar

      frame    the reference frame that states are referenced to, for example
               'J2000'.

               help, frame
                  STRING = Scalar

      first,
      last     the bounds on the ephemeris times, expressed as seconds past
               J2000, for which the states can be used to interpolate a state
               for `body'.

               help, first
                  DOUBLE = Scalar
               help, last
                  DOUBLE = Scalar

      segid    the segment identifier.

               help, segid
                  STRING = Scalar

               An SPK segment identifier may contain up to 40 characters.

      gm       the gravitational parameter of the central body ( in units of
               kilometers **3 / seconds **2 ).

               help, gm
                  DOUBLE = Scalar

      n        the number of states and epochs to be stored in the segment.

               help, n
                  LONG = Scalar

      states   contains a time-ordered array of geometric states ( x, y, z,
               dx/dt, dy/dt, dz/dt, in kilometers and kilometers per second )
               of the target body with respect to the central body specified in
               the segment descriptor.

               help, states
                  DOUBLE = Array[6,n]

      epochs   contains the epochs (ephemeris seconds past J2000) corresponding
               to the states in `states'.

               help, epochs
                  DOUBLE = Array[n]

               Epochs must form a strictly increasing sequence.

   the call:

      cspice_spkw05, handle, body,   center, frame,  first,  last, $
                     segid,  gm,     n,      states, epochs

   writes to the SPK file referred to by `handle' a type 5 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 5 kernel
      containing only one segment, given a time-ordered set of
      discrete states and epochs, and the gravitational parameter
      of a central body.


      Example code begins here.


      PRO spkw05_ex1

         ;;
         ;; Define the segment identifier parameters.
         ;;
         BODY       = 3
         CENTER     = 10
         REF        = 'J2000'
         GM_SUN     = 132712440023.310d
         N_DISCRETE = 9
         SPK5       = 'spkw05_ex1.bsp'

         segid      = 'SPK type 5 test segment'

         ;;
         ;; 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 ]  $
                          ]

         ;;
         ;; Open a new SPK file.
         ;;
         cspice_spkopn, SPK5, 'Type 5 SPK internal file name.', 4, handle

         ;;
         ;; Create a type 5 segment.
         ;;
         cspice_spkw05, handle,                         $
                        BODY,                           $
                        CENTER,                         $
                        REF,                            $
                        DISCRETEEPOCHS[0],              $
                        DISCRETEEPOCHS[N_DISCRETE-1],   $
                        segid,                          $
                        GM_SUN,                         $
                        N_DISCRETE,                     $
                        DISCRETESTATES,                 $
                        DISCRETEEPOCHS

         ;;
         ;; 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 5 exists in
      the output directory.

Particulars


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

Exceptions


   1)  If `gm' is not positive, the error SPICE(NONPOSITIVEMASS)
       is signaled by a routine in the call tree of this routine.

   2)  If the input epochs do not form an increasing sequence, the
       error SPICE(UNORDEREDTIMES) is signaled by a routine in the
       call tree of this routine.

   3)  If the number of states and epochs is not positive, the error
       SPICE(NUMSTATESNOTPOS) is signaled by a routine in the call
       tree of this routine.

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

   5)  If `segid' is more than 40 characters long, the error
       SPICE(SEGIDTOOLONG) is signaled by a routine in the call tree
       of this routine.

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

   7)  If a file i/o problem occurs, an error is signaled by a
       routine in the call tree of this routine.

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

   9)  If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `gm', `n', `states' or
       `epochs', 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 05 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.0.1, 01-JUN-2021 (JDR)

       Edited the header 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_5 ephemeris data segment



Fri Dec 31 18:43:07 2021