Index Page
cspice_ckw01
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_CKW01 adds a type 1 segment to a C-kernel.

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

I/O

   
   Given:
   
      handle   scalar integer value of the file handle for 
               an open CK file returned from cspice_ckopn
               
      begtim   double precision scalar encoded SCLK segment
               begin time value
               
      endtim   double precision scalar encoded SCLK segment 
               end time value
               
      inst     the scalar integer NAIF instrument ID code
      
      ref      scalar string identifying the reference frame for the
               segment
               
      avflag   a scalar boolean indicating if the segment will contain 
               angular velocity
   
      segid    a scalar string to identify the segment
      
      nrec     the scalar integer number of pointing records
      
      sclkdp   a double precision N-vector containing the encoded
               SCLK times for the data
               
      quats    a 4xN double precision matrix of SPICE type quaternions
               representing instrument pointing
               
      avvs     a 3xN double precision matrix of angular 
               velocity vectors in units radians per second
   
   the call:
   
      cspice_ckw01, handle, $
                    begtim, $
                    endtim, $
                    inst,   $
                    ref,    $
                    avflag, $
                    segid,  $
                    sclkdp  $
                    quats   $
                    avvs
   
   writes the data for a type 1 segment to the open CK file 
   indicated by 'handle'.
   

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.

   
      ;;
      ;; Create a CK type 1 segment; fill with data for a simple time 
      ;; dependent rotation and angular velocity.
      ;;
   
      ;;
      ;; Define needed parameters
      ;;
      CK1        = "type1.bc"
      INST       = -77701
      MAXREC     = 201
      SECPERTICK = 0.001d
      SPICETRUE  = 1L
      SEGID      = "Test type 1 CK segment"
      IFNAME     = "Test CK type 1 segment created by cspice_ckw01"
   
      ;;
      ;; 'NCOMCH' is the number of characters to reserve for the kernel's
      ;; comment area. This example doesn't write comments, so set to 
      ;; zero.
      ;;
      NCOMCH     = 0
      
      ;;
      ;; The base reference from for the rotation data.
      ;;
      REF        = "J2000"
   
      ;;
      ;; Time spacing in encoded ticks.
      ;;
      SPACING_TICKS = 10.d
      
      ;;
      ;; Time spacing in seconds
      ;;
      SPACING_SECS = SPACING_TICKS * SECPERTICK
      
      ;;
      ;; Declare an angular rate in radians per sec.
      ;;
      RATE = 1.d-2
   
      ;;
      ;; Open a new kernel.
      ;;
      cspice_ckopn, CK1, IFNAME, NCOMCH, handle
   
      ;;
      ;; Create a 4xMAXREC matrix for quaternions, and a 
      ;; 3xMAXREC for expavs.
      ;;
      quats = dblarr( 4, MAXREC )
      av    = dblarr( 3, MAXREC )
   
      ;;
      ;; Create a 3x3 double precision identity matrix.
      ;; The Icy call:
      ;;
      ;;   cspice_ident, work_mat
      ;;
      ;; performs the same function.
      ;;
      work_mat = identity( 3 )
   
      ;;
      ;; Convert the matrix to quaternions.
      ;;
      cspice_m2q, work_mat, work_quat
   
      ;;
      ;; Copy the work quaternions to the first row of
      ;; 'quats'.
      ;;
      quats[0:3] = work_quat
   
      ;;
      ;; Create an angular velocity vector. This vector is in the
      ;; 'REF' reference frame.
      ;;
      av [0:2] = [0.d, 0.d, RATE ]
   
      ;;
      ;; Create an array of encoded tick values in increments of 
      ;; 'SPACING_TICKS' with an initial value of 1000 ticks...
      ;;
      sclkdp = dindgen(MAXREC) * SPACING_TICKS
      sclkdp = sclkdp + 1000.d
   
      ;;
      ;; Fill the rest of the av and quats matrices
      ;; with simple data.
      ;;
      for i = 1, (MAXREC-1) do begin
    
         ;;
         ;; Create the transformation matrix for a rotation of 'theta' 
         ;; about the Z axis. Calculate 'theta' from the constant
         ;; angular rate 'RATE' at increments of 'SPACING_SECS'.
         ;;
         theta = ( double(i) * RATE * SPACING_SECS)
         cspice_rotmat, work_mat, theta, 3, work_mat
         
         ;;
         ;; Convert the 'work_mat' matrix to SPICE type quaternions.
         ;;
         cspice_m2q, work_mat, work_quat
   
         ;;
         ;; Store the quaternions in the 'quat' matrix.
         ;; Store angular velocity in 'av'. Both variables
         ;; represent arrays, but in IDL you can fill them
         ;; as vectors.
         ;; 
         ;;
         quats[ (i*4):((i*4)+3) ] = work_quat
         av   [ (i*3):((i*3)+2) ] = [ 0.d, 0.d, RATE ]
   
      endfor
   
      ;;
      ;; This segment contains angular velocity.
      ;;
      avflag = SPICETRUE
   
      ;;
      ;; Set the segment boundaries equal to the first and last
      ;; time for the data arrays.
      ;;
      begtim = sclkdp[      0]
      endtim = sclkdp[MAXREC-1]
   
      ;;
      ;; All information ready to write. Write to a CK type 1 segment
      ;; to the file indicated by 'handle'.
      ;;
      cspice_ckw01, handle, $
                    begtim, $
                    endtim, $
                    INST,   $
                    REF,    $
                    avflag, $
                    SEGID , $
                    sclkdp, $
                    quats,  $
                    av
   
      ;;
      ;; SAFELY close the file
      ;;
      cspice_ckcls, handle

Particulars


   None.

Required Reading


   ICY.REQ
   CK.REQ
   DAF.REQ 
   SCLK.REQ 

Version


   -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

Index_Entries

 
   write ck type_1 pointing data segment 
 



Wed Apr  5 17:57:59 2017