/**C*
 *
 * Vaisala software source code file
 *
 * Copyright (c) Vaisala Oyj 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 * 2006, 2007, 2008, 2009, 2010, 2011, 2013.
 * All rights reserved.
 *
 **C*/

/** @file
 *
 * Vaisala Weather Radar Standard Type Definition Header File
 *
 * $URL: https://subversion.vaisala.com/svn/repos/sigmet/wr_iris_rda/branches/release8.13.5/base/include/sigtypes.h $
 *
 * $Id: sigtypes.h 29252 2013-03-26 16:05:38Z jho $
 *
 */

#ifndef SIGMET_SIGTYPES_H
#define SIGMET_SIGTYPES_H 1

#ifdef EMB_EMBEDDED_H
#error Can not mix embedded.h and sigtypes.h
#endif

#include <inttypes.h>   /* Required to pick up the *int*_t typedefs */
#include "signoarch.h"  /* Always include architecture-independent defs */

/* ============== Check for incorrect machine flags ==============
 */
#ifdef HPUX
#define _HPUX 1
#else
#define _HPUX 0
#endif

#ifdef LINUX
#define _LINUX 1
#else
#define _LINUX 0
#endif

#ifdef MSDOS
#define _MSDOS 1
#else
#define _MSDOS 0
#endif


/* DESIGN_TIME is set when using the UIM/X gui
** editor.  There when editing .i files it
** will ignore the below statement
*/
#ifndef DESIGN_TIME
#if (_HPUX + _LINUX + _MSDOS) != 1
error 'Inconsistent Machine FLags'
#endif
#endif

#undef _HPUX
#undef _LINUX
#undef _MSDOS

/* =========== Various Physical and Numerical Constants ===========
 */

/* Speed of light in Km/Sec
 */
#define FSPEED_OF_LIGHT_KM_PER_S (299792.5)  
#define FSPEED_OF_LIGHT (299792.5)  /* Phase out using this one */
#define FSPEED_OF_LIGHT_M_PER_S (299792458.0)  

/* PI, and some variants
 */
#define FPI   (3.14159265358979)
#define FPI_P FPI
#define SQRT2PI (2.506628274)

/* KM per Nautical Mile, Statute Mile, and Kilofoot
 */
#define KM_PER_NMI  (1.852)
#define KM_PER_NM   (1.852)  /* Phase out using this one */
#define KM_PER_MILE (1.609344)
#define KM_PER_KFT  (0.3048)

/* meters per second per knot, mi/h, and km/h
 */
#define MPS_PER_KNOT (KM_PER_NMI  * 1000.0/3600.0)
#define MPS_PER_MPH  (KM_PER_MILE * 1000.0/3600.0)
#define MPS_PER_KMHR (1000.0/3600.0)

/* cm / inch
 */
#define CM_PER_INCH (2.54)

/* Average earth radius in Km, and effective radar radius in Km.
 */
#define FEARTH_MEAN_RADIUS    (6371.0)
#define FEARTH_RADAR_RADIUS   (8495.0)

/* Directory and pathname sizes
 */
#define DIRECTORY_SIZE (81)  /* Size allocated to hold directories */
#define FILENAME_SIZE  (80)  /* Size allocated to hold filenames */
#define PATHNAME_SIZE  (160) /* Size allocated to hold pathnames */

/* Signal and Message definitions.  The message catalog number, plus
 * other internal modification bits, reside in the low 16-bits of a
 * 32-bit message.  The Facility number is in the upper 16-bits.
 */
#define SS_NORMAL    (0x00000001) /* Normal Successful Return */

#define MSGMOD_BIT   (11)	  /* Bit offset of mod bits in message value */
#define MSGVAL_MASK  (0xFFFF &  ((1 << MSGMOD_BIT) - 1))
#define MSGMOD_MASK  (0xFFFF & ~((1 << MSGMOD_BIT) - 1))
#define MSGMOD_COUNT ((1 << (16 - MSGMOD_BIT)) - 1)
#define MSGFACILITY_MASK (0x00FF0000)
#define MSGFACILITY_SHIFT (16)  /* Shift facility up this much into MESSAGE */

