Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_bodc2s

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   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.

I/O


   Given:

      code     the integer scalar SPICE ID code for a body: planet, satellite,
               barycenter, spacecraft, asteroid, comet, or other ephemeris
               object.

               help, code
                  LONG = Scalar

   the call:

      cspice_bodc2s, code, name

   returns:

      name     the string name of the body identified by `code' if a mapping
               between `code' and a body name exists within SPICE.

               help, name
                  STRING = Scalar

               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 was defined.

               If the input value of `code' does not map to a body name, `name'
               returns with the string representation of `code'.

Parameters


   MAXL        is the maximum allowable length of a body name. The
               current value of this parameter is 36.

Examples


   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) Apply the cspice_bodc2s call to several IDs representing codes
      included in the default SPICE ID-name lists and codes not
      included in the list.

      Example code begins here.


      PRO bodc2s_ex1

         ;;
         ;; 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 ]


         ;;
         ;; Loop over the `code' array, call cspice_bodc2s for each
         ;; element of `code'.
         ;;
         print, 'Code      Name'
         print, '-------   -----------------------'
         for i=0, 6 do begin

            cspice_bodc2s, code[i], name
            print, format='(I7,3x,A)', code[i], name

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Code      Name
      -------   -----------------------
          399   EARTH
            0   SOLAR SYSTEM BARYCENTER
            3   EARTH BARYCENTER
          -77   GALILEO ORBITER
           11   11
           -1   GEOTAIL
      6000001   6000001


      Note that the codes 11 and 6000001 did not map to a name so the
      call returns as `name' the string expression of the codes.

Particulars


   cspice_bodc2s is one of five related procedures,

      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.

Exceptions


   1)  If there is any problem with the body name-ID mapping kernel
       variables present in the kernel pool, an error is signaled by
       a routine in the call tree of this routine.

   2)  If the input argument `code' is undefined, an error is
       signaled by the IDL error handling system.

   3)  If the input argument `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.

   4)  If the output argument `name' is not a named variable, an
       error is signaled by the Icy interface.

Files


   Body-name mappings may be defined at run time by loading text
   kernels containing kernel variable assignments of the form

      NAIF_BODY_NAME += ( <name 1>, ... )
      NAIF_BODY_CODE += ( <code 1>, ... )

   See naif_ids.req for details.

Restrictions


   None.

Required_Reading


   ICY.REQ
   NAIF_IDS.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.1, 31-MAY-2021 (JDR)

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Edited the header to comply with NAIF standard. Updated code
       example to introduce solution's header. Fixed minor typos in the
       header.

       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.0, 01-JUN-2009 (EDW)

Index_Entries


   body ID code to string



Fri Dec 31 18:43:02 2021