con2con [options] [file file ... ]
This utility converts contour files into more generalized contour files and vice versa. Contour files have usually the same format as those created by the contour product with adcpsect or xtract(1). They have typically the following columns:
where data for the different Y grid points at the same X location appear successively. If the file has been created with
xtract(1), more than one column of data for the Z axis can be present. A more generalized contour file will contain additional X position information. This is used for example with
con2db(1), where both TIME and POSITION are required to locate a profile. In this case, the file has the following columns:
where several columns with different bin data can appear. This utility can be used to transform files from one format to the other.
In order to generate a more generalized contour file, one has to specify a position file with the -f option. If this option is not specified, a transformation to a usual contour file is assumed. In the former case, data from both both input files have to synchronized. This is done by specifying which columns contain data of the same variable in both files. Values from the position file are interpolated to those in the contour file, so that grid points do not need to match. This allows to use a contour file from adcpsect together with the output from getnav.
If no contour files are specified on the command line, standard input is assumed. Output is directed by default to standard output, unless an output file is specified with option -o. Input data must be separated by white spaces. Output data are written with format %15.6f and separated by a space. This utility can handle bad data which are defined with value 1.0E38.
Although this utility was created to manipulate files with contour data, it is supplied with many options and can in fact be used to perform other operations on file, such as filter out columns, changing the order of columns or inserting columns from another file.
The following options are implemented:
List of columns to read from the file specified with option
-f. Data from these columns will be inserted in the
same order as they appear in the list. See
columns(5)
for information on how to specify these columns. The default is
2,3 which corresponds to files generated by
getnav.
Specify the file containing additional position data. No
default is supplied for this option. If not specified, a
conversion to a usual and more simpler contour format will be
carried out.
Specify where in the input contour file data from the external
file should be inserted. The value of n must
correspond to a column number. All specified columns with option
-c will be inserted, starting from this column number.
Column numbering starts from one. Default is 2.
Specify the file for new contour data. If not specified,
standard output is assumed.
Specify the column for synchronization of data. This the number
of the column in the external file that contains data which
appears also in the input contour file (see option -X).
Column numbering starts from one. Default is 1.
List of columns to read from the input control file. Data from these columns will be written in the same order as they appear in the list. See columns(5) for information on how to specify these columns. If a more generalized contour file is to be created, the default is 1,2,3. This allows to have input files with the following columns:
Specify the column for synchronization of data. This the number of the column in the input contour file that contains data which appears also in the external file (see option -x). Column numbering starts from one. Default is 1
If an external position file is specified, the default options allow a conversion to a more generalized contour format, where
The file specified by the -o option.
Assuming getnav.nav is the file generated by getnav and adcpsect.con is the file generated by adcpsect, with the longitude as the x-axis for contours (found in the first column) and both U and V as bin data (found in the third and fourth columns, the second column containing bin depths). Then,
con2con -f getnav.nav \
-c '1,3' -x 2 -i 2 \
-C '1,2,3,4' -X 1 adcpsect.con
will generate a more generalized contour file, inserting values of time and latitude (option -c) in the second aand third columns (option -i). All input columns from the contour file are kept (option -C). Synchronization of both files and interpolation of data from getnav.nav on the grid defined in adcpsect.con is carried out along longitude (options -x and -X.
In the example above, output is written to standard output. Piping it into a second call to con2con, such as
con2con -C '2,1,3-6' -o output.con
will generate file output.con with columns containing longitude and time data swapped.
adcpsect,
This is a Perl script, and could probably be more faster and handle numbers in a better way if coded in C.
Pierre Jaccard, Geophysical Institute, University of Bergen, 1999