
/******************************************************************************

  FILE:  adcp_hm.def

         This producer definition file is used with the [[process]] program
         to load averaged ADCP data from NB Raw files into a CODAS database.

-------------------------------------------------------------------------------
  PRODUCER DEFINITION FILE STRUCTURE:

  DATASET_ID        < insttype________________________ >
                    { a 32-character string, where the first 8 chars.
                      indicate the type of instrument, e.g., ADCP-VM,
                      and the remainder can be used for anything }
  PRODUCER_ID       < cciippinst______________________ >
                    { a 32-character string, where cc = 2-char. NODC country
                      code, ii = 2-char. NODC institution code, pp = 2-char.
                      NODC platform code, inst = 4-char. instrument ID (unique
                      to site), and the remainder can be used for anything }
  BLOCK_DIR_TYPE    < 0 >
                    { block directory can have one or more keys;
                      currently there is only one type = 0 (time) }
  PROFILE_DIR_TYPE  < 0 | 1 | 2 | 3 >
                    { profile directory can have one or more keys,
                      depending on the nature of the data collected:
                      0 = time only (for fixed installations)
                      1 = time and position (moving installations)
                      2 = time and depth range
                      3 = time, position, and depth range }

  { data type definition(s), one for each variable to be loaded: }
  < freq > < id > < value_type > < data_name > < offset > < scale > < units >
  .
  .
  .
    { where       freq = < BLOCK_VAR | PROFILE_VAR | UNUSED >
                         refering to how often the data item will be loaded:
                         BLOCK_VAR   = once per block file
                                       (data varies only from block to block)
                         PROFILE_VAR = once per profile
                                       (data varies from profile to profile)
                         UNUSED      = not loaded at all
                    id = unique numeric code associated with the data item
            value_type = < BYTE | UBYTE | SHORT | ... >    (see below)
                         choose the type that minimizes storage requirements
                         but is sufficient to accommodate the range of values
                         that type can assume:

                         Value   Bytes of                Value
                         Type    Storage                 Range
                         -----   --------   ---------------------------------
                         BYTE       1                 -128 to +127
                         UBYTE      1                    0 to +255
                         SHORT      2               -32768 to +32767
                         USHORT     2                    0 to +65535
                         LONG       4       -2,147,483,648 to +2,147,483,647
                         ULONG      4                    0 to +4,294,967,295
                         FLOAT      4              -1.0e38 to +1.0e38
                         DOUBLE     8              -1.0e38 to +1.0e38
                         CHAR       1                printable ASCII
                         TEXT       1                printable ASCII
                         STRUCT  variable          depends on elements
             data_name = name of data item (max. 20 chars., no spaces)
                offset = a constant amount to add (subtract) to the data values
                         when storing (retrieving); useful when a data item
                         can be squeezed into a smaller value_type by
                         performing this offset; set to 0 if no offset
                 scale = a scaling factor to apply to the data values when
                         storing and retrieving; useful when a data item
                         can be squeezed into a smaller value_type by
                         scaling; set to 1 if no scaling
                 units = mks units (12 chars. or less) or "none" if unit-less }

  { structure defintion(s), one for each STRUCT-type variable to be loaded: }
  [ DEFINE_STRUCT <struct_name> <no. of elements>
      ELEM <no. of instances> <value type> <element name> <units>
      .
      .
      .
      ]
  .
  .
  .
    { where struct_name = name of data item that is of STRUCT type
                          (exactly as it appears in data definition section)
        no. of elements = no. of ELEM lines that immediately follow
       no. of instances = how many such ELEM (1 if single-valued; >1 if array)
             value type = < BYTE | UBYTE | SHORT | ... > (see above)
           element name = name unique within the structure definition
                          max. 20 characters, no spaces
                  units = mks unit (12 chars. or less) or "none" if unit-less }
-----------------------------------------------------------------------------*/

