diff --git a/src/tools/core/grid_stat/Makefile.am b/src/tools/core/grid_stat/Makefile.am index 75382103e4..d6bcf022d9 100644 --- a/src/tools/core/grid_stat/Makefile.am +++ b/src/tools/core/grid_stat/Makefile.am @@ -26,9 +26,10 @@ grid_stat_LDADD = -lvx_stat_out \ -lvx_data2d_nc_pinterp \ $(PYTHON_LIBS) \ -lvx_data2d_nccf \ + -lvx_data2d_ugrid -latlas -leckit -leckit_mpi -leckit_geometry \ -lvx_statistics \ -lvx_data2d \ - -lvx_seeps \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ diff --git a/src/tools/core/grid_stat/Makefile.in b/src/tools/core/grid_stat/Makefile.in index 07eed34176..ca963b5493 100644 --- a/src/tools/core/grid_stat/Makefile.in +++ b/src/tools/core/grid_stat/Makefile.in @@ -215,11 +215,17 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MET_ATLAS = @MET_ATLAS@ +MET_ATLASINC = @MET_ATLASINC@ +MET_ATLASLIB = @MET_ATLASLIB@ MET_BUFR = @MET_BUFR@ MET_BUFRLIB = @MET_BUFRLIB@ MET_CAIRO = @MET_CAIRO@ MET_CAIROINC = @MET_CAIROINC@ MET_CAIROLIB = @MET_CAIROLIB@ +MET_ECKIT = @MET_ECKIT@ +MET_ECKITINC = @MET_ECKITINC@ +MET_ECKITLIB = @MET_ECKITLIB@ MET_FREETYPE = @MET_FREETYPE@ MET_FREETYPEINC = @MET_FREETYPEINC@ MET_FREETYPELIB = @MET_FREETYPELIB@ @@ -336,9 +342,10 @@ grid_stat_LDADD = -lvx_stat_out \ -lvx_data2d_nc_pinterp \ $(PYTHON_LIBS) \ -lvx_data2d_nccf \ + -lvx_data2d_ugrid -latlas -leckit -leckit_mpi -leckit_geometry \ -lvx_statistics \ -lvx_data2d \ - -lvx_seeps \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index 6eef678e72..981c56493b 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -114,8 +114,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -127,8 +125,6 @@ using namespace std; #include #include -using namespace netCDF; - #include "main.h" #include "handle_openmp.h" @@ -140,8 +136,19 @@ using namespace netCDF; #include "vx_log.h" #include "seeps.h" +#include "vx_data2d_ugrid.h" + +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// +static ConcatString ugrid_nc; + +//////////////////////////////////////////////////////////////////////// + + static void process_command_line(int, char **); static void setup_first_pass (const DataPlane &); @@ -184,6 +191,7 @@ static void clean_up(); static void usage(); static void set_outdir(const StringArray &); static void set_compress(const StringArray &); +static void set_ugrid_nc(const StringArray &); static bool read_data_plane(VarInfo* info, DataPlane& dp, Met2dDataFile* mtddf, const ConcatString &filename); @@ -236,6 +244,7 @@ void process_command_line(int argc, char **argv) { // Add the options function calls cline.add(set_outdir, "-outdir", 1); cline.add(set_compress, "-compress", 1); + cline.add(set_ugrid_nc, "-ugrid", 1); // Parse the command line cline.parse(); @@ -263,6 +272,7 @@ void process_command_line(int argc, char **argv) { // Get the forecast and observation file types from config, if present ftype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_fcst)); otype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_obs)); + if (ftype == FileType_None && 0 < ugrid_nc.length()) ftype = FileType_UGrid; // Read forecast file if(!(fcst_mtddf = mtddf_factory.new_met_2d_data_file(fcst_file.c_str(), ftype))) { @@ -285,6 +295,10 @@ void process_command_line(int argc, char **argv) { // Process the configuration conf_info.process_config(ftype, otype); + if (FileType_UGrid == ftype) { + ((MetUGridDataFile *)fcst_mtddf)->open_metadata(ugrid_nc.c_str()); + } + // For python types read the first field to set the grid if(is_python_grdfiletype(ftype)) { if(!fcst_mtddf->data_plane(*conf_info.vx_opt[0].fcst_info, dp)) { @@ -3026,6 +3040,7 @@ void usage() { << "\tfcst_file\n" << "\tobs_file\n" << "\tconfig_file\n" + << "\t[-ugrid ugrid_file]\n" << "\t[-outdir path]\n" << "\t[-log file]\n" << "\t[-v level]\n" @@ -3040,6 +3055,9 @@ void usage() { << "\t\t\"config_file\" is a GridStatConfig file containing " << "the desired configuration settings (required).\n" + << "\t\t\"-ugrid ugrid_file\" is the metadata file for unstructured grid " + << " (only required for unstructured grid data).\n" + << "\t\t\"-outdir path\" overrides the default output directory " << "(" << out_dir << ") (optional).\n" @@ -3069,6 +3087,13 @@ void set_compress(const StringArray & a) { //////////////////////////////////////////////////////////////////////// +void set_ugrid_nc(const StringArray & a) +{ + ugrid_nc = a[0]; +} + +//////////////////////////////////////////////////////////////////////// + bool read_data_plane(VarInfo* info, DataPlane& dp, Met2dDataFile* mtddf, const ConcatString &filename) { diff --git a/src/tools/core/grid_stat/grid_stat_conf_info.h b/src/tools/core/grid_stat/grid_stat_conf_info.h index a6bf8dd4e7..f3ebdf5441 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.h +++ b/src/tools/core/grid_stat/grid_stat_conf_info.h @@ -277,7 +277,7 @@ class GridStatConfInfo { GridStatVxOpt * vx_opt; // Array of vx task options [n_vx] (allocated) - map mask_map; // Mapping of mask names to MaskPlanes + std::map mask_map; // Mapping of mask names to MaskPlanes GridWeightType grid_weight_flag; // Grid weighting flag ConcatString tmp_dir; // Directory for temporary files diff --git a/src/tools/core/point_stat/Makefile.in b/src/tools/core/point_stat/Makefile.in index 6970bd2117..610f61f98d 100644 --- a/src/tools/core/point_stat/Makefile.in +++ b/src/tools/core/point_stat/Makefile.in @@ -216,11 +216,17 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MET_ATLAS = @MET_ATLAS@ +MET_ATLASINC = @MET_ATLASINC@ +MET_ATLASLIB = @MET_ATLASLIB@ MET_BUFR = @MET_BUFR@ MET_BUFRLIB = @MET_BUFRLIB@ MET_CAIRO = @MET_CAIRO@ MET_CAIROINC = @MET_CAIROINC@ MET_CAIROLIB = @MET_CAIROLIB@ +MET_ECKIT = @MET_ECKIT@ +MET_ECKITINC = @MET_ECKITINC@ +MET_ECKITLIB = @MET_ECKITLIB@ MET_FREETYPE = @MET_FREETYPE@ MET_FREETYPEINC = @MET_FREETYPEINC@ MET_FREETYPELIB = @MET_FREETYPELIB@ @@ -335,10 +341,11 @@ point_stat_LDADD = -lvx_stat_out \ -lvx_data2d_grib $(GRIB2_LIBS) \ -lvx_data2d_nc_pinterp \ -lvx_data2d_nccf \ + -lvx_data2d_ugrid -latlas -leckit -leckit_mpi -leckit_geometry \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ - -lvx_seeps \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 78ed0bd1d0..a12d434218 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -106,8 +106,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -119,7 +117,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "point_stat.h" @@ -133,14 +130,19 @@ using namespace netCDF; #include "nc_obs_util.h" #include "nc_point_obs_in.h" +#include "vx_data2d_ugrid.h" + #ifdef WITH_PYTHON #include "data2d_nc_met.h" #include "pointdata_python.h" #endif -//////////////////////////////////////////////////////////////////////// +using namespace std; +using namespace netCDF; +//////////////////////////////////////////////////////////////////////// +static ConcatString ugrid_nc; //////////////////////////////////////////////////////////////////////// @@ -177,6 +179,7 @@ static void set_ncfile(const StringArray &); static void set_obs_valid_beg_time(const StringArray &); static void set_obs_valid_end_time(const StringArray &); static void set_outdir(const StringArray &); +static void set_ugrid_nc(const StringArray &); //////////////////////////////////////////////////////////////////////// @@ -240,6 +243,7 @@ void process_command_line(int argc, char **argv) { cline.add(set_obs_valid_beg_time, "-obs_valid_beg", 1); cline.add(set_obs_valid_end_time, "-obs_valid_end", 1); cline.add(set_outdir, "-outdir", 1); + cline.add(set_ugrid_nc, "-ugrid", 1); // Parse the command line cline.parse(); @@ -280,6 +284,7 @@ void process_command_line(int argc, char **argv) { // Get the forecast file type from config, if present ftype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_fcst)); + if (ftype == FileType_None && 0 < ugrid_nc.length()) ftype = FileType_UGrid; // Read forecast file if(!(fcst_mtddf = mtddf_factory.new_met_2d_data_file(fcst_file.c_str(), ftype))) { @@ -297,6 +302,10 @@ void process_command_line(int argc, char **argv) { // Set the model name shc.set_model(conf_info.model.c_str()); + if (FileType_UGrid == ftype) { + ((MetUGridDataFile *)fcst_mtddf)->open_metadata(ugrid_nc.c_str()); + } + // Use the first verification task to set the random number generator // and seed value for bootstrap confidence intervals rng_set(rng_ptr, @@ -2164,6 +2173,7 @@ void usage() { << "\t[-point_obs file]\n" << "\t[-obs_valid_beg time]\n" << "\t[-obs_valid_end time]\n" + << "\t[-ugrid ugrid_file]\n" << "\t[-outdir path]\n" << "\t[-log file]\n" << "\t[-v level]\n\n" @@ -2189,6 +2199,9 @@ void usage() { << "\t\t\"-outdir path\" overrides the default output " << "directory (" << out_dir << ") (optional).\n" + << "\t\t\"-ugrid ugrid_file\" is the metadata file for unstructured grid " + << " (only required for unstructured grid data).\n" + << "\t\t\"-log file\" outputs log messages to the specified " << "file (optional).\n" @@ -2234,3 +2247,11 @@ void set_outdir(const StringArray & a) } //////////////////////////////////////////////////////////////////////// + +void set_ugrid_nc(const StringArray & a) +{ + ugrid_nc = a[0]; +} + +//////////////////////////////////////////////////////////////////////// + diff --git a/src/tools/core/point_stat/point_stat_conf_info.cc b/src/tools/core/point_stat/point_stat_conf_info.cc index 47823acdb5..c1f6d35af2 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,9 @@ using namespace std; #include "vx_data2d.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class PointStatConfInfo diff --git a/src/tools/core/point_stat/point_stat_conf_info.h b/src/tools/core/point_stat/point_stat_conf_info.h index 26613f0781..61a5f58ec2 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -134,7 +134,7 @@ class PointStatVxOpt { SingleThresh seeps_p1_thresh; // SEESP p1 threshold // Vector of MaskLatLon objects defining Lat/Lon Point masks - vector mask_llpnt; + std::vector mask_llpnt; StringArray mask_name; // Masking names @@ -235,13 +235,13 @@ class PointStatConfInfo { SingleThresh topo_interp_fcst_thresh; // Message type groups that should be processed together - map msg_typ_group_map; + std::map msg_typ_group_map; // Mapping of mask names to DataPlanes - map mask_area_map; + std::map mask_area_map; // Mapping of mask names to Station ID lists - map mask_sid_map; + std::map mask_sid_map; ConcatString tmp_dir; // Directory for temporary files ConcatString output_prefix; // String to customize output file name