.help tcheck Aug91 tables
.ih
NAME
tcheck -- Check STSDAS table values.
.ih
USAGE
tcheck input chkfile
.ih
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,

.nf
ylower, yupper when ylower >= yupper
.fi

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:

.nf
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.	
.fi

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

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

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

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. 
.fi

The
following is a list of the available functions:

.nf
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,...)
.fi

.ih
PARAMETERS
.ls input [file name template]
List of tables that will be checked.
.le
.ls chkfile [file name]
Text file containing consistency checks.
.le
.ih
EXAMPLES
1. The simplest check is when a table element has one legal
value. This can be tested for as follows.

.nf
overscan when overscan != 5
.fi

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

.nf
aper_area when aper_area <= 0.0
pass_dir when detnum < 1 || detnum > 2
.fi

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

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

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

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

.ih
BUGS
.ih
REFERENCES
This task was written by Bernie Simon.
.ih 
SEE ALSO
hcheck

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