CSPICE_BODC2S translates a body ID code to either the corresponding name
or if no name to ID code mapping exists, the string representation of
the body ID value.
code SPICE code(s) for a set of bodies: planets, satellites,
barycenters, DSN stations, spacecraft, asteroids, comets,
or other ephemeris object.
[1,n] = size(code); int32 = class(code)
[name] = cspice_bodc2s( code )
name the name(s) corresponding to 'code' if a mapping between
'code' and a body name exists within SPICE, assigned either
in SPICE or by the user.
[n,c2] = size(name); char = class(name)
If 'code' has more than one translation, then the most recently
defined 'name' corresponding to 'code' is returned. 'name' will
have the exact format (case and blanks) as when the name/code pair
If the input value of 'code' does not map to a body name, 'name'
returns with the string representation of 'code'.
'name' returns with the same vectorization measure (N) as 'code'.
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.
% Assign an array of body ID codes. Not all the listed codes
% map to a body name.
code = [ 399, 0, 3, -77, 11, -1, 6000001 ];
name = cspice_bodc2s( code );
fprintf( '%8d %s\n', code(i), name(i,:) )
0 SOLAR SYSTEM BARYCENTER
3 EARTH BARYCENTER
-77 GALILEO ORBITER
A sister version of this routine exists named mice_bodc2n that returns
the output arguments as fields in a single structure.
cspice_bodc2n 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
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.
For important details concerning this module's function, please refer to
the CSPICE routine bodc2s_c.
-Mice Version 1.0.1, 28-OCT-2014, EDW (JPL)
Edited I/O section to conform to NAIF standard for Mice documentation.
-Mice Version 1.0.0, 01-JUN-2009, EDW (JPL)
body id code to string