#define SIGBASE( SIGNAL ) ((SIGNAL) & (MSGFACILITY_MASK | MSGVAL_MASK))

/* Basic typedefs for all platforms
 */
#ifdef HPUX
#define SIGNED
#endif
#ifdef LINUX
#define SIGNED signed
#define TWOD_QUALIFIERS_BROKEN 1
#endif
#ifdef MSDOS
#define SIGNED signed
#define TWOD_QUALIFIERS_BROKEN 1
#endif

/* Use this if the system call has a (char *) argument which
 * should be (const char *).
 */
#define SHOULD_BE_CONST( VALUE ) ((char *)(VALUE))

typedef    int8_t   SINT1;
typedef   uint8_t   UINT1;
typedef    int16_t  SINT2;
typedef   uint16_t  UINT2;
typedef    int32_t  SINT4;
typedef   uint32_t  UINT4;

typedef float           FLT4;
typedef double          FLT8;

typedef   uint16_t  BIN2;
typedef   uint32_t  BIN4;
typedef   uint16_t  BIN16_T;
typedef   uint32_t  BIN32_T;

typedef uint32_t MESSAGE;

/* Max signed, Min signed, and Max unsigned integer bounds
 */
#define MAXSINT4 ((int32_t)0x7FFFFFFF)
#define MINSINT4 ((int32_t)0x80000000)
#define MAXUINT4 ((uint32_t)0xFFFFFFFF)

#define MAXSINT2 ((int16_t)0x7FFF)
#define MINSINT2 ((int16_t)0x8000)
#define MAXUINT2 ((uint16_t)0xFFFF)

#define MAXSINT1 ((int8_t)0x7F)
#define MINSINT1 ((int8_t)0x80)
#define MAXUINT1 ((uint8_t)0xFF)

/* Macros for general use
 */
#define BIT( ibit ) ( 1 << (ibit) )
#define BTEST( ivalue, ibit ) (((ivalue) &  BIT(ibit)) != 0 )
#define IBSET( ivalue, ibit ) ( (ivalue) |  BIT(ibit) )
#define IBCLR( ivalue, ibit ) ( (ivalue) & ~BIT(ibit) )
#define IBINV( ivalue, ibit ) ( (ivalue) ^  BIT(ibit) )

#define NINT(fvalue) ((int32_t)floor(0.5+(double)(fvalue)))
#define SQUARE(value) ((value)*(value))

#define STR_UPPER(str,size) \
   {int _ii; for(_ii=0;_ii<size;_ii++) (str)[_ii]=toupper((str)[_ii]);}

#define STR_LOWER(str,size) \
   {int _ii; for(_ii=0;_ii<size;_ii++) (str)[_ii]=tolower((str)[_ii]);}

#define SCALARSWAP( ITEMX, ITEMY, TYPE ) \
  do { TYPE __swapVal = ITEMX ; ITEMX = ITEMY ; ITEMY = __swapVal ; } while (0)

#ifndef FALSE  
#define TRUE  (1)
#define FALSE (0)
#endif

/* Copyright Notices embedded in object and executable code.  Some of
 * the compilers have support for embedded notices, others do not, so
 * use our own construction.
 */
#ifdef HPUX
#pragma COPYRIGHT "Vaisala Oyj"
#endif
#ifdef LINUX
static volatile const char *vaisala_copyright_notice __attribute__ ((unused)) =
  { "Copyright (c) Vaisala Oyj 2011. All rights reserved." } ;
#endif
#ifdef MSDOS
static volatile const char *vaisala_copyright_notice __attribute__ ((unused)) =
  { "Copyright (c) Vaisala Oyj 2011. All rights reserved." } ;
#endif

/* Message facility numbers.  Allocate them all here to avoid name
 * collisions and numeric collisions.
 */
