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

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_BODC2N returns the body name corresponding to an input numeric
   ID value.

I/O


   Given:

      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)

   the call:

      [name, found] = cspice_bodc2n( code )

   returns:

      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,c1] = 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 was defined.

      found   flag(s) indicating if the kernel subsystem translated 'code' to
              a corresponding 'name'.

              [1,n] = size(found); logical = class(found)

              'found' and 'name' return with the same vectorization
              measure, N, as 'code'.

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.

      %
      % Retrieve the current body name associated to a given NAIF ID.
      %
      disp( 'Scalar:' )
      naif_id = 501;
      [name, found] = cspice_bodc2n( naif_id );

      %
      % Output the mapping if it exists.
      %
      if ( found )
         fprintf( 'Body ID %i maps to name %s\n', naif_id, name );
      end

      disp( ' ' )

      %
      % Create an array of IDs. Include one unknown ID.
      %
      disp( 'Vector:' )
      naif_id       = [ 502, 503, 504, 505, 5006 ];
      [name, found] = cspice_bodc2n( naif_id );

      n_elements = size(found,2);

      %
      % Loop over the output array.
      %
      for n=1:n_elements

         %
         % Check for a valid name/ID mapping.
         %
         if( found(n) )
            fprintf( 'Body ID %i maps to name %s\n', ...
                           naif_id(n) , name(n,:) );
         else
            fprintf( 'Unknown body ID %i\n', naif_id(n) );
         end

      end

   MATLAB outputs:

      Scalar:
      Body ID 501 maps to name IO

      Vector:
      Body ID 502 maps to name EUROPA
      Body ID 503 maps to name GANYMEDE
      Body ID 504 maps to name CALLISTO
      Body ID 505 maps to name AMALTHEA
      Unknown body ID 5006

Particulars


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

Required Reading


   For important details concerning this module's function, please refer to
   the CSPICE routine bodc2n_c.

   MICE.REQ
   NAIF_IDS.REQ

Version


   -Mice Version 1.0.2, 28-OCT-2014, EDW (JPL)

       Edited I/O section to conform to NAIF standard for Mice documentation.

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

       Corrected typo in usage string.

   -Mice Version 1.0.0, 22-NOV-2005, EDW (JPL)

Index_Entries


   body id code to name


Wed Apr  5 18:00:29 2017