kdata |
Table of contents
ProcedureKDATA ( Kernel Data ) ENTRY KDATA ( WHICH, KIND, FILE, FILTYP, SRCFIL, HANDLE, FOUND ) AbstractReturn data for the nth kernel that is among a list of specified kernel types. Required_ReadingKERNEL KeywordsKERNEL DeclarationsINTEGER WHICH CHARACTER*(*) KIND CHARACTER*(*) FILE CHARACTER*(*) FILTYP CHARACTER*(*) SRCFIL INTEGER HANDLE LOGICAL FOUND Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- WHICH I Index of kernel to fetch from the list of kernels. KIND I The kind of kernel to which fetches are limited. FILE O The name of the kernel file. FILTYP O The type of the kernel. SRCFIL O Name of the source file used to load FILE. HANDLE O The handle attached to FILE. FOUND O .TRUE. if the specified file could be located. Detailed_InputWHICH is 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 FURNSH but that have not been unloaded through the routine UNLOAD. The range of WHICH is 1 to COUNT, where COUNT is the number of kernels loaded via FURNSH of type KIND. This count may be obtained by calling KTOTAL. See the $Examples section for an illustrative example. KIND is a list of types of kernels to be considered when fetching kernels from the list of loaded kernels. 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 KTOTAL for examples of the use of KIND. Detailed_OutputFILE is the name of the file having index WHICH in the sequence of files of type KIND that is currently loaded via FURNSH. FILE will be blank if there is not such kernel loaded. FILTYP is the type of the kernel specified by FILE. FILE will be blank if there is no file matching the specification of WHICH and KIND. SRCFIL is the name of the source file that was used to specify FILE as one to load. If FILE was loaded directly via a call to FURNSH, SRCFIL will be blank. If there is no file matching the specification of WHICH and KIND, SRCFIL will be blank. HANDLE is the 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 is returned .TRUE. if a FILE matching the specification of WHICH and KIND exists. If there is no such file, FOUND will be set to .FALSE. ParametersNone. ExceptionsError free. 1) If a file is not loaded matching the specification of WHICH and KIND, FOUND will be .FALSE., FILE, FILTYP, and SRCFIL will be blank and HANDLE will be set to zero. 2) If any of FILE, FILTYP or SRCFIL output strings has length too short to contain the corresponding output string, the string is truncated on the right. FilesNone. ParticularsThis routine allows you to determine which kernels have been loaded via FURNSH and to obtain information sufficient to directly query those files. ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, 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. PROGRAM KDATA_EX1 IMPLICIT NONE C C Local constants. C INTEGER FNAMLN PARAMETER ( FNAMLN = 256 ) INTEGER FTYPLN PARAMETER ( FTYPLN = 33 ) INTEGER SRCLEN PARAMETER ( SRCLEN = 256 ) C C Local variables. C CHARACTER*(FNAMLN) FILE CHARACTER*(FTYPLN) FILTYP CHARACTER*(SRCLEN) SRCFIL INTEGER COUNT INTEGER HANDLE INTEGER WHICH LOGICAL FOUND C C Load several kernel files. C CALL FURNSH ( 'kdata_ex1.tm' ) C C Count the number of loaded kernel files. C CALL KTOTAL ( 'ALL', COUNT ) DO WHICH= 1, COUNT + 1 CALL KDATA ( WHICH, 'ALL', FILE, FILTYP, . SRCFIL, HANDLE, FOUND ) IF ( FOUND ) THEN WRITE(*,*) 'Index : ', WHICH WRITE(*,*) 'File : ', FILE WRITE(*,*) 'Type : ', FILTYP WRITE(*,*) 'Source: ', SRCFIL WRITE(*,*) 'Handle: ', HANDLE WRITE(*,*) ' ' ELSE WRITE(*,*) 'No kernel found with index: ', WHICH END IF END DO END When this program was executed on a Mac/Intel/gfortran/64-bit platform, the output was: Index : 1 File : kdata_ex1.tm Type : META Source: Handle: 0 Index : 2 File : de421.bsp Type : SPK Source: kdata_ex1.tm Handle: 1 Index : 3 File : pck00009.tpc Type : TEXT Source: kdata_ex1.tm Handle: 0 Index : 4 File : naif0009.tls Type : TEXT Source: kdata_ex1.tm Handle: 0 No kernel found with index: 5 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) B.V. Semenov (JPL) W.L. Taber (JPL) VersionSPICELIB Version 5.1.0, 08-AUG-2021 (JDR) (NJB) Changed argument name SOURCE to SRCFIL for consistency with other routines. Edited the header to comply with NAIF standard. Created complete code example from existing code fragments. Updated $Detailed_Input description of input arguments KIND, to illustrate use of multi-word lists, and WHICH, to describe its range. Added entry #2 to $Exceptions section. Added KERNEL to the list of required readings. SPICELIB Version 5.0.0, 01-FEB-2017 (NJB) (BVS) Updated to support use of DSKs. Updated the $Author_and_Institution section. SPICELIB Version 1.1.0, 02-APR-2009 (NJB) Deleted reference to unneeded variable DOALL. SPICELIB Version 1.0.1, 06-DEC-2002 (NJB) Typo in header example was corrected. SPICELIB Version 1.0.0, 01-JUL-1999 (WLT) |
Fri Dec 31 18:36:29 2021