#define ASCOPE_FACILITY     (  11 << 16 )
#define RVP8MAIN_FACILITY   (  12 << 16 )
#define RVP9MAIN_FACILITY   (  13 << 16 )
#define RCP8_FACILITY       (  14 << 16 )
#define RVPXPROC_FACILITY   (  15 << 16 )

#define ANT_FACILITY        ( 100 << 16 )
#define DSP_FACILITY        ( 101 << 16 )
#define CONFIG_FACILITY     ( 103 << 16 )
#define TVSUBS_FACILITY     ( 104 << 16 )
#define VTV_FACILITY        ( 105 << 16 )
#define ERRNO_FACILITY      ( 106 << 16 )
#define USER_FACILITY       ( 107 << 16 )
#define LINK_FACILITY       ( 108 << 16 )
#define RIBLIB_FACILITY     ( 109 << 16 )
#define PCI_FACILITY        ( 110 << 16 )
#define RDA_FACILITY        ( 111 << 16 )
#define IPP_FACILITY        ( 112 << 16 )
#define SPL_FACILITY        ( 113 << 16 )
#define MAPSLIB_FACILITY    ( 114 << 16 )
#define HIMATH_FACILITY     ( 115 << 16 )
#define RTQLIB_FACILITY     ( 116 << 16 )
#define NETCARDS_FACILITY   ( 117 << 16 )
#define IRISSCAN_FACILITY   ( 118 << 16 )
#define DPOLAPP_FACILITY    ( 120 << 16 )

#define TSARCHLIB_FACILITY  ( 150 << 16 )

#define ING_FACILITY        ( 202 << 16 )
#define FIO_FACILITY        ( 203 << 16 )
#define IRIS_FACILITY       ( 204 << 16 )
#define WAT_FACILITY        ( 205 << 16 )
#define RADAR_FACILITY      ( 206 << 16 )
#define RIBBLD_FACILITY     ( 207 << 16 )
#define PRO_FACILITY        ( 208 << 16 )
#define OUT_FACILITY        ( 209 << 16 )
#define ARCHIVE_FACILITY    ( 210 << 16 )
#define REI_FACILITY        ( 211 << 16 )
#define INPUT_FACILITY      ( 212 << 16 )
#define SERV_FACILITY       ( 213 << 16 )
#define NET_FACILITY        ( 214 << 16 )
#define IRIS_SHR_FACILITY   ( 215 << 16 )
#define NOR_FACILITY        ( 217 << 16 )

#define VCPC_FACILITY       ( 230 << 16 )

/* Storage of time as Year, Month, day, and # seconds into the day.
 */
#define YMDS_FLG_DST  (0x0400)   /* Time is in Daylight Savings Time */
#define YMDS_FLG_UTC  (0x0800)   /* Time is UTC (else local) */
#define YMDS_FLG_LDST (0x1000)   /* Local time is in Daylight Savings Time */
struct ymds_time
{
    uint32_t isec;
    uint16_t imills;      /* Fractions of seconds in milliseconds, in low 10 bits */
    uint16_t iyear, imon, iday;
};

/* Extract the milliseconds from the ymds structure
 */
#define YMDS_MASK_FLAGS   (0xfc00)
#define YMDS_MASK_MS      (0x03ff)
#define DST_FROM_MILLS( _MILLS )   (0 != ( YMDS_FLG_DST & (_MILLS) ))
#define UTC_FROM_MILLS( _MILLS )   (0 != ( YMDS_FLG_UTC & (_MILLS) ))
#define LDST_FROM_MILLS( _MILLS )  (0 != ( YMDS_FLG_LDST & (_MILLS) ))
#define FLAGS_FROM_MILLS( _MILLS ) ( YMDS_MASK_FLAGS & (_MILLS) )
#define MS_FROM_MILLS( _MILLS )    ( YMDS_MASK_MS & (_MILLS) )
#define MILLS_FROM_MS_FLAGS( _MS, _FLAGS ) ((YMDS_MASK_MS&(_MS))|(YMDS_MASK_FLAGS&(_FLAGS)))