DATASET_ID         ADCP-VM    /* vessel-mounted ADCP */
PRODUCER_ID        5810AA; Pierre Jaccard
BLOCK_DIR_TYPE     0
PROFILE_DIR_TYPE   3          /* time, position, and depth range keys */
/*
        DATA DEFINITION FOR ADCP DATA

frequency     id value_type  data_name         offset  scale  units
*/
BLOCK_VAR      0  SHORT     DEPTH                0       1       m
UNUSED         1  USHORT    TEMPERATURE          -10     1.E-3   C
UNUSED         2  USHORT    SALINITY             0       1.E-3   ppt
UNUSED         3  USHORT    OXYGEN               0       1.E-3   ppt
UNUSED         6  STRUCT    OPTICS               0       1       none
PROFILE_VAR    7  UBYTE     AMP_SOUND_SCAT       0       1       none
PROFILE_VAR    8  SHORT     U                    0       1.E-3   m/s
PROFILE_VAR    9  SHORT     V                    0       1.E-3   m/s
UNUSED        10  SHORT     P                    0       1       dbar
UNUSED        11  STRUCT    TEMP_SAMPLE          0       1       none
UNUSED        12  USHORT    SALINITY_SAMPLE      0       1.E-3   ppt
UNUSED        13  USHORT    OXYGEN_SAMPLE        0       1.E-3   ppt
UNUSED        14  STRUCT    NUTRIENT_SAMPLE      0       1       none
UNUSED        15  STRUCT    TRACER_SAMPLE        0       1       none
UNUSED        20  SHORT     OCEAN_DEPTH          0       1       m
PROFILE_VAR   21  STRUCT    WEATHER              0       1       none
UNUSED        22  STRUCT    SEA_SURFACE          0       1       none
PROFILE_VAR   32  CHAR      PROFILE_COMMENTS     0       1       none
BLOCK_VAR     33  CHAR      BLOCK_COMMENTS       0       1       none
PROFILE_VAR   34  UBYTE     PROFILE_FLAGS        0       1       none
BLOCK_VAR     35  STRUCT    CONFIGURATION_1      0       1       none
BLOCK_VAR     36  STRUCT    CONFIGURATION_2      0       1       none
PROFILE_VAR   37  STRUCT    ANCILLARY_1          0       1       none
PROFILE_VAR   38  STRUCT    ANCILLARY_2          0       1       none
PROFILE_VAR   39  STRUCT    ACCESS_VARIABLES     0       1       none
UNUSED        40  SHORT     DEPTH_SAMPLE         0       1       m
UNUSED        41  USHORT    SIGMA_T              0       1.E-3   kg/m3
UNUSED        42  USHORT    SIGMA_THETA          0       1.E-3   kg/m3
UNUSED        43  USHORT    SIGMA_Z              0       1.E-3   kg/m3
UNUSED        44  USHORT    SIGMA_2              0       1.E-3   kg/m3
UNUSED        45  USHORT    SIGMA_4              0       1.E-3   kg/m3
UNUSED        46  USHORT    SPEC_VOL_ANOM        0       1.E-9   m3/kg
UNUSED        47  USHORT    THERMOSTERIC_ANOM    0       1.E-9   m3/kg
UNUSED        48  SHORT     DYNAMIC_HEIGHT       0       1.E-3   dyn_m
UNUSED        49  SHORT     BVF                  0       1.E-5   /s
UNUSED        50  SHORT     SOUNDSPEED           1500    1.E-2   m/s
UNUSED        51  SHORT     TIME_FROM_START      0       1       s
UNUSED        52  USHORT    POTENTIAL_TEMP       -10     1.E-3   C
UNUSED        53  FLOAT     CONDUCTIVITY         0       1       none
PROFILE_VAR   54  SHORT     W                    0       1.E-3   m/s
PROFILE_VAR   55  SHORT     ERROR_VEL            0       1.E-3   m/s
PROFILE_VAR   56  UBYTE     PERCENT_GOOD         0       1       none
PROFILE_VAR   57  UBYTE     PERCENT_3_BEAM       0       1       none
PROFILE_VAR   58  SHORT     SPECTRAL_WIDTH       0       1.E-4   m/s
PROFILE_VAR   59  SHORT     U_STD_DEV            0       1.E-3   m/s
PROFILE_VAR   60  SHORT     V_STD_DEV            0       1.E-3   m/s
PROFILE_VAR   61  SHORT     W_STD_DEV            0       1.E-3   m/s
PROFILE_VAR   62  SHORT     EV_STD_DEV           0       1.E-3   m/s
/* PROFILE_VAR   63  BYTE      AMP_STD_DEV          0       1       none 
	 98.03.30 PJ 
	 Changed the type of AMP_STD_DEV to UBYTE */
PROFILE_VAR   63  UBYTE     AMP_STD_DEV          0       1       none 
PROFILE_VAR   64  SHORT     RAW_DOPPLER          0       1       none
PROFILE_VAR   65  UBYTE     RAW_AMP              0       1       none
PROFILE_VAR   66  UBYTE     RAW_SPECTRAL_WIDTH   0       1       none
PROFILE_VAR   67  UBYTE     BEAM_STATS           0       1       none
PROFILE_VAR   68  STRUCT    NAVIGATION           0       1       none
PROFILE_VAR   69  STRUCT    BOTTOM_TRACK         0       1       none
UNUSED        70  SHORT     U_LOG                0       1.E-3   m/s
UNUSED        71  SHORT     V_LOG                0       1.E-3   m/s
UNUSED        75  STRUCT    USER_BUFFER          0       1       none
UNUSED        76  STRUCT    ADCP_CTD             0       1       none

