Index Page
cspice_ckw03
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_CKW03 adds a type 3 segment to a C-kernel.

   For important details concerning this module's function, please refer to
   the CSPICE routine ckw03_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 boolean signifying if the segment will contain 
               angular velocity
               
      segid    a scalar string to identify the segment
      
      sclkdp   a double precision N-vector containing the encoded
               SCLK times for the data
               
      quats    a 4xN double precision matrix of quaternions
               representing instrument pointing
               
      avvs     a 3xN double precision matrix of angular 
               velocity vectors
               
      starts   a double precision M-vector containing the encoded 
               SCLK interval start times of each interpolation
               intervals, the times must be strictly increasing and
               coincide with pointing data times
   
   the call:
   
      cspice_ckw03, handle, $ 
                    begtim, $
                    endtim, $
                    inst,   $
                    ref,    $
                    avflag, $
                    segid,  $
                    sclkdp, $
                    quats,  $
                    avvs,   $
                    starts
   
   writes the data for a type 3 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 3 segment; fill with data for a simple time 
      ;; dependent rotation and angular velocity.
      ;;
   
      ;;
      ;; Define needed parameters.
      ;;
      SPICETRUE     = 1L
      CK3           = "type3.bc"
      IFNAME        = "Test CK type 3 created by cspice_ckw03"
      INST          = -77703
      MAXREC        = 201
      SC            = -777
      SECPERTICK    = 0.001d
      SEGID         = "Test type 3 segment test CK"
      SPACING_TICKS = 10.d
   
      ;;
      ;; 'NCOMCH' defines the number of characters to reserve for the kernel's
      ;; comment area. This example needs no 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
   
      ;;
      ;; Create a 4xMAXREC matrix for quaternions, and a 
      ;; 3xMAXREC for angular velocity.
      ;;
      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. Copy to the first row 
      ;; of 'av'. 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 = t * d(theta)
         ;;               --------
         ;;               dt
         ;;
         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
   
      ;;
      ;; Create and open the new CK file.
      ;;
      cspice_ckopn, CK3, IFNAME, NCOMCH, handle
         
      ;;
      ;; Create an array start times for the interpolation intervals.
      ;; The end time for a particular interval is determined as the
      ;; time of the final data value prior in time to the next start 
      ;; time.
      ;;
      numint = MAXREC/2
      starts = dblarr( numint )
      
      for i = 0, (numint-1) do begin
         starts[i] = sclkdp[2*i]
      endfor
   
      ;;
      ;; Set the segment boundaries equal to the first and last
      ;; time in the segment.
      ;;
      begtim = sclkdp[       0]
      endtim = sclkdp[MAXREC-1]
   
      ;;
      ;; Enter the information to go in the segment descriptor.
      ;;
      ;; This segment contains angular velocity.
      ;;
      avflag = SPICETRUE
   
      ;;
      ;; All information ready to write. Write to a CK type 3 segment
      ;; to the file indicated by 'handle'.
      ;;
      cspice_ckw03, handle, $
                    begtim, $
                    endtim, $
                    INST ,  $
                    REF,    $
                    avflag, $
                    SEGID , $
                    sclkdp, $
                    quats,  $
                    av,     $
                    starts
   
      ;;
      ;; 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_3 pointing data segment 
 



Wed Apr  5 17:57:59 2017