/* Structures used for passing time between client and server.
 * Storage of time as Year, Month, day, seconds, and nanoseconds.
 */
#define SYMDS_FLG_DST  (0x00100000)   /* Time is in Daylight Savings Time */
#define SYMDS_FLG_UTC  (0x00200000)   /* Time is UTC (else local) */
#define SYMDS_FLG_LDST (0x00400000)   /* Local time is in Daylight Savings Time */
struct serv_ymds_time
{
    uint32_t iyear, imon, iday;
    uint32_t isec;
    uint32_t inanos;            /* Fractions in nanoseconds in low 20 bits */
};

/* Extract the nanoseconds from the serv_ymds structure
 */
#define SYMDS_MASK_FLAGS   (0xFFF00000)
#define SYMDS_MASK_NS      (0x000FFFFF)
#define DST_FROM_NANOS( _NANOS )  (0 != ( SYMDS_FLG_DST & (_NANOS) ))
#define UTC_FROM_NANOS( _NANOS )  (0 != ( SYMDS_FLG_UTC & (_NANOS) ))
#define LDST_FROM_NANOS( _NANOS ) (0 != ( SYMDS_FLG_LDST& (_NANOS) ))
#define DST_FROM_NANOS( _NANOS )  (0 != ( SYMDS_FLG_DST & (_NANOS) ))
#define FLAGS_FROM_NANOS( _NANOS )( SYMDS_MASK_FLAGS & (_NANOS) )
#define NS_FROM_NANOS( _NANOS )   ( SYMDS_MASK_NS & (_NANOS) )
#define NANOS_FROM_NS_FLAGS( _NS, _FLAGS ) \
  ((SYMDS_MASK_NS&(_NS))|(SYMDS_MASK_FLAGS&(_FLAGS)))

#define NANOS_FROM_MILLS( _MILLS2 ) \
( (1000*MS_FROM_MILLS(_MILLS2)) | (FLAGS_FROM_MILLS(_MILLS2)<<10) ) 

#define MILLS_FROM_NANOS( _NANOS2 ) \
( (NS_FROM_NANOS(_NANOS2)/1000) | (FLAGS_FROM_NANOS(_NANOS2)>>10) )

#define TZNAME_SIZE (8)
struct full_time_spec
{
  struct ymds_time Ymds;
  char  sLocalTZName[TZNAME_SIZE];
  char  sRecordTZName[TZNAME_SIZE];
  long  tv_sec;       /* Seconds from timeval structure */
  long  tv_usec;      /* Microseconds from timeval structure */
  int32_t iRelDay;      /* Sigmet defined relative day number */
  int16_t iMinutesWest; /* Offset from recorded standard time to UTC */
  int16_t iLocalWest;   /* Offset from local standard time to UTC */
  int16_t iJulianDay;   /* Julian day origin 0, like tm_yday */
  char  ipad_end[2];
};

/* Latitude and Longitude of a point on the earth
 */
struct latlon8
{
  double fLat;  /* Angle in radians +/- PI/2 */
  double fLon;  /* Angle in radians +/- PI   */
#define LATLON_FLG_INVALID (0x0001)
  uint32_t iFlags;
  char  ipad_end[4];
};

/* Polar coordinate relative position
 */
struct D2Polar8
{
  double fRange;  /* Range in km */
  double fAz;     /* Azimuth in radians range 0 to 2PI   */
};

/* Triangle on either a plane or sphere.
 */
struct Triangle8
{
  double  fAngle1;  /* Angle of vertex in radians */
  double  fAngle2;  
  double  fAngle3;  
  double  fSide1;   /* Size opposite angle 1 */
  double  fSide2; 
  double  fSide3; 
};

/* Various XY points
 */
struct XYPoint4
{
  float fX, fY ;
};
struct XYPoint8
{
  double fX, fY ;
};

/* ------------------------------
 * FIFO holding a string of bytes (actually, unsigned shorts, so that
 * extra bits can be passed with each byte if needed).  The macro
 * expands into whatever size structure is needed.  The buffer size
 * may be one slot longer to insure that the size of the overall
 * structure is a multiple of four.
 */
