bodc2n_c

Index Page bodc2n_c
A B C D E F G H I J K L M N O P Q R S T U V W X
Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries
#### Procedure
       void bodc2n_c ( SpiceInt        code,
                       SpiceInt        lenout,
                       SpiceChar     * name,
                       SpiceBoolean  * found   )
#### Abstract
       Translate the SPICE integer code of a body into a common name
       for that body.
#### Required_Reading
       NAIF_IDS
#### Keywords
       BODY
       CONVERSION
#### Brief_I/O
       Variable  I/O  Description
       --------  ---  --------------------------------------------------
       code       I   Integer ID code to be translated into a name.
       lenout     I   Maximum length of output name.
       name       O   A common name for the body identified by code.
       found      O   True if translated, otherwise false.
#### Detailed_Input
       code        is an integer code for a body ---
                   a planet, satellite, barycenter, spacecraft,
                   asteroid, comet, or other ephemeris object.

       lenout      is the maximum allowed length of the output name,
                   including the terminating null character.  For example,
                   if the caller wishes to be able to accept a 32-character
                   name, lenout must be set to (at least) 33.  The current
                   maximum name length is 32 characters, so a value of 33
                   for lenout will suffice.
#### Detailed_Output
       name        is a common name of the body identified by code.
                   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.

                   No more than lenout characters, including the
                   terminating null, will be written to name.  A terminating
                   null will always be written.

       found       is SPICETRUE if code has a translation.  Otherwise, found
                   is SPICEFALSE.
#### Parameters
       None.
#### Exceptions
       1) If the output string pointer is null, the error SPICE(NULLPOINTER)
          is signaled.

       2) If the output string has length less than two characters, it
          is too short to contain one character of output data plus a null
          terminator, so it cannot be passed to the underlying Fortran
          routine.  In this event, the error SPICE(STRINGTOOSHORT) is
          signaled.
#### Files
       None.
#### Particulars
       bodc2n_c is one of three related subroutines,

          bodn2c_c      Body name to code

          bodc2n_c      Body code to name

          boddef_c      Body name/code definition

       bodn2c_c and bodc2n_c perform translations between body names
       and their corresponding integer ID codes which are used
       in SPK and PCK files and routines.  A set of name/code
       pairs are automatically defined during the first call to
       one of these subroutines.  Additional name/code pairs may
       be defined via boddef_c.
#### Examples
       1.  Suppose you ran the utility program SPACIT to summarize
           an SPK ephemeris file and the following data was output
           to the terminal screen.

              ----------------------------------------------------------
              Segment identifier: JPL archive 21354
              Body        : -77                         Center     : 399
              From        : 1990 DEC 08 18:00:00.000
              To          : 1990 DEC 10 21:10:00.000
              Reference   : DE-200                      SPK Type    :1
              ----------------------------------------------------------

          You could write a program to translate the body codes
          shown in the SPACIT output:

             #define MAXLEN 32
                    .
                    .
                    .
             bodc2n_c ( -77, MAXLEN, body,   found );
             bodc2n_c ( 399, MAXLEN, center, found );

             if ( found )
                {
                printf ( "body:    -77 =  %s\n", body   );
                printf ( "center:  399 =  %s\n", center );
                }

          You could also read the body and center codes directly from
          the SPK files, using the appropriate DAF routines, and then
          translate them, as above.

       2.  In this example, we assume that boddef_c has not been called,
           so only the set of default name/code pairs has
           been defined.

           Given these names, bodn2c_c will return the following codes:

              Name                         Code    Found?
              ------------------------   ------    ------
              "EARTH"                       399    Yes
              "  Earth "                    399    Yes
              "EMB"                           3    Yes
              "Solar System Barycenter"       0    Yes
              "SolarSystemBarycenter"         -    No
              "SSB"                           0    Yes
              "Voyager 2"                   -32    Yes
              "U.S.S. Enterprise"             -    No
              " "                             -    No
              "Halley's Comet"                -    No

           Given these codes, bodc2n_c will return the following names:

              Code        Name                        Found?
              -------     -------------------         ------
              399         "EARTH"                     Yes
                0         "SOLAR SYSTEM BARYCENTER"   Yes
                3         "EARTH BARYCENTER"          Yes
              -77         "GALILEO ORBITER"           Yes
               11          -                          No
               -1          -                          No
#### Restrictions
       None.
#### Literature_References
       None.
#### Author_and_Institution
       N.J. Bachman    (JPL)
       K.R. Gehringer  (JPL)
       B.V. Semenov    (JPL)
#### Version
       -CSPICE Version 2.2.1, 27-FEB-2008 (BVS)

           Corrected the contents of the Required_Reading section of
           the header.

       -CSPICE Version 2.2.0, 02-SEP-1999 (NJB)

          Local type logical variable now used for found flag used in
          interface of bodc2n_.

       -CSPICE Version 2.1.1, 25-MAR-1998 (EDW)

          Minor corrections to header.

       -CSPICE Version 2.1.0, 09-FEB-1998 (NJB)

          Re-implemented routine without dynamically allocated, temporary
          strings.  Updated the Exceptions header section.

       -CSPICE Version 2.0.1, 16-JAN-1998 (EDW)

           Corrected and clarified header entries.

       -CSPICE Version 1.0.0, 25-OCT-1997 (NJB)

          Based on SPICELIB Version 1.0.0, 23-JAN-1996 (KRG)
#### Index_Entries
       body id code to name
#### Link to routine bodc2n_c source file bodc2n_c.c

    Thu Apr 16 08:57:22 2009