tcheck: Check STSDAS table element values.

Package: nttools

Usage

tcheck input chkfile

Description

This task allows the user to check the correctness of an STSDAS table by printing the rows, column names, and values of selected table elements. The table elements selected are controlled by lines in the check file. Table elements are printed by placing their names on a line in the check file followed by the word "when" and a logical expression. The values of all columns listed before the "when" will be printed for each row for which the expression is true. For example,

ylower, yupper when ylower >= yupper

prints the values of the columns 'ylower' and 'yupper' for any row where 'ylower' is greater than or equal to 'yupper'. If the column names and expression are too long to fit on a line, the line can be continued by placing a backslash as the last character on the line. Lines which are blank, or start with a comment character (#), are ignored.

An expression may contain table column names and string or numerical constants. The table column names may be in either lower or upper case. If "when" is a column name, place it in upper case so its meaning will not be ambiguous. String constants may be surrounded by either single or double quotes. Numeric constants will be treated as real numbers if they contain a decimal point or integers if they do not.

The expression must have a boolean (logical) value. Boolean operators can be used in an expression in either their SPP or Fortran form:

equal           ==      .eq.    not equal               !=      .ne.
less than       <       .lt.    less than or equal      <=      .le.
greater than    >       .gt.    greater than or equal   >=      .ge.
or              ||      .or.    and                     &&      .and.
negation        !       .not.

The expression may also include the usual arithmetic operators and functions. Arguments to the trigonometric functions must be in degrees. The available operators are:

addition                +        subtraction            -
multiplication          *        division               /
negation                -        exponentiation         **
string concatenation    //

Three new functions are available in addition to the usual arithmetic functions:

row     takes no argument, returns current row number
delta   takes two dates (in CDBS format) and returns the
        number of days between them
match   returns true if the first argument matches one or more
        of the remaining arguments of the function (the arguments
        may be of any type, as long as all arguments have the
        same type.

The following is a list of the available functions:

absolute value  abs(x)       cosine             cos(x)
sine            sin(x)       tangent            tan(x)
arc cosine      acos(x)      arc sine           asin(x)
arc tangent     atan(x)      arc tangent        atan2(x,y)
exponential     exp(x)       square root        sqrt(x)
natural log     log(x)       common log         log10(x)
minimum         min(x,y)     maximum            max(x,y)
modulo          mod(x,y)     row number         row()
date difference delta(x,y)   equality           match (x,y,z,...)

Parameters

input [file name template]
List of tables that will be checked.
chkfile [file name]
Text file containing consistency checks.

Examples

1. The simplest check is when a table element has one legal value. This can be tested for as follows.

overscan when overscan != 5

2. A range of values can also be tested, as in the following expressions.

aper_area when aper_area <= 0.0
pass_dir when detnum < 1 || detnum > 2

3. If a keyword has several legal values and they do not form a range, it may be easier to use the match function.

fgwa_id when ! match(fgwa_id,"CAM","H13","H19","H27",\
"H40","H57","H78")

4. The value of one keyword may depend on the value of another. This can be tested by combining the conditions with an "and":

aper_pos when aper_id == 'A-1' && aper_pos != 'SINGLE'
polar_id when fgwa_id == 'CAM' && polar_id != 'C'

Bugs

References

This task was written by Bernie Simon.

See also

hcheck

Type "help tables opt=sys" for a description of the 'tables' package.