#define BFIFO(NSLOTS) struct {		\
  uint16_t nSlots, writeptr, readptr ;	\
  uint16_t buf[ (NSLOTS) | 1 ] ;		\
}
#define BFIFO_HSIZE 6		/* Size of header portion */

/* ------------------------------
 * Least Squares and Polynomial Fitting Structures
 */
#define MAX_POLY_ORDER (11)
struct polynomial {
  int32_t iorder ;
  double fcoefs[MAX_POLY_ORDER+1] ;
} ;

struct lsquare8 {
  int32_t icount ;		      /* Number of points */
  int32_t iorder ;		      /* Max order of polynomial fit */
  double  fWeight ;		      /* Total weight of all points */
  double  xnsum[1+(2*MAX_POLY_ORDER)] ; /* Sums of X^n */
  double  yxnsum[1+MAX_POLY_ORDER]  ;   /* Sums of Y*X^n */
  double  yysum ;                       /* Sum of Y^2 */
} ;

/* Two-dimensional polynomials defined by XYPOLY are scalar functions
 * of (x,y).  The order of XYPOLY is the highest sum of the individual
 * powers of "x" and "y" in any given term.  An Nth order XYPOLY
 * consists of an (N-1)th order XYPOLY followed by (N+1) additional
 * terms.  For example, an order three XYPOLY would have the following
 * 10 coefficients corresponding to the indicated powers of "x" and
 * "y":
 *
 *    00   10  01  20  11  02  30  21  12  03
 *   ----  ------  ----------  --------------
 *   zero   one       two           three
 */
#define MAX_XYPOLY_ORDER (4)
#define MAX_XYPOLY_TERMS ( ((MAX_XYPOLY_ORDER+1) * (MAX_XYPOLY_ORDER+2)) / 2 )
#define MAX_XYPOLY_UDIAG ( ((MAX_XYPOLY_TERMS  ) * (MAX_XYPOLY_TERMS+1)) / 2 )

struct xypoly8 {		      /* Polynomial in (x,y) */
  int32_t iOrder, iPad4x4 ;	      /*   Highest x+y power */
  double  fTerms[ MAX_XYPOLY_TERMS ] ;  /*   Coefficients, or mixed data terms */
} ;
struct xypoly_lsq8 {		      /* Least squares statistics */
  int32_t iCount ;		      /*   Number of points */
  int32_t iOrder ;		      /*   Max order of polynomial fit */
  double  fWSums[ MAX_XYPOLY_TERMS ] ;  /*   Weighted data sums */
  double  fUDiag[ MAX_XYPOLY_UDIAG ] ;  /*   Upper diagonal matrix terms */
  double  fZZSum ;		      /*   Sum of Z^2 */
} ;
struct xypoly_area8 {		      /* 2D area modelling descriptor */
  struct xypoly8 xypoly ;	      /*   The model function for the region */
  float fMinX, fMaxX, fMinY, fMaxY ;   /*   X and Y limits of the region */
  float  fZOffset ;		      /*   Offset to add for final value */
  float  fError ;		      /*   Mean error in the fit */
  uint32_t iFlags ;		      /*   Flags affecting the model */
  char  ipad_end[4];
#define XYPOLYAREAFLAGS_SQMODEL 0x01  /*     Model Z^2 rather than Z */
} ;

/* Flags for units conversion/display
 */
#define UNITS_METRIC    (0) /* Use: km, km,  m/s  */
#define UNITS_NAUTICAL  (1) /* Use: nm, kft, kts  */
#define UNITS_METRIC_HR (2) /* Use: km, km,  km/h */
#define UNITS_ENGLISH   (3) /* Use: mi, kft, mi/h */

/* Type for VTV image pointer, needs somewhat global definition
 */
typedef uint32_t VTV;
typedef uint32_t VTV_PIXEL;

/* Do not change this without checking the event flags defined in event_flags.h
 */
