Help for ASC2TCL
PURPOSE:
asc2tcl gets a value (int, double, or string) and puts it into
a TAE TCL variable. It can find the value by position in the
file, position in a line in the file, or position after a keyword
in the file. The separators can be whitespaces, commas, or both.
If the selection is not found, or wrong type, etc., a special value
of -999 (int) -999.0 (real) or "-999" (character string) is output
to the TAE TCL variable.
(.met) files are a special case... the keyword option will find a
specific keyword and the value will be taken from the next line that has
that has the "VALUE =" followed by the value in quotes.
If more than one value is desired, keyword is a vector input with up
to 50 values, and the output variables v2,..v50 are provided. The
other parameters are not vectorized and so the single values for the
other parameters are applied to each case of the multiple get.
EXECUTION:
Examples
asc2tcl LOCATIONS seq=7 val=latitude vtype=8
gets the 7th number from the file LOCATIONS and puts
into the TCL variable latitude
asc2tcl LOCATIONS seq=7 val=latitude vtype=8 'comma
gets the 7th number from the file LOCATIONS and puts
into the TCL variable latitude, numbers are separated
by commas
asc2tcl LOCATIONS seq=7 lineno=2 val=latitude vtype=8 'comma
gets the 7th number starting from the second line
from the file LOCATIONS and puts into the TCL variable
latitude, numbers are separated by commas
asc2tcl LOCATIONS seq=2 keyword="GZERO =" val=latitude vtype=8
gets the 2d number starting from text GZERO = from
the file LOCATIONS and puts into the TCL variable
latitude. Note that the equals sign and the space
preceding it are part of the text.
OPERATION:
asc2tcl does not use VICAR I/O. It uses C I/O to parse the
input per the parameters to find the value to put into the
TCL variable.
TIMING:
As fast as C can read the lines.
ORIGINAL PROGRAMMER: A. Zobrist 26 May 2000
COGNIZANT PROGRAMMER: A. Zobrist 26 May 2000
REVISION HISTORY
2000-06-26 AZ - Initial version
2002-10-17 AZ - Fix blanks in keyword and add 'MET format
2006-04-04 AZ - allow leading blanks in number
2006-05-16 AZ - 50 inputs for amt project speedup
2008-01-02 WLB - switched to USES_ANSI_C AND LIB_CARTO; misc cleanup
2011-05-25 RJB - Added warning when input file not found; gives
[TAE-PRCSTRM] Abnormal process termination; process status code = 11.;
[not a graceful way to report missing file]
removed all warnings with gcc4.4.4
Put in fseek in code due to failure with met keyword, which also gave
[TAE-PRCSTRM] Abnormal process termination; process status code = 11.;
2011-09-02 RJB - Removed a printf statment that printed out "vtype <number>"
2012-07-02 RJB - replaced cartlab's zifmessage with zvmessage
and removed cartoVicarProto.h to make compatible
with transfer to MIPL
2013-09-26 RJB - Fixed pointer for long files, increased MAXTEXT value to 25000
2016-01-13 WLB - Migrated to MIPL; replaced printf with zifmessage
2019-06-12 WLB - IDS-7925: null-terminated some buffers
PARAMETERS:
INP
Ascii input file name
SEQUENCE
the position of the item
desired
LINENO
skip to this line before
counting items to sequence
KEYWORD
skip to this text before
counting items to sequence
can have internal blanks
VAL
TAE TCL name without &, gets
the found value or -999
VTYPE
0 - string
2 - integer
4 - integer
7 - double
8 - double
V2
TAE TCL name 2
V3
TAE TCL name 3
V4
TAE TCL name 4
V5
TAE TCL name 5
V6
TAE TCL name 6
V7
TAE TCL name 7
V8
TAE TCL name 8
V9
TAE TCL name 9
V10
TAE TCL name 10
V11
TAE TCL name 11
V12
TAE TCL name 12
V13
TAE TCL name 13
V14
TAE TCL name 14
V15
TAE TCL name 15
V16
TAE TCL name 16
V17
TAE TCL name 17
V18
TAE TCL name 18
V19
TAE TCL name 19
V20
TAE TCL name 20
V21
TAE TCL name 21
V22
TAE TCL name 22
V23
TAE TCL name 23
V24
TAE TCL name 24
V25
TAE TCL name 25
V26
TAE TCL name 26
V27
TAE TCL name 27
V28
TAE TCL name 28
V29
TAE TCL name 29
V30
TAE TCL name 30
V31
TAE TCL name 31
V32
TAE TCL name 32
V33
TAE TCL name 33
V34
TAE TCL name 34
V35
TAE TCL name 35
V36
TAE TCL name 36
V37
TAE TCL name 37
V38
TAE TCL name 38
V39
TAE TCL name 39
V40
TAE TCL name 40
V41
TAE TCL name 41
V42
TAE TCL name 42
V43
TAE TCL name 43
V44
TAE TCL name 44
V45
TAE TCL name 45
V46
TAE TCL name 46
V47
TAE TCL name 47
V48
TAE TCL name 48
V49
TAE TCL name 49
V50
TAE TCL name 50
BTRIM
trims from beginning of
string result
ETRIM
trims from end of
string result
SEPTYPE
SPACE - blanks, tabs, retns
COMMA - commas or spaces
MET
use this to find a value for
a keyword in a .met file
See Examples:
Cognizant Programmer: