This reverts commit 4c1637974b
[formerly d3388798e0f55a35f429347c24b408d0e8ae3b7f].
Change-Id: I76b2eb1e28297eed288555d056c88812fe76faac
Former-commit-id: 954250c0b33bab2538cceea77afa2946b0c19445
This commit is contained in:
parent
4c1637974b
commit
de112777bd
5 changed files with 2715 additions and 1791 deletions
|
@ -1,20 +1,20 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* FILENAME: empe_fieldgen.h
|
* FILENAME: empe_fieldgen.h
|
||||||
*
|
*
|
||||||
* DESCRIPTION: This file contains parameters and
|
* DESCRIPTION: This file contains parameters and
|
||||||
* user-defined types for the empe_fieldgen main function.
|
* user-defined types for the empe_fieldgen main function.
|
||||||
*
|
*
|
||||||
* ORIGINAL AUTHOR: Guoxian Zhou
|
* ORIGINAL AUTHOR: Guoxian Zhou
|
||||||
* CREATION DATE: January 2007
|
* CREATION DATE: January 2007
|
||||||
* ORGANIZATION: HSEB / OHD
|
* ORGANIZATION: HSEB / OHD
|
||||||
* MACHINE: Dell-Redhat Linux
|
* MACHINE: Dell-Redhat Linux
|
||||||
* MODIFICATION HISTORY:
|
* MODIFICATION HISTORY:
|
||||||
* DATE PROGRAMMER DESCRIPTION/REASON
|
* DATE PROGRAMMER DESCRIPTION/REASON
|
||||||
* 07/2013 JingtaoD add prototypes for dual pol proudcts DSA/DPR
|
* 07/2013 JingtaoD add prototypes for dual pol proudcts DSA/DPR
|
||||||
* 02/2015 JingtaoD A2 OB14.4.1 DR#17123 - HPE Bias Source field
|
* 02/2015 JingtaoD A2 OB14.4.1 DR#17123 - HPE Bias Source field
|
||||||
* update wrtodb_HPERadarResult()
|
* update wrtodb_HPERadarResult()
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EMPE_FIELDGEN_H
|
#ifndef EMPE_FIELDGEN_H
|
||||||
#define EMPE_FIELDGEN_H
|
#define EMPE_FIELDGEN_H
|
||||||
|
@ -50,32 +50,21 @@
|
||||||
/* Ordering of the elements in this list must be the same as the beginning
|
/* Ordering of the elements in this list must be the same as the beginning
|
||||||
* of the enum DisplayFieldData type in the mpe_field_names.h header file. */
|
* of the enum DisplayFieldData type in the mpe_field_names.h header file. */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {dhrmosaic = 0, bdhrmosaic, ermosaic, avgermosaic, maxermosaic,
|
||||||
dhrmosaic = 0,
|
gaugeonly, ebmosaic, lmosaic, mmosaic, mlmosaic, lsatpre,
|
||||||
bdhrmosaic,
|
p3lmosaic, num_mosaics}mosaicType ;
|
||||||
ermosaic,
|
|
||||||
avgermosaic,
|
|
||||||
maxermosaic,
|
|
||||||
gaugeonly,
|
|
||||||
ebmosaic,
|
|
||||||
lmosaic,
|
|
||||||
mmosaic,
|
|
||||||
mlmosaic,
|
|
||||||
lsatpre,
|
|
||||||
p3lmosaic,
|
|
||||||
num_mosaics
|
|
||||||
} mosaicType;
|
|
||||||
|
|
||||||
extern char currTime[HHMMSS_LEN + 1];
|
extern char currTime[HHMMSS_LEN + 1];
|
||||||
extern char message[MESSAGE_LEN];
|
extern char message[MESSAGE_LEN] ;
|
||||||
|
|
||||||
extern FILE * logFile;
|
extern FILE * logFile ;
|
||||||
|
|
||||||
extern run_date_struct * ptrRunDate;
|
|
||||||
|
|
||||||
extern geo_data_struct * ptrGeoData;
|
extern run_date_struct * ptrRunDate ;
|
||||||
|
|
||||||
extern empe_params_struct * ptrEMPEParams;
|
extern geo_data_struct * ptrGeoData ;
|
||||||
|
|
||||||
|
extern empe_params_struct * ptrEMPEParams ;
|
||||||
|
|
||||||
extern gage_table_struct ** ptrGageTable;
|
extern gage_table_struct ** ptrGageTable;
|
||||||
extern gage_table_struct ** ptrGageTableP3;
|
extern gage_table_struct ** ptrGageTableP3;
|
||||||
|
@ -88,389 +77,674 @@ extern radarLoc_table_struct * ptrRadarLocTable;
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
/*-----------------------------*/
|
/*-----------------------------*/
|
||||||
|
|
||||||
void apply_mpe_polygons(double ** real_mosaic, const char * dateYMD, int year,
|
void apply_mpe_polygons ( double ** real_mosaic,
|
||||||
int month, int day, int hour, enum DisplayFieldData field,
|
const char * dateYMD,
|
||||||
const geo_data_struct * pGeoData, double factor, int add_flag,
|
int year,
|
||||||
int draw_only_persistent);
|
int month,
|
||||||
|
int day,
|
||||||
|
int hour,
|
||||||
|
enum DisplayFieldData field,
|
||||||
|
const geo_data_struct * pGeoData,
|
||||||
|
double factor,
|
||||||
|
int add_flag,
|
||||||
|
int draw_only_persistent );
|
||||||
|
|
||||||
void hpe_fieldgen_constructor();
|
void hpe_fieldgen_constructor() ;
|
||||||
void hpe_fieldgen_constructorByRunTime();
|
void hpe_fieldgen_constructorByRunTime() ;
|
||||||
void hpe_fieldgen_constructorByGeodata(int blnMosaic[]);
|
void hpe_fieldgen_constructorByGeodata(int blnMosaic[]) ;
|
||||||
void constructorForMeanBias(int radarLocNum);
|
void constructorForMeanBias(int radarLocNum) ;
|
||||||
|
|
||||||
void hpe_fieldgen_destructor();
|
void hpe_fieldgen_destructor() ;
|
||||||
|
|
||||||
void editPolygonConstructor(const geo_data_struct * pGeoData);
|
void editPolygonConstructor ( const geo_data_struct * pGeoData );
|
||||||
void editPolygonDestructor(const geo_data_struct * pGeoData);
|
void editPolygonDestructor ( const geo_data_struct * pGeoData );
|
||||||
|
|
||||||
void readGeoData(const int hrap_grid_factor, geo_data_struct* pGeoData);
|
void readGeoData(const int hrap_grid_factor,
|
||||||
|
geo_data_struct* pGeoData);
|
||||||
|
|
||||||
void readParams(empe_params_struct *);
|
void readParams(empe_params_struct *) ;
|
||||||
|
|
||||||
void readDBParams(empe_params_struct *);
|
void readDBParams(empe_params_struct *) ;
|
||||||
|
|
||||||
void readRWParams(RWParams *, long int *);
|
void readRWParams ( RWParams * , long int * ) ;
|
||||||
|
|
||||||
void readRWBiasStat(RWBiasStat * pRWBiasStat, const char * office_id,
|
void readRWBiasStat ( RWBiasStat * pRWBiasStat,
|
||||||
long int * ircbia);
|
const char * office_id,
|
||||||
|
long int * ircbia ) ;
|
||||||
|
|
||||||
void writeParams(const empe_params_struct *);
|
void writeParams(const empe_params_struct *) ;
|
||||||
|
|
||||||
void hpe_fieldgen_parseArgs(const int, char **, run_date_struct *);
|
void hpe_fieldgen_parseArgs(const int , char **, run_date_struct *);
|
||||||
|
|
||||||
void readGageData(const run_date_struct * pRunDate,
|
void readGageData(const run_date_struct * pRunDate ,
|
||||||
const empe_params_struct * pMPEParams, const geo_data_struct *pGeoData,
|
const empe_params_struct * pMPEParams ,
|
||||||
gage_table_struct ** pGageTable, gage_table_struct ** pGageTableP3,
|
const geo_data_struct *pGeoData ,
|
||||||
gage_table_struct ** pQCGageTable);
|
gage_table_struct ** pGageTable ,
|
||||||
|
gage_table_struct ** pGageTableP3 ,
|
||||||
|
gage_table_struct ** pQCGageTable );
|
||||||
|
|
||||||
void checkMultiple(gage_table_struct * pGageTable);
|
void checkMultiple( gage_table_struct * pGageTable);
|
||||||
|
|
||||||
void readGagePrecip(const int runHours, char ** datetimes,
|
void readGagePrecip ( const int runHours ,
|
||||||
const int hrap_grid_factor, const geo_data_struct *pGeoData,
|
char ** datetimes ,
|
||||||
const int gage_qc, gage_table_struct ** pGageTable,
|
const int hrap_grid_factor ,
|
||||||
gage_table_struct ** pGageTableP3, int * gageSize, int * gageSizeP3);
|
const geo_data_struct *pGeoData,
|
||||||
|
const int gage_qc,
|
||||||
|
gage_table_struct ** pGageTable,
|
||||||
|
gage_table_struct ** pGageTableP3,
|
||||||
|
int * gageSize,
|
||||||
|
int * gageSizeP3 ) ;
|
||||||
|
|
||||||
void readPseudoPrecip(const int runHours, char ** datetimes,
|
void readPseudoPrecip( const int runHours ,
|
||||||
const int hrap_grid_factor, const geo_data_struct * pGeoData,
|
char ** datetimes ,
|
||||||
gage_table_struct ** pGageTable, gage_table_struct ** pGageTableP3,
|
const int hrap_grid_factor ,
|
||||||
int * gageSize, int * gageSizeP3);
|
const geo_data_struct * pGeoData,
|
||||||
|
gage_table_struct ** pGageTable,
|
||||||
|
gage_table_struct ** pGageTableP3,
|
||||||
|
int * gageSize,
|
||||||
|
int * gageSizeP3 ) ;
|
||||||
|
|
||||||
void read_lightning(char dt[19], int *ihrap, int *jhrap, int *num_strike,
|
void read_lightning(char dt[19], int *ihrap, int *jhrap,
|
||||||
long int *irc);
|
int *num_strike, long int *irc) ;
|
||||||
|
|
||||||
double readPrecipLimit(const char * gageID, const time_t datetime);
|
double readPrecipLimit( const char * gageID ,
|
||||||
|
const time_t datetime) ;
|
||||||
|
|
||||||
void checkSpatialConsistency(const empe_params_struct * pMPEParams,
|
void checkSpatialConsistency(const empe_params_struct * pMPEParams,
|
||||||
const geo_data_struct *pGeoData, const gage_table_struct * pGageTable,
|
const geo_data_struct *pGeoData,
|
||||||
int * gageqc);
|
const gage_table_struct * pGageTable,
|
||||||
|
int * gageqc) ;
|
||||||
|
|
||||||
void writeGageQC(const char * lid, const double value, const char * ts,
|
void writeGageQC ( const char * lid,
|
||||||
const int dur, const char * dt, const int qctype, long int *irc,
|
const double value,
|
||||||
int *messageid);
|
const char * ts,
|
||||||
|
const int dur,
|
||||||
|
const char * dt,
|
||||||
|
const int qctype,
|
||||||
|
long int *irc,
|
||||||
|
int *messageid ) ;
|
||||||
|
|
||||||
void writeRWResult(const char *rfc, const char * dt, const int ngag,
|
void writeRWResult ( const char *rfc,
|
||||||
const int isat, const int nrad, const char *field, int * overwrt,
|
const char * dt,
|
||||||
long int *irc);
|
const int ngag,
|
||||||
|
const int isat,
|
||||||
|
const int nrad,
|
||||||
|
const char *field,
|
||||||
|
int * overwrt,
|
||||||
|
long int *irc ) ;
|
||||||
|
|
||||||
void writeArrayConstructor(const geo_data_struct * pGeoData);
|
void writeArrayConstructor ( const geo_data_struct * pGeoData );
|
||||||
void writeArrayDestructor(const geo_data_struct * pGeoData);
|
void writeArrayDestructor ( const geo_data_struct * pGeoData );
|
||||||
|
|
||||||
void writeArray(const geo_data_struct * pGeoData, const char * filedir,
|
void writeArray( const geo_data_struct * pGeoData ,
|
||||||
const char * filename, const double factor, const int replace_missing,
|
const char * filedir ,
|
||||||
const char * user, const time_t tRunTime, const char * proc_flag,
|
const char * filename ,
|
||||||
double ** real_mosaic, long int * irc);
|
const double factor ,
|
||||||
|
const int replace_missing ,
|
||||||
|
const char * user ,
|
||||||
|
const time_t tRunTime ,
|
||||||
|
const char * proc_flag ,
|
||||||
|
double ** real_mosaic ,
|
||||||
|
long int * irc ) ;
|
||||||
|
|
||||||
void writeQPE(const run_date_struct * pRunDate,
|
void writeQPE(const run_date_struct * pRunDate ,
|
||||||
const empe_params_struct * pMPEParams, const geo_data_struct * pGeoData,
|
const empe_params_struct * pMPEParams ,
|
||||||
const int gageNum, const int gageNumP3, double ** pQPEMosaic);
|
const geo_data_struct * pGeoData ,
|
||||||
|
const int gageNum ,
|
||||||
|
const int gageNumP3 ,
|
||||||
|
double ** pQPEMosaic ) ;
|
||||||
|
|
||||||
void writeRadarResult(const char * rad, const char * dt, const int ngag,
|
void writeRadarResult(const char * rad,
|
||||||
const int irad, const double bias_used, const double mem_span_bias,
|
const char * dt,
|
||||||
long int * irc);
|
const int ngag,
|
||||||
|
const int irad,
|
||||||
|
const double bias_used,
|
||||||
|
const double mem_span_bias,
|
||||||
|
long int * irc) ;
|
||||||
|
|
||||||
void saveGif(const geo_data_struct * pGeoData, const char * datestring,
|
void saveGif( const geo_data_struct * pGeoData ,
|
||||||
const char * filen, double ** mosaic, long int * irc);
|
const char * datestring,
|
||||||
|
const char * filen,
|
||||||
|
double ** mosaic,
|
||||||
|
long int * irc) ;
|
||||||
|
|
||||||
void saveNetCDF(const int max_x, const int max_y, const char * strDateTime,
|
void saveNetCDF( const int max_x ,
|
||||||
const char * fname, double ** pMosaic, const char * proc_flag,
|
const int max_y,
|
||||||
const char * external_dir, long int *irc);
|
const char * strDateTime ,
|
||||||
|
const char * fname,
|
||||||
|
double ** pMosaic ,
|
||||||
|
const char * proc_flag ,
|
||||||
|
const char * external_dir ,
|
||||||
|
long int *irc) ;
|
||||||
|
|
||||||
void checkMultisensorQC(const char * datetime, double ** mosaic,
|
void checkMultisensorQC(const char * datetime ,
|
||||||
const geo_data_struct * pGeoData, const gage_table_struct * pGageArray);
|
double ** mosaic ,
|
||||||
|
const geo_data_struct * pGeoData,
|
||||||
|
const gage_table_struct * pGageArray ) ;
|
||||||
|
|
||||||
void runERMosaic(const run_date_struct * pRunDate,
|
void runERMosaic(const run_date_struct * pRunDate,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData,
|
||||||
const radarLoc_table_struct * pRadarLocTable,
|
empe_params_struct * pMPEParams,
|
||||||
|
const radarLoc_table_struct * pRadarLocTable ,
|
||||||
const gage_table_struct * pGageTable,
|
const gage_table_struct * pGageTable,
|
||||||
const gage_table_struct * pGageTableP3,
|
const gage_table_struct * pGageTableP3,
|
||||||
const gage_table_struct * pQCGageTable, double * meanFieldBias,
|
const gage_table_struct * pQCGageTable,
|
||||||
double ** RadarBeamHeight, int ** ID, double ** RMosaic,
|
double * meanFieldBias,
|
||||||
double ** QPEMosaic, int * blnMosaic);
|
double ** RadarBeamHeight,
|
||||||
|
int ** ID,
|
||||||
|
double ** RMosaic,
|
||||||
|
double ** QPEMosaic,
|
||||||
|
int * blnMosaic) ;
|
||||||
|
|
||||||
void readRadarLoc(radarLoc_table_struct * pRadarLocTable);
|
void readRadarLoc ( radarLoc_table_struct * pRadarLocTable ) ;
|
||||||
|
|
||||||
|
void readRadarResult (const char * datetime,
|
||||||
|
radar_result_struct * pRadarResult,
|
||||||
|
short * count ,
|
||||||
|
int * dual_pol_flag,
|
||||||
|
long int * irc) ;
|
||||||
|
|
||||||
void readRadarResult(const char * datetime, radar_result_struct * pRadarResult,
|
|
||||||
short * count, int * dual_pol_flag, long int * irc);
|
|
||||||
|
|
||||||
void readDAARadarResult(const char * datetime,
|
void readDAARadarResult(const char * datetime,
|
||||||
radar_result_struct * pRadarResult, short * count, int * dual_pol_flag,
|
radar_result_struct * pRadarResult,
|
||||||
|
short * count,
|
||||||
|
int * dual_pol_flag,
|
||||||
long int * irc);
|
long int * irc);
|
||||||
|
|
||||||
void readRadarData(const char * radarID, const char * datetime,
|
void readRadarData(const char * radarID,
|
||||||
const int dpa_wind, const int ignoreRadarFlag,
|
const char * datetime,
|
||||||
float radar[][NUM_DPA_COLS], int * radarAvailFlag);
|
const int dpa_wind,
|
||||||
|
const int ignoreRadarFlag,
|
||||||
|
float radar [ ] [ NUM_DPA_COLS ] ,
|
||||||
|
int * radarAvailFlag) ;
|
||||||
|
|
||||||
void readDPARadar(const char * rad, const char * datetime, const int idpawind,
|
void readDPARadar(const char * rad,
|
||||||
double * maxvald, double * bias, char * fname, int * itim,
|
const char * datetime,
|
||||||
long int * irc);
|
const int idpawind,
|
||||||
|
double * maxvald,
|
||||||
|
double * bias,
|
||||||
|
char * fname,
|
||||||
|
int * itim,
|
||||||
|
long int * irc) ;
|
||||||
|
|
||||||
void readMisc(const radarLoc_table_struct * pRadarLocTable,
|
void readMisc(const radarLoc_table_struct * pRadarLocTable,
|
||||||
short int ** radarMiscBins);
|
short int ** radarMiscBins ) ;
|
||||||
|
|
||||||
void getMeanBias(const radarLoc_record_struct * pRadarLocRecord,
|
void getMeanBias(const radarLoc_record_struct * pRadarLocRecord,
|
||||||
const char * datetime, const int grid_rows, const int grid_cols,
|
const char * datetime ,
|
||||||
short ** radarMiscBins, float ** radar,
|
const int grid_rows,
|
||||||
const geo_data_struct * pGeoData, const gage_table_struct * pGageArray,
|
const int grid_cols,
|
||||||
const empe_params_struct * pMPEParams, int dualpol_data_avail,
|
short ** radarMiscBins ,
|
||||||
double * meanBias, double * memSpanBias, int * gageRadarPairNum);
|
float ** radar,
|
||||||
|
const geo_data_struct * pGeoData ,
|
||||||
|
const gage_table_struct * pGageArray ,
|
||||||
|
const empe_params_struct * pMPEParams ,
|
||||||
|
int dualpol_data_avail,
|
||||||
|
double * meanBias,
|
||||||
|
double * memSpanBias,
|
||||||
|
int * gageRadarPairNum) ;
|
||||||
|
|
||||||
void retrieveMeanBias(const char * radarID, const char * datetime,
|
void retrieveMeanBias(const char * radarID,
|
||||||
const empe_params_struct * pMPEParams, int dualpol_data_avail,
|
const char * datetime ,
|
||||||
double * meanBias, double * memSpanBias);
|
const empe_params_struct * pMPEParams ,
|
||||||
|
int dualpol_data_avail,
|
||||||
|
double * meanBias,
|
||||||
|
double * memSpanBias );
|
||||||
|
|
||||||
void readMeanBias(const run_date_struct * pRunDate,
|
void readMeanBias(const run_date_struct * pRunDate,
|
||||||
const radarLoc_table_struct * pRadarLocTable,
|
const radarLoc_table_struct * pRadarLocTable ,
|
||||||
const empe_params_struct * pMPEParams, double * meanFieldBias,
|
const empe_params_struct * pMPEParams ,
|
||||||
|
double * meanFieldBias,
|
||||||
int dualpol_data_avail);
|
int dualpol_data_avail);
|
||||||
|
|
||||||
void pairGageRadar(const radarLoc_record_struct * pRadarLocRecord,
|
void pairGageRadar(const radarLoc_record_struct * pRadarLocRecord,
|
||||||
const int grid_rows, const int grid_cols, short ** radarMiscBins,
|
const int grid_rows,
|
||||||
float ** radar, const geo_data_struct * pGeoData,
|
const int grid_cols,
|
||||||
|
short ** radarMiscBins,
|
||||||
|
float ** radar,
|
||||||
|
const geo_data_struct * pGeoData ,
|
||||||
|
const gage_table_struct * pGageArray ,
|
||||||
|
const empe_params_struct * pMPEParams ,
|
||||||
|
gage_radar_pair_table_struct * pGageRadarPairTable) ;
|
||||||
|
|
||||||
|
void calculatePixelHeight(const double lon_coord,
|
||||||
|
const double lat_coord,
|
||||||
|
const double hrap_coord_x,
|
||||||
|
const double hrap_coord_y,
|
||||||
|
const double hrap_x,
|
||||||
|
const double hrap_y,
|
||||||
|
double * pixelHeight ) ;
|
||||||
|
|
||||||
|
void calculateMeanBias(const char * radarID,
|
||||||
|
const char * datetime ,
|
||||||
|
const empe_params_struct * pMPEParams ,
|
||||||
const gage_table_struct * pGageArray,
|
const gage_table_struct * pGageArray,
|
||||||
const empe_params_struct * pMPEParams,
|
gage_radar_pair_table_struct * pGageRadarPairTable ,
|
||||||
gage_radar_pair_table_struct * pGageRadarPairTable);
|
int dualpol_data_avail,
|
||||||
|
double * meanBias,
|
||||||
|
double * memSpanBias ) ;
|
||||||
|
|
||||||
void calculatePixelHeight(const double lon_coord, const double lat_coord,
|
void gageRadarPairsQC(const empe_params_struct * pMPEParams ,
|
||||||
const double hrap_coord_x, const double hrap_coord_y,
|
const double bias_long ,
|
||||||
const double hrap_x, const double hrap_y, double * pixelHeight);
|
gage_radar_pair_table_struct * pGageRadarPairTable ,
|
||||||
|
int * flag) ;
|
||||||
|
|
||||||
void calculateMeanBias(const char * radarID, const char * datetime,
|
void updateStateVariable(const empe_params_struct * pMPEParams ,
|
||||||
const empe_params_struct * pMPEParams,
|
const float mem_span[] ,
|
||||||
const gage_table_struct * pGageArray,
|
const int lag ,
|
||||||
gage_radar_pair_table_struct * pGageRadarPairTable,
|
const gage_radar_pair_table_struct * pGageRadarPairTable ,
|
||||||
int dualpol_data_avail, double * meanBias, double * memSpanBias);
|
double sumGage[] ,
|
||||||
|
double sumRadar[] ,
|
||||||
|
double num_pairs[] ) ;
|
||||||
|
|
||||||
void gageRadarPairsQC(const empe_params_struct * pMPEParams,
|
void write_rwbiasdyn(const char *rad,
|
||||||
const double bias_long,
|
const char * dt,
|
||||||
gage_radar_pair_table_struct * pGageRadarPairTable, int * flag);
|
const int num_span,
|
||||||
|
double * num_pairs,
|
||||||
|
double * sumgag,
|
||||||
|
double * sumrad,
|
||||||
|
double * bb,
|
||||||
|
long int *irc) ;
|
||||||
|
|
||||||
void updateStateVariable(const empe_params_struct * pMPEParams,
|
void readRWBiasDyn(const char *radar_id,
|
||||||
const float mem_span[], const int lag,
|
const char *office_id,
|
||||||
const gage_radar_pair_table_struct * pGageRadarPairTable,
|
const char * str,
|
||||||
double sumGage[], double sumRadar[], double num_pairs[]);
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char sstr1[19],
|
||||||
|
int dualpol_data_avail,
|
||||||
|
long int *irc) ;
|
||||||
|
|
||||||
void write_rwbiasdyn(const char *rad, const char * dt, const int num_span,
|
void readDAABiasDyn(const char *radar_id,
|
||||||
double * num_pairs, double * sumgag, double * sumrad, double * bb,
|
const char *office_id,
|
||||||
|
const char * str,
|
||||||
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char sstr1[19],
|
||||||
long int *irc);
|
long int *irc);
|
||||||
|
|
||||||
void readRWBiasDyn(const char *radar_id, const char *office_id,
|
|
||||||
const char * str, const int lag_cut, double *num_pairs, double *sumgag,
|
|
||||||
double *sumrad, double *bias, int *lag, char sstr1[19],
|
|
||||||
int dualpol_data_avail, long int *irc);
|
|
||||||
|
|
||||||
void readDAABiasDyn(const char *radar_id, const char *office_id,
|
void read_spe ( const char * satpre_filename ,
|
||||||
const char * str, const int lag_cut, double *num_pairs, double *sumgag,
|
const geo_data_struct * pGeoData,
|
||||||
double *sumrad, double *bias, int *lag, char sstr1[19], long int *irc);
|
const int hrap_grid_factor,
|
||||||
|
double ** pSatPre,
|
||||||
|
int * spe_status );
|
||||||
|
|
||||||
void read_spe(const char * satpre_filename, const geo_data_struct * pGeoData,
|
double ** read_satellite ( const run_date_struct * pRunDate,
|
||||||
const int hrap_grid_factor, double ** pSatPre, int * spe_status);
|
const geo_data_struct * pGeoData,
|
||||||
|
const int hrap_grid_factor,
|
||||||
|
int run_hour,
|
||||||
|
int * is_sat_avail );
|
||||||
|
|
||||||
double ** read_satellite(const run_date_struct * pRunDate,
|
void free_spe_memory ( const geo_data_struct * pGeoData,
|
||||||
const geo_data_struct * pGeoData, const int hrap_grid_factor,
|
const int hrap_grid_factor );
|
||||||
int run_hour, int * is_sat_avail);
|
|
||||||
|
|
||||||
void free_spe_memory(const geo_data_struct * pGeoData,
|
|
||||||
const int hrap_grid_factor);
|
|
||||||
|
|
||||||
void free_locbias_memory(const geo_data_struct * pGeoData,
|
void free_locbias_memory(const geo_data_struct * pGeoData,
|
||||||
const int hrap_grid_factor);
|
const int hrap_grid_factor);
|
||||||
|
|
||||||
void deleteZeros(int * gageSize, short * iug, short * ivg, float * zg,
|
void deleteZeros( int * gageSize,
|
||||||
double ** mosaic);
|
short * iug, short * ivg, float * zg,
|
||||||
|
double ** mosaic) ;
|
||||||
|
|
||||||
void get_climate(const char * os, const int rowSize, const int colSize,
|
void get_climate(const char * os, const int rowSize, const int colSize,
|
||||||
const char* cem, double ** umeang);
|
const char* cem, double ** umeang) ;
|
||||||
|
|
||||||
void readxmrg(const char * os, const int rowSize, const int colSize,
|
void readxmrg(const char * os, const int rowSize, const int colSize,
|
||||||
const char * fname, const int lenf, const double factor, double ** xmrg,
|
const char * fname, const int lenf, const double factor,
|
||||||
int * irc);
|
double ** xmrg , int * irc);
|
||||||
|
|
||||||
void runGageonly(const run_date_struct * pRunDate,
|
void runGageonly(const run_date_struct * pRunDate,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData,
|
||||||
const int gageSize, short * iug, short * ivg, float * zg,
|
empe_params_struct * pMPEParams,
|
||||||
double ** umeang, double ** QPEMosaic);
|
const int gageSize,
|
||||||
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
double ** umeang,
|
||||||
|
double ** QPEMosaic) ;
|
||||||
|
|
||||||
void check_autosave(const char * rfcname, const int * rfclen,
|
|
||||||
const char dt[ANSI_YEARSEC_TIME_LEN], const int * datelen,
|
|
||||||
int * ioverwrt);
|
|
||||||
|
|
||||||
void apply_mfb(const double * mfbias, const int rowSize, const int colSize,
|
void check_autosave ( const char * rfcname, const int * rfclen,
|
||||||
int ** ID, double ** RMosaic, double ** BMosaic);
|
const char dt[ANSI_YEARSEC_TIME_LEN],
|
||||||
|
const int * datelen,
|
||||||
|
int * ioverwrt ) ;
|
||||||
|
|
||||||
int applyLocalBias(const time_t tRunTime, const geo_data_struct * pGeoData,
|
void apply_mfb(const double * mfbias ,
|
||||||
const empe_params_struct * pEMPEParams, double ** ERMosaic,
|
const int rowSize ,
|
||||||
|
const int colSize ,
|
||||||
|
int ** ID ,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** BMosaic) ;
|
||||||
|
|
||||||
|
int applyLocalBias(const time_t tRunTime ,
|
||||||
|
const geo_data_struct * pGeoData ,
|
||||||
|
const empe_params_struct * pEMPEParams ,
|
||||||
|
double ** ERMosaic ,
|
||||||
double ** EBMosaic);
|
double ** EBMosaic);
|
||||||
|
|
||||||
void runEBMosaic(const run_date_struct * pRunDate,
|
void runEBMosaic(const run_date_struct * pRunDate ,
|
||||||
const geo_data_struct * pGeoData, const empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData ,
|
||||||
double * meanFieldBias, int ** ID, double ** RMosaic, double ** BMosaic,
|
const empe_params_struct * pMPEParams ,
|
||||||
double ** QPEMosaic);
|
double * meanFieldBias ,
|
||||||
|
int ** ID ,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** BMosaic,
|
||||||
|
double ** QPEMosaic) ;
|
||||||
|
|
||||||
void runLMosaic(const run_date_struct * pRunDate,
|
void runLMosaic(const run_date_struct * pRunDate ,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData ,
|
||||||
const int gageSize, short * iug, short * ivg, float * zg,
|
empe_params_struct * pMPEParams ,
|
||||||
double ** RMosaic, double ** LMosaic, double ** QPEMosaic);
|
const int gageSize,
|
||||||
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** LMosaic,
|
||||||
|
double ** QPEMosaic) ;
|
||||||
|
|
||||||
void lb_gr_pairs(float gr_min_value, const int gageSize, short * iug,
|
void lb_gr_pairs ( float gr_min_value ,
|
||||||
short * ivg, float * zg, double ** mosaic,
|
const int gageSize,
|
||||||
gage_radar_pair_table_struct * pGageRadarPairTable);
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
double ** mosaic ,
|
||||||
|
gage_radar_pair_table_struct * pGageRadarPairTable) ;
|
||||||
|
|
||||||
void runMMosaic(const run_date_struct * pRunDate,
|
void runMMosaic(const run_date_struct * pRunDate ,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData ,
|
||||||
const int gageSize, short * iug, short * ivg, float * zg, int ** ID,
|
empe_params_struct * pMPEParams ,
|
||||||
double ** RMosaic, double ** BMosaic, double ** umeang,
|
const int gageSize,
|
||||||
double ** QPEMosaic);
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
int ** ID ,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** BMosaic ,
|
||||||
|
double ** umeang ,
|
||||||
|
double ** QPEMosaic) ;
|
||||||
|
|
||||||
void runMLMosaic(const run_date_struct * pRunDate,
|
void runMLMosaic(const run_date_struct * pRunDate ,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData ,
|
||||||
const int gageSize, short * iug, short * ivg, float * zg, int ** ID,
|
empe_params_struct * pMPEParams ,
|
||||||
double ** RMosaic, double ** LMosaic, double ** umeang,
|
const int gageSize,
|
||||||
double ** QPEMosaic);
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
int ** ID ,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** LMosaic ,
|
||||||
|
double ** umeang ,
|
||||||
|
double ** QPEMosaic) ;
|
||||||
|
|
||||||
void runLSatpre(const run_date_struct * pRunDate,
|
void runLSatpre ( const run_date_struct * pRunDate,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData,
|
||||||
const int gageSize, short * iug, short * ivg, float * zg,
|
empe_params_struct * pMPEParams,
|
||||||
double ** RMosaic, double ** LSatpre, double ** QPEMosaic);
|
const int gageSize,
|
||||||
|
short * iug ,
|
||||||
|
short * ivg ,
|
||||||
|
float * zg ,
|
||||||
|
double ** RMosaic,
|
||||||
|
double ** LSatpre,
|
||||||
|
double ** QPEMosaic ) ;
|
||||||
|
|
||||||
int runP3LMosaic(const run_date_struct * pRunDate,
|
int runP3LMosaic ( const run_date_struct * pRunDate,
|
||||||
const empe_params_struct * pMPEParams,
|
const empe_params_struct * pMPEParams,
|
||||||
const radarLoc_table_struct * pRadarLocTable,
|
const radarLoc_table_struct * pRadarLocTable,
|
||||||
const gage_table_struct * pGageTableP3,
|
const gage_table_struct * pGageTableP3,
|
||||||
const geo_data_struct * pGeoData,
|
const geo_data_struct * pGeoData,
|
||||||
enum DisplayFieldData radar_display_type, double ** P3Mosaic,
|
enum DisplayFieldData radar_display_type,
|
||||||
double ** AvgMosaic, double ** QPEMosaic);
|
double ** P3Mosaic,
|
||||||
|
double ** AvgMosaic,
|
||||||
|
double ** QPEMosaic);
|
||||||
|
|
||||||
/* Routines for computing local bias fields. */
|
/* Routines for computing local bias fields. */
|
||||||
|
|
||||||
const local_bias_params * getLocalBiasParams();
|
const local_bias_params * getLocalBiasParams ( );
|
||||||
void local_bias(const run_date_struct * pRunDate,
|
void local_bias ( const run_date_struct * pRunDate,
|
||||||
const geo_data_struct * pGeoData, const int gageSize, short * iug,
|
const geo_data_struct * pGeoData,
|
||||||
short * ivg, float * zg, empe_params_struct * pMPEParams,
|
const int gageSize,
|
||||||
const local_bias_params * pLocalBiasParams, float si_cut,
|
short * iug ,
|
||||||
gage_radar_pair_table_struct * pGageRadarPair, double ** RMosaic,
|
short * ivg ,
|
||||||
short int ** local_span, double ** local_bias, const char * dirname,
|
float * zg ,
|
||||||
double ** lmosaic, int * ierr);
|
empe_params_struct * pMPEParams,
|
||||||
|
const local_bias_params * pLocalBiasParams,
|
||||||
|
float si_cut,
|
||||||
|
gage_radar_pair_table_struct * pGageRadarPair,
|
||||||
|
double ** RMosaic,
|
||||||
|
short int ** local_span,
|
||||||
|
double ** local_bias,
|
||||||
|
const char * dirname,
|
||||||
|
double ** lmosaic,
|
||||||
|
int * ierr ) ;
|
||||||
|
|
||||||
|
|
||||||
/* Quick sort routines. */
|
/* Quick sort routines. */
|
||||||
|
|
||||||
void qksort4(gage_radar_pair_table_struct * pGageRadarTable);
|
void qksort4 ( gage_radar_pair_table_struct * pGageRadarTable );
|
||||||
void qksort22(int n, float * dd, short * ii);
|
void qksort22 ( int n, float * dd, short * ii );
|
||||||
void qksort32(int n, double * dd, short * ii, short * jj);
|
void qksort32 ( int n, double * dd, short * ii, short * jj );
|
||||||
void qksorti22(int n, short * dd, short * ii);
|
void qksorti22 ( int n, short * dd, short * ii );
|
||||||
|
|
||||||
/* heap sort functionss. */
|
/* heap sort functionss. */
|
||||||
|
|
||||||
void heapSortForGeoIndex(float heapArray[], short hrap_x[], short hrap_y[],
|
void heapSortForGeoIndex(float heapArray[], short hrap_x[],
|
||||||
int arraySize);
|
short hrap_y[], int arraySize) ;
|
||||||
void heapSortForDoubleAndGeoIndex(double heapArray[], int index_x[],
|
void heapSortForDoubleAndGeoIndex(double heapArray[], int index_x[],
|
||||||
int index_y[], int arraySize);
|
int index_y[], int arraySize) ;
|
||||||
|
|
||||||
|
|
||||||
/* Routines for handling binary search for station
|
/* Routines for handling binary search for station
|
||||||
latitude and longitude data. */
|
latitude and longitude data. */
|
||||||
|
|
||||||
void free_mpe_latlon_info();
|
void free_mpe_latlon_info ( );
|
||||||
void freeRadarLocMemory();
|
void freeRadarLocMemory();
|
||||||
|
|
||||||
int get_mpe_loc_latlon(char * lid, double * dlat, double * dlon);
|
int get_mpe_loc_latlon ( char * lid, double * dlat, double * dlon );
|
||||||
int get_mpe_loc_latlon_list(int * arraySize, double * dlat, double * dlon);
|
int get_mpe_loc_latlon_list ( int * arraySize ,
|
||||||
|
double * dlat ,
|
||||||
|
double * dlon ) ;
|
||||||
|
|
||||||
void buildNeighborList(const geo_data_struct * pGeoData,
|
void buildNeighborList (const geo_data_struct * pGeoData ,
|
||||||
empe_params_struct * pMPEParams, const int gageSize, short * iug,
|
empe_params_struct * pMPEParams,
|
||||||
short * ivg, float * zg);
|
const int gageSize, short * iug,
|
||||||
|
short * ivg, float * zg ) ;
|
||||||
|
|
||||||
void findNeighborList(const int radius, const int index_x, const int index_y,
|
void findNeighborList (
|
||||||
short * arrIndex, float * arrDist, int * listNum);
|
const int radius,
|
||||||
|
const int index_x,
|
||||||
|
const int index_y,
|
||||||
|
short * arrIndex,
|
||||||
|
float * arrDist,
|
||||||
|
int * listNum ) ;
|
||||||
|
|
||||||
void findLocalBiasNeighborList(
|
void findLocalBiasNeighborList (
|
||||||
const gage_radar_pair_table_struct * pGageRadarPair, const short * iug,
|
const gage_radar_pair_table_struct * pGageRadarPair,
|
||||||
const short * ivg, const int radius, const int index_x,
|
const short * iug,
|
||||||
const int index_y, short * arrIndex, float * arrDist, int * listNum);
|
const short * ivg,
|
||||||
|
const int radius,
|
||||||
|
const int index_x,
|
||||||
|
const int index_y,
|
||||||
|
short * arrIndex,
|
||||||
|
float * arrDist,
|
||||||
|
int * listNum );
|
||||||
|
|
||||||
void find_nbrsX(const int size, short * iu, short * iv, const int iu0,
|
void find_nbrsX(const int size ,
|
||||||
const int iv0, const int iradi, int * k, short * ilist, float * rlist,
|
short * iu ,
|
||||||
int * iu0_prev, int * m, short * ivv, short * in);
|
short * iv ,
|
||||||
|
const int iu0 ,
|
||||||
|
const int iv0 ,
|
||||||
|
const int iradi ,
|
||||||
|
int * k ,
|
||||||
|
short * ilist ,
|
||||||
|
float * rlist ,
|
||||||
|
int * iu0_prev ,
|
||||||
|
int * m ,
|
||||||
|
short * ivv ,
|
||||||
|
short * in ) ;
|
||||||
|
|
||||||
void freeNeighborList(const geo_data_struct * pGeoData);
|
void freeNeighborList(const geo_data_struct * pGeoData) ;
|
||||||
|
|
||||||
void createMosaic(const radarLoc_record_struct * pRadarLocRecord,
|
void createMosaic(const radarLoc_record_struct * pRadarLocRecord,
|
||||||
const int grid_rows, const int grid_cols, float ** radar,
|
const int grid_rows,
|
||||||
short ** radarMiscBins, const geo_data_struct * pGeoData,
|
const int grid_cols,
|
||||||
const int index, double ** RadarBeamHeight, double ** RMosaic,
|
float ** radar ,
|
||||||
double ** MHeight, int ** ID, double ** MaxMosaic, double ** AvgMosaic,
|
short ** radarMiscBins,
|
||||||
int ** AvgMosaicNumRadars, int * blnMosaic);
|
const geo_data_struct * pGeoData ,
|
||||||
|
const int index ,
|
||||||
|
double ** RadarBeamHeight,
|
||||||
|
double ** RMosaic ,
|
||||||
|
double ** MHeight,
|
||||||
|
int ** ID,
|
||||||
|
double ** MaxMosaic,
|
||||||
|
double ** AvgMosaic,
|
||||||
|
int ** AvgMosaicNumRadars,
|
||||||
|
int * blnMosaic);
|
||||||
|
|
||||||
void rfcw_load_static(const int hrap_grid_factor, int * status);
|
void rfcw_load_static (const int hrap_grid_factor, int * status );
|
||||||
|
|
||||||
void runDHRMosaic(const run_date_struct * pRunDate,
|
void runDHRMosaic(const run_date_struct * pRunDate,
|
||||||
const geo_data_struct * pGeoData, empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData,
|
||||||
const radarLoc_table_struct * pRadarLocTable,
|
empe_params_struct * pMPEParams,
|
||||||
const gage_table_struct * pGageTable, double * meanFieldBias,
|
const radarLoc_table_struct * pRadarLocTable ,
|
||||||
double ** radar_bean_height, int ** ID, double ** DHRMosaic,
|
double * meanFieldBias,
|
||||||
|
double ** radar_bean_height,
|
||||||
|
int ** ID,
|
||||||
|
double ** DHRMosaic,
|
||||||
double ** QPEMosaic);
|
double ** QPEMosaic);
|
||||||
|
|
||||||
void runBDHRMosaic(const run_date_struct * pRunDate,
|
void runBDHRMosaic(const run_date_struct * pRunDate ,
|
||||||
const geo_data_struct * pGeoData, const empe_params_struct * pMPEParams,
|
const geo_data_struct * pGeoData ,
|
||||||
double * meanFieldBias, int ** ID, double ** RMosaic,
|
const empe_params_struct * pMPEParams ,
|
||||||
|
double * meanFieldBias ,
|
||||||
|
int ** ID ,
|
||||||
|
double ** RMosaic ,
|
||||||
double ** QPEMosaic);
|
double ** QPEMosaic);
|
||||||
|
|
||||||
void createDHRMosaic(const radarLoc_record_struct * pRadarLocRecord,
|
void createDHRMosaic(const radarLoc_record_struct * pRadarLocRecord,
|
||||||
const int grid_rows, const int grid_cols, float ** radar,
|
const int grid_rows,
|
||||||
short ** radarMiscBins, const geo_data_struct * pGeoData,
|
const int grid_cols,
|
||||||
const int index, double ** RadarBeamHeight, double ** height, int ** ID,
|
float ** radar ,
|
||||||
|
short ** radarMiscBins,
|
||||||
|
const geo_data_struct * pGeoData ,
|
||||||
|
const int index ,
|
||||||
|
double ** RadarBeamHeight,
|
||||||
|
double ** height,
|
||||||
|
int ** ID,
|
||||||
double ** mosaic);
|
double ** mosaic);
|
||||||
|
|
||||||
void readDHRData(const char * radarID, const char * datetime,
|
void readDHRData(const char * radarID,
|
||||||
const int dhr_wind, const int ignoreRadarFlag, float ** radar,
|
const char * datetime,
|
||||||
|
const int dhr_wind,
|
||||||
|
const int ignoreRadarFlag,
|
||||||
|
float ** radar,
|
||||||
int * radarAvailFlag);
|
int * radarAvailFlag);
|
||||||
|
|
||||||
void readDPRData(const char * radarID, const char * datetime,
|
void readDPRData(const char * radarID,
|
||||||
const int dhr_wind, const int ignoreRadarFlag, float ** radar,
|
const char * datetime,
|
||||||
|
const int dhr_wind,
|
||||||
|
const int ignoreRadarFlag,
|
||||||
|
float ** radar,
|
||||||
int * radarAvailFlag);
|
int * radarAvailFlag);
|
||||||
|
|
||||||
void readDHRRadar(const char * radid, const char * datetime,
|
|
||||||
const int dhr_window, double * prev_bias, double * post_bias,
|
|
||||||
char * prev_filename, char * post_filename, int * prev_offset,
|
|
||||||
int * post_offset, int * status);
|
|
||||||
|
|
||||||
void readDPRRadar(const char * radid, const char * datetime,
|
void readDHRRadar(const char * radid,
|
||||||
const int dhr_window, double * prev_bias, double * post_bias,
|
const char * datetime,
|
||||||
char * prev_filename, char * post_filename, int * prev_offset,
|
const int dhr_window,
|
||||||
int * post_offset, int * status);
|
double * prev_bias,
|
||||||
|
double * post_bias,
|
||||||
|
char * prev_filename,
|
||||||
|
char * post_filename,
|
||||||
|
int * prev_offset,
|
||||||
|
int * post_offset,
|
||||||
|
int * status);
|
||||||
|
|
||||||
void readDecodedDHR(const char * filename, float ** radar, int * status);
|
void readDPRRadar(const char * radid,
|
||||||
|
const char * datetime,
|
||||||
|
const int dhr_window,
|
||||||
|
double * prev_bias,
|
||||||
|
double * post_bias,
|
||||||
|
char * prev_filename,
|
||||||
|
char * post_filename,
|
||||||
|
int * prev_offset,
|
||||||
|
int * post_offset,
|
||||||
|
int * status);
|
||||||
|
|
||||||
void readDecodedDPR(const char * filename, float ** radar, int * status);
|
void readDecodedDHR(const char * filename,
|
||||||
|
float ** radar ,
|
||||||
|
int * status);
|
||||||
|
|
||||||
void readDecodedDSP(const char * filename, float ** radar, int * status);
|
void readDecodedDPR(const char * filename,
|
||||||
|
float ** radar,
|
||||||
|
int * status);
|
||||||
|
|
||||||
void readDecodedDSA(const char * filename, float ** radar, int * status);
|
void readDecodedDSP(const char * filename,
|
||||||
|
float ** radar,
|
||||||
|
int * status);
|
||||||
|
|
||||||
void readDSPRadar(const char * radid, const char * datetime,
|
void readDecodedDSA(const char * filename,
|
||||||
const int dsp_window, const int dsp_duration, const int ignoreRadarFlag,
|
float ** radar,
|
||||||
float ** radar, int * radarAvailFlag);
|
int * status);
|
||||||
|
|
||||||
void readDSARadar(const char * radid, const char * datetime,
|
void readDSPRadar(const char * radid,
|
||||||
const int dsp_window, const int dsp_duration, const int ignoreRadarFlag,
|
const char * datetime,
|
||||||
float ** radar, int * radarAvailFlag);
|
const int dsp_window,
|
||||||
|
const int dsp_duration,
|
||||||
|
const int ignoreRadarFlag,
|
||||||
|
float ** radar,
|
||||||
|
int * radarAvailFlag);
|
||||||
|
|
||||||
void loadRadarBeamHeight(double ** radar_bean_height, const int grid_rows,
|
void readDSARadar(const char * radid,
|
||||||
|
const char * datetime,
|
||||||
|
const int dsp_window,
|
||||||
|
const int dsp_duration,
|
||||||
|
const int ignoreRadarFlag,
|
||||||
|
float ** radar,
|
||||||
|
int * radarAvailFlag);
|
||||||
|
|
||||||
|
void loadRadarBeamHeight(double ** radar_bean_height,
|
||||||
|
const int grid_rows,
|
||||||
const int grid_cols);
|
const int grid_cols);
|
||||||
|
|
||||||
void writeFormattedXMRG(const empe_params_struct * pEMPEParams,
|
void writeFormattedXMRG(const empe_params_struct * pEMPEParams,
|
||||||
const geo_data_struct * pGeoData, const char * mosaic_dir,
|
const geo_data_struct * pGeoData,
|
||||||
const char * fname_mosaic, const char * proc_flag,
|
const char * mosaic_dir,
|
||||||
const char * save_grib_token, const char * save_gif_token,
|
const char * fname_mosaic,
|
||||||
const char * gif_dir_token, const char * gif_id_token,
|
const char * proc_flag ,
|
||||||
const char * save_netcdf_token, const char * netcdf_dir_token,
|
const char * save_grib_token,
|
||||||
const char * netcdf_id_token, const char * save_jpeg_token,
|
const char * save_gif_token,
|
||||||
|
const char * gif_dir_token,
|
||||||
|
const char * gif_id_token,
|
||||||
|
const char * save_netcdf_token,
|
||||||
|
const char * netcdf_dir_token,
|
||||||
|
const char * netcdf_id_token,
|
||||||
|
const char * save_jpeg_token,
|
||||||
double ** pMosaic);
|
double ** pMosaic);
|
||||||
|
|
||||||
void read_daabiasdyn(const char *radar_id, const char *office_id,
|
void read_daabiasdyn(const char *radar_id,
|
||||||
const char * str, const int lag_cut, double *num_pairs, double *sumgag,
|
const char *office_id,
|
||||||
double *sumrad, double *bias, int *lag, char sstr1[19], long int *irc);
|
const char * str,
|
||||||
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char sstr1[19],
|
||||||
|
long int *irc);
|
||||||
|
|
||||||
|
|
||||||
void wrtodb_HPERadarResult(const char * hpe_productname,
|
void wrtodb_HPERadarResult(const char * hpe_productname,
|
||||||
const char * producttime, const empe_params_struct * pEMPEParams,
|
const char * producttime,
|
||||||
const int radar_data_source, const int nobias_flag);
|
const empe_params_struct * pEMPEParams,
|
||||||
|
const int radar_data_source,
|
||||||
|
const int nobias_flag);
|
||||||
|
|
||||||
#endif /* #ifndef MPE_FIELDGEN_H */
|
#endif /* #ifndef MPE_FIELDGEN_H */
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
#include "get_empe_product_state.h"
|
#include "get_empe_product_state.h"
|
||||||
#include "p3.h"
|
#include "p3.h"
|
||||||
|
|
||||||
run_date_struct * ptrRunDate;
|
run_date_struct * ptrRunDate ;
|
||||||
|
|
||||||
geo_data_struct * ptrGeoData;
|
geo_data_struct * ptrGeoData ;
|
||||||
|
|
||||||
empe_params_struct * ptrEMPEParams;
|
empe_params_struct * ptrEMPEParams ;
|
||||||
|
|
||||||
gage_table_struct ** ptrGageTable;
|
gage_table_struct ** ptrGageTable;
|
||||||
|
|
||||||
|
@ -20,19 +20,20 @@ gage_table_struct ** ptrQCGageTable;
|
||||||
|
|
||||||
radarLoc_table_struct * ptrRadarLocTable;
|
radarLoc_table_struct * ptrRadarLocTable;
|
||||||
|
|
||||||
char * Mosaics[num_mosaics] = { "dhrmosaic", "bdhrmosaic", "ermosaic",
|
char * Mosaics[num_mosaics] = {"dhrmosaic", "bdhrmosaic", "ermosaic",
|
||||||
"avgermosaic", "maxermosaic", "gageonly", "ebmosaic", "lmosaic",
|
"avgermosaic", "maxermosaic", "gageonly",
|
||||||
"mmosaic", "mlmosaic", "lsatpre", "p3lmosaic" };
|
"ebmosaic","lmosaic", "mmosaic", "mlmosaic",
|
||||||
|
"lsatpre", "p3lmosaic"};
|
||||||
|
|
||||||
double ** BaseRMosaic = NULL;
|
double ** BaseRMosaic = NULL;
|
||||||
|
|
||||||
double ** RMosaic = NULL;
|
double ** RMosaic = NULL ;
|
||||||
|
|
||||||
double ** DHRMosaic = NULL;
|
double ** DHRMosaic = NULL ;
|
||||||
|
|
||||||
double ** BMosaic = NULL;
|
double ** BMosaic = NULL ;
|
||||||
|
|
||||||
double ** LMosaic = NULL;
|
double ** LMosaic = NULL ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Added by Ram for the average and max mosaic calculation
|
* Added by Ram for the average and max mosaic calculation
|
||||||
|
@ -63,28 +64,28 @@ double ** P3Mosaic = NULL;
|
||||||
int p3_return_value = -1;
|
int p3_return_value = -1;
|
||||||
|
|
||||||
int readradartriangles_once_for_all_hours = 0;
|
int readradartriangles_once_for_all_hours = 0;
|
||||||
int ** ID = NULL;
|
int ** ID = NULL ;
|
||||||
|
|
||||||
/* This two dimensional array hold the "best estimate" mosaic */
|
/* This two dimensional array hold the "best estimate" mosaic */
|
||||||
double ** QPEMosaic = NULL;
|
double ** QPEMosaic = NULL ;
|
||||||
|
|
||||||
/* prism data */
|
/* prism data */
|
||||||
|
|
||||||
double ** umeang = NULL;
|
double ** umeang = NULL ;
|
||||||
|
|
||||||
/* radar bean height data */
|
/* radar bean height data */
|
||||||
|
|
||||||
double ** RadarBeamHeight = NULL;
|
double ** RadarBeamHeight = NULL ;
|
||||||
|
|
||||||
short ** radarMiscBins = NULL;
|
short ** radarMiscBins = NULL ;
|
||||||
|
|
||||||
/* The local bias satellite precipitation array. */
|
/* The local bias satellite precipitation array. */
|
||||||
|
|
||||||
double ** LSatpre = NULL;
|
double ** LSatpre = NULL ;
|
||||||
|
|
||||||
/* mean field bias array */
|
/* mean field bias array */
|
||||||
|
|
||||||
double * meanFieldBias = NULL;
|
double * meanFieldBias = NULL ;
|
||||||
|
|
||||||
extern void free_tr();
|
extern void free_tr();
|
||||||
|
|
||||||
|
@ -93,25 +94,28 @@ extern void free_tr();
|
||||||
int dualpol_on_flag = 1;
|
int dualpol_on_flag = 1;
|
||||||
int dualpol_used = 0;
|
int dualpol_used = 0;
|
||||||
|
|
||||||
int hpe_fieldgen_main(int argc, const char ** argv) {
|
int hpe_fieldgen_main(int argc, const char ** argv)
|
||||||
|
{
|
||||||
enum DisplayFieldData radar_display_type = display_erMosaic;
|
enum DisplayFieldData radar_display_type = display_erMosaic;
|
||||||
mosaicType indexMosaic;
|
mosaicType indexMosaic;
|
||||||
mosaicType indexBaseRadar = ermosaic;
|
mosaicType indexBaseRadar = ermosaic;
|
||||||
|
|
||||||
int i, j, k, status;
|
int i, j, k, status;
|
||||||
int blnMosaic[num_mosaics];
|
int blnMosaic[num_mosaics];
|
||||||
int blnGetPrism = 0;
|
int blnGetPrism = 0 ;
|
||||||
time_t tmpTime, start_time, end_time;
|
time_t tmpTime, start_time, end_time;
|
||||||
static char strTempTime[50] = { '\0' };
|
static char strTempTime[50] = {'\0'} ;
|
||||||
int flag, mosaicLength;
|
int flag , mosaicLength ;
|
||||||
int radar_processed;
|
int radar_processed;
|
||||||
int empe_base_radar_len = BESTFIELD_LEN;
|
int empe_base_radar_len = BESTFIELD_LEN;
|
||||||
int verbose = VERBOSE;
|
int verbose = VERBOSE ;
|
||||||
char cemr[3] = { '\0' }; /* char month of run */
|
char cemr[3] = {'\0'} ; /* char month of run */
|
||||||
struct tm * pRunTime = NULL;
|
struct tm * pRunTime = NULL ;
|
||||||
char datetime[ANSI_YEARSEC_TIME_LEN + 1] = { '\0' };
|
char datetime[ANSI_YEARSEC_TIME_LEN + 1] = {'\0'} ;
|
||||||
int blnOverwrite = 1; /* 0 = overwrite best xmrg; 1 = don't overwrite */
|
int blnOverwrite = 1 ; /* 0 = overwrite best xmrg; 1 = don't overwrite */
|
||||||
char tokenvalue[TOKEN_VALUE_LEN] = { '\0' };
|
|
||||||
|
const char * HPE_DUALPOL_ON_TOKEN = "hpe_dualpol_on";
|
||||||
|
char dualpol_on[TOKEN_LEN] = {'\0'};
|
||||||
short * iug = NULL;
|
short * iug = NULL;
|
||||||
short * ivg = NULL;
|
short * ivg = NULL;
|
||||||
float * zg = NULL;
|
float * zg = NULL;
|
||||||
|
@ -125,10 +129,18 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
ptrRunDate = NULL;
|
ptrRunDate = NULL;
|
||||||
ptrGeoData = NULL;
|
ptrGeoData = NULL;
|
||||||
ptrEMPEParams = NULL;
|
ptrEMPEParams = NULL;
|
||||||
ptrRadarLocTable = NULL;
|
ptrRadarLocTable = NULL ;
|
||||||
ptrGageTable = NULL;
|
ptrGageTable = NULL ;
|
||||||
ptrGageTableP3 = NULL;
|
ptrGageTableP3 = NULL ;
|
||||||
ptrQCGageTable = NULL;
|
ptrQCGageTable = NULL ;
|
||||||
|
|
||||||
|
/* determin if dual pol product can be retrived */
|
||||||
|
|
||||||
|
getAppsDefaults(HPE_DUALPOL_ON_TOKEN, dualpol_on);
|
||||||
|
if (strcmp(toLowerCase(dualpol_on), "yes") != 0 )
|
||||||
|
dualpol_on_flag = 0;
|
||||||
|
else
|
||||||
|
dualpol_on_flag = 1;
|
||||||
|
|
||||||
time(&start_time);
|
time(&start_time);
|
||||||
|
|
||||||
|
@ -136,14 +148,14 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* allocates memory for global struct data and initialization.
|
* allocates memory for global struct data and initialization.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpe_fieldgen_constructor();
|
hpe_fieldgen_constructor() ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify the argument list
|
* Verify the argument list
|
||||||
* and parse the values into variable ptrRunDate.
|
* and parse the values into variable ptrRunDate.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpe_fieldgen_parseArgs(argc, argv, ptrRunDate);
|
hpe_fieldgen_parseArgs(argc, argv, ptrRunDate) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open the log file.
|
* open the log file.
|
||||||
|
@ -153,77 +165,97 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
|
|
||||||
time(&tmpTime);
|
time(&tmpTime);
|
||||||
strftime(strTempTime, 50, "%Y-%m-%d %X %Z", gmtime(&tmpTime));
|
strftime(strTempTime, 50, "%Y-%m-%d %X %Z", gmtime(&tmpTime));
|
||||||
sprintf(message, "\n\n\tHPE Precip Processing -- %s\n", strTempTime);
|
sprintf ( message , "\n\n\tHPE Precip Processing -- %s\n", strTempTime) ;
|
||||||
printLogMessage(message);
|
printLogMessage(message);
|
||||||
sprintf(message, "\t\tVersion OB16.2.1 -- August 08, 2015 \n");
|
sprintf ( message , "\t\tVersion OB14.3.1 -- March 08, 2014 \n") ;
|
||||||
printMessage(message, logFile);
|
printMessage( message, logFile );
|
||||||
|
|
||||||
|
/*
|
||||||
|
sprintf( message , "STATUS: HPE Fieldgen is running for %d hour(s)\n",
|
||||||
|
ptrRunDate->hourNum) ;
|
||||||
|
printMessage( message);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* retrieve the value of the base radar product.
|
* retrieve the value of the base radar product.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
get_empe_base_radar(&verbose, ptrEMPEParams->base_radar_mosaic,
|
get_empe_base_radar ( &verbose, ptrEMPEParams->base_radar_mosaic,
|
||||||
&empe_base_radar_len, &status);
|
&empe_base_radar_len, &status );
|
||||||
|
|
||||||
if (status != 0) {
|
if ( status != 0 )
|
||||||
sprintf(message, "Error occurred when retrieving base radar "
|
{
|
||||||
"mosaic.\n\tProgram Exit.");
|
sprintf ( message, "Error occurred when retrieving base radar "
|
||||||
shutdown(message);
|
"mosaic.\n\tProgram Exit." );
|
||||||
|
shutdown( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
hpe_fieldgen_toLowerCase(ptrEMPEParams->base_radar_mosaic);
|
hpe_fieldgen_toLowerCase(ptrEMPEParams->base_radar_mosaic);
|
||||||
|
|
||||||
if (strcmp(ptrEMPEParams->base_radar_mosaic, "ermosaic") == 0) {
|
if ( strcmp ( ptrEMPEParams->base_radar_mosaic, "ermosaic" ) == 0 )
|
||||||
|
{
|
||||||
indexBaseRadar = ermosaic;
|
indexBaseRadar = ermosaic;
|
||||||
radar_display_type = display_erMosaic;
|
radar_display_type = display_erMosaic;
|
||||||
} else if (strcmp(ptrEMPEParams->base_radar_mosaic, "avgermosaic") == 0) {
|
}
|
||||||
|
else if ( strcmp ( ptrEMPEParams->base_radar_mosaic, "avgermosaic" ) == 0 )
|
||||||
|
{
|
||||||
indexBaseRadar = avgermosaic;
|
indexBaseRadar = avgermosaic;
|
||||||
radar_display_type = display_avgerMosaic;
|
radar_display_type = display_avgerMosaic;
|
||||||
} else if (strcmp(ptrEMPEParams->base_radar_mosaic, "maxermosaic") == 0) {
|
}
|
||||||
|
else if ( strcmp ( ptrEMPEParams->base_radar_mosaic, "maxermosaic" ) == 0 )
|
||||||
|
{
|
||||||
indexBaseRadar = maxermosaic;
|
indexBaseRadar = maxermosaic;
|
||||||
radar_display_type = display_maxerMosaic;
|
radar_display_type = display_maxerMosaic;
|
||||||
} else {
|
}
|
||||||
sprintf(message, "Error: Unrecognized base radar mosaic %s.\n"
|
else
|
||||||
"\tProgram Exit.", ptrEMPEParams->base_radar_mosaic);
|
{
|
||||||
shutdown(message);
|
sprintf ( message, "Error: Unrecognized base radar mosaic %s.\n"
|
||||||
|
"\tProgram Exit.",
|
||||||
|
ptrEMPEParams->base_radar_mosaic );
|
||||||
|
shutdown( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(message, "STATUS: Using %s as the base radar mosaic...",
|
sprintf ( message, "STATUS: Using %s as the base radar mosaic...",
|
||||||
ptrEMPEParams->base_radar_mosaic);
|
ptrEMPEParams->base_radar_mosaic );
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read status for qpe generate types.
|
* read status for qpe generate types.
|
||||||
* and flag indicates if need calculate mean field bias.
|
* and flag indicates if need calculate mean field bias.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: loading qpe generate types...");
|
sprintf( message , "STATUS: loading qpe generate types...") ;
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
|
||||||
ptrEMPEParams->blnMeanFieldBias = 0;
|
ptrEMPEParams->blnMeanFieldBias = 0;
|
||||||
ptrEMPEParams->blnDHRMeanFieldBias = 0;
|
ptrEMPEParams->blnDHRMeanFieldBias = 0;
|
||||||
|
|
||||||
for (indexMosaic = dhrmosaic; indexMosaic < num_mosaics; indexMosaic++) {
|
for( indexMosaic = dhrmosaic; indexMosaic < num_mosaics; indexMosaic++)
|
||||||
|
{
|
||||||
blnMosaic[indexMosaic] = 0;
|
blnMosaic[indexMosaic] = 0;
|
||||||
mosaicLength = strlen(Mosaics[indexMosaic]);
|
mosaicLength = strlen(Mosaics[indexMosaic]) ;
|
||||||
get_empe_product_state(Mosaics[indexMosaic], &mosaicLength, &verbose,
|
get_empe_product_state(Mosaics[indexMosaic], &mosaicLength,
|
||||||
&flag, &status);
|
&verbose, &flag, &status);
|
||||||
if (status != 0) {
|
if(status != 0)
|
||||||
sprintf(message, "Error(s) occur when set generate type: %s."
|
{
|
||||||
"\n\tProgram exit.", Mosaics[indexMosaic]);
|
sprintf ( message , "Error(s) occur when set generate type: %s."
|
||||||
shutdown(message);
|
"\n\tProgram exit." , Mosaics[indexMosaic]) ;
|
||||||
|
shutdown( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
blnMosaic[indexMosaic] = flag;
|
blnMosaic[indexMosaic] = flag ;
|
||||||
|
|
||||||
if (blnMosaic[indexMosaic] == 1) {
|
if(blnMosaic[indexMosaic] == 1)
|
||||||
sprintf(message, "\tgenerate type: \"%s\" is set \"ON\" ",
|
{
|
||||||
Mosaics[indexMosaic]);
|
sprintf ( message , "\tgenerate type: \"%s\" is set \"ON\" ",
|
||||||
hpe_fieldgen_printMessage(message);
|
Mosaics[indexMosaic]) ;
|
||||||
} else {
|
hpe_fieldgen_printMessage( message);
|
||||||
sprintf(message, "\tgenerate type: \"%s\" is set \"OFF\" ",
|
}
|
||||||
Mosaics[indexMosaic]);
|
else
|
||||||
hpe_fieldgen_printMessage(message);
|
{
|
||||||
|
sprintf ( message , "\tgenerate type: \"%s\" is set \"OFF\" ",
|
||||||
|
Mosaics[indexMosaic]) ;
|
||||||
|
hpe_fieldgen_printMessage( message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -231,7 +263,9 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* when ebmosaic or mmosaic is ON
|
* when ebmosaic or mmosaic is ON
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((indexMosaic == ebmosaic) && blnMosaic[indexMosaic] == 1) {
|
if((indexMosaic == ebmosaic)
|
||||||
|
&& blnMosaic[indexMosaic] == 1)
|
||||||
|
{
|
||||||
ptrEMPEParams->blnMeanFieldBias = 1;
|
ptrEMPEParams->blnMeanFieldBias = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +274,9 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* when bdhrmosaic is ON
|
* when bdhrmosaic is ON
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((indexMosaic == bdhrmosaic) && blnMosaic[indexMosaic] == 1) {
|
if((indexMosaic == bdhrmosaic)
|
||||||
|
&& blnMosaic[indexMosaic] == 1)
|
||||||
|
{
|
||||||
blnMosaic[dhrmosaic] = 1;
|
blnMosaic[dhrmosaic] = 1;
|
||||||
ptrEMPEParams->blnDHRMeanFieldBias = 1;
|
ptrEMPEParams->blnDHRMeanFieldBias = 1;
|
||||||
}
|
}
|
||||||
|
@ -250,8 +286,10 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* when mmosiac or mlmosaic or gageonly is ON
|
* when mmosiac or mlmosaic or gageonly is ON
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((indexMosaic == mmosaic || indexMosaic == mlmosaic
|
if((indexMosaic == mmosaic ||
|
||||||
|| indexMosaic == gaugeonly) && blnMosaic[indexMosaic] == 1)
|
indexMosaic == mlmosaic ||
|
||||||
|
indexMosaic == gaugeonly )
|
||||||
|
&& blnMosaic[indexMosaic] == 1)
|
||||||
blnGetPrism = 1;
|
blnGetPrism = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,67 +298,30 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* which are determined by the run time data.
|
* which are determined by the run time data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpe_fieldgen_constructorByRunTime();
|
hpe_fieldgen_constructorByRunTime() ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read in static parameters from Apps_defaults files.
|
* read in static parameters from Apps_defaults files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
readParams(ptrEMPEParams);
|
readParams(ptrEMPEParams) ;
|
||||||
|
|
||||||
/*
|
|
||||||
* print out dualPol bias info
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (hpe_fieldgen_getAppsDefaults("hpe_dualpol_on", tokenvalue) == -1) {
|
|
||||||
/* default to Yes */
|
|
||||||
dualpol_on_flag = 1;
|
|
||||||
sprintf(message, "\tDefault HPE dualPol radar product flag = ON");
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
} else {
|
|
||||||
if (strcmp(toLowerCase(tokenvalue), "yes") != 0) {
|
|
||||||
dualpol_on_flag = 0;
|
|
||||||
sprintf(message, "\tHPE dualPol radar product flag = OFF");
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
} else {
|
|
||||||
dualpol_on_flag = 1;
|
|
||||||
sprintf(message, "\tHPE dualPol radar product flag = ON");
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hpe_fieldgen_getAppsDefaults("hpe_bias_source", tokenvalue) == -1) {
|
|
||||||
/* default to RFC*/
|
|
||||||
sprintf(message, "\tDefault HPE Bias Source = RFC");
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
} else {
|
|
||||||
sprintf(message, "\tHPE Bias Source = %s", tokenvalue);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hpe_fieldgen_getAppsDefaults("hpe_rfc_bias_flag", tokenvalue) == -1) {
|
|
||||||
/* default to 2 minutes*/
|
|
||||||
sprintf(message, "\tDefault HPE RFC bias flag = 2");
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
} else {
|
|
||||||
sprintf(message, "\tHPE RFC bias flag = %s", tokenvalue);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read in geo grid data.
|
* read in geo grid data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
readGeoData(ptrEMPEParams->hrap_grid_factor, ptrGeoData);
|
readGeoData(ptrEMPEParams->hrap_grid_factor, ptrGeoData) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read in the overlays
|
* read in the overlays
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rfcw_load_static(ptrEMPEParams->hrap_grid_factor, &status);
|
rfcw_load_static (ptrEMPEParams->hrap_grid_factor, & status );
|
||||||
|
|
||||||
if (status != 0) {
|
if ( status != 0 )
|
||||||
sprintf(message, "Error occurred when reading overlay data.\n");
|
{
|
||||||
hpe_fieldgen_printMessage(message);
|
sprintf ( message, "Error occurred when reading overlay data.\n" );
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
}
|
}
|
||||||
ptrEMPEParams->irc_load_stat = status;
|
ptrEMPEParams->irc_load_stat = status;
|
||||||
|
|
||||||
|
@ -329,30 +330,31 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* which are determined by the geographic grid data.
|
* which are determined by the geographic grid data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpe_fieldgen_constructorByGeodata(blnMosaic);
|
hpe_fieldgen_constructorByGeodata(blnMosaic) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the database.
|
* Open the database.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((status = OpenDbms(ptrEMPEParams->db_name)) != 0) {
|
if ( (status = OpenDbms ( ptrEMPEParams->db_name )) != 0 )
|
||||||
sprintf(message, "Error(s) occur during opening database %s."
|
{
|
||||||
" SQLCODE: %ld\n\tProgram exit.", ptrEMPEParams->db_name,
|
sprintf ( message , "Error(s) occur during opening database %s."
|
||||||
SQLCODE);
|
" SQLCODE: %ld\n\tProgram exit.",
|
||||||
shutdown(message);
|
ptrEMPEParams->db_name , SQLCODE ) ;
|
||||||
|
shutdown( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read static parameters from database for running hpe_fieldgen.
|
* read static parameters from database for running mpe_fieldgen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
readDBParams(ptrEMPEParams);
|
readDBParams(ptrEMPEParams) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* write static data to log file.
|
* write static data to log file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
writeParams(ptrEMPEParams);
|
writeParams(ptrEMPEParams) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read in gage data for entire area and whole time range
|
* read in gage data for entire area and whole time range
|
||||||
|
@ -362,13 +364,16 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
|
|
||||||
pRunTime = gmtime(&(ptrRunDate->tRunTime));
|
pRunTime = gmtime(&(ptrRunDate->tRunTime));
|
||||||
|
|
||||||
if ((ptrEMPEParams->dsp_duration == 60) && (pRunTime->tm_min == 0)) {
|
if( (ptrEMPEParams->dsp_duration == 60) &&
|
||||||
|
(pRunTime->tm_min == 0) )
|
||||||
|
{
|
||||||
isTopHour = 1;
|
isTopHour = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTopHour == 1) {
|
if(isTopHour == 1)
|
||||||
readGageData(ptrRunDate, ptrEMPEParams, ptrGeoData, ptrGageTable,
|
{
|
||||||
ptrGageTableP3, ptrQCGageTable);
|
readGageData(ptrRunDate, ptrEMPEParams, ptrGeoData,
|
||||||
|
ptrGageTable, ptrGageTableP3, ptrQCGageTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -376,21 +381,20 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* store in radarloc struct variable
|
* store in radarloc struct variable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
readRadarLoc(ptrRadarLocTable);
|
readRadarLoc(ptrRadarLocTable) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate memory and Initialize the mean bias struct data
|
* allocate memory and Initialize the mean bias struct data
|
||||||
* which is determined by the radarLoc number.
|
* which is determined by the radarLoc number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
constructorForMeanBias(ptrRadarLocTable->radarNum);
|
constructorForMeanBias(ptrRadarLocTable->radarNum) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build the category name based on dsp_duration
|
* build the category name based on dsp_duration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
buildCategoryName(ptrEMPEParams->dsp_duration,
|
buildCategoryName(ptrEMPEParams->dsp_duration, ptrEMPEParams->category_name);
|
||||||
ptrEMPEParams->category_name);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for multiple hours case:
|
* for multiple hours case:
|
||||||
|
@ -408,45 +412,48 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
NUM_DPA_ROWS * ptrEMPEParams->hrap_grid_factor,
|
NUM_DPA_ROWS * ptrEMPEParams->hrap_grid_factor,
|
||||||
NUM_DPA_COLS * ptrEMPEParams->hrap_grid_factor);
|
NUM_DPA_COLS * ptrEMPEParams->hrap_grid_factor);
|
||||||
|
|
||||||
for (i = 0; i < ptrRunDate->hourNum; i++) {
|
for( i = 0; i < ptrRunDate->hourNum; i++)
|
||||||
|
{
|
||||||
radar_processed = 0;
|
radar_processed = 0;
|
||||||
ptrEMPEParams->sat_avail = 0;
|
ptrEMPEParams->sat_avail = 0;
|
||||||
ptrEMPEParams->build_neighbor_list = 0;
|
ptrEMPEParams->build_neighbor_list = 0 ;
|
||||||
|
|
||||||
gageSize = ptrGageTable[i]->totalGageNum;
|
gageSize = ptrGageTable[i]->totalGageNum ;
|
||||||
gageSizeP3 = ptrGageTableP3[i]->totalGageNum;
|
gageSizeP3 = ptrGageTableP3[i]->totalGageNum ;
|
||||||
|
|
||||||
if (isTopHour == 1) {
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
iug = init1DShortArray(ZERO_CONSTANT, gageSize);
|
iug = init1DShortArray(ZERO_CONSTANT, gageSize);
|
||||||
ivg = init1DShortArray(ZERO_CONSTANT, gageSize);
|
ivg = init1DShortArray(ZERO_CONSTANT, gageSize);
|
||||||
zg = init1DFloatArray(MOSAIC_DEFAULT, gageSize);
|
zg = init1DFloatArray(MOSAIC_DEFAULT, gageSize);
|
||||||
|
|
||||||
for (j = 0; j < gageSize; j++) {
|
for(j = 0; j < gageSize; j ++)
|
||||||
iug[j] = ptrGageTable[i]->ptrGageRecords[j].hrap_x;
|
{
|
||||||
ivg[j] = ptrGageTable[i]->ptrGageRecords[j].hrap_y;
|
iug[j] = ptrGageTable[i]->ptrGageRecords[j].hrap_x ;
|
||||||
zg[j] = ptrGageTable[i]->ptrGageRecords[j].gageValue;
|
ivg[j] = ptrGageTable[i]->ptrGageRecords[j].hrap_y ;
|
||||||
|
zg[j] = ptrGageTable[i]->ptrGageRecords[j].gageValue ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pRunTime = gmtime(&(ptrRunDate->tRunTime));
|
pRunTime = gmtime(&(ptrRunDate->tRunTime));
|
||||||
sprintf(cemr, "%02d", (pRunTime->tm_mon + 1));
|
sprintf(cemr, "%02d", (pRunTime->tm_mon + 1));
|
||||||
|
|
||||||
strftime(datetime, ANSI_YEARSEC_TIME_LEN + 1, "%Y-%m-%d %H:%M:00",
|
strftime ( datetime, ANSI_YEARSEC_TIME_LEN + 1,
|
||||||
pRunTime);
|
"%Y-%m-%d %H:%M:00", pRunTime ) ;
|
||||||
|
|
||||||
hpe_fieldgen_getCurrentTime(currTime);
|
hpe_fieldgen_getCurrentTime(currTime) ;
|
||||||
sprintf(message,
|
sprintf( message , "\n%s = time begin HPE fieldgen MOSAIC generation for: %s." ,
|
||||||
"\n%s = time begin HPE fieldgen MOSAIC generation for: %s.",
|
currTime, datetime) ;
|
||||||
currTime, datetime);
|
hpe_fieldgen_printMessage( message);
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read in prism data if required.
|
* read in prism data if required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (blnGetPrism == 1) {
|
if(blnGetPrism == 1)
|
||||||
get_climate(ptrEMPEParams->os, ptrGeoData->num_rows,
|
{
|
||||||
ptrGeoData->num_cols, cemr, umeang);
|
get_climate(ptrEMPEParams->os , ptrGeoData->num_rows,
|
||||||
|
ptrGeoData->num_cols, cemr, umeang) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -457,8 +464,25 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
|
|
||||||
int irfclen = strlen(ptrEMPEParams->rfc_name);
|
int irfclen = strlen(ptrEMPEParams->rfc_name);
|
||||||
int idatelen = strlen(datetime);
|
int idatelen = strlen(datetime);
|
||||||
check_autosave(ptrEMPEParams->rfc_name, &irfclen, datetime, &idatelen,
|
check_autosave(ptrEMPEParams->rfc_name, &irfclen,
|
||||||
&blnOverwrite);
|
datetime, &idatelen, &blnOverwrite) ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* load the mean bias data for each radar ID
|
||||||
|
* if need compute ebmosaic and/or bdhrmosaic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* if( (ptrEMPEParams->blnDHRMeanFieldBias == 1) ||
|
||||||
|
(ptrEMPEParams->blnMeanFieldBias == 1) )*/
|
||||||
|
|
||||||
|
/*if (ptrEMPEParams->blnDHRMeanFieldBias == 1)
|
||||||
|
{
|
||||||
|
readMeanBias(ptrRunDate,
|
||||||
|
ptrRadarLocTable,
|
||||||
|
ptrEMPEParams,
|
||||||
|
meanFieldBias );
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* run mosaic functions based on mosaic status value.
|
* run mosaic functions based on mosaic status value.
|
||||||
|
@ -472,32 +496,55 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* -- gzhou 09/2007
|
* -- gzhou 09/2007
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (indexMosaic = dhrmosaic; indexMosaic < num_mosaics;
|
for( indexMosaic = dhrmosaic; indexMosaic < num_mosaics; indexMosaic++)
|
||||||
indexMosaic++) {
|
{
|
||||||
if (blnMosaic[indexMosaic] == 0) {
|
if(blnMosaic[indexMosaic] == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (indexMosaic) {
|
switch(indexMosaic)
|
||||||
case dhrmosaic:
|
{
|
||||||
runDHRMosaic(ptrRunDate, ptrGeoData, ptrEMPEParams,
|
case dhrmosaic :
|
||||||
ptrRadarLocTable, ptrGageTable[i], meanFieldBias,
|
runDHRMosaic(ptrRunDate,
|
||||||
RadarBeamHeight, ID, DHRMosaic, QPEMosaic);
|
ptrGeoData,
|
||||||
break;
|
ptrEMPEParams,
|
||||||
|
ptrRadarLocTable,
|
||||||
|
meanFieldBias,
|
||||||
|
RadarBeamHeight,
|
||||||
|
ID,
|
||||||
|
DHRMosaic,
|
||||||
|
QPEMosaic) ;
|
||||||
|
break ;
|
||||||
|
|
||||||
case bdhrmosaic:
|
case bdhrmosaic :
|
||||||
runBDHRMosaic(ptrRunDate, ptrGeoData, ptrEMPEParams,
|
runBDHRMosaic(ptrRunDate,
|
||||||
meanFieldBias, ID, DHRMosaic, QPEMosaic);
|
ptrGeoData,
|
||||||
break;
|
ptrEMPEParams,
|
||||||
|
meanFieldBias,
|
||||||
|
ID,
|
||||||
|
DHRMosaic,
|
||||||
|
QPEMosaic) ;
|
||||||
|
break ;
|
||||||
|
|
||||||
case avgermosaic:
|
case avgermosaic:
|
||||||
case maxermosaic:
|
case maxermosaic:
|
||||||
case ermosaic:
|
case ermosaic :
|
||||||
if (radar_processed == 0) {
|
if ( radar_processed == 0 )
|
||||||
runERMosaic(ptrRunDate, ptrGeoData, ptrEMPEParams,
|
{
|
||||||
ptrRadarLocTable, ptrGageTable[i],
|
runERMosaic(ptrRunDate,
|
||||||
ptrGageTableP3[i], ptrQCGageTable[i], meanFieldBias,
|
ptrGeoData,
|
||||||
RadarBeamHeight, ID, RMosaic, QPEMosaic, blnMosaic);
|
ptrEMPEParams,
|
||||||
|
ptrRadarLocTable,
|
||||||
|
ptrGageTable[i],
|
||||||
|
ptrGageTableP3[i],
|
||||||
|
ptrQCGageTable[i],
|
||||||
|
meanFieldBias,
|
||||||
|
RadarBeamHeight,
|
||||||
|
ID,
|
||||||
|
RMosaic,
|
||||||
|
QPEMosaic,
|
||||||
|
blnMosaic) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign the base radar mosaic. This radar mosaic
|
* Assign the base radar mosaic. This radar mosaic
|
||||||
|
@ -505,7 +552,8 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* derived MPE products.
|
* derived MPE products.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (indexBaseRadar) {
|
switch ( indexBaseRadar )
|
||||||
|
{
|
||||||
case ermosaic:
|
case ermosaic:
|
||||||
BaseRMosaic = RMosaic;
|
BaseRMosaic = RMosaic;
|
||||||
break;
|
break;
|
||||||
|
@ -519,10 +567,10 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(message, "Error: Unrecognized base "
|
sprintf ( message, "Error: Unrecognized base "
|
||||||
"radar mosaic index.\n\t"
|
"radar mosaic index.\n\t"
|
||||||
"Program Exit.");
|
"Program Exit." );
|
||||||
shutdown(message);
|
shutdown ( message );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,27 +581,55 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* time will delete bad values
|
* time will delete bad values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ptrEMPEParams->del_gage_zeros == 1) {
|
if( ptrEMPEParams->del_gage_zeros == 1 )
|
||||||
deleteZeros(&gageSize, iug, ivg, zg, BaseRMosaic);
|
{
|
||||||
|
deleteZeros( &gageSize, iug, ivg, zg,
|
||||||
|
BaseRMosaic) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radar_processed = 1;
|
radar_processed = 1;
|
||||||
break;
|
break ;
|
||||||
|
|
||||||
case ebmosaic:
|
case ebmosaic :
|
||||||
runEBMosaic(ptrRunDate, ptrGeoData, ptrEMPEParams,
|
runEBMosaic(ptrRunDate,
|
||||||
meanFieldBias, ID, BaseRMosaic, BMosaic, QPEMosaic);
|
ptrGeoData,
|
||||||
break;
|
ptrEMPEParams,
|
||||||
|
meanFieldBias,
|
||||||
|
ID,
|
||||||
|
BaseRMosaic,
|
||||||
|
BMosaic,
|
||||||
|
QPEMosaic) ;
|
||||||
|
break ;
|
||||||
|
|
||||||
case p3lmosaic:
|
case p3lmosaic :
|
||||||
sprintf(message, "STATUS: P3LMosaic product is "
|
sprintf ( message , "STATUS: P3LMosaic product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
|
||||||
|
/*
|
||||||
|
p3_return_value = runP3LMosaic ( ptrRunDate,
|
||||||
|
ptrEMPEParams,
|
||||||
|
ptrRadarLocTable,
|
||||||
|
ptrGageTableP3[i],
|
||||||
|
ptrGeoData,
|
||||||
|
radar_display_type,
|
||||||
|
P3Mosaic,
|
||||||
|
BaseRMosaic,
|
||||||
|
QPEMosaic);
|
||||||
|
|
||||||
|
if(p3_return_value == -1)
|
||||||
|
{
|
||||||
|
sprintf ( message , "oops!...Problem calculating P3"
|
||||||
|
" Mosaic..."
|
||||||
|
" seems like there is no gage data\n");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
readradartriangles_once_for_all_hours = 1;
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gaugeonly:
|
case gaugeonly :
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The gageonly can be calculated
|
* The gageonly can be calculated
|
||||||
|
@ -561,13 +637,31 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* the run time is the top of the hour.
|
* the run time is the top of the hour.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: Gageonly product is "
|
sprintf ( message , "STATUS: Gageonly product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
/*
|
||||||
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
|
runGageonly(ptrRunDate,
|
||||||
|
ptrGeoData,
|
||||||
|
ptrEMPEParams,
|
||||||
|
gageSize, iug, ivg, zg,
|
||||||
|
umeang,
|
||||||
|
QPEMosaic) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: Gageonly could not be "
|
||||||
|
"calculated due to "
|
||||||
|
"it is at non-top hour or "
|
||||||
|
"DSP duration is not 60 minutes.");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break ;
|
||||||
|
|
||||||
break;
|
case lmosaic :
|
||||||
|
|
||||||
case lmosaic:
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The lmosaic can be calculated
|
* The lmosaic can be calculated
|
||||||
|
@ -575,13 +669,32 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* the run time is the top of the hour.
|
* the run time is the top of the hour.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: LMosaic product is "
|
sprintf ( message , "STATUS: LMosaic product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
/*
|
||||||
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
|
runLMosaic( ptrRunDate,
|
||||||
|
ptrGeoData,
|
||||||
|
ptrEMPEParams,
|
||||||
|
gageSize, iug, ivg, zg,
|
||||||
|
BaseRMosaic,
|
||||||
|
LMosaic,
|
||||||
|
QPEMosaic) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: LMosaic could not be "
|
||||||
|
"calculated due to "
|
||||||
|
"it is at non-top hour or "
|
||||||
|
"DSP duration is not 60 minutes.");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break ;
|
||||||
|
|
||||||
break;
|
case mmosaic :
|
||||||
|
|
||||||
case mmosaic:
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The mmosaic can be calculated
|
* The mmosaic can be calculated
|
||||||
|
@ -589,13 +702,34 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* the run time is the top of the hour.
|
* the run time is the top of the hour.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: MMosaic product is "
|
sprintf ( message , "STATUS: MMosaic product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
/*
|
||||||
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
|
runMMosaic(ptrRunDate,
|
||||||
|
ptrGeoData,
|
||||||
|
ptrEMPEParams,
|
||||||
|
gageSize, iug, ivg, zg,
|
||||||
|
ID,
|
||||||
|
BaseRMosaic ,
|
||||||
|
BMosaic ,
|
||||||
|
umeang ,
|
||||||
|
QPEMosaic) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: MMosaic could not be "
|
||||||
|
"calculated due to "
|
||||||
|
"it is at non-top hour or "
|
||||||
|
"DSP duration is not 60 minutes.");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break ;
|
||||||
|
|
||||||
break;
|
case mlmosaic :
|
||||||
|
|
||||||
case mlmosaic:
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The mlmosaic can be calculated
|
* The mlmosaic can be calculated
|
||||||
|
@ -603,13 +737,34 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* the run time is the top of the hour.
|
* the run time is the top of the hour.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: MLMosaic product is "
|
sprintf ( message , "STATUS: MLMosaic product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
/*
|
||||||
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
|
runMLMosaic( ptrRunDate,
|
||||||
|
ptrGeoData,
|
||||||
|
ptrEMPEParams,
|
||||||
|
gageSize, iug, ivg, zg,
|
||||||
|
ID,
|
||||||
|
BaseRMosaic ,
|
||||||
|
LMosaic ,
|
||||||
|
umeang ,
|
||||||
|
QPEMosaic) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: MLMosaic could not be "
|
||||||
|
"calculated due to "
|
||||||
|
"it is at non-top hour or "
|
||||||
|
"DSP duration is not 60 minutes.");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break ;
|
||||||
|
|
||||||
break;
|
case lsatpre :
|
||||||
|
|
||||||
case lsatpre:
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The lsatpre can be calculated
|
* The lsatpre can be calculated
|
||||||
|
@ -617,16 +772,34 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* the run time is the top of the hour.
|
* the run time is the top of the hour.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(message, "STATUS: LSatpre product is "
|
sprintf ( message , "STATUS: LSatpre product is "
|
||||||
"not available for current version.");
|
"not available for current version.");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
|
/*
|
||||||
break;
|
if( isTopHour == 1 )
|
||||||
|
{
|
||||||
|
runLSatpre ( ptrRunDate,
|
||||||
|
ptrGeoData,
|
||||||
|
ptrEMPEParams,
|
||||||
|
gageSize, iug, ivg, zg,
|
||||||
|
BaseRMosaic,
|
||||||
|
LSatpre,
|
||||||
|
QPEMosaic );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: LSatpre could not be "
|
||||||
|
"calculated due to "
|
||||||
|
"it is at non-top hour or "
|
||||||
|
"DSP duration is not 60 minutes.");
|
||||||
|
printMessage( message);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(message, "ERROR: Unknown mosaic type!");
|
sprintf ( message , "ERROR: Unknown mosaic type!");
|
||||||
hpe_fieldgen_printMessage(message);
|
hpe_fieldgen_printMessage( message);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,23 +811,24 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* -- gzhou 05-2007
|
* -- gzhou 05-2007
|
||||||
*/
|
*/
|
||||||
|
|
||||||
blnOverwrite = 1;
|
blnOverwrite = 1 ;
|
||||||
if (blnOverwrite == 0) {
|
if( blnOverwrite == 0)
|
||||||
writeQPE(ptrRunDate, ptrEMPEParams, ptrGeoData,
|
{
|
||||||
|
writeQPE(ptrRunDate, ptrEMPEParams, ptrGeoData ,
|
||||||
ptrGageTable[i]->totalGageNum,
|
ptrGageTable[i]->totalGageNum,
|
||||||
ptrGageTableP3[i]->totalGageNum, QPEMosaic);
|
ptrGageTableP3[i]->totalGageNum, QPEMosaic ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
hpe_fieldgen_getCurrentTime(currTime);
|
hpe_fieldgen_getCurrentTime(currTime) ;
|
||||||
sprintf(message,
|
sprintf( message , "%s = time end HPE Fieldgen MOSAIC generation for: %s.\n" ,
|
||||||
"%s = time end HPE Fieldgen MOSAIC generation for: %s.\n",
|
currTime, datetime) ;
|
||||||
currTime, datetime);
|
hpe_fieldgen_printMessage( message);
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
if (isTopHour == 1) {
|
if( isTopHour == 1 )
|
||||||
free1DShortArray(iug);
|
{
|
||||||
free1DShortArray(ivg);
|
free1DShortArray( iug );
|
||||||
free1DFloatArray(zg);
|
free1DShortArray( ivg );
|
||||||
|
free1DFloatArray( zg );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -671,19 +845,20 @@ int hpe_fieldgen_main(int argc, const char ** argv) {
|
||||||
* releases memory for global struct data.
|
* releases memory for global struct data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpe_fieldgen_destructor();
|
hpe_fieldgen_destructor() ;
|
||||||
|
|
||||||
time(&end_time);
|
time(&end_time);
|
||||||
|
|
||||||
sprintf(message, "STATUS: Program exit normally"
|
sprintf ( message , "STATUS: Program exit normally"
|
||||||
" with elapse time: %ld second(s)", (end_time - start_time));
|
" with elapse time: %ld second(s)",
|
||||||
hpe_fieldgen_printMessage(message);
|
(end_time - start_time));
|
||||||
|
hpe_fieldgen_printMessage( message);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* close db connection and free memory of global variables.
|
* close db connection and free memory of global variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hpeDeleteLogFile();
|
hpeDeleteLogFile ( );
|
||||||
CloseDbms();
|
CloseDbms();
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -6,30 +6,48 @@
|
||||||
#include "RadarLoc.h"
|
#include "RadarLoc.h"
|
||||||
|
|
||||||
#define HPE_RFC_BIAS_LAG 2 // default number of bias lag hours
|
#define HPE_RFC_BIAS_LAG 2 // default number of bias lag hours
|
||||||
RadarLoc * pRadarLocHead = NULL;
|
|
||||||
|
RadarLoc * pRadarLocHead = NULL ;
|
||||||
extern int dualpol_on_flag;
|
extern int dualpol_on_flag;
|
||||||
|
|
||||||
void retrieveOfficeIDByRadarID(const char * radarID, char * officeID,
|
void retrieveOfficeIDByRadarID(const char * radarID,
|
||||||
|
char * officeID,
|
||||||
long int * status);
|
long int * status);
|
||||||
|
|
||||||
void read_rwbiasdyn2(const char *radar_id, const char *office_id,
|
void read_rwbiasdyn2(const char *radar_id,
|
||||||
const char * str, const int lag_cut, double *num_pairs, double *sumgag,
|
const char *office_id,
|
||||||
double *sumrad, double *bias, int *lag, char sstr1[19], long int *irc);
|
const char * str,
|
||||||
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char sstr1[19],
|
||||||
|
long int *irc);
|
||||||
|
|
||||||
void readRWBiasDyn(const char *radar_id, const char *site_id,
|
void readRWBiasDyn(const char *radar_id,
|
||||||
const char *datehour, const int lag_cut, double *num_pairs,
|
const char *site_id,
|
||||||
double *sumgag, double *sumrad, double *bias, int *lag,
|
const char *datehour,
|
||||||
char datetime1[19], int dualpol_data_avail, long int *irc)
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char datetime1[19],
|
||||||
|
int dualpol_data_avail,
|
||||||
|
long int *irc)
|
||||||
|
|
||||||
{
|
{
|
||||||
const char * HPE_RFC_BIAS_LAG_TOKEN = "hpe_rfc_bias_lag";
|
const char * HPE_RFC_BIAS_LAG_TOKEN = "hpe_rfc_bias_lag";
|
||||||
const char * HPE_BIAS_SOURCE_TOKEN = "hpe_bias_source";
|
const char * HPE_BIAS_SOURCE_TOKEN = "hpe_bias_source";
|
||||||
|
|
||||||
static int first = 1;
|
static int first = 1 ;
|
||||||
static int rfc_bias_lag = HPE_RFC_BIAS_LAG;
|
static int rfc_bias_lag = HPE_RFC_BIAS_LAG;
|
||||||
static char bias_source[6] = "rfc"; // RFC or LOCAL, default to RFC
|
static char bias_source[6] = "rfc"; // RFC or LOCAL, default to RFC
|
||||||
char officeID[WFO_LEN + 1] = { '\0' };
|
char officeID[WFO_LEN + 1] = {'\0'};
|
||||||
char strTokenValue[6] = { '\0' };
|
char strTokenValue[6] = {'\0'} ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load and store the token values:
|
* load and store the token values:
|
||||||
|
@ -37,53 +55,62 @@ void readRWBiasDyn(const char *radar_id, const char *site_id,
|
||||||
* HPE_BIAS_SOURCE_TOKEN
|
* HPE_BIAS_SOURCE_TOKEN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (first == 1) {
|
if(first == 1)
|
||||||
if ((hpe_fieldgen_getAppsDefaults(HPE_RFC_BIAS_LAG_TOKEN, strTokenValue)
|
{
|
||||||
!= -1) && (hpe_fieldgen_isDigits(strTokenValue) == 1)) {
|
if((hpe_fieldgen_getAppsDefaults(HPE_RFC_BIAS_LAG_TOKEN, strTokenValue) != -1)
|
||||||
|
&& (hpe_fieldgen_isDigits(strTokenValue) == 1))
|
||||||
|
{
|
||||||
int value = atoi(strTokenValue);
|
int value = atoi(strTokenValue);
|
||||||
|
if(value > 0)
|
||||||
if (value > 0) {
|
{
|
||||||
rfc_bias_lag = value;
|
rfc_bias_lag = value;
|
||||||
sprintf(message,
|
sprintf ( message , "STATUS: token value for \"%s\" is: %d.",
|
||||||
"STATUS:in readRWBiasDyn - token value for \"%s\" is: %d",
|
HPE_RFC_BIAS_LAG_TOKEN, rfc_bias_lag) ;
|
||||||
HPE_RFC_BIAS_LAG_TOKEN, rfc_bias_lag);
|
hpe_fieldgen_printMessage( message );
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
} else {
|
|
||||||
sprintf(message, "ERROR:in readRWBiasDyn - Invalid token value"
|
|
||||||
" for token \"%s\". Default value is set to: %d",
|
|
||||||
HPE_RFC_BIAS_LAG_TOKEN, HPE_RFC_BIAS_LAG);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
sprintf(message, "ERROR:in readRWBiasDyn - Invalid token value"
|
{
|
||||||
" for token \"%s\". Default value is set to: %d",
|
sprintf ( message , "ERROR: Invalid token value"
|
||||||
HPE_RFC_BIAS_LAG_TOKEN, HPE_RFC_BIAS_LAG);
|
" for token \"%s\". Default it's value to: %d.",
|
||||||
hpe_fieldgen_printMessage(message);
|
HPE_RFC_BIAS_LAG_TOKEN, HPE_RFC_BIAS_LAG) ;
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf ( message , "ERROR: Invalid token value"
|
||||||
|
" for token \"%s\". Default it's value to: %d.",
|
||||||
|
HPE_RFC_BIAS_LAG_TOKEN, HPE_RFC_BIAS_LAG) ;
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hpe_fieldgen_getAppsDefaults(HPE_BIAS_SOURCE_TOKEN, strTokenValue)
|
if(hpe_fieldgen_getAppsDefaults(HPE_BIAS_SOURCE_TOKEN, strTokenValue) != -1)
|
||||||
!= -1) {
|
{
|
||||||
if (strcmp(hpe_fieldgen_toLowerCase(strTokenValue), "local") == 0) {
|
if(strcmp(hpe_fieldgen_toLowerCase(strTokenValue), "local") == 0)
|
||||||
|
{
|
||||||
strcpy(bias_source, "local");
|
strcpy(bias_source, "local");
|
||||||
|
|
||||||
sprintf(message,
|
sprintf ( message , "STATUS: token value for \"%s\" is: %s.",
|
||||||
"STATUS:in readRWBiasDyn - token value for \"%s\" is: %s",
|
HPE_BIAS_SOURCE_TOKEN, bias_source) ;
|
||||||
HPE_BIAS_SOURCE_TOKEN, bias_source);
|
hpe_fieldgen_printMessage( message );
|
||||||
hpe_fieldgen_printMessage(message);
|
}
|
||||||
} else if (strcmp(hpe_fieldgen_toLowerCase(strTokenValue), "rfc")
|
else if(strcmp(hpe_fieldgen_toLowerCase(strTokenValue), "rfc") == 0)
|
||||||
== 0) {
|
{
|
||||||
strcpy(bias_source, "rfc");
|
strcpy(bias_source, "rfc");
|
||||||
|
|
||||||
sprintf(message,
|
sprintf ( message , "STATUS: token value for \"%s\" is: %s.",
|
||||||
"STATUS:in readRWBiasDyn - token value for \"%s\" is: %s",
|
HPE_BIAS_SOURCE_TOKEN, bias_source) ;
|
||||||
HPE_BIAS_SOURCE_TOKEN, bias_source);
|
hpe_fieldgen_printMessage( message );
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
sprintf(message, "ERROR:in readRWBiasDyn - Invalid token value"
|
}
|
||||||
" for token \"%s\". Default value is set to: rfc",
|
else
|
||||||
HPE_BIAS_SOURCE_TOKEN);
|
{
|
||||||
hpe_fieldgen_printMessage(message);
|
sprintf ( message , "ERROR: Invalid token value"
|
||||||
|
" for token \"%s\".",
|
||||||
|
HPE_BIAS_SOURCE_TOKEN) ;
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
first = 0;
|
first = 0;
|
||||||
|
@ -94,28 +121,58 @@ void readRWBiasDyn(const char *radar_id, const char *site_id,
|
||||||
* pick up bias value based on the FXA_LOCAL_SITE
|
* pick up bias value based on the FXA_LOCAL_SITE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strcmp(bias_source, "local") == 0) /*for LOCAL MFB */
|
if(strcmp(bias_source, "local") == 0)
|
||||||
{
|
{
|
||||||
if (dualpol_on_flag == 0) {
|
sprintf ( message , "STATUS: in readRWBiasDyn,loading bias value based on FXA_LOCAL_SITE.") ;
|
||||||
sprintf(message,
|
hpe_fieldgen_printMessage( message );
|
||||||
" STATUS:in readRWBiasDyn - Loading SP LOCAL MFB bias from RWBiasDyn "
|
|
||||||
"table for siteID (token fxa_local_site) = %s, lag time = %d",
|
|
||||||
site_id, lag_cut);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
read_rwbiasdyn2(radar_id, site_id, datehour, lag_cut, num_pairs,
|
if (dualpol_on_flag == 0)
|
||||||
sumgag, sumrad, bias, lag, datetime1, irc);
|
{
|
||||||
} else {
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
sprintf(message,
|
lag_cut, num_pairs, sumgag,
|
||||||
"STATUS:in readRWBiasDyn - Loading DP LOCAL MFB bias from DAABiasDyn "
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
"table for siteID (token fxa_local_site) = %s, lag time = %d",
|
|
||||||
site_id, lag_cut);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
read_daabiasdyn(radar_id, site_id, datehour, lag_cut, num_pairs,
|
sprintf (message, " STATUS:in readRWBiasDyn, dualpol_on_flag is NO, loading bias value from RWBiasDyn table.");
|
||||||
sumgag, sumrad, bias, lag, datetime1, irc);
|
hpe_fieldgen_printMessage( message );
|
||||||
}
|
}
|
||||||
} else /* for RFC MFB */
|
else
|
||||||
|
{
|
||||||
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is YES, loading bias value from DAABiasDyn table");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
|
read_daabiasdyn(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
if (*irc != 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
|
||||||
|
sprintf(message, "STATUS: in readRWBiasDyn, dualpol_on_flag is YES. Fail to load bias value from DAABiasDyn table. Try RWBiasDyn table");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dualpol_data_avail == 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table.But dualpol raw data is not available. "
|
||||||
|
"Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table. Dualpol raw data is available.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* retrieve the office ID from RadarLoc table
|
* retrieve the office ID from RadarLoc table
|
||||||
|
@ -123,17 +180,13 @@ void readRWBiasDyn(const char *radar_id, const char *site_id,
|
||||||
|
|
||||||
retrieveOfficeIDByRadarID(radar_id, officeID, irc);
|
retrieveOfficeIDByRadarID(radar_id, officeID, irc);
|
||||||
|
|
||||||
if (*irc == -1) {
|
if(*irc == -1)
|
||||||
sprintf(message,
|
{
|
||||||
"ERROR:in readRWBiasDyn - could not find office ID for radar: %s",
|
sprintf ( message, "ERROR: could not find office ID for radar: %s",
|
||||||
radar_id);
|
radar_id);
|
||||||
shutdown(message);
|
shutdown( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(message, "STATUS:in readRWBiasDyn - officeID = %s, siteID = %s",
|
|
||||||
officeID, site_id);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pick up the bias value based on the radar's office ID.
|
* Pick up the bias value based on the radar's office ID.
|
||||||
* If there is no record found, check if the office ID is
|
* If there is no record found, check if the office ID is
|
||||||
|
@ -141,92 +194,195 @@ void readRWBiasDyn(const char *radar_id, const char *site_id,
|
||||||
* FXA_LOCAL_SITE as office ID to pick up the bias value again.
|
* FXA_LOCAL_SITE as office ID to pick up the bias value again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strcmp(officeID, site_id) != 0) {
|
if(strcmp(officeID, site_id) != 0)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* if the office ID != FXA_LOCAL_SITE,
|
* if the office ID != FXA_LOCAL_SITE,
|
||||||
* then use the HPE_RFC_BIAS_LAG_TOKEN value
|
* then use the HPE_RFC_BIAS_LAG_TOKEN value
|
||||||
* to pick up the bias value.
|
* to pick up the bias value.
|
||||||
*/
|
*/
|
||||||
if (dualpol_on_flag == 0) {
|
|
||||||
sprintf(message,
|
|
||||||
"STATUS:in readRWBiasDyn - start to load SP RFC MFB from RWBiasDyn table"
|
|
||||||
" for officeID = %s, lag time = %d", officeID,
|
|
||||||
rfc_bias_lag);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
read_rwbiasdyn2(radar_id, officeID, datehour, rfc_bias_lag,
|
sprintf ( message , "STATUS: loading bias value based on"
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1, irc);
|
" %s and lag time: %d",
|
||||||
if (*irc != 0) {
|
officeID, rfc_bias_lag) ;
|
||||||
sprintf(message,
|
hpe_fieldgen_printMessage( message );
|
||||||
"STATUS:in readRWBiasDyn - can not load SP RFC MFB bias from RWBiasDyn"
|
|
||||||
" table for officeID = %s. Loading SP LOCAL MFB for siteID = %s, lag time = %d",
|
if (dualpol_on_flag == 0)
|
||||||
officeID, site_id, lag_cut);
|
{
|
||||||
hpe_fieldgen_printMessage(message);
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
|
rfc_bias_lag, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is NO, loading bias value from RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
read_rwbiasdyn2(radar_id, site_id, datehour, lag_cut,
|
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1,
|
|
||||||
irc);
|
|
||||||
} else {
|
|
||||||
sprintf(message,
|
|
||||||
"STATUS:in readRWBiasDyn - Loading SP RFC MFB bias from RWBiasDyn "
|
|
||||||
"table for officeID = %s, lag time = %d",
|
|
||||||
officeID, rfc_bias_lag);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
sprintf(message,
|
{
|
||||||
"STATUS:in readRWBiasDyn - start to load DP RFC MFB from DAABiasDyn table"
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is YES, loading bias value from DAABiasDyn table");
|
||||||
" for officeID = %s, lag time = %d", officeID,
|
hpe_fieldgen_printMessage( message );
|
||||||
rfc_bias_lag);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
read_daabiasdyn(radar_id, officeID, datehour, rfc_bias_lag,
|
read_daabiasdyn(radar_id, officeID, datehour,
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1, irc);
|
rfc_bias_lag, num_pairs, sumgag,
|
||||||
if (*irc != 0) {
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
sprintf(message,
|
|
||||||
"STATUS:in readRWBiasDyn - can not load DP RFC MFB from DAABiasDyn table"
|
|
||||||
" for officeID = %s. Loading DP LOCAL MFB for siteID = %s, lag time = %d",
|
|
||||||
officeID, site_id, lag_cut);
|
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
read_daabiasdyn(radar_id, site_id, datehour, lag_cut,
|
if (*irc != 0)
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1,
|
{
|
||||||
irc);
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
} else {
|
rfc_bias_lag, num_pairs, sumgag,
|
||||||
sprintf(message,
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
"STATUS:in readRWBiasDyn - Loading DP RFC MFB bias from DAABiasDyn table"
|
sprintf(message, "STATUS: in readRWBiasDyn, Fail to load bias value from DAABiasDyn table. Try RWBiasDyn table");
|
||||||
" for officeID = %s, lag time = %d",
|
hpe_fieldgen_printMessage( message );
|
||||||
officeID, rfc_bias_lag);
|
}
|
||||||
hpe_fieldgen_printMessage(message);
|
else
|
||||||
|
{
|
||||||
|
if (dualpol_data_avail == 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
|
rfc_bias_lag, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table.But dualpol data is not available. "
|
||||||
|
"Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table. Dualpol data is available.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (dualpol_on_flag == 0) {
|
}
|
||||||
read_rwbiasdyn2(radar_id, officeID, datehour, lag_cut,
|
else
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1, irc);
|
{
|
||||||
|
sprintf ( message , "STATUS: in readRWBiasDyn, loading bias value based on"
|
||||||
|
" %s and lag time: %d",
|
||||||
|
officeID, lag_cut) ;
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
sprintf(message,
|
if (dualpol_on_flag == 0)
|
||||||
"STATUS:in readRWBiasDyn - Loading SP RFC MFB bias from RWBiasDyn table"
|
{
|
||||||
" for officeID(siteID) = %s, lag time = %d",
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
officeID, lag_cut);
|
lag_cut, num_pairs, sumgag,
|
||||||
hpe_fieldgen_printMessage(message);
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
} else {
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is NO. Loading bias value from RWBiasDyn table.");
|
||||||
read_daabiasdyn(radar_id, officeID, datehour, lag_cut,
|
hpe_fieldgen_printMessage( message );
|
||||||
num_pairs, sumgag, sumrad, bias, lag, datetime1, irc);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is YES. Loading bias value from DAABiasDyn table");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
sprintf(message,
|
read_daabiasdyn(radar_id, officeID, datehour,
|
||||||
"STATUS:in readRWBiasDyn - Loading DP RFC MFB bias from DAABiasDyn table "
|
lag_cut, num_pairs, sumgag,
|
||||||
"for officeID(siteID) = %s, lag time = %d",
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
officeID, lag_cut);
|
if (*irc != 0)
|
||||||
hpe_fieldgen_printMessage(message);
|
{
|
||||||
|
sprintf(message, "STATUS: in readRWBiasDyn, faild to load bias value from DAABiasDyn table. Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dualpol_data_avail == 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, officeID, datehour,
|
||||||
|
rfc_bias_lag, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table.But dualpol data is not available. "
|
||||||
|
"Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table. Dualpol data is available.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record not found in RWBiasDyn table based on office ID.
|
||||||
|
* try to pick up bias value based on the FXA_LOCAL_SITE
|
||||||
|
* if it is different from office ID.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(*irc == 100)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(strcmp(officeID, site_id) != 0)
|
||||||
|
{
|
||||||
|
sprintf ( message , "STATUS: in readRWBiasDyn,Record not found in"
|
||||||
|
" RWBiasDyn table based on %s."
|
||||||
|
" try to pick up the bias value"
|
||||||
|
" based on the %s",
|
||||||
|
officeID, site_id) ;
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
|
if (dualpol_on_flag == 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is NO. Loading bias value from RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (message, "STATUS: in readRWBiasDyn, dualpol_on_flag is YES. Loading bias value from DAABiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
|
||||||
|
read_daabiasdyn(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
if (*irc != 0)
|
||||||
|
{
|
||||||
|
sprintf(message, "STATUS: in readRWBiasDyn, faild to find bias value in DAABiasDyn table. Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dualpol_data_avail == 0)
|
||||||
|
{
|
||||||
|
read_rwbiasdyn2(radar_id, site_id, datehour,
|
||||||
|
lag_cut, num_pairs, sumgag,
|
||||||
|
sumrad, bias, lag, datetime1, irc) ;
|
||||||
|
|
||||||
|
sprintf( message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table.But dualpol data is not available. "
|
||||||
|
"Try RWBiasDyn table.");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(message, "STATUS: in readRWBiasDyn, bias value is found in DAABiasDyn table. Dualpol data is available.s");
|
||||||
|
hpe_fieldgen_printMessage( message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_rwbiasdyn2(const char *radar_id, const char *office_id,
|
void read_rwbiasdyn2(const char *radar_id,
|
||||||
const char * str, const int lag_cut, double *num_pairs, double *sumgag,
|
const char *office_id,
|
||||||
double *sumrad, double *bias, int *lag, char sstr1[19], long int *irc)
|
const char * str,
|
||||||
|
const int lag_cut,
|
||||||
|
double *num_pairs,
|
||||||
|
double *sumgag,
|
||||||
|
double *sumrad,
|
||||||
|
double *bias,
|
||||||
|
int *lag,
|
||||||
|
char sstr1[19],
|
||||||
|
long int *irc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this function reads records from the RWBiasDyn table for previous hours
|
this function reads records from the RWBiasDyn table for previous hours
|
||||||
|
@ -235,17 +391,17 @@ void read_rwbiasdyn2(const char *radar_id, const char *office_id,
|
||||||
table if no records is found, then state variables are reinitialized
|
table if no records is found, then state variables are reinitialized
|
||||||
|
|
||||||
calling function: mfb_subr
|
calling function: mfb_subr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
int j, irec, ctr;
|
int j, irec, ctr;
|
||||||
RWBiasDyn *bdHead = NULL;
|
RWBiasDyn *bdHead = NULL;
|
||||||
RWBiasDyn *bdPtr = NULL;
|
RWBiasDyn *bdPtr = NULL;
|
||||||
char rrad[4] = { '\0' };
|
char rrad[4] = {'\0'};
|
||||||
char strp[22] = { '\0' };
|
char strp[22] = {'\0'};
|
||||||
char dude[22] = { '\0' };
|
char dude[22] = {'\0'};
|
||||||
char where[BUFSIZ] = { '\0' };
|
char where[BUFSIZ] = {'\0'};
|
||||||
char obstime_ANSI[ANSI_TIME_LEN + 1] = { '\0' };
|
char obstime_ANSI[ANSI_TIME_LEN+1] = {'\0'};
|
||||||
time_t firstTime = 0;
|
time_t firstTime = 0;
|
||||||
|
|
||||||
strncpy(rrad, radar_id, 3);
|
strncpy(rrad, radar_id, 3);
|
||||||
|
@ -258,13 +414,14 @@ void read_rwbiasdyn2(const char *radar_id, const char *office_id,
|
||||||
/*------------------------------------------------*/
|
/*------------------------------------------------*/
|
||||||
|
|
||||||
*irc = -1;
|
*irc = -1;
|
||||||
for (j = 0; j < lag_cut; j++) {
|
for(j = 0; j < lag_cut; j ++)
|
||||||
|
{
|
||||||
firstTime -= SECONDS_PER_HOUR;
|
firstTime -= SECONDS_PER_HOUR;
|
||||||
timet_to_yearsec_ansi(firstTime, strp);
|
timet_to_yearsec_ansi(firstTime, strp);
|
||||||
strncpy(sstr1, strp, 19);
|
strncpy(sstr1, strp, 19);
|
||||||
|
|
||||||
irec = 0;
|
irec = 0;
|
||||||
*lag = j + 1;
|
*lag = j+1;
|
||||||
|
|
||||||
/*------------------------------------------*/
|
/*------------------------------------------*/
|
||||||
/* select records for all mem_span values */
|
/* select records for all mem_span values */
|
||||||
|
@ -272,84 +429,110 @@ void read_rwbiasdyn2(const char *radar_id, const char *office_id,
|
||||||
|
|
||||||
timet_to_yearsec_ansi(firstTime, obstime_ANSI);
|
timet_to_yearsec_ansi(firstTime, obstime_ANSI);
|
||||||
sprintf(where, " WHERE radid='%s' AND obstime='%s' AND "
|
sprintf(where, " WHERE radid='%s' AND obstime='%s' AND "
|
||||||
" office_id = '%s'", rrad, obstime_ANSI, office_id);
|
" office_id = '%s'",
|
||||||
|
rrad, obstime_ANSI, office_id);
|
||||||
|
|
||||||
bdHead = GetRWBiasDyn(where);
|
bdHead = GetRWBiasDyn(where);
|
||||||
if (bdHead) {
|
if (bdHead)
|
||||||
|
{
|
||||||
bdPtr = (RWBiasDyn *) ListFirst(&bdHead->list);
|
bdPtr = (RWBiasDyn *) ListFirst(&bdHead->list);
|
||||||
ctr = 0;
|
ctr = 0;
|
||||||
while (bdPtr) {
|
while (bdPtr)
|
||||||
num_pairs[ctr] = (double) bdPtr->numpairs;
|
{
|
||||||
sumgag[ctr] = (double) bdPtr->sumgag;
|
num_pairs[ctr] = (double)bdPtr->numpairs;
|
||||||
sumrad[ctr] = (double) bdPtr->sumrad;
|
sumgag[ctr] = (double)bdPtr->sumgag;
|
||||||
bias[ctr] = (double) bdPtr->bias;
|
sumrad[ctr] = (double)bdPtr->sumrad;
|
||||||
|
bias[ctr] = (double)bdPtr->bias;
|
||||||
|
|
||||||
ctr++;
|
ctr++;
|
||||||
bdPtr = (RWBiasDyn *) ListNext(&bdPtr->node);
|
bdPtr = (RWBiasDyn *) ListNext(&bdPtr->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdHead != NULL) {
|
if ( bdHead != NULL )
|
||||||
|
{
|
||||||
FreeRWBiasDyn(bdHead);
|
FreeRWBiasDyn(bdHead);
|
||||||
bdHead = NULL;
|
bdHead = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctr > 0) {
|
if (ctr > 0)
|
||||||
|
{
|
||||||
*irc = 0;
|
*irc = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*irc = 100;
|
*irc = 100;
|
||||||
}
|
}
|
||||||
} /* end for (j=0 ... */
|
} /* end for (j=0 ... */
|
||||||
|
|
||||||
return;
|
return ;
|
||||||
|
|
||||||
} /* end read_rwbiasdyn2 function */
|
} /* end read_rwbiasdyn2 function */
|
||||||
|
|
||||||
void retrieveOfficeIDByRadarID(const char * radarID, char * officeID,
|
|
||||||
long int * status) {
|
|
||||||
char where_clause[BUFSIZ] = { '\0' };
|
|
||||||
RadarLoc * pRadarLocNode = NULL;
|
|
||||||
|
|
||||||
*status = 0;
|
void retrieveOfficeIDByRadarID(const char * radarID,
|
||||||
|
char * officeID,
|
||||||
|
long int * status)
|
||||||
|
{
|
||||||
|
char where_clause [ BUFSIZ ] = {'\0'};
|
||||||
|
RadarLoc * pRadarLocNode = NULL ;
|
||||||
|
|
||||||
|
*status = 0 ;
|
||||||
strcpy(officeID, "");
|
strcpy(officeID, "");
|
||||||
|
|
||||||
sprintf(where_clause, " ");
|
sprintf ( where_clause, " ");
|
||||||
|
|
||||||
if (pRadarLocHead == NULL) {
|
if(pRadarLocHead == NULL)
|
||||||
pRadarLocHead = GetRadarLoc(where_clause);
|
{
|
||||||
|
pRadarLocHead = GetRadarLoc ( where_clause ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRadarLocHead != NULL) {
|
if ( pRadarLocHead != NULL )
|
||||||
pRadarLocNode = (RadarLoc *) ListFirst(&pRadarLocHead->list);
|
{
|
||||||
|
pRadarLocNode = ( RadarLoc * ) ListFirst (&pRadarLocHead->list);
|
||||||
|
|
||||||
while (pRadarLocNode != NULL) {
|
while (pRadarLocNode != NULL)
|
||||||
if (strcmp(pRadarLocNode->radid, radarID) == 0) {
|
{
|
||||||
|
if(strcmp(pRadarLocNode->radid, radarID) == 0)
|
||||||
|
{
|
||||||
strcpy(officeID, pRadarLocNode->office_id);
|
strcpy(officeID, pRadarLocNode->office_id);
|
||||||
|
|
||||||
sprintf(message,
|
sprintf ( message , "From RadarLoc table, Radar ID: %s, Office ID: %s",
|
||||||
"STATUS:in retrieveOfficeIDByRadarID - From RadarLoc table, Radar ID: %s, Office ID: %s",
|
radarID, officeID );
|
||||||
radarID, officeID);
|
hpe_fieldgen_printMessage( message);
|
||||||
hpe_fieldgen_printMessage(message);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pRadarLocNode = (RadarLoc *) ListNext(&pRadarLocNode->node);
|
pRadarLocNode = (RadarLoc *) ListNext(&pRadarLocNode->node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
*status = -1;
|
else
|
||||||
|
{
|
||||||
|
* status = -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeRadarLocMemory() {
|
|
||||||
|
void freeRadarLocMemory()
|
||||||
|
{
|
||||||
/* Deallocate the RadarLoc linked list. */
|
/* Deallocate the RadarLoc linked list. */
|
||||||
|
|
||||||
if (pRadarLocHead != NULL) {
|
if ( pRadarLocHead != NULL )
|
||||||
FreeRadarLoc(pRadarLocHead);
|
{
|
||||||
pRadarLocHead = NULL;
|
FreeRadarLoc ( pRadarLocHead ) ;
|
||||||
|
pRadarLocHead = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============== Statements containing RCS keywords: */
|
||||||
|
{static char rcs_id1[] = "$Source: /fs/hseb/ob83/ohd/pproc/src/hpe_fieldgen/RCS/read_rwbiasdyn2.c,v $";
|
||||||
|
static char rcs_id2[] = "$Id: read_rwbiasdyn2.c,v 1.2 2007/10/30 13:33:13 gzhou Exp $";}
|
||||||
|
/* =================================================== */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue