  1.  NAME

  con2db - Convert a contour data file into a CODAS database

  2.  USAGE

  con2db control_file

  3.  DESCRIPTION

  This utility reads data from a generalized contour data file and loads
  it into a CODAS database. The database is defined in the producer
  definition file con2db.def. The input file has the following columns:

  1. Time in decimal days

  2. Longitude in decimal degree

  3. Latitude in decimal degree

  4. Data for variable 1

  5. Data for variable 2

  6. etc

  This is not exactly the same contour format as the one generated by
  adcpsect. However, full description of profile time and positions is
  required for creating a database to be used efficiently. In order to
  generate such a file from a contour file generated by adcpsect and,
  for example the position file generated by getnav, use the Perl script
  con2con(1).

  The lines must be sorted along increasing time values, then longitude
  and latitude values in order for con2db to work properly. This is
  necessary in order to detect automatically profile changes.

  Data are read from the input file as float and converted according to
  the variable type specified in the producer definition file. Variables
  into which data should be loaded are specified by their name, as it
  appears in the producer definition file. Element of structures are not
  implemented. For example, bin depth is DEPTH, eastward and northward
  velocities are U and V, error velocity is ERROR_VEL and so on. See
  also varnames(5) for more information.

  In order to be used by other utilities, the profile flags and access
  variable structure are filled with default values. These are:

     PROFILE_FLAGS   ' '

     ACCESS_VARIABLES

        first_good_bin   0

        last_good_bin    n_var
           where n_var is the number of profile data which is expected
           to be the number of bins.

        U_ship_absolute   0.0

        V_ship_absolute   0.0

        user_flag_X       0
           where X is a number from 1 to 4.

  The number of bins is determined as the number of different block data
  through the whole file. Each specified block variable is parsed and
  the maximal number of different values is kept. Hence, different
  blocks must be loaded by successive run of con2db. However, data in
  columns specified as block variables need not to be sorted. Profiles
  with less data than the largest one are filled with bad values.

  4.  PARAMETERS

  The following parameters must be specified in the control file:

     year_base: YYYY
        Year base used to determine the time in decimal days found in
        the first column of the input file.

     dbname database name
        Name of database in which data from the contour file should be
        loaded.

     prdfile: file
        Name (with path) to the producer definition file for con2db
        CODAS database.

     confile: file
        Name (with path) of input file containing contour data to be
        loaded.

  5.  OPTIONS

  In addition, the following options allow to control the behaviour of
  con2db:

     OPTIONS:
        This key word can be used to improve the clarity of the control
        file and specify the beginning of options. It has no effect.

     profile_variables:
        This option lists which profile variables to load and from which
        columns they are to be read. It must be terminated with the
        keyword end:

        variable_name column_number

        variable_name column_number

        ...

        end

     block_variables:
        This option lists which block variables to load and from which
        columns they are to be read. It must be terminated with the
        keyword end:

        variable_name column_number

        variable_name column_number

        ...

        end

     block_comments:
        This option specifies an information text to be loaded as the
        block comment. This is quite useful since databases generated
        this way are not complete. Hence, it is a good idea to specify
        where data come from. New lines are preserved, however leading
        and trailing spaces are removed. The text must be terminated by
        the keyword end on a line by itself:

        text

        text

        ...

        end

     end
        This keyword is mandatory and terminates the list of selected
        options.

  6.  OUTPUT FILES

  The specified CODAS database files.

  7.  SEE ALSO

  con2con(1)

  8.  AUTHOR

  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999

