Table of contents
CSPICE_SPKSFS searches through loaded SPK files to find the
highest-priority segment applicable to the body and time specified.
Given:
body the NAIF integer code of an ephemeris object, typically a solar
system body.
help, body
LONG = Scalar
et a time, in seconds past the epoch J2000 TDB.
help, et
DOUBLE = Scalar
the call:
cspice_spksfs, body, et, handle, descr, ident, found
returns:
handle the handle of the SPK file containing a located segment.
help, handle
LONG = Scalar
descr the descriptor of a located segment.
help, descr
DOUBLE = Array[5]
ident the identifier of a located segment.
help, ident
STRING = Scalar
found a logical flag indicating whether a requested segment was found
or not.
help, found
BOOLEAN = Scalar
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) Find a segment for the Pluto barycenter, with coverage for
a specified epoch, in a JPL planetary SPK file, and display
the segment's information.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: spksfs_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
naif0010.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'naif0010.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO spksfs_ex1
;;
;; Local constants
;;
META = 'spksfs_ex1.tm'
ND = 2
NI = 6
;;
;; Load a meta-kernel that specifies a planetary SPK file
;; and leapseconds kernel. The contents of this meta-kernel
;; are displayed above.
;;
cspice_furnsh, META
;;
;; Get the NAIF ID code for the Pluto system barycenter.
;; This is a built-in ID code, so something's seriously
;; wrong if we can't find the code.
;;
cspice_bodn2c, 'PLUTO BARYCENTER', idcode, found
if ( ~found ) then begin
cspice_kclear
print, 'SPICE(BUG)'
return
endif
;;
;; Pick a request time; convert to seconds past J2000 TDB.
;;
reqtim = '2011 FEB 18 UTC'
cspice_str2et, reqtim, et
;;
;; Find a loaded segment for the specified body and time.
;;
cspice_spksfs, idcode, et, handle, descr, segid, found
if ( ~found ) then begin
cspice_kclear
print, 'Body : ', idcode
print, 'Time : ', et
print, 'No descriptor found for the body at time.'
return
endif else begin
;;
;; Display the DAF file handle.
;;
print, format='(A, I10)', 'DAF handle: ', handle
;;
;; Display the segment ID.
;;
;;
;; Unpack the descriptor. Display the contents.
;;
cspice_dafus, descr, ND, NI, dc, ic
print, format='(A, A)', 'Segment ID: ',segid
print, format='(A, I10)', 'Body ID code: ',ic[0]
print, format='(A, I10)', 'Center ID code: ',ic[1]
print, format='(A, I10)', 'Frame ID code: ',ic[2]
print, format='(A, I10)', 'SPK data type: ',ic[3]
print, format='(A, e24.17)', 'Start time (TDB): ',dc[0]
print, format='(A, e24.17)', 'Stop time (TDB): ',dc[1]
print
endelse
;;
;; 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:
DAF handle: 1
Segment ID: DE-0421LE-0421
Body ID code: 9
Center ID code: 0
Frame ID code: 1
SPK data type: 2
Start time (TDB): -3.16919520000000000e+09
Stop time (TDB): 1.69685280000000000e+09
This routine finds the highest-priority segment, in any loaded
SPK file, such that the segment provides data for the specified
body and epoch.
1) If an attempt is made to call cspice_spksfs when there aren't any
files loaded, the error SPICE(NOLOADEDFILES) is signaled by a
routine in the call tree of this routine.
2) If any of the input arguments, `body' or `et', is undefined,
an error is signaled by the IDL error handling system.
3) If any of the input arguments, `body' or `et', 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, `handle', `descr', `ident' or
`found', is not a named variable, an error is signaled by the
Icy interface.
All files loaded by cspice_spklef are potential search targets for
cspice_spksfs.
1) If Fortran i/o errors occur while searching a loaded SPK
file, the internal state of this suite of routines may
be corrupted. It may be possible to correct the state
by unloading the pertinent SPK files and then re-loading
them.
ICY.REQ
SPK.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.1, 09-AUG-2021 (JDR)
Edited header to comply with NAIF standard.
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.0, 24-OCT-2012 (EDW)
select SPK file and segment
|