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

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_KDATA returns data for the nth kernel among a list
   of specified kernel types.

   For important details concerning this module's function, please refer to
   the CSPICE routine kdata_c.

I/O


   Given:

      which   the scalar integer index of the kernel to fetch (matching the
              type specified by kind) from the list of kernels loaded using
              cspice_furnsh but not unloaded using cspice_unload or cleared
              by cspice_kclear.

              The range of 'which' is 0 to 'count', where 'count' is
              the number of kernels loaded via cspice_furnsh. Retrieve
              this value from a cspice_ktotal call.  See the
              Examples section for an illustrative code fragment.

      kind    a scalar string list of types of kernels to consider when
              fetching kernels from the list of loaded kernels. 'kind'
              should consist of a list of words of kernels to
              examine.  Recognized types are

              'kind' should consist of a list of words of kernels to
              examine. Recognized types are

                 'SPK'  --- All SPK files are counted in the total.
                 'CK'   --- All CK files are counted in the total.
                 'PCK'  --- All binary PCK files are counted in the
                            total.
                 'DSK'  --- All DSK files are counted in the total.
                 'EK'   --- All EK files are counted in the total.
                 'TEXT' --- All text kernels that are not meta-text
                            kernels are included in the total.
                 'META' --- All meta-text kernels are counted in the
                            total.
                 'ALL'  --- Every type of kernel is counted in the
                            total.

              'kind' lacks case sensitivity. The cspice_kdata algorithm
              ignores words in 'kind' if not one of those listed above.

              See the routine cspice_ktotal for example use 'kind'.

   the call:

      cspice_kdata, which, kind, file, filtyp, source, handle, found

   returns:

      file     the scalar string name of the file having index 'which' in the
               sequence of files of type 'kind' currently loaded via
               cspice_furnsh. 'file' returns empty if no loaded kernels
               match the specification of 'which' and 'kind'.

      filtyp   the scalar string name of the type of kernel specified
               by 'file'. 'filtyp' will be empty if no loaded kernels
               match the specification of 'which' and 'kind'.

      source   the scalar string name of the source file used to
               specify file as one to load. If file was loaded
               directly via a call to cspice_furnsh, 'source' will be empty.
               If there is no file matching the specification of
               which and kind, 'source' will be empty.

      handle   the scalar integer handle attached to file if it is a binary
               kernel.  If file is a text kernel or meta-text kernel
               handle will be zero.  If there is no file matching
               the specification of 'which' and 'kind', 'handle' will be
               set to zero.

      found    a scalar boolean indicating if a file matching the
               specification of 'which' and 'kind' exists. If there no such
               file exists, 'found' returns false (if 'found' returns as
               false, all return strings are empty, not null).

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.

      Use the meta-kernel shown below to load the required SPICE
      kernels.

         KPL/MK

         File name: standard.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name                     Contents
            ---------                     --------
            de421.bsp                     Planetary ephemeris
            pck00009.tpc                  Planet orientation and
                                          radii
            naif0009.tls                  Leapseconds

         \begindata

            KERNELS_TO_LOAD = ( 'de421.bsp',
                                'pck00009.tpc',
                                'naif0009.tls'  )

         \begintext

   Example:

      ;;
      ;; Load several kernel files.
      ;;
      cspice_furnsh, 'standard.tm'

      ;;
      ;; Count the number of loaded kernel files.
      ;;
      cspice_ktotal, 'ALL', count

      ;;
      ;; Loop over the count, outputting file information as we loop.
      ;; The loop tells us all files loaded via cspice_furnsh, their
      ;; type, and how they were loaded.
      ;;
      for i = 0, (count)  do begin

         cspice_kdata, i, 'ALL', file, type, source, handle, found

         if ( found ) then begin
            print, 'Index : ' + string(i)
            print, 'File  : ' + file
            print, 'Type  : ' + type
            print, 'Source: ' + source
            print, 'Handle: ' + string(handle)
            print
         endif else begin
            print, 'No kernel found with index: ' + string(i)
         endelse

      endfor

      ;;
      ;; It's always good form to unload kernels after use,
      ;; particularly in IDL due to data persistence.
      ;;
      cspice_kclear

   IDL outputs:

      Index :        0
      File  : standard.tm
      Type  : META
      Source:
      Handle:            0

      Index :        1
      File  : de421.bsp
      Type  : SPK
      Source: standard.tm
      Handle:            1

      Index :        2
      File  : pck00009.tpc
      Type  : TEXT
      Source: standard.tm
      Handle:            0

      Index :        3
      File  : naif0009.tls
      Type  : TEXT
      Source: standard.tm
      Handle:            0

      No kernel found with index:        4

   The output informs us that cspice_furnsh loaded a single meta kernel
   file 'standard.tm', the meta kernel listing 3 additional kernel files.

Particulars


   None.

Required Reading


   ICY.REQ
   DSK.REQ
   KERNEL.REQ

Version


   -Icy Version 2.0.0, 02-NOV-2016, EDW (JPL), NJB (JPL)

      Updated to support use of DSKs.

   -Icy Version 1.0.2, 05-NOV-2012, EDW (JPL)

      Edits to Example section, proper description of "standard.tm"
      meta kernel.

      I/O descriptions edits to parallel Mice version.

   -Icy Version 1.0.1, 04-DEC-2006, EDW (JPL)

       Added the unload "good form" comment to the example code.

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

Index_Entries


   Retrieve information on loaded SPICE kernels




Wed Apr  5 17:58:02 2017