/* **********************************************************
 * *                                                        *
 * *  Sigmet Product Line Data Type Definition Header File  *
 * *                                                        *
 * **********************************************************
 * File: include/sig_data_types.h
 *
 *                       COPYRIGHT (c) 2010 BY 
 *             VAISALA INC., WESTFORD MASSACHUSETTS, U.S.A.  
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED. 
 */ 
#ifndef SIGMET_SIG_DATA_TYPES_H
#define SIGMET_SIG_DATA_TYPES_H 1


/* HCLASS data convert helper structure
 */
#define NR_CLASSIFIERS 6   /* Maximum number of enum segments in HCLASS data */

#define SIGMET_ENUM_CONVERT_DEFINED 1
struct enum_convert
{
    uint8_t iClassifier; /* ID of an active echo classifier, implicit type enum classifiers */
    uint8_t iBinOff;     /* bit offset of the enum segment, starting from LSB=0 */
    uint8_t iBinLen;     /* length if the enum segment */
    char    ipad_end;
};

/* IRIS data convert helper structure
 */
#define CONVERT_FLAGS_DEFAULT 0   /* Use default units */

#define SIGMET_CLASSIFIER_MERGER_DEFINED 1
enum classifier_merger  /* How to merge the classes */
{
    SELECT_METEO = 0,   /* Force to zero may not be needed */
    SELECT_PRECIP,
    SELECT_CELL,
    SELECT_MELT,
/*
    SELECT_AUX4,
    SELECT_AUX5,
    SELECT_AUX6,
    SELECT_AUX7,
*/
    MERGE_METEO_PRECIP,
    MERGE_METEO_CELL
/*    MERGE_METEO_CELL_PRECIP */
};


#define SIGMET_DATA_CONVERT_DEFINED 1
struct data_convert
{
    double   fvelun_velocity; /* Nyquist velocity, including unfolding */
    double   fvelun_width;    /* Nyquist velocity, not including unfolding */
    double   flambda;         /* Wavelength in cm */
    uint32_t iColorFlags;     /* Flags controlling type of color scale */
    struct enum_convert Coding[NR_CLASSIFIERS]; /* data packing spec of enum data */
};


enum classifier
{
    METEO_CLASSIFIER  = 0,   /* HydroClass, as available from IRIS/RDA 8.10.8 onwards */
    PRECIP_CLASSIFIER = 1,   /* Classifier of GC/AP, BIO and PRECIP (light, moderate, heavy and large drops) */
    CELL_CLASSIFIER   = 2,   /* Classifier of stratiform and convective precipitation */
    MELT_CLASSIFIER   = 3,   /* Classifier for direct detection of melting precipitation (no melting layer constraint) */
    AUX4_CLASSIFIER   = 4,
    AUX5_CLASSIFIER   = 5,
    AUX6_CLASSIFIER   = 6,
    AUX7_CLASSIFIER   = 7,
    ALL_CLASSIFIER    = 254, /* all classifier's data in "allClasses" */
    NO_CLASSIFIER     = 255,  /* no classfier ("0" is reserved for METEO_CLASSIFIER) */
    MAX_STD_CLASSIFIER= CELL_CLASSIFIER
};


/* This is a super-enum which contains all ways the returns
 * might be classified.  Not all can happen at the same
 * time.
 */

enum allClasses
{
    ALL_CLASS_THRESHOLD = 0,
    ALL_CLASS_NON_MET   = 1,     /* Non-meteorological targets */
    ALL_CLASS_RAIN      = 2,     /* Rain */
    ALL_CLASS_WET_SNOW  = 3,     /* Wet snow */
    ALL_CLASS_SNOW      = 4,     /* Snow */
    ALL_CLASS_GRAUPEL   = 5,     /* Graupel */
    ALL_CLASS_HAIL      = 6,     /* Hail */
    ALL_CLASS_GC_AP           = 7,   /* Ground clutter */
    ALL_CLASS_BIO             = 8,   /* Biological */
    ALL_CLASS_PRECIPITATION   = 9,   /* Precipitation */
    ALL_CLASS_LARGE_DROPS     = 10,  /* Large drops */
    ALL_CLASS_LIGHT_PRECIP    = 11,  /* Light precipitation */
    ALL_CLASS_MODERATE_PRECIP = 12,  /* Moderate precipitation */
    ALL_CLASS_HEAVY_PRECIP    = 13,  /* Heavy precipitation (including hail) */
    ALL_CLASS_STRATIFORM      = 14,  /* Stratiform precipitation */
    ALL_CLASS_CONVECTIVE      = 15,  /* Convective precipitation */
    ALL_CLASS_MELTING         = 16,  /* Melting precipitation */
    ALL_CLASS_NOT_MELTING     = 17,  /* Not melting precipitation */
    ALL_CLASS_AUX3      = 18,
    ALL_CLASS_AUX4      = 19,
    ALL_CLASS_AUX5      = 20,
    ALL_CLASS_USER1     = 21,    /* For use by customers */
    ALL_CLASS_USER2     = 22,
    ALL_CLASS_USER3     = 23,
    ALL_CLASS_USER4     = 24,
    ALL_CLASS_USER5     = 25
};

/* #define NR_HCLASSES (6) */
/* Meteorlogical Classes */
enum meteoClasses
{
    MET_CLASS_THRESHOLD = ALL_CLASS_THRESHOLD,
    MET_CLASS_NON_MET   = ALL_CLASS_NON_MET,   /* Non-meteorological targets */
    MET_CLASS_RAIN      = ALL_CLASS_RAIN,      /* Rain */
    MET_CLASS_WET_SNOW  = ALL_CLASS_WET_SNOW,  /* Wet snow */
    MET_CLASS_SNOW      = ALL_CLASS_SNOW,      /* Snow */
    MET_CLASS_GRAUPEL   = ALL_CLASS_GRAUPEL,   /* Graupel */
    MET_CLASS_HAIL      = ALL_CLASS_HAIL       /* Hail */
};


enum precipClasses
{
    PRE_CLASS_THRESHOLD = 0,
    PRE_CLASS_GC_AP,             /* Ground clutter/AP */
    PRE_CLASS_BIO,               /* Biological */
    PRE_CLASS_PRECIPITATION,     /* Precip */
    PRE_CLASS_LARGE_DROPS,       /* Large Drops */
    PRE_CLASS_LIGHT_PRECIP,      /* Light precipitation */
    PRE_CLASS_MODERATE_PRECIP,   /* Moderate precipitation */
    PRE_CLASS_HEAVY_PRECIP,      /* Heavy precipitation */
};

/* Cell Classes */
enum cellClasses
{
  CELL_CLASS_THRESHOLD  = 0,
  CELL_CLASS_STRATIFORM,         /* Stratiform precipitation */
  CELL_CLASS_CONVECTIVE          /* Convective precipitation */
};

/* Melt Classes */
enum meltClasses
{
  MELT_CLASS_THRESHOLD   = 0,
  MELT_CLASS_UNKNOWN     = 1,
  MELT_CLASS_MELTING     = 2,   /* Melting precipitation */
  MELT_CLASS_NOT_MELTING = 3    /* Not melting precipitation */
};

#endif  /* #ifndef SIGMET_SIG_DATA_TYPES_H */
