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

Required Reading


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



      name   name(s) 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

             [n,c1] = size(name); char = class(name)


             [1,n] = size(bodynm); cell = class(bodynm)

             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

   the call:

      [code, found] = cspice_bodn2c( name )


      code    containing the SPICE code(s) assigned either by SPICE or the
              user to 'name'.

              [1,n] = size(code); int32 = class(code)

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

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

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


   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 NAIF ID associated to a body name.
      disp( 'Scalar:' )
      name            = 'Hyperion';
      [ code, found ] = cspice_bodn2c( name );

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

      disp(' ')

      % Create an array of body names. Include one unknown name.
      disp( 'Vector:' )
      name           = strvcat( 'Triton', 'Mimas', ...
                                'Oberon', 'Callisto', 'Halo' );
      [ code, found] = cspice_bodn2c( name );

      n_elements = size(code,2);

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

         % Check for a valid name/code mapping.
         if( found(n) )
            txt = sprintf( 'Body code %i maps to name %s', ...
                            code(n), name(n,:) );
            txt = sprintf( 'Unknown body name %s', name(n,:) );


   MATLAB outputs:

      Body code 607 maps to name Hyperion

      Body code 801 maps to name Triton
      Body code 601 maps to name Mimas
      Body code 704 maps to name Oberon
      Body code 504 maps to name Callisto
      Unknown body name Halo


   A sister version of this routine exists named mice_bodn2c that returns
   the output arguments as fields in a single structure.

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

Required Reading

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



   -Mice Version 1.0.3, 01-DEC-2014, EDW (JPL)

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

   -Mice Version 1.0.2, 12-MAR-2012 (EDW), SCK (JPL)

       I/O descriptions edits to conform to Mice documentation format.

       Corrected minor typo in header.

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

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


   body name to code

Wed Apr  5 18:00:29 2017