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_bodn2c

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


Abstract


   CSPICE_BODN2C translates the name of a body or object to the corresponding
   SPICE integer ID code.

I/O


   Given:

      name     the scalar string name of a body or object, such as a planet,
               satellite, comet, asteroid, barycenter, DSN station, spacecraft,
               or instrument, "known" to the SPICE system, whether through
               hard-coded registration or run-time registration in the SPICE
               kernel pool.

               help, name
                  STRING = Scalar

               Case and leading and trailing blanks in a name are not
               significant. However when a name is made up of more than one
               word, they must be separated by at least one blank. That is, all
               of the following strings are equivalent names:

                      'JUPITER BARYCENTER'
                      'Jupiter Barycenter'
                      'JUPITER BARYCENTER   '
                      'JUPITER    BARYCENTER'
                      '   JUPITER BARYCENTER'

               However, 'JUPITERBARYCENTER' is not equivalent to the names
               above.

   the call:

      cspice_bodn2c, name, code, found

   returns:

      code     the scalar, integer SPICE code assigned either by SPICE or the
               user to `name'.

               help, code
                  LONG = Scalar

      found    a scalar boolean flagging if the kernel subsystem translated
               `name' to a corresponding `code'.

               help, found
                  BOOLEAN = Scalar

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) Retrieve, using the cspice_bodn2c call, the NAIF ID mapped
      to the 'Galileo Orbiter' name.

      Example code begins here.


      PRO bodn2c_ex1

         ;;
         ;; Query for the code mapped to Galileo Orbiter.
         ;;
         name = 'Galileo Orbiter'

         cspice_bodn2c, name, code, found

         ;;
         ;; Respond if found.
         ;;
         if ( found ) then begin
            print, 'Code corresponding to name: ', code
         endif else begin
            print, 'No code corresponding to name: ', name
         endelse

      END


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


      Code corresponding to name:          -77


Particulars


   cspice_bodn2c 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.

   Programmers writing user interface code should consider using the
   Icy routine cspice_bods2c. cspice_bods2c provides more flexibility
   in handling input strings, since it accepts both body names and
   strings representing integer ID codes, for example '399'.

   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)  Body name strings are upper-cased, their leading and trailing
       blanks removed, and embedded blanks are compressed out, after
       which they get truncated to the maximum body name length MAXL.
       Therefore, two body names that differ only after that maximum
       length are considered equal.

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

   4)  If the input argument `name' is not of the expected type, or
       it does not have the expected dimensions and size, an error is
       signaled by the Icy interface.

   5)  If any of the output arguments, `code' or `found', 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


   1)  See exception <2>.

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.2, 10-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)

Index_Entries


   body name to code



Fri Dec 31 18:43:02 2021