Table of contents
CSPICE_CKOBJ finds the set of ID codes of all objects in a specified CK
file.
Given:
ckfnm the scalar string name of an C-kernel.
help, ckfnm
STRING = Scalar
ids an initialized SPICE set data structure.
help, ids
STRUCT = cspice_celli(N)
`ids' optionally may contain a set of CK ID codes on input; on
output, the data already present in `ids' will be combined with
CK ID code set found for the file `ckfnm'.
If `ids' contains no data on input, its size and
cardinality still must be initialized.
the call:
cspice_ckobj, ckfnm, ids
returns:
ids a SPICE set data structure which contains the union of its
contents upon input with the set of ID codes of each object for
which pointing data are present in the indicated CK file.
help, ids
STRUCT = cspice_celli(N)
The elements of SPICE sets are unique; hence each ID code in
`ids' appears only once, even if the CK file contains multiple
segments for that ID code.
See the -Examples section below for a complete example
program showing how to retrieve the ID codes from `ids'.
The user must create `ids' using cspice_celld. (Note:
a set is a type of cell).
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) Display the interval-level coverage for each object in a
specified CK file. Use tolerance of zero ticks. Do not
request angular velocity. Express the results in the TDB time
system.
Find the set of objects in the file. Loop over the contents
of the ID code set: find the coverage for each item in the
set and display the coverage.
Example code begins here.
PRO ckobj_ex1
;;
;; From a given CK file, retrieve the list of objects listed
;; in the file then retrieve the time coverage for each object.
;;
;; Local parameters...
;;
SPICEFALSE = 0B
MAXIV = 1000
WINSIZ = 2 * MAXIV
TIMLEN = 51
MAXOBJ = 1000
;;
;; Local variables
;;
cover = cspice_celld( WINSIZ )
ids = cspice_celli( MAXOBJ )
ckfnm = ''
lsk = ''
sclk = ''
;;
;; Load a leapseconds kernel and SCLK kernel for output time
;; conversion. Note that we assume a single spacecraft clock is
;; associated with all of the objects in the CK.
;;
read, lsk, PROMPT='Name of leapseconds kernel > '
cspice_furnsh, lsk
read, sclk, PROMPT='Name of SCLK kernel > '
cspice_furnsh, sclk
;;
;; Get name of CK file.
;;
read, ckfnm, PROMPT='Name of CK file > '
;;
;; Find the set of objects in the CK file.
;;
cspice_ckobj, ckfnm, ids
;;
;; We want to display the coverage for each object. Loop over
;; the contents of the ID code set, find the coverage for
;; each item in the set, and display the coverage.
;;
for i=0, cspice_card( ids ) - 1 do begin
;;
;; Find the coverage window for the current object, `i'.
;; Empty the coverage window each time
;; so we don't include data for the previous object.
;;
obj = ids.base[ ids.data + i ]
cspice_scard, 0L, cover
cspice_ckcov, CK, obj, SPICEFALSE, 'INTERVAL', 0.D, $
'TDB', cover
;;
;; Get the number of intervals in the coverage window.
;;
niv = cspice_wncard( cover )
;;
;; Display a simple banner.
;;
print, '========================================'
print, 'Coverage for object:', obj
;;
;; Convert the coverage interval start and stop times to TDB
;; calendar strings.
;;
for j=0, niv-1 do begin
;;
;; Get the endpoints of the jth interval.
;;
cspice_wnfetd, cover, j, b, e
;;
;; Convert the endpoints to TDB calendar
;; format time strings and display them.
;; Pass the endpoints in an array, [b,e],
;; so cspice_timout returns an array of time
;; strings.
;;
cspice_timout, [b,e], $
'YYYY MON DD HR:MN:SC.### (TDB) ::TDB', $
TIMLEN ,$
timstr
print
print, 'Interval: ', j
print, 'Start : ', timstr[0]
print, 'Stop : ', timstr[1]
endfor
print, '========================================'
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, using the LSK file named naif0010.tls, the SCLK file
named cas00145.tsc and the CK file named 08052_08057ra.bc, the
output was:
Name of leapseconds kernel > naif0010.tls
Name of SCLK kernel > cas00145.tsc
Name of CK file > 08052_08057ra.bc
========================================
Coverage for object: -82000
Interval: 0
Start : 2008 FEB 21 00:01:07.771 (TDB)
Stop : 2008 FEB 23 22:53:30.001 (TDB)
Interval: 1
Start : 2008 FEB 23 22:58:13.999 (TDB)
Stop : 2008 FEB 24 02:22:25.913 (TDB)
Interval: 2
Start : 2008 FEB 24 02:27:49.910 (TDB)
Stop : 2008 FEB 24 19:46:33.470 (TDB)
Interval: 3
Start : 2008 FEB 24 19:49:33.469 (TDB)
Stop : 2008 FEB 25 04:25:21.250 (TDB)
Interval: 4
Start : 2008 FEB 25 04:29:33.248 (TDB)
Stop : 2008 FEB 25 15:23:44.971 (TDB)
Interval: 5
Start : 2008 FEB 25 15:24:12.971 (TDB)
Stop : 2008 FEB 25 20:25:04.843 (TDB)
Interval: 6
Start : 2008 FEB 25 20:25:48.843 (TDB)
Stop : 2008 FEB 26 00:01:04.752 (TDB)
========================================
This routine provides an API via which applications can determine
the set of objects for which there are pointing data in a
specified CK file.
1) If the input file has transfer format, the error
SPICE(INVALIDFORMAT) is signaled by a routine in the call tree
of this routine.
2) If the input file is not a transfer file but has architecture
other than DAF, the error SPICE(INVALIDARCHTYPE) is signaled
by a routine in the call tree of this routine.
3) If the input file is a binary DAF file of type other than CK,
the error SPICE(INVALIDFILETYPE) is signaled by a routine in
the call tree of this routine.
4) If the CK file cannot be opened or read, an error is signaled
by a routine in the call tree of this routine.
5) If the size of the output set argument `ids' is insufficient to
contain the actual number of ID codes of objects covered by
the indicated CK file, an error is signaled by a routine in
the call tree of this routine.
6) If any of the input arguments, `ckfnm' or `ids', is undefined,
an error is signaled by the IDL error handling system.
7) If any of the input arguments, `ckfnm' or `ids', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
This routine reads a C-kernel.
1) If an error occurs while this routine is updating the set
`ids', the set may be corrupted.
CELLS.REQ
CK.REQ
DAF.REQ
ICY.REQ
NAIF_IDS.REQ
SETS.REQ
None.
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 24-AUG-2021 (JDR)
Changed in the input argument name "ck" to "ckfnm" for consistency
with other routines.
Edited the header to comply with NAIF standard. Modified
code example to prompt for the required kernels.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
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.3, 04-APR-2012 (EDW)
Explicitly described ID variables as "CK IDs."
-Icy Version 1.0.2, 30-NOV-2007 (NJB) (EDW)
Corrected bug in the -Examples section program:
program now empties the coverage window prior to collecting
data for the current object. Updated example to
use cspice_wncard rather than cspice_card.
-Icy Version 1.0.1, 27-FEB-2007 (EDW)
Replaced cspice_unload call in example section with
cspice_kclear.
-Icy Version 1.0.0, 30-DEC-2004 (EDW)
find id codes of objects in CK file
|