scan_sbe User Manual

jaccard@gfi.uib.no
13 December 2000


Table of Contents


1. USAGE

scan_sbe [options] <name1> <name2> ...

where <name> arguments must contain the path to SBE CTD header files and optionally the beginning of each file name.


2. DESCRIPTION

Parses all header files in specified directory and eventually beginning with the given name and generate for each of them a new standard header file. Parsing is carried out by a lexical scanner defined in file scan_sbe.lex which must be in the working directory. The new header files are generated in the working directory and have the same name as their sources. Hence, scan_sbe cannot be run in the directory where sources are located, or these would be overwritten. Field which may not be present in the source files can be inserted with a default value in the new header files.


3. OPTIONS

The following options are supported


4. LEXICAL ANALYSER

Header fields and their elements are defined in the lex file scan_sbe.lex. This file specifies how each header line should be parsed. Once a header line as been parsed successfully, the next one is considered. Hence, the order in which definitions appear in the lex file is important.

Comments are allowed and begin with a # as the first non-blank character. The rest of the line is ignored. Each definition contains the regular expression that should match a specified header line, followed by a list of keywords defining the format for reading and extracting information from the line. Keywords must be enclosed between % not to confuse them with word in the header. Implemented keywords are


5. EXAMPLES

To read and extract the following header lines


  * Latitude = 64 N 25' 33"
  * Depth :    716m
  * Station Number = #4

the lex file should contain the following lines


  * Latitude = %DLATI% %HLATC% %MLATI%' %SLATI%"
  * Depth : %BOTTOM%m
  * Station Number = #%STATION%

Now, assuming some header files have the following syntax


  * LAT: 70 20.1
  * STA: 3
  * BTM: 234

the following definitions could be added to the lex file in order to extract information from both syntax in one single run.


  * LAT: %DLATI% %MLATF%
  * STA: %STATION%
  * BTM: %BOTTOM%

Note that for the latter case, scan_sbe must be called with option -N (or -S in order to specify a default hemisphere for latitudes.


6. OUTPUT FORMAT

The generated header file contains at least the same number of fields than its source file. Output format of some fields such as time and position are coded into the source code and cannot be changed without recompiling scan_sbe. This is intentional and helps keeping a standard syntax for header files.