#define MAX_OUT_DEVICES       (200)      /*Max # of output devices in IRIS*/
#define MAX_INPUT_DEVICES     (16)       /*Max # of input devices in IRIS*/

/* Maximum number of different political overlays loaded into memory.  Note that
 * if the overlays are large, the storage space will be used up, and less can
 * be loaded.
 */
#define MAX_OVERLAYS    (20)

/* Structure holding information about data types.  This is somewhat
 * awkward to deal with backwards compatibility.
 */
struct dsp_data_mask
{
  uint32_t iWord0;
  uint32_t iXhdrType;
  uint32_t iWord1;
  uint32_t iWord2;
  uint32_t iWord3;
  uint32_t iWord4;
};

/* ------------------------------
 * Color structures
 */
struct color_def	 /* Define the color map for a single entry */
{
  uint8_t ired;
  uint8_t igreen;
  uint8_t iblue;
  uint8_t iaux;            /* Auxiliary information */
};

struct linear_list_header
{
  int32_t iused, isize;		/* # slots used, and total # slots */
};

/* Structure used to hold 42-bit numbers.  The low ten bits (1K) are
 * split off from the upper 32.
 */
struct kilo_count {
  int32_t ikilo ;			/* Upper 32-bits (thousands) */
  int32_t iones ;			/* Lower 10-bits (ones) */
} ;

/* ------------------------------
 * Some constants that can't reside within more specific include files
 * due to awkwardness when including them.
 */
#define MAXTRIGPERIODS (64)	/* Longest definable trigger sequence, and */
#define CUSTOMTRIGS    ( 4)	/*   max number of custom sequences. */

/* *************************************
 * *                                   *
 * *  Data Parameter Type Definitions  *
 * *                                   *
 * *************************************
 */
/* These are the bit numbers that are used in may places to specify a
 * choice of data type and to tell what kind of data to process.  Note
 * that the "Extended Header" type is included here, though it is not
 * generated by the DSP.  Historically, types 0-31 were directly
 * produced by the DSP, but that distinction is no longer maintained.
 */
