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_ckmeta

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

Abstract


   CSPICE_CKMETA returns (depending upon the user's request) the ID code of
   either the spacecraft or spacecraft clock associated with a C-Kernel ID
   code.

I/O


   Given:

      ckid     the ID code for some object whose attitude and possibly
               angular velocity are stored in some C-kernel.

               [1,1] = size(ckid); int32 = class(ckid)

      meta     a character string that indicates which piece of meta data to
               fetch.

               [1,c1] = size(meta); char = class(meta)

                  or

               [1,1] = size(meta); cell = class(meta)

               Acceptable values are 'SCLK' and 'SPK'. The routine is case
               insensitive. Leading and trailing blanks are insignificant.
               However, blanks between characters are regarded as being
               significant.

   the call:

      [idcode] = cspice_ckmeta( ckid, meta )

   returns:

      idcode   if `meta' is 'SCLK' then the value returned in `idcode' is
               the ID code of the spacecraft clock used for converting ET to
               TICKS and TICKS to ET for the C-kernel used to represent the
               attitude of the object with ID code `ckid'.

               [1,1] = size(idcode); int32 = class(idcode)

               If `meta' is 'SPK' then the value returned in `idcode' is the
               ID code of the spacecraft on which the platform indicated
               by `ckid' is mounted.

Parameters


   None.

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) Suppose you would like to look up the attitude of an object
      in a C-kernel but have ET and seconds as your input time and
      tolerance.

      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: ckmeta_ex1.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name              Contents
            --------------------   -----------------------
            cas00071.tsc           CASSINI SCLK
            naif0012.tls           Leapseconds
            04153_04182ca_ISS.bc   CASSINI image navigated
                                   spacecraft CK


         \begindata

            KERNELS_TO_LOAD = ( 'naif0012.tls',
                                'cas00071.tsc'
                                '04153_04182ca_ISS.bc' )

         \begintext

         End of meta-kernel


      Example code begins here.


      function ckmeta_ex1()

         %
         % Local parameters.
         %
         % -- The code for CASSINI spacecraft reference frame is
         %    -82000.
         %
         % -- The reference frame we want is J2000.
         %
         REF  =   'J2000';
         CKID =   -82000;

         %
         % Initial values.
         %
         et     = [141162208.034340]';
         sectol = [0.5]';

         %
         % First load the CK, LSK and SCLK files.
         %
         cspice_furnsh( 'ckmeta_ex1.tm' );

         %
         % Get the SCLK identifier of the spacecraft clock required
         % to convert from `et' to `ticks'.
         %
         [idcode] = cspice_ckmeta( CKID, 'SCLK' );

         %
         % Convert `et' and et+sectol to spacecraft clock ticks.
         %
         [ticks] = cspice_sce2c( idcode, et );
         [tick2] = cspice_sce2c( idcode, et+sectol );

         %
         % Compute the tolerance in spacecraft clock ticks.
         %
         tol = tick2 - ticks;

         %
         % Look the attitude up.
         %
         [cmat, av, clkout, found] = cspice_ckgpav( CKID, ticks, tol, REF );

         fprintf( 'Input ET:             %19.6f\n', et )

         if ( found )

            [etout] = cspice_sct2e( idcode, clkout );
            fprintf( 'Attitude found at ET: %19.6f\n', etout )

         else

            fprintf( 'No attitude found at ET.\n' )

         end

         %
         % It's always good form to unload kernels after use,
         % particularly in Matlab due to data persistence.
         %
         cspice_kclear


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


      Input ET:                141162208.034340
      Attitude found at ET:    141162208.034586


Particulars


   This is a utility routine for mapping C-kernels to associated
   spacecraft clocks.

   An association of an SCLK ID and spacecraft ID with a CK frame
   class ID may be made by placing in a text kernel the kernel
   variable assignments

      CK_<ck_frame_class_ID_code>_SCLK = <ID code of SCLK>
      CK_<ck_frame_class_ID_code>_SPK  = <SPK ID code>

   See the Frames Required Reading section on CK frames.

Exceptions


   1)  If the variable `meta' is not recognized to be one of the
       inputs 'SPK' or 'SCLK', the error SPICE(UNKNOWNCKMETA)
       is signaled by a routine in the call tree of this routine.

   2)  If `ckid' is greater than -1000, the associated SCLK and SPK
       IDs must be in the kernel pool. If they are not present
       a value of zero is returned for the requested item. Zero
       is never the valid ID of a spacecraft clock.

   3)  If any of the input arguments, `ckid' or `meta', is undefined,
       an error is signaled by the Matlab error handling system.

   4)  If any of the input arguments, `ckid' or `meta', is not of the
       expected type, or it does not have the expected dimensions and
       size, an error is signaled by the Mice interface.

Files


   None.

Restrictions


   None.

Required_Reading


   CK.REQ
   FRAMES.REQ
   MICE.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Mice Version 1.0.0, 21-JUN-2021 (JDR)

Index_Entries


   Map C-kernel ID to SCLK and SPK ID


Fri Dec 31 18:44:23 2021