| ekcii |
|
Table of contents
Procedure
EKCII ( EK, column info by index )
ENTRY EKCII ( TABLE, CINDEX, COLUMN, ATTDSC )
Abstract
Return attribute information about a column belonging to a loaded
EK table, specifying the column by table and index.
Required_Reading
EK
Keywords
EK
FILES
UTILITY
Declarations
CHARACTER*(*) TABLE
INTEGER CINDEX
CHARACTER*(*) COLUMN
INTEGER ATTDSC ( ADSCSZ )
Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
TABLE I Name of table containing column.
CINDEX I Index of column whose attributes are to be found.
COLUMN O Name of column.
ATTDSC O Column attribute descriptor.
Detailed_Input
TABLE is the name of a loaded EK table. Case is not
significant.
CINDEX is the index, within TABLE's column attribute
table, of the column whose attributes are to be
found. The indices of the column table entries
range from 1 to CCOUNT, where CCOUNT is the value
returned by the entry point EKCCNT.
Detailed_Output
COLUMN is the name of the specified column.
ATTDSC is a column attribute descriptor. ATTDSC is an
integer array containing descriptive information
that applies uniformly to all loaded columns
having the name COLUMN. The following parameter
values occur in ATTDSC:
IFALSE: -1
ITRUE: 1
CHR: 1
DP: 2
INT: 3
TIME: 4
The meanings of the elements of ATTDSC are given
below. The indices of the elements are
parameterized; the parameter values are defined
in the include file ekattdsc.inc.
ATTDSC(ATTCLS): Column class code
ATTDSC(ATTTYP): Data type code---CHR, DP, INT,
or TIME
ATTDSC(ATTLEN): String length; applies to CHR
type. Value is IFALSE for
variable-length strings.
ATTDSC(ATTSIZ): Column entry size; value is
IFALSE for variable-size
columns. Here `size' refers
to the number of array
elements in a column entry.
ATTDSC(ATTIDX): Index flag; value is ITRUE if
column is indexed, IFALSE
otherwise.
ATTDSC(ATTNFL): Null flag; value is ITRUE if
column may contain null
values, IFALSE otherwise.
Parameters
ADSCSZ is the size of column attribute descriptor.
(Defined in ekattdsc.inc.)
Exceptions
1) If the specified table is not loaded, the error
SPICE(TABLENOTLOADED) is signaled.
2) If the input argument CINDEX is out of range, the error
SPICE(INVALIDINDEX) is signaled.
Files
See the header of EKQMGR for a description of files used
by this routine.
Particulars
This routine is a utility that allows a calling routine to
determine the attributes of the currently loaded columns.
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) Dump the names and attributes of the columns in each loaded
table.
Example code begins here.
PROGRAM EKCII_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 constants.
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 file named vo_sedr.bdb to load the
Viking Orbiter Image SEDR Data, the output was:
Enter name of EK to examine > vo_sedr.bdb
Number of tables in EK: 1
------------------------------------------------------------
TABLE = VIKING_SEDR_DATA
COLUMN = IMAGE_ID
TYPE = CHR
STRING LENGTH = 6
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = IMAGE_NUMBER
TYPE = INT
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = SPACECRAFT_ID
TYPE = CHR
STRING LENGTH = 3
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = IMAGE_TIME
TYPE = TIME
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = INSTRUMENT_ID
TYPE = CHR
STRING LENGTH = 4
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = GAIN_MODE_ID
TYPE = CHR
STRING LENGTH = 4
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = FLOOD_MODE_ID
TYPE = CHR
STRING LENGTH = 3
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = OFFSET_MODE_ID
TYPE = CHR
STRING LENGTH = 3
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = FILTER_ID
TYPE = INT
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = EXPOSURE_DURATION
TYPE = DP
SIZE = 1
INDEXED
NULL VALUES ALLOWED
COLUMN = PLATFORM_IN_MOTION
TYPE = CHR
STRING LENGTH = 3
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = PLATFORM_CONE
TYPE = DP
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = PLATFORM_CLOCK
TYPE = DP
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
COLUMN = PLATFORM_TWIST
TYPE = DP
SIZE = 1
NOT INDEXED
NULL VALUES ALLOWED
Restrictions
None.
Literature_References
None.
Author_and_Institution
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
B.V. Semenov (JPL)
Version
SPICELIB Version 2.1.0, 06-JUL-2021 (JDR)
Added IMPLICIT NONE statement.
Edited header to comply with NAIF standard.
Added complete code example from existing code fragment.
SPICELIB Version 2.0.1, 10-FEB-2014 (BVS)
Added description of ADSCSZ to the $Parameters section of the
header.
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)
Previous version line was changed from "Beta" to "SPICELIB."
SPICELIB Version 1.0.0, 23-OCT-1995 (NJB)
|
Fri Dec 31 18:36:18 2021