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

   CTD module for ADCPSECT

*/

#include "dbhost.h"  /* PROTOTYPE_ALLOWED */

#define NOMINAL_SVEL  1470.0           /* used in correct_depths */
#define NPMAX  512                     /* max number of pressure levels */

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

   Structure for the CTD module.

*/
/* The following structure might be augmented with
   one or more flags to indicate which variables are
   desired and/or present, and with a parameter equal
   to NPMAX.  Additional variables might also be added.
   The structure could be redefined to contain pointers
   instead of arrays, so that the space could be dynamically
   allocated.
*/
#define  CTD_NONE        0    /* no density needed */
#define  CTD_SVAN        1    /* specific volume anomaly */
#define  CTD_POT_SVAN    2    /* potential spec. vol. anom. (like sigma th)*/
#define  CTD_SIGMA_THETA 3    /* sigma theta */
#define  CTD_SIGMA_T     4    /* sigma t, added by fb */

typedef struct
{
   YMDHMS_TIME_TYPE time;
   DOUBLE_LL_TYPE position;
   float salinity[NPMAX];
   float temperature[NPMAX];
   float pressure[NPMAX];
   float depth[NPMAX];
   float sigma_sva[NPMAX];  /* sigma-theta or svan, depending on density_var */
   float svel[NPMAX];
   int n;
   int density_var;        /* flag */
} CTD_PROFILE_TYPE;

#if PROTOTYPE_ALLOWED
int init_ctd(FILE *fp_cnt);
void write_ctd_params(FILE *fp);
void set_ctd_grid(CTD_PROFILE_TYPE *ctd, int regrid_var);
void get_ctd_profile(CTD_PROFILE_TYPE *prof);
void correct_depths(CTD_PROFILE_TYPE *ctd, float *depth, int *nd_ptr);
#else
int init_ctd();
void write_ctd_params();
void set_ctd_grid();
void get_ctd_profile();
void correct_depths();
#endif
