/* 
@(#) File name: fci2_sw.h	Release: 1.1	Date: 1/13/94, 09:03:22
*/
/****************************************************************************
PROGRAM:
	fci2_sw.h
	
PURPOSE/DESCRIPTION:
	This file defines constants and data structures used in the FIRE CI2 
	read routines for the ASCII data sets.
	
*****************************************************************************/

#ifndef  _fci2_sw_h
#define  _fci2_sw_h

#include  <signal.h>
#include  <stdio.h>
#include  <stdlib.h>
#include  <sys/types.h>
#include  <sys/file.h>
#include  <sys/param.h>
#include  <string.h>
#include  <math.h>            
#include  <varargs.h>


#define BAD_DATA  -9999.0
#define  MISSING  -9999.0

/****  Defined for CLASS_SONDE data. ****/

/* There are 21 variables, which appear in the following order */
typedef struct  class_sonde_data {
	float  sec;			/* time in second */
	float  pressure;		/* in mb */
	float  c_temp;			/* in C */
	float  dewpoint;		/* dewpoint temperature, in C */
	float  rhumidity;		/* relative humidity, in % */
	float  uwind;		        /* Wwind, in m/s */
	float  vwind;		        /* Vwind, in m/s */
	float  wnd_speed;		/* wind speed, in m/s */
	float  wnd_dir;			/* wind direction, in degrees */
	float  dz;			/* zonal component of wind, in m/s */
	float  longitude;		/* longitude, in degrees */
	float  latitude;		/* latitude, in degrees */
	float  range;		        /* range, in km */
	float  angle;			/* angle, in degree */
	float  altitude;		/* altitude, in meter */
	float  qp;			/* in mb */
	float  qt;			/* in C */
	float  qh;			/* in % */
	float  qu;			/* in m/s */
	float  qv;			/* in m/s */
	float  quv;			/* in m/s */
} class_data;

#define PARAM_POS  35
#define CLASS_FMT "%7.2f%8.3f%6.1f%7.2f%7.2f%6.1f%6.1f%9.4f%7.2f%7.2f%6.1f%6.1f%6.1f%6.1f%8.0f%7.2f%7.2f%8.3f%8.3f%9.4f%9.4f\n" 

/****   End definition for CLASS_SONDE data set  ****/


/****  Defined for CSU STATION1 data set.  ****/

/**********************************************************************
 *   There are 8 direct solar filters related variables.  They are put 
 *   in a data structure called "dir_solar". 
 **********************************************************************/
typedef struct  dir_solar {
        float  yfilter;
        float  rfilter;
        float  drfilter;
        float  n90filter; 
        float  n0filter;
        float  n30filter;
        float  n60filter;
        float  nfilter;
} dir_solar ;
/****  End definition for CSU STATION1 data set.  ****/


/****  Defined for DOPPLER LIDAR data set.  ****/

enum prt_ndx { PROFILE_DAT, PROFILE_DESC, PROFILE_FLD } ;

/* There are 9 parameters appear in the following order: */

                
typedef  struct vad_profile {  
	float  altitude;
	float  wndspeed;	/* Wind speed */
	float  wnd_dir;		/* Wind direction */
	float  sig2noise;	/* Signal to noise ratio */
	float  good_pts;	/* Percent of good pts */
	float  rms_err;		/* rms error */
	float  vvelocity;	/* Vertical velocity divergence */
	int  qa_flag;		/* Quality of each data value */
	float  energy;		/* Energy at each altitude */
} vad_profile;

/****  End definition for DOPPLER LIDAR data set.  ****/

/****  Defined for MAPS data set.  ****/

#define  PTS_X    81             /* # grid points in x direction */
#define  PTS_Y    62             /* # grid points in y direction */
#define  PTS_Z    25             /* # grid points in vertical direction */
#define  NUM_VAR    6            /* # analysis variables in the maps data */

#define  fmin(a, b)   ((a >= b) ? b : a)
#define  fmax(a, b)   ((a >= b) ? a : b)

typedef struct map_var {
    float  fld[PTS_X][PTS_Y][PTS_Z];
    float  vcoord;
    char  var_name[9];
} map_var;

/****  End definition for MAPS data set.  ****/

/****  Defined for NOAA WINDPROFILES data set.  ****/
#define MAX_NOAA  72         /* Current NOAA windprofile entries in a record */
/****  End definition for NOAA WINDPROFILES data set.  ****/

/****  Defined for NWS_SONDE data set.  ****/
/* There are 21 data variables, which appear in the following order */

typedef struct  nws_sonde_data {
	float  min;			/* minutes into launch */
	float  height;			/* in kilometer */
	float  pressure;		/* in mb */
	float  c_temp;			/* in C */
	float  k_temp;			/* potential temperature, in K */
	float  rh_water;		/* relative humidity to water, in % */
	float  rh_ice;			/* relative humidity to ice, in % */
	float  humidity;		/* specific humidity, in g/kg */
	float  dewpoint;		/* dewpoint temperature, in C */
	float  frost_pt;		/* frost point temperature, in C */
	float  wnd_speed;		/* wind speed, in m/s */
	float  wnd_dir;			/* wind direction, in degrees */
	float  zonal;			/* zonal component of wind, in w/s */
	float  meridional;		/* meridional component of wind, in w/s */
	float  asc_rate;		/* ascent rate, in m/min */
	float  lapse_rate;		/* lapse rate, in C/km */
	float  tmp_lapse;		/* potential temperature lapse, K/km */
	float  lon_dist;		/* longitudinal distance */
	float  lat_dist;		/* latitudinal distance */
	float  lon_pos;			/* longitudinal position, degrees N */
	float  lat_pos;			/* latitudinal position, degrees W */
} nws_data;
#define NWS_FMT "%3d%7.2f%8.3f%6.1f%7.2f%7.2f%6.1f%6.1f%9.4f%7.2f%7.2f%6.1f%6.1f%6.1f%6.1f%8.0f%7.2f%7.2f%8.3f%8.3f%9.4f%9.4f%3d\n" 

/****  End definition for NWS_SONDE data set.  ****/

/****  Defined for PAMS data set.  ****/

typedef  struct pams_ks_param {  
	float  param;
	short  flag;
	char  id;        /* One of 3 values: G(ood), B(ad), ?(suspected value) 
	                    for the flag value 0, 8 or 9, and 7 respectively */
} pams_param;
                
#define  STATION_KEY   "station"
#define  MISSING_DATA   -99.0

/****  End definition for PAMS data set.  ****/


#endif   /* !_fci2_sw_h */