#define SIGMET_IRIS_DATA_TYPE_DEFINED 1
enum iris_data_type
{
    DB_XHDR          =  0,  /* Extended Headers  */
    DB_DBT           =  1,  /* Total H power (1 byte) */
    DB_DBZ           =  2,  /* Clutter Corrected H reflectivity (1 byte) */
    DB_VEL           =  3,  /* Velocity (1 byte) */
    DB_WIDTH         =  4,  /* Width (1 byte) */
    DB_ZDR           =  5,  /* Differential reflectivity (1 byte) */
    DB_ORAIN         =  6,  /* Old Rainfall rate (stored as dBZ), not used */
    DB_DBZC          =  7,  /* Fully corrected reflectivity (1 byte) */
    DB_DBT2          =  8,  /* Uncorrected reflectivity (2 byte) */
    DB_DBZ2          =  9,  /* Corrected reflectivity (2 byte) */
    DB_VEL2          = 10,  /* Velocity (2 byte) */
    DB_WIDTH2        = 11,  /* Width (2 byte) */
    DB_ZDR2          = 12,  /* Differential reflectivity (2 byte) */
    DB_RAINRATE2     = 13,  /* Rainfall rate (2 byte) */
    DB_KDP           = 14,  /* Kdp (specific differential phase)(1 byte) */
    DB_KDP2          = 15,  /* Kdp (specific differential phase)(2 byte) */
    DB_PHIDP         = 16,  /* PHIdp (differential phase)(1 byte) */
    DB_VELC          = 17,  /* Corrected Velocity (1 byte) */
    DB_SQI           = 18,  /* SQI (1 byte) */
    DB_RHOHV         = 19,  /* RhoHV(0) (1 byte) */
    DB_RHOHV2        = 20,  /* RhoHV(0) (2 byte) */
    DB_DBZC2         = 21,  /* Fully corrected reflectivity (2 byte) */
    DB_VELC2         = 22,  /* Corrected Velocity (2 byte) */
    DB_SQI2          = 23,  /* SQI (2 byte) */
    DB_PHIDP2        = 24,  /* PHIdp (differential phase)(2 byte) */
    DB_LDRH          = 25,  /* LDR H to V (1 byte) */
    DB_LDRH2         = 26,  /* LDR H to V (2 byte) */
    DB_LDRV          = 27,  /* LDR V to H (1 byte) */
    DB_LDRV2         = 28,  /* LDR V to H (2 byte) */
    DB_FLAGS         = 29,  /* Individual flag bits for each bin */
    DB_FLAGS2        = 30,  /*  (See bit definitions below) */
    DB_FLOAT32       = 31,  /* Test of floating format */
    DB_HEIGHT        = 32,  /* Height (1/10 km) (1 byte) */
    DB_VIL2          = 33,  /* Linear liquid (.001mm) (2 byte) */
    DB_NULL          = 34,  /* Data type is not applicable  */
    DB_SHEAR         = 35,  /* Wind Shear (1 byte) */
    DB_DIVERGE2      = 36,  /* Divergence (.001 10**-4) (2-byte) */
    DB_FLIQUID2      = 37,  /* Floated liquid (2 byte) */
    DB_USER          = 38,  /* User type, unspecified data (1 byte) */
    DB_OTHER         = 39,  /* Unspecified data, no color legend */
    DB_DEFORM2       = 40,  /* Deformation (.001 10**-4) (2-byte) */
    DB_VVEL2         = 41,  /* Vertical velocity (.01 m/s) (2-byte) */
    DB_HVEL2         = 42,  /* Horizontal velocity (.01 m/s) (2-byte) */
    DB_HDIR2         = 43,  /* Horizontal wind direction (.1 degree) (2-byte) */
    DB_AXDIL2        = 44,  /* Axis of Dilation (.1 degree) (2-byte) */
    DB_TIME2         = 45,  /* Time of data (seconds) (2-byte) */
    DB_RHOH          = 46,  /* Rho H to V (1 byte) */
    DB_RHOH2         = 47,  /* Rho H to V (2 byte) */
    DB_RHOV          = 48,  /* Rho V to H (1 byte) */
    DB_RHOV2         = 49,  /* Rho V to H (2 byte) */
    DB_PHIH          = 50,  /* Phi H to V (1 byte) */
    DB_PHIH2         = 51,  /* Phi H to V (2 byte) */
    DB_PHIV          = 52,  /* Phi V to H (1 byte) */
    DB_PHIV2         = 53,  /* Phi V to H (2 byte) */
    DB_USER2         = 54,  /* User type, unspecified data (2 byte) */
    DB_HCLASS        = 55,  /* Hydrometeor class (1 byte) */
    DB_HCLASS2       = 56,  /* Hydrometeor class (2 byte) */
    DB_ZDRC          = 57,  /* Corrected Differential reflectivity (1 byte) */
    DB_ZDRC2         = 58,  /* Corrected Differential reflectivity (2 byte) */
    DB_TEMPERATURE16 = 59,  /* Temperature (2 byte) */
    DB_VIR16         = 60,  /* Vertically Integrated Reflectivity (2 byte) */
    DB_DBTV8         = 61,  /* Total V Power (1 byte) */
    DB_DBTV16        = 62,  /* Total V Power (2 byte) */
    DB_DBZV8         = 63,  /* Clutter Corrected V Reflectivity (1 byte) */
    DB_DBZV16        = 64,  /* Clutter Corrected V Reflectivity (2 byte) */
    DB_SNR8          = 65,  /* Signal to Noise ratio (1 byte) */
    DB_SNR16         = 66,  /* Signal to Noise ratio (2 byte) */
    DB_ALBEDO8       = 67,  /* Albedo (1 byte) */
    DB_ALBEDO16      = 68,  /* Albedo (2 byte) */
    DB_VILD16        = 69,  /* VIL Density (2 byte) */
    DB_TURB16        = 70,  /* Turbulence (2 byte) */
    DB_DBTE8         = 71,  /* Total Power Enhanced (via H+V or HV) (1 byte) */
    DB_DBTE16        = 72,  /* Total Power Enhanced (via H+V or HV) (2 byte) */
    DB_DBZE8         = 73,  /* Clutter Corrected Reflectivity Enhanced (1 byte) */
    DB_DBZE16        = 74,  /* Clutter Corrected Reflectivity Enhanced (2 byte) */
    
