Index Page
cspice_ekinsr
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_EKINSR inserts a new, empty record into specified EK
   segment at a specified index.

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

I/O

   
   Given:
   
      handle   the scalar integer referring to an EK file open for 
               write access
      segno    the scalar integer indicating the EK segment
               of interest
      recno    the scalar integer indicating the index of the
               record of interest
   
   the call:
   
      cspice_ekinsr, handle, segno, recno
   
   inserts a new record at index 'recno' in EK segment 'segno' from 
   the EK referred to 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.

   
      ;;
      ;; Constants
      ;;
      SPICETRUE        = 1B
      SPICEFALSE       = 0B
      SPICE_EK_CNAMSZ  = 32
      SPICE_EK_CSTRLN  = SPICE_EK_CNAMSZ + 1  
      SPICE_EK_TNAMSZ  = 64
      SPICE_EK_TSTRLN  = SPICE_EK_TNAMSZ + 1 
      EKNAME           = "test.ek"
      IFNAME           = "Test EK"
      NCOLS            = 1
      NROWS            = 100
      NRESVC           = 0
      TABLE            = "SCALAR_DATA"
      MAXVAL           = 10
      
      ;;
      ;; Declare memory for the column data.
      ;;
      ivals  = intarr( MAXVAL )
         
      ;;
      ;; Open a new EK file.  For simplicity, we won't 
      ;; reserve space for the comment area, so the 
      ;; number of reserved comment characters is zero. 
      ;; The constant IFNAME is the internal file name. 
      ;;   
      if ( cspice_exists (EKNAME) ) then begin
         file_delete, EKNAME
      endif
      
      ;;
      ;; Create the new EK.
      ;;
      cspice_ekopn, EKNAME, IFNAME, NRESVC, handle
             
      ;;
      ;; Set up the table and column names and declarations 
      ;; for the SCALAR_DATA segment.
      ;;
      cdecls = strarr(NCOLS)
      cnames = strarr(NCOLS)
   
      cnames[0] = "INT_COL_1"
      cdecls[0] = "DATATYPE = INTEGER, INDEXED  = TRUE, " +$
                  "NULLS_OK = TRUE"
   
      ;;
      ;; Start the segment.
      ;;
      cspice_ekbseg, handle, TABLE, NCOLS, cnames, cdecls, segno
      
      ;;
      ;; Add NROWS simple data values.
      ;;
      for i = 0, (NROWS-1) do begin
      
         cspice_ekappr, handle, segno, recno
      
         isnull   =  SPICEFALSE
      
         ivals[0] = i
         cspice_ekacei, handle, segno,  recno,  cnames[0], $
                        1,      ivals,  isnull
   
      endfor
      
      ;;
      ;; Summarize the EK.
      ;;
      cspice_ekssum, handle,  segno, sum_nrow, sum_ncol, $
                     tabnam, cnames, cclass  , dtype   , $ 
                     size  , strlen, indexd  , nullok
   
      ;;
      ;; Display the number of rows and columns in the EK.
      ;;
      print, 'Number of rows before delete: ', sum_nrow
      
      ;; End the file.
      ;;
      cspice_ekcls, handle
      
      ;;
      ;; Update the EK: delete half the records
      ;; via a cspice_ekdelr call. First, open the file for 
      ;; write access.
      ;;
      cspice_ekopw, EKNAME, handle
      
      ;;
      ;; Perform the delete. Delete every other record.
      ;; 
      for i = 0,  ( (NROWS/2) - 1) do begin
         cspice_ekdelr, handle, 0, i
      endfor
      
      ;;
      ;; Summarize the EK.
      ;;
      cspice_ekssum, handle,  segno, sum_nrow, sum_ncol,  $
                     tabnam, cnames, cclass  , dtype   ,  $ 
                     size  , strlen, indexd  , nullok
      
      ;;
      ;; Display the number of rows and columns in the EK.
      ;;
      print, 'Number of rows after delete : ', sum_nrow
      
      ;;
      ;; Insert new data into the deleted records.
      ;;
      for i = 0, ( NROWS - 1 ), 2 do begin
   
         recno = i;
   
         cspice_ekinsr, handle, segno, recno
   
         ivals[0] = i
         isnull   =  0
   
         cspice_ekacei, handle, segno,  recno,  cnames[0], $
                        1,      ivals,  isnull 
   
      endfor
   
      ;;
      ;; Summarize the EK.
      ;;
      cspice_ekssum, handle,  segno, sum_nrow, sum_ncol,  $
                     tabnam, cnames, cclass  , dtype   ,  $ 
                     size  , strlen, indexd  , nullok
      
      ;;
      ;; Display the number of rows and columns in the EK.
      ;;
      print, 'Number of rows after insert : ', sum_nrow
      
      ;;
      ;; End the file.
      ;;
      cspice_ekcls, handle
   
   IDL outputs:
   
      Number of rows before delete:     100
      Number of rows after delete :      50
      Number of rows after insert :     100
   

Particulars


   None.

Required Reading


   ICY.REQ
   EK.REQ

Version


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

Index_Entries

 
   insert record into EK segment 
 



Wed Apr  5 17:58:00 2017