Index Page
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Required Reading


   CSPICE_EKIFLD initializes a new EK segment so as to allow
   fast writing.

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


      handle   the scalar integer referring to an EK file open for 
               write access
      tabnam   the scalar string holding the table name for the
               current segment, with the string no longer than
               SPICE_EK_TNAMSZ (see SpiceEK.h)  
      ncols    the scalar integer holding the count of columns 
               in the new segment; cnames and decls must have
               ncols members
      nrows    the scalar integer holding the count of rows 
               in the new segment
      cnames   an array of strings with dimension no larger than
               i.e. no more than SPICE_EK_MXCLSG elements
               for array cnames, with each string no longer
               than SPICE_EK_CSTRLN (see SpiceEK.h); the array
               elements contain the table column names
      decls    an array of strings with the number of array elements
               no larger than SPICE_EK_MXCLSG (see SpiceEK.h); the
               array elements contain the type declarations for
               each column with the Ith element of cnames and the Ith 
               element of decls apply to the Ith column in the segment. 
                     Column names must start with a letter
                     and contain only characters from the set
                     {A-Z,a-z,0-9,$,_}.  Case is not
                     The declarations are strings that contain 
                     `keyword=value' assignments that define the 
                     attributes of the columns to which they apply.
   the call:
      cspice_ekifld, handle, tabnam, ncols, nrows, cnames, $
                     decls, segno, rcptrs
      segno    the scalar integer value for the data segment
               targeted by the data write
      rcptrs   an array of integers holding  the record pointers
               for the input segment
                  The caller MUST NOT modify 'rcptrs'
   Note, write to EK segments initialized with cspice_ekifld using
   the fast column writer routines: cspice_ekaclc, cspice_ekacld,
   and cspice_ekacli.
   Note, an EK initialized with cspice_ekifld must end the segment 
   write with cspice_ekffld before closing the EK with a
   cspice_ekcls call.


   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.

      ;; Initialize needed parameters.
      SPICETRUE  = 1B
      EKNAME     = "order_db.ek"
      FNMLEN     = 50
      IFNAME     = "Test EK"
      LNMLEN     = 50
      LSK        = ""
      NCOLS      = 6
      NRESVC     = 0
      NROWS      = 9
      TABLE       = "DATAORDERS"
      ;; Load a leapseconds kernel for UTC/ET conversion.
      cspice_furnsh, LSK
      ;; 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
      cspice_ekopn, EKNAME, IFNAME, NRESVC, handle
      cnames = strarr( NCOLS )
      cdecls = strarr( NCOLS )
      cnames[0] = "ORDER_ID" 
      cdecls[0] = "DATATYPE = INTEGER, INDEXED = TRUE"
      cnames[1] = "CUSTOMER_ID"
      cdecls[1] = "DATATYPE = INTEGER, INDEXED = TRUE"
      cnames[2] = "LAST_NAME" 
      cdecls[2] = "DATATYPE = CHARACTER*(*), INDEXED  = TRUE"
      cnames[3] = "FIRST_NAME" 
      cdecls[3] = "DATATYPE = CHARACTER*(*), INDEXED  = TRUE"
      cnames[4] = "ORDER_DATE"
      cdecls[4] = "DATATYPE = TIME, INDEXED  = TRUE" 
      cnames[5] = "COST"
      cdecls[5] = "DATATYPE = DOUBLE PRECISION, "    +$
                  "INDEXED  = TRUE, NULLS_OK = TRUE"
      ;; Start the segment.  We presume the number of  rows 
      ;; of data is known in advance. 
      cspice_ekifld, handle,  TABLE,   NCOLS,  NROWS,  $  
                     cnames,   cdecls, segno,  rcptrs
      ;; At this point, arrays containing data for the 
      ;; segment's columns may be filled in.  The names 
      ;; of the data arrays are shown below. 
      ;;   Column           Data array 
      ;;   "ORDER_ID"       ordids 
      ;;   "CUSTOMER_ID"    cstids 
      ;;   "LAST_NAME"      lnames 
      ;;   "FIRST_NAME"     fnames 
      ;;   "ORDER_DATE"     odates 
      ;;   "COST"           costs 
      ;; The null flags array indicates which entries are null. 
      ;; It is ignored for columns that don't allow null 
      ;; values.  In this case, only the COST column allows 
      ;; nulls. 
      ;; Fill in data arrays and null flag arrays here.  This code
      ;; section would normally be replaced by calls to user functions
      ;; returning column values.
      ordids = lonarr( NROWS)
      cstids = lonarr( NROWS)
      costs  = dblarr( NROWS)
      ets    = dblarr( NROWS)
      fnames = strarr( NROWS)
      lnames = strarr( NROWS)
      nlflgs = lonarr( NROWS)
      wkindx = lonarr( NROWS)
      sizes  = lonarr( NROWS)
      for i = 0, (NROWS-1) do begin
         ordids[i] =  i
         cstids[i] =  i*100
         costs [i] =  double(100*i)
         fnames[i] = "Order " + string(i) + " Customer first name"
         lnames[i] = "Order " + string(i) + " Customer last name"
         date_string = '2001 Mar ' + string(i)
         cspice_utc2et, date_string, et
         ets[i] = et
         nlflgs[i]  =  SPICEFALSE
      nlflgs[1] = SPICETRUE
      ;; The sizes array shown below is ignored for scalar 
      ;; and fixed-size array columns, so we need not 
      ;; initialize it.  For variable-size arrays, the 
      ;; Ith element of the sizes array must contain the size 
      ;; of the Ith column entry in the column being written. 
      ;; Normally, the sizes array would be reset for each 
      ;; variable-size column. 
      ;; Add the columns of data to the segment.  All of the 
      ;; data for each column is written in one shot. 
      cspice_ekacli, handle, segno , "order_id", ordids, sizes,    $
                     nlflgs, rcptrs, wkindx
      cspice_ekacli, handle, segno , "customer_id", cstids, sizes, $
                     nlflgs, rcptrs, wkindx 
      cspice_ekaclc, handle, segno , "last_name", LNMLEN, lnames,  $
                     sizes , nlflgs, rcptrs     , wkindx 
      cspice_ekaclc, handle, segno, "first_name", FNMLEN, fnames,  $
                             sizes,  nlflgs     , rcptrs, wkindx
      cspice_ekacld, handle, segno , "order_date", ets, sizes,     $
                     nlflgs, rcptrs, wkindx
      cspice_ekacld, handle, segno , "cost", costs, sizes,         $
                     nlflgs, rcptrs, wkindx
      ;; Complete the segment.  The rcptrs array is that 
      ;; returned by ekifld_c. 
      cspice_ekffld, handle, segno, rcptrs
      ;; The file must be closed by a call to cspice_ekcls
      cspice_ekcls, handle
      cspice_unload, LSK



Required Reading



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


   start new E-kernel segment for fast writing 
   start new EK segment for fast writing 

Wed Apr  5 17:58:00 2017