    NUM_DEFINED_DATA        /* Total number of defined data types */
};

/* Remember to update these counts whenever new data types are added
 * to the above list.
 */
#define  DSP_NUM_DEFINED_DATA (22) /* Number of data types direct from the DSP */
#define TASK_NUM_DEFINED_DATA (26) /* Number of data types found in ingest files */

#define  SETUP_DTYPE_COUNT (22)      /* Number of data types in color_setup */
#define SERVER_DTYPE_COUNT (SETUP_DTYPE_COUNT+3) /* Number of data types in POM */

/* Special data values that can be used for many of the above data
 * types to indicate exceptional conditions.
 */
#define DV_NOSCAN1         (      0xFF) /* Area-not-scanned code for */
#define DV_NOSCAN2         (    0xFFFF) /*   the 1-byte, 2-byte, and */
#define DV_NOSCAN4         (0xFFFFFFFF) /*   4-byte data types. */
#define DV_NOSCANF32       (INFINITY)   /*   4-byte floats */
#define DV_THRESH8         (         0) /* Thresholded */
#define DV_THRESH1         (         0) /* Thresholded */
#define DV_THRESH16        (         0) /* Thresholded */
#define DV_THRESH2         (         0) /* Thresholded */
/* For many of the VVP data types, and their standard deviations a different
 * threshold value must be used, specifically for: DB_DIVERGE2, DB_DEFORM2, 
 * DB_VVEL2, DB_HVEL2, DB_HDIR2, and DB_AXDIL2.
 */
#define DV_THRESH_VVP16    (    0x7FFF) /* Thresholded for some VVP data types */
#define DV_THRESH32        (NAN)        /* Thresholded for 4-byte floats */
#define DV_HEIGHT1_UNKNOWN (      0xFE) /* Height not known */

/* Bit assignments for the DB_FLAGS data type
 */
#define DBFLG_OBSCRREFL  0x0001	/* These bits indicate whether reflectivity, */
#define DBFLG_OBSCRVEL   0x0002	/*   velocity, and width data are obscured at */
#define DBFLG_OBSCRWID   0x0004	/*   this bin, i.e., value can't be determined */
#define DBFLG_POINTCLUT  0x0008	/* Point clutter detected at this bin */

/* What kind of scan geometry is being used.
 */
#define TASK_SCAN_UNKNOWN  0		/* Undetermined scan type */
#define TASK_SCAN_PPI      1		/* PPI (Sector) */
#define TASK_SCAN_RHI      2		/* RHI (Sector) */
#define TASK_SCAN_MANUAL   3		/* Manual */
#define TASK_SCAN_PPIFULL  4		/* PPI (Full scan) */
#define TASK_SCAN_FILE     5		/* File scan */
#define TASK_SCAN_EXEC     6		/* Exec an arbitrary program instead */
#define TASK_SCAN_RHIFULL  7		/* RHI (Full scan) */

enum device_states
{                        /* Color:  Meaning  */
    DEV_NULL     = 0,    /* NORMAL: Not applicable*/
    DEV_OK       = 1,    /* NORMAL: OK*/
    DEV_CRITICAL = 2,    /* RED:    Critical fault has occured*/
    DEV_FAULT    = 3,    /* YELLOW: Fault has occured*/
/* The following are only valid for network devices */
    DEV_UNAVAIL  = 5,    /* RED:    Remote computer unavailable*/
    DEV_NOIRIS   = 6     /* RED:    Remote IRIS unavailable*/
};
         
#endif  /* #ifndef SIGMET_SIGTYPES_H */
