Table of contents
CSPICE_KDATA returns data for the nth kernel that is among a list of
specified kernel types.
Given:
which the number of the kernel to fetch (matching the type
specified by `kind') from the list of kernels that have been
loaded through the routine cspice_furnsh but that have not
been unloaded through the routine cspice_unload.
help, which
LONG = Scalar
The range of `which' is 0 to count-1, where `count' is the
number of kernels loaded via cspice_furnsh of type `kind'. This
count may be obtained by calling cspice_ktotal. See the
-Examples section for an illustrative example.
kind a list of types of kernels to be considered when fetching
kernels from the list of loaded kernels.
help, kind
STRING = Scalar
`kind' should consist of words from list of kernel types
given below.
SPK --- All SPK files are counted in the total.
CK --- All CK files are counted in the total.
DSK --- All DSK files are counted in the total.
PCK --- All binary PCK 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' is case insensitive. If a word appears in `kind'
that is not one of those listed above, it is ignored.
When `kind' consists of multiple words, the words must
be separated by blanks. Examples of valid lists are the
strings
'SPK CK TEXT'
'SPK CK text'
'PCK DSK'
'CK'
'ALL'
See the routine cspice_ktotal for examples of the use of
`kind'.
the call:
cspice_kdata, which, kind, file, filtyp, srcfil, handle, found
returns:
file the name of the file having index `which' in the sequence of
files of type `kind' that is currently loaded via
cspice_furnsh.
help, file
STRING = Scalar
`file' will be empty if there is not such kernel loaded.
filtyp the type of the kernel specified by `file'.
help, filtyp
STRING = Scalar
`file' will be empty if there is no file matching the
specification of `which' and `kind'.
srcfil the name of the source file that was used to specify `file'
as one to load.
help, srcfil
STRING = Scalar
If `file' was loaded directly via a call to cspice_furnsh,
`srcfil' will be empty. If there is no file matching the
specification of `which' and `kind', `srcfil' will be empty.
handle the handle attached to `file' if it is a binary kernel.
help, handle
LONG = Scalar
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 returned True if a `file' matching the specification of
`which' and `kind' exists.
help, found
BOOLEAN = Scalar
If there is no such file, `found' will be set to False.
None.
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) Load a meta-kernel with a PCK, an LSK and an SPK and loop over
the loaded kernels, outputting file information for each of
them.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: kdata_ex1.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
End of meta-kernel
Example code begins here.
PRO kdata_ex1
;;
;; Load several kernel files.
;;
cspice_furnsh, 'kdata_ex1.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, srcfil, handle, found
if ( found ) then begin
print, 'Index : ' + string(i)
print, 'File : ' + file
print, 'Type : ' + type
print, 'Source: ' + srcfil
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
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Index : 0
File : kdata_ex1.tm
Type : META
Source:
Handle: 0
Index : 1
File : de421.bsp
Type : SPK
Source: kdata_ex1.tm
Handle: 1
Index : 2
File : pck00009.tpc
Type : TEXT
Source: kdata_ex1.tm
Handle: 0
Index : 3
File : naif0009.tls
Type : TEXT
Source: kdata_ex1.tm
Handle: 0
No kernel found with index: 4
This routine allows you to determine which kernels have been
loaded via cspice_furnsh and to obtain information sufficient to directly
query those files.
1) If a file is not loaded matching the specification of `which' and
`kind', `found' will be False, `file', `filtyp', and `srcfil' will be
empty and `handle' will be set to zero.
2) If any of the input arguments, `which' or `kind', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `which' or `kind', is not of
the expected type, or it does not have the expected dimensions
and size, an error is signaled by the Icy interface.
4) If any of the output arguments, `file', `filtyp', `srcfil',
`handle' or `found', is not a named variable, an error is
signaled by the Icy interface.
None.
None.
ICY.REQ
KERNEL.REQ
None.
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 2.1.0, 10-AUG-2021 (JDR) (NJB)
Changed the output argument name "source" to "srcfil" for
consistency with other routines.
Edited the header to comply with NAIF standard. Added example's
problem statement and removed note providing the same information
(after the problem's solution).
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 and dsk.req from the list of required readings.
Added arguments' type and size information in the -I/O section.
Updated -I/O description of input arguments "kind", to illustrate
use of multi-word lists, and "which", to describe its range.
-Icy Version 2.0.0, 02-NOV-2016 (EDW) (NJB)
Updated to support use of DSKs.
-Icy Version 1.0.2, 05-NOV-2012 (EDW)
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)
Added the unload "good form" comment to the example code.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
Retrieve information on loaded SPICE kernels
|