| ekccnt |
|
Table of contents
Procedure
EKCCNT ( EK, column count )
ENTRY EKCCNT ( TABLE, CCOUNT )
Abstract
Return the number of distinct columns in a specified, currently
loaded table.
Required_Reading
EK
Keywords
EK
FILES
UTILITY
Declarations
CHARACTER*(*) TABLE
INTEGER CCOUNT
Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
TABLE I Name of table.
CCOUNT O Count of distinct, currently loaded columns.
Detailed_Input
TABLE is the name of a currently loaded table. Case
is not significant in the table name.
Detailed_Output
CCOUNT is the number of distinct columns in TABLE.
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.
Parameters
None.
Exceptions
1) If the specified table is not loaded, the error
SPICE(TABLENOTLOADED) is signaled.
Files
See the header of EKQMGR for a description of files used
by this routine.
Particulars
This routine is a utility intended for use in conjunction with
the entry point EKCII. These routines can be used to find the
names and attributes of the columns that are currently loaded.
Examples
The numerical results shown for this example may differ across
platforms. The results depend on the SPICE kernels used as
input, the compiler and supporting libraries, and the machine
specific arithmetic implementation.
1) Examine an EK. Dump the names and attributes of the columns in
each loaded table. EKCCNT is used to obtain column counts.
Example code begins here.
PROGRAM EKCCNT_EX1
IMPLICIT NONE
C
C Include EK parameter declarations:
C
C ekattdsc.inc: EK Column Attribute Descriptor
C Parameters
C ekcnamsz.inc: EK Column Name Size
C ektnamsz.inc: EK Table Name Size
C ektype.inc: EK Data Types
C
INCLUDE 'ekattdsc.inc'
INCLUDE 'ekcnamsz.inc'
INCLUDE 'ektnamsz.inc'
INCLUDE 'ektype.inc'
C
C Local parameters.
C
INTEGER FILEN
PARAMETER ( FILEN = 255 )
C
C Local variables.
C
CHARACTER*(CNAMSZ) COLNAM
CHARACTER*(FILEN) EKFILE
CHARACTER*(TNAMSZ) TABNAM
INTEGER ATTDSC ( ADSCSZ )
INTEGER I
INTEGER NCOLS
INTEGER NTAB
INTEGER TAB
C
C Prompt for the EK file name.
C
CALL PROMPT ( 'Enter name of EK to examine > ', EKFILE )
CALL FURNSH ( EKFILE )
C
C Get the number of loaded tables.
C
CALL EKNTAB ( NTAB )
WRITE(*,*) 'Number of tables in EK:', NTAB
DO TAB = 1, NTAB
C
C Get the name of the current table, and look up
C the column count for this table.
C
CALL EKTNAM ( TAB, TABNAM )
CALL EKCCNT ( TABNAM, NCOLS )
WRITE(*,*) '------------------------------'
. // '------------------------------'
WRITE(*,*) 'TABLE = ', TABNAM
WRITE(*,*) ' '
C
C For each column in the current table, look up the
C column's attributes. The attribute block
C index parameters are defined in the include file
C ekattdsc.inc.
C
DO I = 1, NCOLS
CALL EKCII ( TABNAM, I, COLNAM, ATTDSC )
WRITE (*,*) 'COLUMN = ', COLNAM
C
C Write out the current column's data type.
C
IF ( ATTDSC(ATTTYP) .EQ. CHR ) THEN
WRITE (*,*) ' TYPE = CHR'
IF ( ATTDSC(ATTLEN) .EQ. -1 ) THEN
WRITE (*,*) ' STRING LENGTH = VARIABLE.'
ELSE
WRITE (*,'(A,I2)') ' STRING LENGTH = ',
. ATTDSC(ATTLEN)
END IF
ELSE IF ( ATTDSC(ATTTYP) .EQ. DP ) THEN
WRITE (*,*) ' TYPE = DP'
ELSE IF ( ATTDSC(ATTTYP) .EQ. INT ) THEN
WRITE (*,*) ' TYPE = INT'
ELSE
WRITE (*,*) ' TYPE = TIME'
END IF
C
C Write out the current column's entry size.
C
WRITE (*,'(A,I2)') ' SIZE = ', ATTDSC(ATTSIZ)
C
C Indicate whether the current column is indexed.
C
IF ( ATTDSC(ATTIDX) .EQ. -1 ) THEN
WRITE (*,*) ' NOT INDEXED'
ELSE
WRITE (*,*) ' INDEXED'
END IF
C
C Indicate whether the current column allows
C null values.
C
IF ( ATTDSC(ATTNFL) .EQ. -1 ) THEN
WRITE (*,*) ' NULL VALUES NOT ALLOWED'
ELSE
WRITE (*,*) ' NULL VALUES ALLOWED'
END IF
END DO
END DO
END
When this program was executed on a Mac/Intel/gfortran/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
COLUMN = SUBSYSTEM
TYPE = CHR
STRING LENGTH = 32
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = REQUEST_ID
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = REQUEST_TITLE
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = BEGIN_TIME
TYPE = TIME
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = END_TIME
TYPE = TIME
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = SEQUENCE
TYPE = CHR
STRING LENGTH = 32
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = POINTING_AGREEMENT
TYPE = CHR
STRING LENGTH = 80
SIZE = -1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = PRIMARY_POINTING
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = SECONDARY_POINTING
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = REQ_DESCRIPTION
TYPE = CHR
STRING LENGTH = 80
SIZE = -1
NOT INDEXED
NULL VALUES ALLOWED
------------------------------------------------------------
TABLE = CASSINI_SP_OBSERVATION
COLUMN = SUBSYSTEM
TYPE = CHR
STRING LENGTH = 32
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = OBSERVATION_ID
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = OBSERVATION_TITLE
TYPE = CHR
STRING LENGTH = VARIABLE.
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = SEQUENCE
TYPE = CHR
STRING LENGTH = 32
SIZE = 1
INDEXED
NULL VALUES NOT ALLOWED
COLUMN = SCIENCE_OBJECTIVE
TYPE = CHR
STRING LENGTH = 80
SIZE = -1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = OBS_DESCRIPTION
TYPE = CHR
STRING LENGTH = 80
SIZE = -1
[...]
Warning: incomplete output. Only 100 out of 129 lines have been
provided.
Restrictions
None.
Literature_References
None.
Author_and_Institution
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
Version
SPICELIB Version 2.1.0, 06-JUL-2021 (JDR)
Added IMPLICIT NONE statement.
Edited the header to comply with NAIF standard. Added complete
code example based on existing code fragment.
SPICELIB Version 2.0.0, 16-NOV-2001 (NJB)
Bug fix: When an already loaded kernel is opened with EKOPR,
it now has its link count reset to 1 via a call to EKCLS.
SPICELIB Version 1.0.1, 07-JUL-1996 (NJB)
Misspelling of "conjunction" was fixed.
SPICELIB Version 1.0.0, 23-OCT-1995 (NJB)
|
Fri Dec 31 18:36:18 2021