Index Page
mice_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


   MICE_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:

      ID = mice_bodc2n( code )

   returns:

      ID   the structure(s) associating a body name with a corresponding 
           SPICE ID. 

           [1,n] = size(ID); struct = class(ID)

           Each structure consists of the fields:

              name   the "name" of a particular body. If a mapping
                     does not exist, the 'name' field returns as NULL.

                     [1,c1] = size(ID(i).name); char = class(ID(i).name)

              code   the SPICE code assigned either
                     by SPICE or the user to 'name'. If a mapping
                     does not exist, the 'code' field returns as 0.

                     [1,1] = size(ID(i).code); int32 = class(ID(i).code)

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

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

      'ID' returns 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;
      ID      = mice_bodc2n( naif_id );

      %
      % Output the mapping if it exists.
      %
      if ( ID.found )
         txt = sprintf( 'Body ID %i maps to name %s', ...
                         ID.code, ID.name );
         disp(txt)
      end

      disp( ' ' )

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

      n_elements = size(ID);

      %
      % Loop over the output array.
      %
      for i=1:n_elements(1)

         %
         % Check for a valid name/ID mapping.
         %
         if( ID(i).found )
            txt = sprintf( 'Body ID %i maps to name %s', ...
                            ID(i).code, ID(i).name );
            disp(txt)
         else
            txt = sprintf( 'Unknown body ID %i', naif_id(i) );
            disp(txt)
         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 cspice_bodc2n that returns
   the structure field data as separate arguments.

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.1, 01-DEC-2014, EDW (JPL)

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

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

Index_Entries


   body id code to name


Wed Apr  5 18:00:36 2017