Index Page
cspice_badkpv
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_BADKPV determines if a kernel pool variable is present and if so 
   that it has the correct size and type. 
   
   For important details concerning this module's function, please refer to
   the CSPICE routine badkpv_c.

I/O

   
   Given:

      caller   the scalar string name of the routine calling this routine
               to check correctness of kernel pool variables.

      name     the scalar string name of a kernel pool variable that the 
               calling program expects to be present in the 
               kernel pool. 

      comp     the scalar character comparison operator to use when 
               comparing the number of components of the kernel pool 
               variable specified by name with the integer size.  If dim 
               is the actual size of the kernel pool variable then 
               badkpv_c will check the sentence 

                  dim comp size 

               is a true statement.  If it is not a true statement 
               an error will be signaled. 

               Allowed values for comp and their meanings are: 

                  "="      dim == size 
                  "<"      dim <  size 
                  ">"      dim >  size 
                  "=>"     dim >= size 
                  "<="     dim <= size 

      size     a scalar integer to compare with the actual 
               number of components of the kernel pool variable 
               specified by 'name'. 

      divby    a scalar integer that is one of the factors of the 
               actual dimension of the specified kernel pool variable. 
               In other words, it is expected that divby evenly 
               divides the actual dimension of name. In those 
               cases in which the factors of the dimension of name 
               are not important, set divby to 1 in the calling 
               program. 

      type     a scalar character describing the kernel pool variable's
               expected type. Recognized values are 

                'C' for character type 
                'N' for numeric type (integer and double precision) 

               The case of 'type' is insignificant.  If the value 
               is not one of the 2 values given above 
               no check for the type of the variable will be 
               performed. 

   the call:

      cspice_badkpv, `caller`, `name`, `comp`, size, divby, `type`

   returns:
   
      The procedure does not return a value. The call signals a SPICE error
      if the kernel pool variable lacks the described properties, otherwise
      the call has not effect.

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.

      ;;
      ;; Load a kernel containing the variable assignments:
      ;; 
      ;;   CTEST_VAL = ('LARRY', 'MOE', 'CURLY' )
      ;;
      ;;   ITEST_VAL = ( 3141, 186, 282 )
      ;;
      ;;   DTEST_VAL = ( 3.1415, 186. , 282.397 )
      ;;
      cspice_furnsh, 'badkpv_t.ker'

      ;;
      ;; Create an error handler.
      ;;
      catch, err

      ;;
      ;; Wrap the call, providing an output message on error.
      ;;
      if err eq 0 then begin
   
         ;;
         ;; Execute the call. If an error occurs, the first statement
         ;; after "catch, err" executes.
         ;;
         cspice_badkpv, 'BADKPV_T', 'CTEST_VAL', '=', 3, 1, 'C'
         print, 'Expected form of variable CTEST_VAL found in kernel pool.'
      
      endif else begin

         ;;
         ;; cspice_badkpv signaled an error. Output the error message.
         ;;
         print, 'Expected form of variable CTEST_VAL not found in kernel pool.'
         print, !Error_State.Msg

      endelse

      ;;
      ;; Cancel the error handler.
      ;;
      catch, /cancel
      print, ' ' 
   
      ;;
      ;; Perform another run in the same manner as above. Create an error 
      ;; handler respond if an error signals.
      ;;
      catch, err

      if err eq 0 then begin
   
         ;;
         ;; Check for the double precision array, improperly indicate the
         ;; array has type character.
         ;;
         cspice_badkpv, 'BADKPV_T', 'DTEST_VAL', '=', 3, 1, 'C'
         print, 'Expected form of variable DTEST_VAL found in kernel pool.'

      endif else begin

         ;;
         ;; Output error information.
         ;;
         print, 'Expected form of variable DTEST_VAL NOT found in kernel pool.'
         print, !Error_State.Msg

      endelse

      ;;
      ;; Cancel the error handler.
      ;;
      catch, /cancel
      print, ' ' 

      ;;
      ;; Another test.
      ;;
      catch, err

      if err eq 0 then begin
   
         ;;
         ;; Check for the integer array, improperly indicate the size as 2.
         ;;
         cspice_badkpv, 'BADKPV_T', 'ITEST_VAL', '=', 2, 1, 'N'
         print, 'Expected form of variable ITEST_VAL found in kernel pool.'

      endif else begin

         ;;
         ;; Output error information.
         ;;
         print, 'Expected form of variable ITEST_VAL NOT found in kernel pool.'
         print, !Error_State.Msg

      endelse

      catch, /cancel

      ;;
      ;; It's always good form to unload kernels after use,
      ;; particularly in IDL due to data persistence.
      ;;
      cspice_unload, 'badkpv_t.ker'

   IDL outputs:

      Expected form of variable CTEST_VAL found in kernel pool.
 
      Expected form of variable DTEST_VAL NOT found in kernel pool.
      CSPICE_BADKPV: SPICE(BADVARIABLETYPE): [badkpv_c->BADKPV] BADKPV_T: The
                     kernel pool variable 'DTEST_VAL' must be of type
                     "CHARACTER". However, the current type is numeric.
 
      Expected form of variable ITEST_VAL NOT found in kernel pool.
      CSPICE_BADKPV: SPICE(BADVARIABLESIZE): [badkpv_c->BADKPV] BADKPV_T: The
                     kernel pool variable 'ITEST_VAL' is expected to have a
                     number of components DIM such that the comparison DIM = 2
                     is TRUE.  However, the current number of components for
                     'ITEST_VAL' is 3.

Particulars


   None.

Required Reading


   ICY.REQ

Version


   -Icy Version 1.0.0, 29-AUG-2006, EDW (JPL)


Index_Entries

 
   Check the properties of a kernel pool variable 
 



Wed Apr  5 17:57:59 2017