Table of contents
CSPICE_EKCCNT returns the number of distinct columns in a specified,
currently loaded table.
Given:
table the name of a currently loaded table.
help, table
STRING = Scalar
Case is not significant in the table name.
the call:
cspice_ekccnt, table, ccount
returns:
ccount the number of distinct columns in `table'.
help, ccount
LONG = Scalar
Columns that have the same name but belong to different
segments that are considered to be portions of the same column,
if the segments containing those columns belong to `table'.
None.
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.
1) Examine an EK. Dump the names and attributes of the columns in
each loaded table. cspice_ekccnt is used to obtain column counts.
Example code begins here.
PRO ekccnt_ex1
;;
;; Assign character arrays to translate index values.
;;
typstrs = [ "CHR", "DP", "INT", "TIME" ]
indexed = [ "FALSE", "TRUE" ]
null = [ "FALSE", "TRUE" ]
;;
;; Prompt for the EK file name.
;;
ek = ' '
read, ek, PROMPT = 'Enter name of EK to examine > '
cspice_furnsh, ek
;;
;; How many loaded tables in the active EK?
;;
cspice_ekntab, num_table
print, 'Number of tables in EK: ', num_table
print, '------------------------------' + $
'------------------------------'
;;
;; Loop over the number of tables.
;;
for i=0, (num_table - 1 ) do begin
;;
;; Retrieve the name of each table.
;;
cspice_ektnam, i, table_name
;;
;; Retrieve the number of columns for each table.
;;
cspice_ekccnt, table_name, num_cols
print
print, ' Table: ', table_name, ' number of columns: ', num_cols
for j=1, (num_cols-1) do begin
;;
;; Retrieve the column name corresponding to the
;; index j and the structure of column attributes.
;;
cspice_ekcii, table_name, j, column_name, attdsc
print
print, ' Column: ', column_name
print, ' class: ', attdsc.cclass
print, ' type: ', typstrs[attdsc.dtype]
;;
;; If a character column, return the value of the
;; string length.
;;
if ( typstrs[attdsc.dtype] EQ "CHR" ) then begin
print, ' length: ', attdsc.strlen
endif
print, ' size: ', attdsc.size
print, ' indexed: ', indexed[attdsc.indexd]
print, ' null ok: ', null[attdsc.nullok]
endfor
endfor
;;
;; Unload the kernel.
;;
cspice_unload, ek
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, using the EK named S79_CIMSSSUPa.bep to load the
Cassini Science Plan SPICE E-Kernel File based upon the
integrated science plan, the output was:
Enter name of EK to examine > S79_CIMSSSUPa.bep
Number of tables in EK: 3
------------------------------------------------------------
Table: CASSINI_SP_REQUEST number of columns: 10
Column: REQUEST_ID
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: FALSE
Column: REQUEST_TITLE
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: TRUE
Column: BEGIN_TIME
class: 2
type: TIME
size: 1
indexed: TRUE
null ok: FALSE
Column: END_TIME
class: 2
type: TIME
size: 1
indexed: TRUE
null ok: FALSE
Column: SEQUENCE
class: 3
type: CHR
length: 32
size: 1
indexed: TRUE
null ok: FALSE
Column: POINTING_AGREEMENT
class: 6
type: CHR
length: 80
size: -1
indexed: FALSE
null ok: TRUE
Column: PRIMARY_POINTING
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: TRUE
Column: SECONDARY_POINTING
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: TRUE
Column: REQ_DESCRIPTION
class: 6
type: CHR
length: 80
size: -1
indexed: FALSE
null ok: TRUE
Table: CASSINI_SP_OBSERVATION number of columns: 7
Column: OBSERVATION_ID
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: FALSE
Column: OBSERVATION_TITLE
class: 3
type: CHR
length: -1
size: 1
indexed: TRUE
null ok: FALSE
Column: SEQUENCE
class: 3
type: CHR
length: 32
size: 1
indexed: TRUE
[...]
Warning: incomplete output. Only 100 out of 143 lines have been
provided.
This routine is a utility intended for use in conjunction with
the procedure cspice_ekcii. These routines can be used to find the
names and attributes of the columns that are currently loaded.
1) If the specified table is not loaded, the error
SPICE(TABLENOTLOADED) is signaled by a routine in the call
tree of this routine.
2) If the input argument `table' is undefined, an error is
signaled by the IDL error handling system.
3) If the input argument `table' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
4) If the output argument `ccount' is not a named variable, an
error is signaled by the Icy interface.
This routine reads binary "sequence component" EK files.
In order for a binary EK file to be accessible to this routine,
the file must be "loaded" via a call to the routine cspice_eklef.
Text format EK files cannot be used by this routine; they must
first be converted by binary format by the NAIF Toolkit utility
SPACIT.
None.
EK.REQ
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.1, 31-MAY-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete
code example based on existing code fragment.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
return the number of loaded EK columns
return the count of loaded EK columns
|