| bodfnd_c |
|
Table of contents
Procedure
bodfnd_c ( Find values from the kernel pool )
SpiceBoolean bodfnd_c ( SpiceInt body,
ConstSpiceChar * item )
AbstractDetermine whether values exist for some item for any body in the kernel pool. Required_ReadingKERNEL NAIF_IDS PCK KeywordsCONSTANTS Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
body I ID code of body.
item I Item to find ("RADII", "NUT_AMP_RA", etc.).
The function returns the value SPICETRUE if the item is in the
kernel pool, and is SPICEFALSE if it is not.
Detailed_Input
body is the ID code of the body for which the item is
requested. Bodies are numbered according to the
standard NAIF numbering scheme.
item is the item to be returned. Together, the body and
item name combine to form a variable name, e.g.,
"BODY599_RADII"
"BODY4_POLE_RA"
Detailed_OutputThe function returns the value SPICETRUE if the item is in the kernel pool, and is SPICEFALSE if it is not. ParametersNone. Exceptions
1) If the `item' input string pointer is null, the error
SPICE(NULLPOINTER) is signaled. The function returns the value
SPICEFALSE.
2) If the `item' input string has zero length, the error
SPICE(EMPTYSTRING) is signaled. The function returns the value
SPICEFALSE.
FilesNone. ParticularsThe CSPICE routines bodvcd_c and bodvrd_c, which return values from the kernel pool, signal an error if the specified item is not found. In many cases, this is appropriate. However, sometimes the program may attempt to recover, by providing default values, prompting for replacements, and so on. Examples
The 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) Test if the Earth's radii values exist in the kernel pool.
Use the PCK kernel below to load the required triaxial
ellipsoidal shape model for the Earth.
pck00008.tpc
Example code begins here.
/.
Program bodfnd_ex1
./
#include <stdio.h>
#include "SpiceUsr.h"
int main( )
{
/.
Local constants.
./
#define bodyid 399
/.
Local variables.
./
SpiceBoolean found;
SpiceDouble radii [ 3 ];
SpiceInt dim;
/.
Load a PCK file.
./
furnsh_c( "pck00008.tpc" );
/.
Test if Earth's radii values exist in the
kernel pool.
The procedure searches for the kernel variable
BODY399_RADII.
./
found = bodfnd_c( bodyid, "RADII" );
/.
If found, retrieve the values.
./
if ( found )
{
bodvcd_c( bodyid, "RADII", 3, &dim, radii );
printf ( "%d RADII: %10.3f %10.3f %10.3f\n",
(int)bodyid, radii[0], radii[1], radii[2] );
}
else
{
printf ( "No RADII data found for object %d\n",
(int)bodyid );
}
}
When this program was executed on a Mac/Intel/cc/64-bit
platform, the output was:
399 RADII: 6378.140 6378.140 6356.750
RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL) Version
-CSPICE Version 2.0.3, 08-JUL-2021 (JDR)
Edited the header to comply with NAIF standard. Added
complete code examples.
-CSPICE Version 2.0.2, 24-OCT-2005 (NJB)
Header updates: reference to bodvar_c was replaced with
reference to bodvcd_c. The string "AXES" and variable `axes'
were replaced with the string "RADII" and variable `radii'
throughout the header. A few other minor header edits were
made.
-CSPICE Version 2.0.1, 08-FEB-1998 (EDW)
Corrected and clarified header entries.
-CSPICE Version 2.0.0, 06-JAN-1998 (NJB)
Input argument item was changed to type ConstSpiceChar *.
References to C2F_CreateStr_Sig were removed; code was
cleaned up accordingly. String checks are now done using
the macro CHKFSTR_VAL.
-CSPICE Version 1.0.0, 25-OCT-1997 (EDW) (WLT) (IMU) (HAN)
Index_Entriesfind constants for a body in the kernel pool |
Fri Dec 31 18:41:02 2021