  1.  NAME

  con2con - Convert the format of contour files

  2.  USAGE

  con2con [options] [file file ... ]

  3.  DESCRIPTION

  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:

  1. Data for X axis

  2. Data for Y axis

  3. Data for Z axis

  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:

  1. Time

  2. Longitude

  3. Latitude

  4. Bin depth

  5. Bin data

  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.

  4.  OPTIONS

  The following options are implemented:

     -c column_list
        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.

     -f file
        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.

     -i n
        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.

     -o file
        Specify the file for new contour data. If not specified,
        standard output is assumed.

     -x n
        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.

     -C column_list
        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:

        1. Time in decimal days

        2. Bin depth

        3. Bin data

        If conversion to the usual contour format is required, the
        default is 1,4,5, which can be used for a file containing the
        following columns:

        1. Time in decimal days

        2. Longitude in decimal degrees

        3. Latitude in decimal degrees

        4. Bin depth

        5. Bin data

     -X n
        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

  5.  DEFAULT OPTIONS

  If an external position file is specified, the default options allow a
  conversion to a more generalized contour format, where

  o  The input contour file has the following columns:

     1. Time

     2. Bin depth

     3. Bin data

     Such a file can be generated with xtract(1).

  o  The external file with additional position information correspond
     to the output of getnav.

  o  The output file has values of longitude and latitude inserted
     between time and bin depth data.

  o  Synchronization and interpolation of data is carried out on time
     data.

  6.  OUTPUT FILES

  The file specified by the -o option.

  7.  EXAMPLES

  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.

  8.  SEE ALSO

  adcpsect, columns(5), con2db(1), xtract(1),

  9.  NOTES

  This is a Perl script, and could probably be more faster and handle
  numbers in a better way if coded in C.

  10.  AUTHOR

  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999

