From dd5048ac6809b3e2ba445fc1a787e9d22819e45e Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:47:43 -0600 Subject: [PATCH 1/3] Per #2727, add support for setting point_weight_flag --- docs/Users_Guide/glossary.rst | 10 +++++++ docs/Users_Guide/wrappers.rst | 26 +++++++++++++++++++ .../test_ensemble_stat_wrapper.py | 3 +++ .../point_stat/test_point_stat_wrapper.py | 2 ++ metplus/wrappers/ensemble_stat_wrapper.py | 6 +++++ metplus/wrappers/point_stat_wrapper.py | 6 +++++ parm/met_config/EnsembleStatConfig_wrapped | 2 ++ parm/met_config/PointStatConfig_wrapped | 3 +++ .../EnsembleStat/EnsembleStat.conf | 1 + .../met_tool_wrapper/PointStat/PointStat.conf | 2 ++ 10 files changed, 61 insertions(+) diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index 2dcd640c4..012560bf4 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -12970,3 +12970,13 @@ METplus Configuration Glossary using the -aggr command line argument. | *Used by:* SeriesAnalysis + + POINT_STAT_POINT_WEIGHT_FLAG + Specify the value for 'point_weight_flag' in the MET configuration file for PointStat. + + | *Used by:* PointStat + + ENSEMBLE_STAT_POINT_WEIGHT_FLAG + Specify the value for 'point_weight_flag' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat diff --git a/docs/Users_Guide/wrappers.rst b/docs/Users_Guide/wrappers.rst index aa2794377..de94dbf1f 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -356,6 +356,7 @@ METplus Configuration | :term:`ENSEMBLE_STAT_ENS_MEMBER_IDS` | :term:`ENSEMBLE_STAT_CONTROL_ID` | :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG` +| :term:`ENSEMBLE_STAT_POINT_WEIGHT_FLAG` | :term:`ENSEMBLE_STAT_PROB_CAT_THRESH` | :term:`ENSEMBLE_STAT_PROB_PCT_THRESH` | :term:`ENSEMBLE_STAT_ECLV_POINTS` @@ -1091,6 +1092,18 @@ ${METPLUS_GRID_WEIGHT_FLAG} * - :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG` - grid_weight_flag +${METPLUS_POINT_WEIGHT_FLAG} +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 5 5 + :header-rows: 1 + + * - METplus Config(s) + - MET Config File + * - :term:`ENSEMBLE_STAT_POINT_WEIGHT_FLAG` + - point_weight_flag + ${METPLUS_OUTPUT_PREFIX} """""""""""""""""""""""" @@ -7097,6 +7110,7 @@ Configuration | :term:`POINT_STAT_UGRID_MAX_DISTANCE_KM` | :term:`POINT_STAT_UGRID_COORDINATES_FILE` | :term:`POINT_STAT_UGRID_CONFIG_FILE` +| :term:`POINT_STAT_POINT_WEIGHT_FLAG` | .. warning:: **DEPRECATED:** @@ -7787,6 +7801,18 @@ ${METPLUS_OUTPUT_PREFIX} * - :term:`POINT_STAT_OUTPUT_PREFIX` - output_prefix +${METPLUS_POINT_WEIGHT_FLAG} +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 5 5 + :header-rows: 1 + + * - METplus Config(s) + - MET Config File + * - :term:`POINT_STAT_POINT_WEIGHT_FLAG` + - point_weight_flag + ${METPLUS_MET_CONFIG_OVERRIDES} """"""""""""""""""""""""""""""" diff --git a/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py b/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py index b17171495..afd8505dd 100644 --- a/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py +++ b/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py @@ -829,6 +829,9 @@ def test_ensemble_stat_field_info(metplus_config, config_overrides, 'time_interp_method = NEAREST;' 'match_month = TRUE;day_interval = 30;' 'hour_interval = 12;}')}), + ({'ENSEMBLE_STAT_POINT_WEIGHT_FLAG': 'SID', }, + {'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}), + ] ) @pytest.mark.wrapper_c diff --git a/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py b/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py index 3660a1b37..287ff4627 100755 --- a/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py +++ b/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py @@ -863,6 +863,8 @@ def test_met_dictionary_in_var_options(metplus_config): 'time_interp_method = NEAREST;' 'match_month = TRUE;day_interval = 30;' 'hour_interval = 12;}')}), + ({'POINT_STAT_POINT_WEIGHT_FLAG': 'SID', }, + {'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}), ] ) @pytest.mark.wrapper_a diff --git a/metplus/wrappers/ensemble_stat_wrapper.py b/metplus/wrappers/ensemble_stat_wrapper.py index 92364bab1..25ee5a4a6 100755 --- a/metplus/wrappers/ensemble_stat_wrapper.py +++ b/metplus/wrappers/ensemble_stat_wrapper.py @@ -68,6 +68,7 @@ class EnsembleStatWrapper(CompareGriddedWrapper): 'METPLUS_ENS_MEMBER_IDS', 'METPLUS_CONTROL_ID', 'METPLUS_GRID_WEIGHT_FLAG', + 'METPLUS_POINT_WEIGHT_FLAG', 'METPLUS_PROB_CAT_THRESH', 'METPLUS_PROB_PCT_THRESH', 'METPLUS_ECLV_POINTS', @@ -354,6 +355,11 @@ def create_c_dict(self): extra_args={'remove_quotes': True, 'uppercase': True}) + self.add_met_config(name='point_weight_flag', + data_type='string', + extra_args={'remove_quotes': True, + 'uppercase': True}) + self.add_met_config(name='prob_pct_thresh', data_type='list', extra_args={'remove_quotes': True}) diff --git a/metplus/wrappers/point_stat_wrapper.py b/metplus/wrappers/point_stat_wrapper.py index 13d797af2..19d1dba0f 100755 --- a/metplus/wrappers/point_stat_wrapper.py +++ b/metplus/wrappers/point_stat_wrapper.py @@ -58,6 +58,7 @@ class PointStatWrapper(CompareGriddedWrapper): 'METPLUS_UGRID_DATASET', 'METPLUS_UGRID_MAX_DISTANCE_KM', 'METPLUS_UGRID_COORDINATES_FILE', + 'METPLUS_POINT_WEIGHT_FLAG', ] # deprecated env vars that are no longer supported in the wrapped MET conf @@ -286,6 +287,11 @@ def create_c_dict(self): self.add_met_config(name='ugrid_max_distance_km', data_type='int') self.add_met_config(name='ugrid_coordinates_file', data_type='string') + self.add_met_config(name='point_weight_flag', + data_type='string', + extra_args={'remove_quotes': True, + 'uppercase': True}) + if not c_dict['FCST_INPUT_TEMPLATE']: self.log_error('Must set FCST_POINT_STAT_INPUT_TEMPLATE ' 'in config file') diff --git a/parm/met_config/EnsembleStatConfig_wrapped b/parm/met_config/EnsembleStatConfig_wrapped index 9f508ff4c..487cad492 100644 --- a/parm/met_config/EnsembleStatConfig_wrapped +++ b/parm/met_config/EnsembleStatConfig_wrapped @@ -234,6 +234,8 @@ rng = { //grid_weight_flag = ${METPLUS_GRID_WEIGHT_FLAG} +//point_weight_flag = +${METPLUS_POINT_WEIGHT_FLAG} //output_prefix = ${METPLUS_OUTPUT_PREFIX} //version = "V9.0"; diff --git a/parm/met_config/PointStatConfig_wrapped b/parm/met_config/PointStatConfig_wrapped index 0d12bd0a7..1ae93f205 100644 --- a/parm/met_config/PointStatConfig_wrapped +++ b/parm/met_config/PointStatConfig_wrapped @@ -208,6 +208,9 @@ ${METPLUS_UGRID_COORDINATES_FILE} //////////////////////////////////////////////////////////////////////////////// +//point_weight_flag = +${METPLUS_POINT_WEIGHT_FLAG} + tmp_dir = "${MET_TMP_DIR}"; // output_prefix = diff --git a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf index 3ac91314f..14a9ce102 100644 --- a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf +++ b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf @@ -246,3 +246,4 @@ ENSEMBLE_STAT_NC_ORANK_FLAG_WEIGHT = FALSE #ENSEMBLE_STAT_CONTROL_ID = #ENSEMBLE_STAT_GRID_WEIGHT_FLAG = +#ENSEMBLE_STAT_POINT_WEIGHT_FLAG = diff --git a/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf b/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf index 6d793e2bf..39497c661 100644 --- a/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf +++ b/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf @@ -264,3 +264,5 @@ POINT_STAT_MESSAGE_TYPE = ADPUPA, ADPSFC #POINT_STAT_UGRID_MAX_DISTANCE_KM = #POINT_STAT_UGRID_COORDINATES_FILE = #POINT_STAT_UGRID_CONFIG_FILE = + +#POINT_STAT_POINT_WEIGHT_FLAG = From 760c9868615c050d81ea478b31cd65553c5142a4 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:56:26 -0600 Subject: [PATCH 2/3] Per #2727, add support for obtype_as_group_val_flag --- docs/Users_Guide/glossary.rst | 10 +++++++ docs/Users_Guide/wrappers.rst | 28 ++++++++++++++++++- .../test_ensemble_stat_wrapper.py | 2 ++ .../point_stat/test_point_stat_wrapper.py | 2 ++ metplus/wrappers/ensemble_stat_wrapper.py | 3 ++ metplus/wrappers/point_stat_wrapper.py | 3 ++ parm/met_config/EnsembleStatConfig_wrapped | 3 ++ parm/met_config/PointStatConfig_wrapped | 3 ++ .../EnsembleStat/EnsembleStat.conf | 2 ++ .../met_tool_wrapper/PointStat/PointStat.conf | 1 + 10 files changed, 56 insertions(+), 1 deletion(-) diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index 012560bf4..4ed26829b 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -12980,3 +12980,13 @@ METplus Configuration Glossary Specify the value for 'point_weight_flag' in the MET configuration file for EnsembleStat. | *Used by:* EnsembleStat + + POINT_STAT_OBTYPE_AS_GROUP_VAL_FLAG + Specify the value for 'obtype_as_group_val_flag' in the MET configuration file for PointStat. + + | *Used by:* PointStat + + ENSEMBLE_STAT_OBTYPE_AS_GROUP_VAL_FLAG + Specify the value for 'obtype_as_group_val_flag' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat diff --git a/docs/Users_Guide/wrappers.rst b/docs/Users_Guide/wrappers.rst index de94dbf1f..5ca93e9dd 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -233,6 +233,7 @@ METplus Configuration | :term:`ENSEMBLE_STAT_CUSTOM_LOOP_LIST` | :term:`ENSEMBLE_STAT_SKIP_IF_OUTPUT_EXISTS` | :term:`ENSEMBLE_STAT_DESC` +| :term:`ENSEMBLE_STAT_OBTYPE_AS_GROUP_VAL_FLAG` | :term:`ENSEMBLE_STAT_ENS_SSVAR_BIN_SIZE` | :term:`ENSEMBLE_STAT_ENS_PHIST_BIN_SIZE` | :term:`ENSEMBLE_STAT_CLIMO_CDF_BINS` @@ -850,6 +851,18 @@ ${METPLUS_OBS_ERROR_FLAG} * - :term:`ENSEMBLE_STAT_OBS_ERROR_FLAG` - obs_error.flag +${METPLUS_OBTYPE_AS_GROUP_VAL_FLAG} +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 5 5 + :header-rows: 1 + + * - METplus Config(s) + - MET Config File + * - :term:`ENSEMBLE_STAT_OBTYPE_AS_GROUP_VAL_FLAG` + - obtype_as_group_val_flag + ${METPLUS_ENS_SSVAR_BIN_SIZE} """"""""""""""""""""""""""""" @@ -7083,6 +7096,7 @@ Configuration | :term:`POINT_STAT_HIRA_SHAPE` | :term:`POINT_STAT_HIRA_PROB_CAT_THRESH` | :term:`POINT_STAT_MESSAGE_TYPE_GROUP_MAP` +| :term:`POINT_STAT_OBTYPE_AS_GROUP_VAL_FLAG` | :term:`FCST_POINT_STAT_IS_PROB` | :term:`FCST_POINT_STAT_PROB_IN_GRIB_PDS` | :term:`FCST_POINT_STAT_WINDOW_BEGIN` @@ -7486,7 +7500,19 @@ ${METPLUS_MESSAGE_TYPE_GROUP_MAP} - MET Config File * - :term:`POINT_STAT_MESSAGE_TYPE_GROUP_MAP` - message_type_group_map - + +${METPLUS_OBTYPE_AS_GROUP_VAL_FLAG} +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 5 5 + :header-rows: 1 + + * - METplus Config(s) + - MET Config File + * - :term:`POINT_STAT_OBTYPE_AS_GROUP_VAL_FLAG` + - obtype_as_group_val_flag + ${METPLUS_CLIMO_MEAN_DICT} """""""""""""""""""""""""" diff --git a/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py b/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py index afd8505dd..963966513 100644 --- a/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py +++ b/internal/tests/pytests/wrappers/ensemble_stat/test_ensemble_stat_wrapper.py @@ -831,6 +831,8 @@ def test_ensemble_stat_field_info(metplus_config, config_overrides, 'hour_interval = 12;}')}), ({'ENSEMBLE_STAT_POINT_WEIGHT_FLAG': 'SID', }, {'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}), + ({'ENSEMBLE_STAT_OBTYPE_AS_GROUP_VAL_FLAG': 'FALSE', }, + {'METPLUS_OBTYPE_AS_GROUP_VAL_FLAG': 'obtype_as_group_val_flag = FALSE;'}), ] ) diff --git a/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py b/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py index 287ff4627..b76ac81d5 100755 --- a/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py +++ b/internal/tests/pytests/wrappers/point_stat/test_point_stat_wrapper.py @@ -865,6 +865,8 @@ def test_met_dictionary_in_var_options(metplus_config): 'hour_interval = 12;}')}), ({'POINT_STAT_POINT_WEIGHT_FLAG': 'SID', }, {'METPLUS_POINT_WEIGHT_FLAG': 'point_weight_flag = SID;'}), + ({'POINT_STAT_OBTYPE_AS_GROUP_VAL_FLAG': 'FALSE', }, + {'METPLUS_OBTYPE_AS_GROUP_VAL_FLAG': 'obtype_as_group_val_flag = FALSE;'}), ] ) @pytest.mark.wrapper_a diff --git a/metplus/wrappers/ensemble_stat_wrapper.py b/metplus/wrappers/ensemble_stat_wrapper.py index 25ee5a4a6..8121eec8b 100755 --- a/metplus/wrappers/ensemble_stat_wrapper.py +++ b/metplus/wrappers/ensemble_stat_wrapper.py @@ -72,6 +72,7 @@ class EnsembleStatWrapper(CompareGriddedWrapper): 'METPLUS_PROB_CAT_THRESH', 'METPLUS_PROB_PCT_THRESH', 'METPLUS_ECLV_POINTS', + 'METPLUS_OBTYPE_AS_GROUP_VAL_FLAG', ] # deprecated env vars that are no longer supported in the wrapped MET conf @@ -268,6 +269,8 @@ def create_c_dict(self): extra_args={'remove_quotes': True, 'allow_empty': True}) + self.add_met_config(name='obtype_as_group_val_flag', data_type='bool') + self.add_met_config(name='ens_ssvar_bin_size', data_type='float') self.add_met_config(name='ens_phist_bin_size', data_type='float') diff --git a/metplus/wrappers/point_stat_wrapper.py b/metplus/wrappers/point_stat_wrapper.py index 19d1dba0f..bce645936 100755 --- a/metplus/wrappers/point_stat_wrapper.py +++ b/metplus/wrappers/point_stat_wrapper.py @@ -52,6 +52,7 @@ class PointStatWrapper(CompareGriddedWrapper): 'METPLUS_HSS_EC_VALUE', 'METPLUS_HIRA_DICT', 'METPLUS_MESSAGE_TYPE_GROUP_MAP', + 'METPLUS_OBTYPE_AS_GROUP_VAL_FLAG', 'METPLUS_FCST_FILE_TYPE', 'METPLUS_OBS_FILE_TYPE', 'METPLUS_SEEPS_P1_THRESH', @@ -280,6 +281,8 @@ def create_c_dict(self): self.add_met_config(name='message_type_group_map', data_type='list', extra_args={'remove_quotes': True}) + self.add_met_config(name='obtype_as_group_val_flag', data_type='bool') + self.add_met_config(name='seeps_p1_thresh', data_type='string', extra_args={'remove_quotes': True}) diff --git a/parm/met_config/EnsembleStatConfig_wrapped b/parm/met_config/EnsembleStatConfig_wrapped index 487cad492..92a79082a 100644 --- a/parm/met_config/EnsembleStatConfig_wrapped +++ b/parm/met_config/EnsembleStatConfig_wrapped @@ -136,6 +136,9 @@ message_type_group_map = [ { key = "ONLYSF"; val = "ADPSFC,SFCSHP"; } ]; +//obtype_as_group_val_flag = +${METPLUS_OBTYPE_AS_GROUP_VAL_FLAG} + // // Ensemble bin sizes // May be set separately in each "obs.field" entry diff --git a/parm/met_config/PointStatConfig_wrapped b/parm/met_config/PointStatConfig_wrapped index 1ae93f205..780fb829e 100644 --- a/parm/met_config/PointStatConfig_wrapped +++ b/parm/met_config/PointStatConfig_wrapped @@ -93,6 +93,9 @@ ${METPLUS_OBS_PERC_VALUE} //message_type_group_map = ${METPLUS_MESSAGE_TYPE_GROUP_MAP} +//obtype_as_group_val_flag = +${METPLUS_OBTYPE_AS_GROUP_VAL_FLAG} + //////////////////////////////////////////////////////////////////////////////// // diff --git a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf index 14a9ce102..5d08f98ac 100644 --- a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf +++ b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf @@ -131,6 +131,8 @@ ENSEMBLE_STAT_SKIP_CONST = False ENSEMBLE_STAT_OBS_ERROR_FLAG = FALSE +#ENSEMBLE_STAT_OBTYPE_AS_GROUP_VAL_FLAG = + ENSEMBLE_STAT_ENS_SSVAR_BIN_SIZE = 1.0 ENSEMBLE_STAT_ENS_PHIST_BIN_SIZE = 0.05 diff --git a/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf b/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf index 39497c661..92816c297 100644 --- a/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf +++ b/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf @@ -259,6 +259,7 @@ POINT_STAT_MESSAGE_TYPE = ADPUPA, ADPSFC #POINT_STAT_HIRA_PROB_CAT_THRESH = #POINT_STAT_MESSAGE_TYPE_GROUP_MAP = +#POINT_STAT_OBTYPE_AS_GROUP_VAL_FLAG = #POINT_STAT_UGRID_DATASET = #POINT_STAT_UGRID_MAX_DISTANCE_KM = From 67a9928e1955651a066061de5a97709267371e28 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:58:59 -0600 Subject: [PATCH 3/3] per #2714, deprecate master_metplus.py --- ush/master_metplus.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) mode change 120000 => 100755 ush/master_metplus.py diff --git a/ush/master_metplus.py b/ush/master_metplus.py deleted file mode 120000 index ffbf916c4..000000000 --- a/ush/master_metplus.py +++ /dev/null @@ -1 +0,0 @@ -run_metplus.py \ No newline at end of file diff --git a/ush/master_metplus.py b/ush/master_metplus.py new file mode 100755 index 000000000..e8eef52e6 --- /dev/null +++ b/ush/master_metplus.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import sys + +def main(): + print("ERROR: master_metplus.py is deprecated. Please use run_metplus.py instead") + sys.exit(1) + +if __name__ == "__main__": + main()