From 5a05eaa1b700891ec50d24365f96b643bc19cc3d Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 20 Sep 2023 17:45:36 -0600 Subject: [PATCH] #2231 Added ugrid_max_distance_km --- src/basic/vx_config/config_constants.h | 7 +- src/basic/vx_config/config_util.cc | 43 +++------ src/basic/vx_config/config_util.h | 7 +- src/libcode/vx_data2d_ugrid/data2d_ugrid.cc | 9 +- src/libcode/vx_data2d_ugrid/data2d_ugrid.h | 3 +- src/libcode/vx_data2d_ugrid/ugrid_file.cc | 91 +++++-------------- src/libcode/vx_data2d_ugrid/ugrid_file.h | 4 +- src/libcode/vx_grid/grid_base.cc | 34 ++++--- src/libcode/vx_grid/unstructured_grid.cc | 66 +++++++++----- src/libcode/vx_grid/unstructured_grid.h | 3 +- src/libcode/vx_grid/unstructured_grid_defs.h | 5 +- src/tools/core/grid_stat/grid_stat.cc | 10 +- .../core/grid_stat/grid_stat_conf_info.cc | 12 ++- .../core/grid_stat/grid_stat_conf_info.h | 3 +- src/tools/core/point_stat/point_stat.cc | 16 +++- .../core/point_stat/point_stat_conf_info.cc | 12 ++- .../core/point_stat/point_stat_conf_info.h | 3 +- 17 files changed, 170 insertions(+), 158 deletions(-) diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index 03acebbd98..39e220c9f2 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -675,14 +675,15 @@ static const char conf_key_trunc_factor[] = "gaussian_trunc_factor"; static const char conf_key_eclv_points[] = "eclv_points"; static const char conf_key_var_name_map[] = "var_name_map"; static const char conf_key_metadata_map[] = "metadata_map"; -static const char conf_key_ugrid_map_config[] = "ugrid_map_config"; -static const char conf_key_ugrid_metadata_map[]= "ugrid_metadata_map"; static const char conf_key_obs_to_qc_map[] = "obs_to_qc_map"; static const char conf_key_missing_thresh[] = "missing_thresh"; static const char conf_key_control_id[] = "control_id"; static const char conf_key_ens_member_ids[] = "ens_member_ids"; static const char conf_key_seeps_p1_thresh[] = "seeps_p1_thresh"; -static const char conf_key_ugrid_metadata_file[] = "ugrid_metadata_file"; +static const char conf_key_ugrid_coordinates_file[] = "ugrid_coordinates_file"; +static const char conf_key_ugrid_max_distance_km[] = "ugrid_max_distance_km"; +static const char conf_key_ugrid_metadata_map[] = "ugrid_metadata_map"; +static const char conf_key_ugrid_user_map_config[] = "ugrid_user_map_config"; // // Entries to override file metadata diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 9985a22338..d88097deb3 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -293,7 +293,7 @@ ConcatString parse_conf_string(Dictionary *dict, const char *conf_key, const char *method_name = "parse_conf_string() -> "; if(!dict) { - mlog << Error << "\n" << method_name << "empty dictionary!\n\n"; + mlog << Error << "\n" << method_name << "empty dictionary! (" << conf_key <<")\n\n"; exit(1); } @@ -1126,13 +1126,6 @@ map parse_conf_metadata_map(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// -map parse_conf_ugrid_metadata_map(Dictionary *dict) { - const char *method_name = "parse_conf_ugrid_metadata_map() -> "; - return parse_conf_key_values_map(dict, conf_key_ugrid_metadata_map, method_name); -} - -/////////////////////////////////////////////////////////////////////////////// - map parse_conf_obs_name_map(Dictionary *dict) { const char *method_name = "parse_conf_obs_name_map() -> "; return parse_conf_key_value_map(dict, conf_key_obs_name_map); @@ -2269,36 +2262,30 @@ WaveletType parse_conf_wavelet_type(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// -ConcatString parse_conf_ugrid_map_config(Dictionary *dict) { - ConcatString s; - - if(!dict) { - mlog << Error << "\nparse_conf_ugrid_map_config() -> " - << "empty dictionary!\n\n"; - exit(1); - } +double parse_conf_ugrid_max_distance_km(Dictionary *dict) { + return dict ? dict->lookup_double(conf_key_ugrid_max_distance_km, false) : bad_data_double; +} - s = dict->lookup_string(conf_key_ugrid_map_config); +/////////////////////////////////////////////////////////////////////////////// - return s; +ConcatString parse_conf_ugrid_coordinates_file(Dictionary *dict) { + return dict ? dict->lookup_string(conf_key_ugrid_coordinates_file, false) : ""; } /////////////////////////////////////////////////////////////////////////////// -ConcatString parse_conf_ugrid_metadata_file(Dictionary *dict) { - ConcatString s; - - if(!dict) { - mlog << Error << "\nparse_conf_ugrid_metadata_file() -> " - << "empty dictionary!\n\n"; - exit(1); - } +map parse_conf_ugrid_metadata_map(Dictionary *dict) { + const char *method_name = "parse_conf_ugrid_metadata_map() -> "; + return parse_conf_key_values_map(dict, conf_key_ugrid_metadata_map, method_name); +} - s = dict->lookup_string(conf_key_ugrid_metadata_file); +/////////////////////////////////////////////////////////////////////////////// - return s; +ConcatString parse_conf_ugrid_user_map_config(Dictionary *dict) { + return dict ? dict->lookup_string(conf_key_ugrid_user_map_config, false) : ""; } + /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index a52335988b..71435e1a3e 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -64,7 +64,6 @@ extern std::map parse_conf_obs_name_map(Dictionary *dict); extern std::map parse_conf_obs_to_qc_map(Dictionary *dict); -extern std::map parse_conf_ugrid_metadata_map(Dictionary *dict); extern std::map parse_conf_key_convert_map( Dictionary *dict, const char *conf_key_map_name, const char *caller=nullptr); @@ -86,8 +85,10 @@ extern void parse_conf_range_int(Dictionary *dict, int &beg, int &end extern void parse_conf_range_double(Dictionary *dict, double &beg, double &end); extern StringArray parse_conf_ens_member_ids(Dictionary *dict); extern NormalizeType parse_conf_normalize(Dictionary *dict); -extern ConcatString parse_conf_ugrid_map_config(Dictionary *dict); -extern ConcatString parse_conf_ugrid_metadata_file(Dictionary *dict); +extern double parse_conf_ugrid_max_distance_km(Dictionary *dict); +extern ConcatString parse_conf_ugrid_user_map_config(Dictionary *dict); +extern ConcatString parse_conf_ugrid_coordinates_file(Dictionary *dict); +extern std::map parse_conf_ugrid_metadata_map(Dictionary *dict); extern void check_mask_names(const StringArray &); diff --git a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc index f4d842e213..d97c824002 100644 --- a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc +++ b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc @@ -676,9 +676,14 @@ long MetUGridDataFile::convert_value_to_offset(double z_value, string z_dim_name //////////////////////////////////////////////////////////////////////// +void MetUGridDataFile::set_max_distance_km(double max_distance) { + _file->set_max_distance_km(max_distance); +} + +//////////////////////////////////////////////////////////////////////// -void MetUGridDataFile::set_map_config_file(ConcatString filename) { - _file->set_map_config_file(filename); +void MetUGridDataFile::set_user_map_config_file(ConcatString filename) { + _file->set_user_map_config_file(filename); } diff --git a/src/libcode/vx_data2d_ugrid/data2d_ugrid.h b/src/libcode/vx_data2d_ugrid/data2d_ugrid.h index 7a3b1af17c..9912eb9170 100644 --- a/src/libcode/vx_data2d_ugrid/data2d_ugrid.h +++ b/src/libcode/vx_data2d_ugrid/data2d_ugrid.h @@ -100,7 +100,8 @@ class MetUGridDataFile : public Met2dDataFile { bool open (const char * filename); bool open_metadata(const char * filename); - void set_map_config_file(ConcatString filename); + void set_max_distance_km(double max_distance); + void set_user_map_config_file(ConcatString filename); void close (); diff --git a/src/libcode/vx_data2d_ugrid/ugrid_file.cc b/src/libcode/vx_data2d_ugrid/ugrid_file.cc index 153ef46dff..51454fd5ff 100644 --- a/src/libcode/vx_data2d_ugrid/ugrid_file.cc +++ b/src/libcode/vx_data2d_ugrid/ugrid_file.cc @@ -35,7 +35,7 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -static const char *def_user_config = "UGridConfig_user""; +static const char *def_user_config = "UGridConfig_user"; static const char *def_config_filename = "MET_BASE/config/UGridConfig_default"; @@ -100,6 +100,7 @@ void UGridFile::init_from_scratch() _lonVar = (NcVar *)nullptr; _xCoordVar = (NcVar *)nullptr; _yCoordVar = (NcVar *)nullptr; + max_distance_km = bad_data_double; // Close any existing file @@ -172,8 +173,8 @@ bool UGridFile::open(const char * filepath) // Close any open files and clear out the associated members close(); - ConcatString config_file = def_config_filename - if (file_exists(default_user_config.c_str())) config_file = def_user_config; + ConcatString config_file = file_exists(def_user_config) + ? def_user_config : def_config_filename; read_config(config_file); if (_ncFile) { @@ -445,13 +446,7 @@ void UGridFile::dump(ostream & out, int depth) const grid.dump(out, depth + 1); out << prefix << "\n"; - out << prefix << "Nc = " << (_ncFile ? "ok" : "(nul)") << "\n"; - - out << prefix << "\n"; - - out << prefix << "Ndims = " << _numDims << "\n"; - out << prefix << "\n"; out << prefix << "face_dim = " << (_faceDim ? GET_NC_NAME_P(_faceDim) : "(nul)") << "\n"; @@ -528,8 +523,6 @@ std::string UGridFile::find_metadata_name(std::string &key, StringArray &availab for (int idx=0; idx found " << meta_name - // << " for " << key << "\n"; break; } } @@ -559,37 +552,6 @@ double UGridFile::getData(NcVar * var, const LongArray & a) const static const string method_name = "UGridFile::getData(NcVar *, const LongArray &) -> "; -/* - if (!args_ok(a)) - { - mlog << Error << "\n" << method_name - << "bad arguments:\n"; - a.dump(cerr); - exit(1); - } - - int dim_count = get_dim_count(var); - if (dim_count != a.n_elements()) - { - mlog << Error << "\n" << method_name - << "needed " << (dim_count) << " arguments for variable " - << (GET_NC_NAME_P(var)) << ", got " << (a.n_elements()) << "\n\n"; - exit(1); - } - - - for (int k=0; kgetDim(k).getSize(); - if (dim_size < a[k]) { - mlog << Error << "\n" << method_name - << "offset (" << a[k] << ") at " << k - << "th dimension (" << long(dim_size) << ") is too big for variable \"" - << GET_NC_NAME_P(var) << "\"\n\n"; - exit ( 1 ); - } - } -*/ - bool status = false; double d = bad_data_double; @@ -627,23 +589,6 @@ bool UGridFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const static const string method_name = "UGridFile::getData(NcVar *, const LongArray &, DataPlane &) const -> "; -// if (!args_ok(a)) -// { -// mlog << Error << "\n" << method_name -// << "bad arguments:\n"; -// a.dump(cerr); -// exit(1); -// } -// -// int dim_count = get_dim_count(v); -// if (dim_count != a.n_elements()) -// { -// mlog << Error << "\n" << method_name -// << "needed " << (dim_count) << " arguments for variable " -// << (GET_NC_NAME_P(v)) << ", got " << (a.n_elements()) << "\n\n"; -// exit(1); -// } - // find varinfo's NcVarInfo *var = find_by_name(GET_NC_NAME_P(v).c_str()); @@ -780,9 +725,6 @@ bool UGridFile::get_var_info() { for (int j=0; j metadata_map; StringArray metadata_names; + double max_distance_km; // // dimensions diff --git a/src/libcode/vx_grid/grid_base.cc b/src/libcode/vx_grid/grid_base.cc index 8827423321..9d1376c84e 100644 --- a/src/libcode/vx_grid/grid_base.cc +++ b/src/libcode/vx_grid/grid_base.cc @@ -308,11 +308,22 @@ void UnstructuredData::clear() { name = (const char *) nullptr; + Nface = Nnode = Nedge = 0; + max_distance_km = bad_data_double; // disable max_distance + + clear_data(); + +} + + +//////////////////////////////////////////////////////////////////////// + +void UnstructuredData::clear_data() { + Nface = 0; - //distance = -1.; // disable distance + pointLonLat.clear(); lat_checksum = lon_checksum = 0.; - pointLonLat.clear(); if (kdtree) { delete kdtree; kdtree = nullptr; } } @@ -325,9 +336,10 @@ void UnstructuredData::dump() const { mlog << Debug(grid_debug_level) << "\nUnstructured Grid Data:\n" - << " Nface: " << Nface << "\n" - << " lat_checksum: " << lat_checksum << "\n" - << " lon_checksum: " << lon_checksum << "\n" + << " Nface: " << Nface << "\n" + << " lat_checksum: " << lat_checksum << "\n" + << " lon_checksum: " << lon_checksum << "\n" + << " max_distance_km: " << max_distance_km << "\n" ; } @@ -733,17 +745,11 @@ void GridInfo::set(const UnstructuredData & data) clear(); -/* -us = new UnstructuredData(); -memcpy(D, &data, sizeof(data)); -us->Nface = data.Nface; -us->copy_data(data.pointLonLat); -//us = new UnstructuredData(data); -*/ - UnstructuredData *D = new UnstructuredData; -//D->Nface = data.Nface; +D->Nedge = data.Nedge; +D->Nnode = data.Nnode; +D->max_distance_km = data.max_distance_km; D->set_points(data.Nface, data.pointLonLat); us = D; D = (UnstructuredData *)nullptr; diff --git a/src/libcode/vx_grid/unstructured_grid.cc b/src/libcode/vx_grid/unstructured_grid.cc index 03d9e9b0c7..618854bd73 100644 --- a/src/libcode/vx_grid/unstructured_grid.cc +++ b/src/libcode/vx_grid/unstructured_grid.cc @@ -96,12 +96,12 @@ void UnstructuredGrid::set_from_data(const UnstructuredData &data) { clear(); if (data.name) Name = data.name; - Nx = data.Nface;; + Nx = data.Nface; Data.Nface = Nx; Data.Nedge = data.Nedge; Data.Nnode = data.Nnode; - Data.pt_distance = data.pt_distance; + Data.max_distance_km = data.max_distance_km; Data.set_points(Nx, data.pointLonLat); @@ -109,9 +109,9 @@ void UnstructuredGrid::set_from_data(const UnstructuredData &data) { //////////////////////////////////////////////////////////////////////// -void UnstructuredGrid::set_distance(double _distance) { +void UnstructuredGrid::set_max_distance_km(double max_distance) { - Data.pt_distance = _distance; + Data.max_distance_km = max_distance; } @@ -124,19 +124,25 @@ void UnstructuredGrid::latlon_to_xy(double lat, double lon, double &x, double &y IndexKDTree::ValueList neighbor = Data.kdtree->closestPoints(_pointLonLat, 1); size_t index(neighbor[0].payload()); - double distance(neighbor[0].distance()); + double distance_km(neighbor[0].distance()/1000.); + bool is_rejected = (!is_eq(Data.max_distance_km, bad_data_double) + && Data.max_distance_km > 0 + && Data.max_distance_km < distance_km); - x = index; + x = is_rejected ? -1.0 : index; y = 0; - PointLonLat lonlat; - if(distance > 180.0) atlas_geometry.xyz2lonlat(neighbor[0].point(), lonlat); - else lonlat.assign(neighbor[0].point()[0], neighbor[0].point()[1]); + //PointLonLat r_lonlat; + //if(_distance > 180.0) atlas_geometry.xyz2lonlat(neighbor[0].point(), r_lonlat); + //else r_lonlat.assign(neighbor[0].point()[0], neighbor[0].point()[1]); mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredGrid::latlon_to_xy() " - << "input=(" << lon << ", " << lat << ") ==> (" << x << ", " << y - << ") mapped (" << Data.pointLonLat[index].y() << ", " << Data.pointLonLat[index].y() - << ") distance= " << distance << "\n"; + << "input=(" << lon << ", " << lat << ") ==> (" << x << ", " << y << ") == (" + << Data.pointLonLat[index].x() << ", " << Data.pointLonLat[index].y() + << ") distance= " << distance_km << "km, " + << _pointLonLat.distance(Data.pointLonLat[index]) + << " degree, is_rejected: " << is_rejected + << ", max_distanc=" << Data.max_distance_km<< "\n"; } @@ -333,7 +339,7 @@ void Grid::set(const UnstructuredData &data) { UnstructuredData::UnstructuredData() { kdtree = nullptr; - pt_distance = -1.; // disable distance + max_distance_km = bad_data_double; // disable distance clear(); } @@ -349,6 +355,7 @@ void UnstructuredData::build_tree() { atlas::idx_t n = 0; kdtree = new IndexKDTree(atlas_geometry); + kdtree->reserve(Nface); for (int i=0; iNface, us_data->pointLonLat); + Nedge = us_data->Nedge; + Nnode = us_data->Nnode; + max_distance_km = us_data->max_distance_km; +} + +//////////////////////////////////////////////////////////////////////// + void UnstructuredData::set_points(int count, double *_lon, double *_lat) { - clear(); + clear_data(); Nface = count; pointLonLat.reserve(count); @@ -384,21 +409,20 @@ void UnstructuredData::set_points(int count, double *_lon, double *_lat) { //////////////////////////////////////////////////////////////////////// -void UnstructuredData::set_points(int count, const std::vector &_pointLonLat) { +void UnstructuredData::set_points(int count, const std::vector &ptLonLat) { - clear(); + clear_data(); Nface = count; - pointLonLat.reserve(Nface); - + pointLonLat.reserve(count); for (int i=0; i &) first: (" << pointLonLat[0].x() << ", " << pointLonLat[0].y() << ") and last (" << pointLonLat[count-1].x() << ", " << pointLonLat[count-1].y() << ") from (" - << _pointLonLat[0].x() << ", " << _pointLonLat[0].y() << ") and (" - << _pointLonLat[count-1].x() << ", " << _pointLonLat[count-1].y() << ")\n"; + << ptLonLat[0].x() << ", " << ptLonLat[0].y() << ") and (" + << ptLonLat[count-1].x() << ", " << ptLonLat[count-1].y() << ")\n"; build_tree(); diff --git a/src/libcode/vx_grid/unstructured_grid.h b/src/libcode/vx_grid/unstructured_grid.h index e850c03ea5..bdf09a2a77 100644 --- a/src/libcode/vx_grid/unstructured_grid.h +++ b/src/libcode/vx_grid/unstructured_grid.h @@ -47,7 +47,8 @@ class UnstructuredGrid : public GridRep { void clear(); void set_from_data(const UnstructuredData &); - void set_distance(double _distance); + //void set_max_distance_deg(double max_distance); + void set_max_distance_km(double max_distance); // // grid interface diff --git a/src/libcode/vx_grid/unstructured_grid_defs.h b/src/libcode/vx_grid/unstructured_grid_defs.h index fd31bf5a7f..29b9ccfe09 100644 --- a/src/libcode/vx_grid/unstructured_grid_defs.h +++ b/src/libcode/vx_grid/unstructured_grid_defs.h @@ -39,7 +39,7 @@ struct UnstructuredData { int Nface; int Nedge; int Nnode; - double pt_distance; + double max_distance_km; // This should be set after calling set_points() double lat_checksum; double lon_checksum; @@ -52,7 +52,10 @@ struct UnstructuredData { void build_tree(); void set_points(int count, double *_lon, double *_lat); void set_points(int count, const std::vector &); + void copy_from(const UnstructuredData *); + void copy_from(const UnstructuredData &); void clear(); + void clear_data(); void dump() const; }; diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index 620380c5e2..e41a6b8c5e 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -227,6 +227,7 @@ void process_command_line(int argc, char **argv) { GrdFileType ftype, otype; ConcatString default_config_file; DataPlane dp; + const char *method_name = "process_command_line() -> "; // Set the default output directory out_dir = replace_path(default_out_dir); @@ -294,11 +295,16 @@ void process_command_line(int argc, char **argv) { if (FileType_UGrid == ftype) { ConcatString ugrid_nc = conf_info.ugrid_nc; - ConcatString map_config_file = conf_info.ugrid_map_config; + ConcatString ugrid_user_map_config = conf_info.ugrid_user_map_config; MetUGridDataFile *ugrid_mtddf = (MetUGridDataFile *)fcst_mtddf; - if (0 < map_config_file.length()) ugrid_mtddf->set_map_config_file(map_config_file); + ugrid_mtddf->set_max_distance_km(conf_info.ugrid_max_distance_km); + if (0 < ugrid_user_map_config.length()) + ugrid_mtddf->set_user_map_config_file(ugrid_user_map_config); if (0 == ugrid_nc.length() || ugrid_nc == "NA") ugrid_nc = fcst_file; ugrid_mtddf->open_metadata(ugrid_nc.c_str()); + mlog << Debug(9) << method_name + << "ugrid_coordinates_nc: " << ugrid_nc + << " ugrid_max_distance_km: " << conf_info.ugrid_max_distance_km << "\n"; } // For python types read the first field to set the grid diff --git a/src/tools/core/grid_stat/grid_stat_conf_info.cc b/src/tools/core/grid_stat/grid_stat_conf_info.cc index 9d9f9816f3..4c068cf85d 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -67,6 +67,9 @@ void GridStatConfInfo::clear() { tmp_dir.clear(); output_prefix.clear(); version.clear(); + ugrid_nc.clear(); + ugrid_user_map_config.clear(); + ugrid_max_distance_km = bad_data_double; for(i=0; i obs_valid_end_ut) { - mlog << Error << "\nprocess_command_line() -> " + mlog << Error << "\n" << method_name << "the ending time (" << unix_to_yyyymmdd_hhmmss(obs_valid_end_ut) << ") must be greater than the beginning time (" @@ -284,7 +285,7 @@ void process_command_line(int argc, char **argv) { // Read forecast file if(!(fcst_mtddf = mtddf_factory.new_met_2d_data_file(fcst_file.c_str(), ftype))) { - mlog << Error << "\nTrouble reading forecast file \"" + mlog << Error << "\n" << method_name << "Trouble reading forecast file \"" << fcst_file << "\"\n\n"; exit(1); } @@ -300,11 +301,16 @@ void process_command_line(int argc, char **argv) { if (FileType_UGrid == ftype) { ConcatString ugrid_nc = conf_info.ugrid_nc; - ConcatString map_config_file = conf_info.ugrid_map_config; + ConcatString ugrid_user_map_config = conf_info.ugrid_user_map_config; MetUGridDataFile *ugrid_mtddf = (MetUGridDataFile *)fcst_mtddf; - if (0 < map_config_file.length()) ugrid_mtddf->set_map_config_file(map_config_file); + ugrid_mtddf->set_max_distance_km(conf_info.ugrid_max_distance_km); + if (0 < ugrid_user_map_config.length()) + ugrid_mtddf->set_user_map_config_file(ugrid_user_map_config); if (0 == ugrid_nc.length() || ugrid_nc == "NA") ugrid_nc = fcst_file; ugrid_mtddf->open_metadata(ugrid_nc.c_str()); + mlog << Debug(9) << method_name + << "ugrid_coordinate_nc: " << ugrid_nc + << " ugrid_max_distance_km: " << conf_info.ugrid_max_distance_km << "\n"; } // Use the first verification task to set the random number generator 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 4dbb1c0add..b941ecf2e8 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -72,7 +72,8 @@ void PointStatConfInfo::clear() { output_prefix.clear(); version.clear(); ugrid_nc.clear(); - ugrid_map_config.clear(); + ugrid_user_map_config.clear(); + ugrid_max_distance_km = bad_data_double; // Deallocate memory if(vx_opt) { delete [] vx_opt; vx_opt = (PointStatVxOpt *) 0; } @@ -124,10 +125,13 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { tmp_dir = parse_conf_tmp_dir(&conf); // Conf: ugrid_nc - ugrid_nc = parse_conf_ugrid_metadata_file(&conf); + ugrid_nc = parse_conf_ugrid_coordinates_file(&conf); - // Conf: ugrid_map_config - ugrid_map_config = parse_conf_ugrid_map_config(&conf); + // Conf: ugrid_user_map_config + ugrid_user_map_config = parse_conf_ugrid_user_map_config(&conf); + + // Conf: ugrid_max_distance_km + ugrid_max_distance_km = parse_conf_ugrid_max_distance_km(&conf); // Conf: output_prefix output_prefix = conf.lookup_string(conf_key_output_prefix); 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 792a511f7c..1fede798b6 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -247,7 +247,8 @@ class PointStatConfInfo { ConcatString output_prefix; // String to customize output file name ConcatString version; // Config file version ConcatString ugrid_nc; // NetCDF for coordinate variables of unstructured grid - ConcatString ugrid_map_config; // Configuration file which contains ugrid metadata mapping + ConcatString ugrid_user_map_config; // User's configuration file which contains ugrid metadata mapping + double ugrid_max_distance_km; // max distance to be the closest neighbor to unstructured grid // Summary of output file options across all verification tasks STATOutputType output_flag[n_txt]; // Flag for each output line type