/*----------------------------------------------------------------------

  1.  NAME

  tr_ctd - Interpolate CTD at ADCP transducer depth

  2.  USAGE

  tr_ctd control_file

  3.  DESCRIPTION

  This utility interpolates CTD data at Adcp transducer depth and
  profile times or positions, creating a list of temperature and
  salinity values. These can then be used to calibrate the speed of
  sound.

  For each time range listed in the control file, tr_ctd will read CTD
  profiles from a CODAS database and interpolate temperature and
  salinity values at the given transducer depth. It will then regrid
  these values to the specified ADCP positions or times and print them
  to the output files.

  4.  PARAMETERS

  The control file must define the following parameters:

     year_base: YYYY
        Year base to be used for converting time into decimal days. This
        value must correspond to the dates listed in the file specified
        by parameter nav_file.

     dbname: name
        Name (with path) of CTD database containing the profiles to
        process.

     nav_file: file
        Name of file containing ADCP profile times and positions. It has
        the same format as the output from getnav.

     tr_depth: float
        Estimated transducer depth in meter.

     x_axis: keyword
        Keyword specifying the interpolation axis of CTD data. Possible
        values are time, longitude and latitude. If CTD data have been
        collected with a CTD SeaSoar together with ADCP data, then time
        is probably the best choice. If calibration of sound speed must
        be carried out with data from a separate section, position
        values along the section must be chosen.

     output name
        Base name (with path) for output files.

  5.  OPTIONS

  In addition to the parameters listed above, the following options are
  available:

     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.

     steps: n
        Number of profiles to step within the CTD database.

     z_gap: float
        When regriding CTD profile data to transducer depth, a call to
        fill_gaps is performed. If the distance from the next good data
        to transducer depth is too large, vertical filling is not a good
        idea, but horizontal interpolation with adjacent profiles will
        give a better result. You can adjust this by specifying the
        maximal allowed vertical gap (in the units of CTD pressure) for
        vertical filling.

     lon_180
        Specify this for converting longitude values between -180 and
        +180 degree before using them.

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

  6.  TIME RANGES

  Finally, the control file is terminated by a list of time ranges.  See
  time_rng(5) for the syntax of these.

  7.  OUTPUT FILES

  Two files are generated. They have the name specified by parameter
  output, but the one with suffix tem contains interpolated temperature
  values, while the one with suffix sal contains interpolated salinity
  values. The format of these files is the same and has the following
  columns:

  1. ADCP time in decimal days, sorted in ascending order

  2. Interpolated CTD values (temperature or salinity)

  3. ADCP longitude in decimal degree

  4. ADCP latitude in decimal degree

  8.  AUTHOR

  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999



----------------------------------------------------------------------*/