From 67006325773111ea15fa6081bd95fa578ee31a13 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 11:54:39 -0700 Subject: [PATCH 1/7] #1943 Load SEEPS climo only if SEEPS is enabled --- src/libcode/vx_statistics/pair_data_point.cc | 29 +++++++++++++++++-- src/libcode/vx_statistics/pair_data_point.h | 3 ++ .../core/point_stat/point_stat_conf_info.cc | 6 +++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index ff7df4262e..c00859ff31 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -70,8 +70,8 @@ void PairDataPoint::init_from_scratch() { seeps_mpr.clear(); seeps.clear(); + seeps_climo = NULL; clear(); - seeps_climo = get_seeps_climo(); return; } @@ -180,8 +180,16 @@ bool PairDataPoint::add_point_pair(const char *sid, double lat, double lon, //////////////////////////////////////////////////////////////////////// +void PairDataPoint::load_seeps_climo() { + if (NULL == seeps_climo) seeps_climo = get_seeps_climo(); +} + +//////////////////////////////////////////////////////////////////////// + void PairDataPoint::set_seeps_thresh(const SingleThresh &p1_thresh) { - seeps_climo->set_p1_thresh(p1_thresh); + if (NULL != seeps_climo) seeps_climo->set_p1_thresh(p1_thresh); + else mlog << Warning << "\nPairDataPoint::set_seeps_thresh() ignored t1_threshold." + << " Load SEESP climo first\n\n"; } //////////////////////////////////////////////////////////////////////// @@ -1470,6 +1478,23 @@ void VxPairDataPoint::set_obs_perc_value(int percentile) { //////////////////////////////////////////////////////////////////////// +void VxPairDataPoint::load_seeps_climo() { + bool loaded = false; + for(int i=0; i < n_msg_typ; i++){ + for(int j=0; j < n_mask; j++){ + for(int k=0; k < n_interp; k++){ + pd[i][j][k].load_seeps_climo(); + loaded = true; + break; + } + if (loaded) break; + } + if (loaded) break; + } +} + +//////////////////////////////////////////////////////////////////////// + void VxPairDataPoint::set_seeps_thresh(const SingleThresh &p1_thresh) { for(int i=0; i < n_msg_typ; i++){ for(int j=0; j < n_mask; j++){ diff --git a/src/libcode/vx_statistics/pair_data_point.h b/src/libcode/vx_statistics/pair_data_point.h index ab44e87d17..f98a1ee376 100644 --- a/src/libcode/vx_statistics/pair_data_point.h +++ b/src/libcode/vx_statistics/pair_data_point.h @@ -34,6 +34,7 @@ class PairDataPoint : public PairBase { void assign(const PairDataPoint &); SeepsClimo *seeps_climo; + public: PairDataPoint(); @@ -58,6 +59,7 @@ class PairDataPoint : public PairBase { bool add_point_pair(const char *, double, double, double, double, unixtime, double, double, double, double, const char *, double, double, double); + void load_seeps_climo(); void set_seeps_thresh(const SingleThresh &p1_thresh); void set_seeps_score(SeepsScore *, int index=-1); @@ -227,6 +229,7 @@ class VxPairDataPoint { void set_mpr_thresh(const StringArray &, const ThreshArray &); + void load_seeps_climo(); void set_seeps_thresh(const SingleThresh &p1_thresh); void set_climo_cdf_info_ptr(const ClimoCDFInfo *); 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 6579d04574..48af077157 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -1079,7 +1079,11 @@ void PointStatVxOpt::set_vx_pd(PointStatConfInfo *conf_info) { vx_pd.set_duplicate_flag(duplicate_flag); vx_pd.set_obs_summary(obs_summary); vx_pd.set_obs_perc_value(obs_perc); - vx_pd.set_seeps_thresh(seeps_p1_thresh); + if (output_flag[i_seeps_mpr] != STATOutputType_None + || output_flag[i_seeps] != STATOutputType_None) { + vx_pd.load_seeps_climo(); + vx_pd.set_seeps_thresh(seeps_p1_thresh); + } return; } From ad89e6611a04d88da2347f2de643db1a1b15fb56 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 12:46:27 -0700 Subject: [PATCH 2/7] #1943 Corrected path for PPT24_seepsweights.nc --- docs/Users_Guide/point-stat.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index c5bb22b5e9..68fa6a4b7c 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -487,7 +487,7 @@ Note that writing out matched pair data (MPR lines) for a large number of cases If all line types corresponding to a particular verification method are set to NONE, the computation of those statistics will be skipped in the code and thus make the Point-Stat tool run more efficiently. For example, if FHO, CTC, and CTS are all set to NONE, the Point-Stat tool will skip the categorical verification step. -The default SEEPS climo file exists at MET_BASE/share/met/climo/seeps/PPT24_seepsweights.nc. It can be overridden by using the environment variable, MET_SEEPS_POINT_CLIMO_NAME. +The default SEEPS climo file exists at MET_BASE/climo/seeps/PPT24_seepsweights.nc. It can be overridden by using the environment variable, MET_SEEPS_POINT_CLIMO_NAME. .. _point_stat-output: From 31fba0709293a1e00d5ae78e7f46b14fef857abf Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 12:59:17 -0700 Subject: [PATCH 3/7] #1943 Corrected path for print_pointnc2ascii.py --- docs/Users_Guide/reformat_point.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Users_Guide/reformat_point.rst b/docs/Users_Guide/reformat_point.rst index 6cc614abf5..f2bbf92e6a 100644 --- a/docs/Users_Guide/reformat_point.rst +++ b/docs/Users_Guide/reformat_point.rst @@ -1164,10 +1164,10 @@ The script can be found at: .. code-block:: none - MET_BASE/shared/met/utility/print_pointnc2ascii.py + MET_BASE/utility/print_pointnc2ascii.py For how to use the script, issue the command: .. code-block:: none - python3 MET_BASE/shared/met/utility/print_pointnc2ascii.py -h + python3 MET_BASE/utility/print_pointnc2ascii.py -h From 84efc94d3ee512e9c01aecbaf621076ac6a86aa1 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 13:50:43 -0700 Subject: [PATCH 4/7] #1943 SEEPS is not computed if SEEPS climo is not loaded --- src/libcode/vx_statistics/pair_data_point.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index c00859ff31..6739258261 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -299,7 +299,7 @@ SeepsScore *PairDataPoint::compute_seeps(const char *sid, double f, int month, day, year, hour, minute, second; int sid_no = atoi(sid); - if (sid_no) { + if (sid_no && NULL != seeps_climo) { unix_to_mdyhms(ut, month, day, year, hour, minute, second); seeps = seeps_climo->get_seeps_score(sid_no, f, o, month, hour); if (mlog.verbosity_level() >= seeps_debug_level From c95fcb4d05bfd6f8f8b2c6f37eb625add53f6292 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 14:25:34 -0700 Subject: [PATCH 5/7] #1943 load SEEPS climo if activated --- src/libcode/vx_statistics/pair_data_point.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 6739258261..7d239e8f40 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -1479,17 +1479,12 @@ void VxPairDataPoint::set_obs_perc_value(int percentile) { //////////////////////////////////////////////////////////////////////// void VxPairDataPoint::load_seeps_climo() { - bool loaded = false; for(int i=0; i < n_msg_typ; i++){ for(int j=0; j < n_mask; j++){ for(int k=0; k < n_interp; k++){ pd[i][j][k].load_seeps_climo(); - loaded = true; - break; } - if (loaded) break; } - if (loaded) break; } } From d9e4b136265d4f2165a56eb4011b8c17415da614 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 5 Dec 2022 14:34:58 -0700 Subject: [PATCH 6/7] #1943 load SEEPS climo if activated --- src/libcode/vx_statistics/pair_data_point.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 7d239e8f40..ca965a2520 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -189,7 +189,7 @@ void PairDataPoint::load_seeps_climo() { void PairDataPoint::set_seeps_thresh(const SingleThresh &p1_thresh) { if (NULL != seeps_climo) seeps_climo->set_p1_thresh(p1_thresh); else mlog << Warning << "\nPairDataPoint::set_seeps_thresh() ignored t1_threshold." - << " Load SEESP climo first\n\n"; + << " Load SEEPS climo first\n\n"; } //////////////////////////////////////////////////////////////////////// From 6ce65cf6a710afd5856d2e1ce7a6fae31c618ec5 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 6 Dec 2022 13:04:29 -0700 Subject: [PATCH 7/7] Per #1943, tweak log messages for SEEPS pointing users to setting the MET_SEEPS_GRID_CLIMO_NAME or MET_SEEPS_POINT_CLIMO_NAME environment variables. --- src/libcode/vx_seeps/seeps.cc | 45 +++++++++++++++++++++-------------- src/libcode/vx_seeps/seeps.h | 4 ++-- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index 469217251c..df5f47e757 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -30,8 +30,10 @@ bool standalone_debug_seeps = false; static SeepsClimo *seeps_climo = 0; static std::map seeps_climo_grid_map_00; -static const char *def_seeps_filename = "MET_BASE/climo/seeps/PPT24_seepsweights.nc"; -static const char *def_seeps_grid_filename = "MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc"; +static const char *def_seeps_filename = + "MET_BASE/climo/seeps/PPT24_seepsweights.nc"; +static const char *def_seeps_grid_filename = + "MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc"; static const char *var_name_sid = "sid"; static const char *var_name_lat = "lat"; @@ -200,8 +202,10 @@ SeepsClimo::SeepsClimo() { if (seeps_ready) read_seeps_scores(seeps_name); else { mlog << Error << "\nSeepsClimo::SeepsClimo() -> " - << "The SEEPS climo data \"" << seeps_name << "\" is missing!" - << " Turn off SEEPS and SEEPS_MPR to continue\n\n"; + << "The SEEPS point climo data \"" << seeps_name << "\" is missing!\n" + << "Set the " << MET_ENV_SEEPS_POINT_CLIMO_NAME + << " environment variable to define its location " + << "or disable output for SEEPS and SEEPS_MPR.\n\n"; exit(1); } } @@ -312,10 +316,13 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { } else { mlog << Error << "\n" << method_name - << "The SEEPS climo data is missing!" - << " Turn off SEEPS and SEEPS_MPR to continue\n\n"; + << "The SEEPS point climo data is missing!\n" + << "Set the " << MET_ENV_SEEPS_POINT_CLIMO_NAME + << " environment variable to define its location " + << "or disable output for SEEPS and SEEPS_MPR.\n\n"; exit(1); } + return record; } @@ -326,22 +333,22 @@ ConcatString SeepsClimo::get_seeps_climo_filename() { const char *method_name = "SeepsClimo::get_seeps_climo_filename() -> "; // Use the MET_TMP_DIR environment variable, if set. - bool use_env = get_env(MET_ENV_SEEPS_CLIMO_NAME, seeps_filename); + bool use_env = get_env(MET_ENV_SEEPS_POINT_CLIMO_NAME, seeps_filename); if(use_env) seeps_filename = replace_path(seeps_filename); else seeps_filename = replace_path(def_seeps_filename); if (seeps_ready = file_exists(seeps_filename.c_str())) { - mlog << Debug(7) << method_name << "SEEPS climo name=\"" + mlog << Debug(7) << method_name << "SEEPS point climo name=\"" << seeps_filename.c_str() << "\"\n"; } else { - ConcatString message = " "; + ConcatString message = ""; if (use_env) { message.add("from the env. name "); - message.add(MET_ENV_SEEPS_CLIMO_NAME); + message.add(MET_ENV_SEEPS_POINT_CLIMO_NAME); } mlog << Warning << "\n" << method_name - << "The SEEPS climo name \"" << seeps_filename.c_str() + << "The SEEPS point climo name \"" << seeps_filename.c_str() << "\"" << message << " does not exist!\n\n"; } @@ -652,8 +659,10 @@ SeepsClimoGrid::SeepsClimoGrid(int month, int hour) : month{month}, hour{hour} if (seeps_ready) read_seeps_scores(seeps_name); else { mlog << Error << "\nSeepsClimoGrid::SeepsClimoGrid -> " - << "The SEEPS climo data \"" << seeps_name << "\" is missing!" - << " Turn off SEEPS to continue\n\n"; + << "The SEEPS grid climo data \"" << seeps_name << "\" is missing!\n" + << "Set the " << MET_ENV_SEEPS_GRID_CLIMO_NAME + << " environment variable to define its location " + << "or disable output for SEEPS.\n\n"; exit(1); } @@ -769,24 +778,24 @@ ConcatString SeepsClimoGrid::get_seeps_climo_filename() { const char *method_name = "SeepsClimoGrid::get_seeps_climo_filename() -> "; // Use the MET_TMP_DIR environment variable, if set. - bool use_env = get_env(MET_ENV_SEEPS_CLIMO_GRID_NAME, seeps_filename); + bool use_env = get_env(MET_ENV_SEEPS_GRID_CLIMO_NAME, seeps_filename); if(use_env) { seeps_filename = replace_path(seeps_filename); } else seeps_filename = replace_path(def_seeps_grid_filename); if (seeps_ready = file_exists(seeps_filename.c_str())) { - mlog << Debug(7) << method_name << "SEEPS climo name=\"" + mlog << Debug(7) << method_name << "SEEPS grid climo name=\"" << seeps_filename.c_str() << "\"\n"; } else { - ConcatString message = " "; + ConcatString message = ""; if (use_env) { message.add("from the env. name "); - message.add(MET_ENV_SEEPS_CLIMO_GRID_NAME); + message.add(MET_ENV_SEEPS_GRID_CLIMO_NAME); } mlog << Warning << "\n" << method_name - << "The SEEPS climo name \"" << seeps_filename.c_str() + << "The SEEPS grid climo name \"" << seeps_filename.c_str() << "\"" << message << " does not exist!\n\n"; } diff --git a/src/libcode/vx_seeps/seeps.h b/src/libcode/vx_seeps/seeps.h index ae5915298e..47ee2ad3df 100644 --- a/src/libcode/vx_seeps/seeps.h +++ b/src/libcode/vx_seeps/seeps.h @@ -24,8 +24,8 @@ //////////////////////////////////////////////////////////////////////// -static const char *MET_ENV_SEEPS_CLIMO_NAME = "MET_SEEPS_POINT_CLIMO_NAME"; -static const char *MET_ENV_SEEPS_CLIMO_GRID_NAME = "MET_SEEPS_GRID_CLIMO_NAME"; +static const char *MET_ENV_SEEPS_POINT_CLIMO_NAME = "MET_SEEPS_POINT_CLIMO_NAME"; +static const char *MET_ENV_SEEPS_GRID_CLIMO_NAME = "MET_SEEPS_GRID_CLIMO_NAME"; static const char *dim_name_nstn = "nstn";