Table of contents
CSPICE_BODDEF defines a body name/ID code pair for later translation via
cspice_bodn2c or cspice_bodc2n.
Given:
name the scalar string defining the name to associate to the ID value
`code'.
help, name
STRING = Scalar
The case and positions of blanks in a name are significant.
cspice_bodc2n returns the same string (case and space) most
recently mapped to a code. When `name' consists of more than one
word, the words require separation by at least one blank.
The kernel sub-system stores `name' as described in the
cspice_boddef call, but creates an equivalence class based on
`name' for comparisons in cspice_bodn2c. This class ignores
leading and trailing whitespace, compresses interior whitespace
to a single space, and ignores character case.
The following strings belong to the same equivalence
class:
'JUPITER BARYCENTER'
'Jupiter Barycenter'
'JUPITER BARYCENTER '
'JUPITER BARYCENTER'
' JUPITER BARYCENTER'
However, 'JUPITERBARYCENTER' is distinct from the names above.
code the integer defining the NAIF ID code corresponding to `name'.
help, code
LONG = Scalar
the call:
cspice_boddef, name, code
performs the mapping assignment
`name' -> `code'
and
`code' -> `name'
The `code' -> `name' assignment supersedes any other mapping for `code'.
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) Map a non-existent code and name to each other and validate
the mapping by retrieving, first, the code associated to the
name, and then, the name associated to the code.
Example code begins here.
PRO boddef_ex1
;;
;; Map a non-existent code and name to each other.
;;
cspice_boddef, 'spud', -69
;;
;; Retrieve the code for name 'spud'.
;;
cspice_bodn2c, 'spud', code, found
;;
;; Check we found a mapping.
;;
if (found) then begin
print, 'ID for spud : ' + string(code)
endif else begin
print, 'Found no mapping for spud.'
endelse
;;
;; Retrieve the name for ID -69.
;;
cspice_bodc2n, -69, name, found
;;
;; Check we found a mapping.
;;
if (found) then begin
print, 'Name for -69: ' + name
endif else begin
print, 'Found no mapping for -69.'
endelse
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
ID for spud : -69
Name for -69: spud
cspice_boddef is one of five related subroutines,
cspice_bods2c Body string to code
cspice_bodc2s Body code to string
cspice_bodn2c Body name to code
cspice_bodc2n Body code to name
cspice_boddef Body name/code definition
cspice_bods2c, cspice_bodc2s, cspice_bodn2c, and cspice_bodc2n
perform translations between body names and their corresponding
integer ID codes which are used in SPICE files and routines.
cspice_bods2c is a slightly more general version of cspice_bodn2c:
support for strings containing ID codes in string format enables a caller
to identify a body using a string, even when no name is associated with
that body.
cspice_bodc2s is a general version of cspice_bodc2n; the routine returns
either the name assigned in the body ID to name mapping or a string
representation of the 'code' value if no mapping exists.
cspice_boddef assigns a body name to ID mapping. The mapping has
priority in name-to-ID and ID-to-name translations.
Refer to naif_ids.req for the list of name/code associations built
into SPICE, and for details concerning adding new name/code
associations at run time by loading text kernels.
1) If improper inputs are supplied, or if there is insufficient
room to store the requested addition, an error is signaled by
a routine in the call tree of this routine.
2) If the length of `name' exceeds the maximum allowed length for a
body name, the name stored in the kernel pool will be
truncated on the right.
3) If a name-code definition inserted into this routine seems to
have no effect, it is possible that the contents of the
definition are masked by the higher precedence kernel pool
assignments. See the -Particulars section of this document
for more information.
4) If any of the input arguments, `name' or `code', is undefined,
an error is signaled by the IDL error handling system.
5) If any of the input arguments, `name' or `code', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
None.
None.
ICY.REQ
NAIF_IDS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 13-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's problem
statement.
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.1, 16-MAY-2009 (EDW)
Edit to -Particulars section to document the cspice_bodc2s routine.
Extended argument descriptions in the -I/O section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
body name/id code definition
|