/*
     STRUCTURE DEFINITIONS
*/
DEFINE_STRUCT  CONFIGURATION_1  23
  ELEM         1  FLOAT     avg_interval                         s
  ELEM         1  SHORT     compensation                         none
  ELEM         1  SHORT     num_bins                             none
  ELEM         1  FLOAT     tr_depth                             m
  ELEM         1  FLOAT     bin_length                           m
  ELEM         1  FLOAT     pls_length                           m
  ELEM         1  FLOAT     blank_length                         m
  ELEM         1  FLOAT     ping_interval                        s
  ELEM         1  SHORT     bot_track                            none
  ELEM         1  SHORT     pgs_ensemble                         none
  ELEM         1  SHORT     ens_threshold                        none
  ELEM         1  SHORT     ev_threshold                         mm/s
  ELEM         1  FLOAT     hd_offset                            deg
  ELEM         1  FLOAT     pit_offset                           deg
  ELEM         1  FLOAT     rol_offset                           deg
  ELEM         1  FLOAT     unused1                              none
  ELEM         1  FLOAT     unused2                              none
  ELEM         1  FLOAT     unused3                              none
  ELEM         1  FLOAT     freq_transmit                        Hz
  ELEM         1  SHORT     top_ref_bin                          none
  ELEM         1  SHORT     bot_ref_bin                          none
  ELEM         1  FLOAT     unused4                              none
  ELEM         1  FLOAT     heading_bias                         deg

DEFINE_STRUCT ANCILLARY_1 10
  ELEM         1  FLOAT     tr_temp                              C
  ELEM         1  FLOAT     snd_spd_used                         m/s
  ELEM         1  FLOAT     best_snd_spd                         m/s
  ELEM         1  FLOAT     mn_heading                           deg
  ELEM         1  SHORT     pgs_sample                           none
  ELEM         1  SHORT     unassigned1                          none
  ELEM         1  SHORT     unassigned2                          none
  ELEM         1  SHORT     unassigned3                          none
  ELEM         1  SHORT     unassigned4                          none
  ELEM         1  SHORT     unassigned5                          none

DEFINE_STRUCT ANCILLARY_2 23
  ELEM         1  FLOAT     watrk_hd_misalign                    deg
  ELEM         1  FLOAT     watrk_scale_factor                   none
  ELEM         1  FLOAT     botrk_hd_misalign                    deg
  ELEM         1  FLOAT     botrk_scale_factor                   none
  ELEM         1  FLOAT     pit_misalign                         deg
  ELEM         1  FLOAT     rol_misalign                         deg
  ELEM         1  FLOAT     unused1                              none
  ELEM         1  FLOAT     last_temp                            C
  ELEM         1  FLOAT     last_heading                         deg
  ELEM         1  FLOAT     last_pitch                           deg
  ELEM         1  FLOAT     last_roll                            deg
  ELEM         1  FLOAT     mn_pitch                             deg
  ELEM         1  FLOAT     mn_roll                              deg
  ELEM         1  FLOAT     std_temp                             C
  ELEM         1  FLOAT     std_heading                          deg
  ELEM         1  FLOAT     std_pitch                            deg
  ELEM         1  FLOAT     std_roll                             deg
  ELEM         1  SHORT     ocean_depth                          m
  ELEM         1  SHORT     max_amp_bin                          none
  ELEM         1  SHORT     last_good_bin                        none
  ELEM         1  SHORT     unused2                              none
  ELEM         1  SHORT     unused3                              none
  ELEM         1  SHORT     unused4                              none

DEFINE_STRUCT  ACCESS_VARIABLES  8
  ELEM         1  SHORT     first_good_bin                       none
  ELEM         1  SHORT     last_good_bin                        none
  ELEM         1  FLOAT     U_ship_absolute                      m/s
  ELEM         1  FLOAT     V_ship_absolute                      m/s
  ELEM         1  SHORT     user_flag_1                          none
  ELEM         1  SHORT     user_flag_2                          none
  ELEM         1  SHORT     user_flag_3                          none
  ELEM         1  SHORT     user_flag_4                          none

DEFINE_STRUCT  BOTTOM_TRACK  3
  ELEM         1  FLOAT     u                                    m/s
  ELEM         1  FLOAT     v                                    m/s
  ELEM         1  FLOAT     depth                                m

/* 97.10.01 PJ 
	 Changed below the unit of speed from [[knots]] to [[m/s]]: Transect ship 
	 speed is given in [[m/s]]. However, the procedure [[fill_nav]] defined in
	 [[t2db_nbp.c]] which is called just before loading navigation data into
	 the da***tabase does not translate from [[m/s]] to [[knots]].

* 97.10.01 PJ
	Changed back the speed unit from [[m/s]] to [[knots]], because the 
	[[adcpsect]] procedure expects it to be given in this unit and converts it
	back into [[m/s]] automatically.

*/

DEFINE_STRUCT  NAVIGATION 4
  ELEM         1  DOUBLE   latitude                              deg
  ELEM         1  DOUBLE   longitude                             deg
  ELEM         1  DOUBLE   speed                                 knots
  ELEM         1  DOUBLE   direction                             deg

DEFINE_STRUCT  WHEATHER   6
  ELEM         1  FLOAT    pressure                              mbar
  ELEM         1  FLOAT    air_temp                              deg
  ELEM         1  UBYTE    humidity                              %
  ELEM         1  FLOAT    sea_temp                              deg
  ELEM         1  FLOAT    speed                                 m/s
  ELEM         1  FLOAT    direction                             deg





