Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/~sontag/spicedocs/cspice/ckobj_c.html
Дата изменения: Sat Dec 17 06:08:35 2005 Дата индексирования: Sun Apr 10 23:23:39 2016 Кодировка: Поисковые слова: star trail |
Find the set of ID codes of all objects in a specified CK file.
CELLS CK DAF NAIF_IDS SETS
Variable I/O Description -------- --- -------------------------------------------------- ck I Name of CK file. ids I/O Set of ID codes of objects in CK file.
ck is the name of a C-kernel. ids is an initialized CSPICE set data structure. `ids' optionally may contain a set of ID codes on input; on output, the data already present in `ids' will be combined with ID code set found for the file `ck'. If `ids' contains no data on input, its size and cardinality still must be initialized.
ids is a CSPICE 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. The elements of CSPICE 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'.
None.
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) Display the coverage for each object in a specified CK file. 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. #include <stdio.h> #include "SpiceUsr.h" int main() { /. Local parameters ./ #define FILSIZ 256 #define MAXIV 100000 #define WINSIZ ( 2 * MAXIV ) #define TIMLEN 51 #define MAXOBJ 1000 /. Local variables ./ SPICEDOUBLE_CELL ( cover, WINSIZ ); SPICEINT_CELL ( ids, MAXOBJ ); SpiceChar ck [ FILSIZ ]; SpiceChar lsk [ FILSIZ ]; SpiceChar sclk [ FILSIZ ]; SpiceChar timstr [ TIMLEN ]; SpiceDouble b; SpiceDouble e; SpiceInt i; SpiceInt j; SpiceInt niv; SpiceInt obj; /. 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. ./ prompt_c ( "Name of leapseconds kernel > ", FILSIZ, lsk ); furnsh_c ( lsk ); prompt_c ( "Name of SCLK kernel > ", FILSIZ, sclk ); furnsh_c ( sclk ); /. Get name of CK file. ./ prompt_c ( "Name of CK file > ", FILSIZ, ck ); /. Find the set of objects in the CK file. ./ ckobj_c ( ck, &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; i < card_c( &ids ); i++ ) { /. Find the coverage window for the current object. ./ obj = SPICE_CELL_ELEM_I( &ids, i ); ckcov_c ( ck, obj, SPICEFALSE, "INTERVAL", 0.0, "TDB", &cover ); /. Get the number of intervals in the coverage window. ./ niv = card_c ( &cover ) / 2; /. Display a simple banner. ./ printf ( "%s\n", "========================================" ); printf ( "Coverage for object %ld\n", obj ); /. Convert the coverage interval start and stop times to TDB calendar strings. ./ for ( j = 0; j < niv; j++ ) { /. Get the endpoints of the jth interval. ./ wnfetd_c ( &cover, j, &b, &e ); /. Convert the endpoints to TDB calendar format time strings and display them. ./ timout_c ( b, "YYYY MON DD HR:MN:SC.###### (TDB) ::TDB", TIMLEN, timstr ); printf ( "\n" "Interval: %ld\n" "Start: %s\n", j, timstr ); timout_c ( e, "YYYY MON DD HR:MN:SC.###### (TDB) ::TDB", TIMLEN, timstr ); printf ( "Stop: %s\n", timstr ); } printf ( "%s\n", "========================================" ); } return ( 0 ); }
1) If an error occurs while this routine is updating the set `ids', the set may be corrupted.
1) If the input file has transfer format, the error SPICE(INVALIDFORMAT) is signaled. 2) If the input file is not a transfer file but has architecture other than DAF, the the error SPICE(BADARCHTYPE) is signaled. 3) If the input file is a binary DAF file of type other than CK, the error SPICE(BADFILETYPE) is signaled. 4) If the CK file cannot be opened or read, the error will be diagnosed by routines called by 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, the error will be diagnosed by routines called by this routine. 6) The error SPICE(EMPTYSTRING) is signaled if the input string `ck' does not contain at least one character, since the input string cannot be converted to a Fortran-style string in this case. 7) The error SPICE(NULLPOINTER) is signaled if the input string pointer `ck' is null.
This routine reads a C-kernel.
N.J. Bachman (JPL)
None.
-CSPICE Version 1.0.0, 30-DEC-2004 (NJB)
find id codes in ck file