From b50e2814b6ac238707a3962bce0ab85061d9916a Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:28:18 -0700 Subject: [PATCH 1/2] per #1464, add support for setting prob_pct_thresh, eclv_points, and new output_flag values (pct, pstd, pjc, prc, and eclv) --- docs/Users_Guide/glossary.rst | 35 +++++++++++++++++ docs/Users_Guide/wrappers.rst | 39 +++++++++++++++++++ .../test_ensemble_stat_wrapper.py | 35 +++++++++++++++-- metplus/wrappers/ensemble_stat_wrapper.py | 31 +++++++++++---- parm/met_config/EnsembleStatConfig_wrapped | 7 ++++ .../EnsembleStat/EnsembleStat.conf | 8 ++++ 6 files changed, 144 insertions(+), 11 deletions(-) diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index fee8163874..593a6b6842 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -5716,6 +5716,31 @@ METplus Configuration Glossary | *Used by:* EnsembleStat + ENSEMBLE_STAT_OUTPUT_FLAG_PCT + Specify the value for 'output_flag.pct' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + + ENSEMBLE_STAT_OUTPUT_FLAG_PSTD + Specify the value for 'output_flag.pstd' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + + ENSEMBLE_STAT_OUTPUT_FLAG_PJC + Specify the value for 'output_flag.pjc' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + + ENSEMBLE_STAT_OUTPUT_FLAG_PRC + Specify the value for 'output_flag.prc' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + + ENSEMBLE_STAT_OUTPUT_FLAG_ECLV + Specify the value for 'output_flag.eclv' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + ENSEMBLE_STAT_ENSEMBLE_FLAG_LATLON Specify the value for 'ensemble_flag.latlon' in the MET configuration file for EnsembleStat. @@ -9110,3 +9135,13 @@ METplus Configuration Glossary Specify the value for 'climo_cdf.direct_prob' in the MET configuration file for SeriesAnalysis. | *Used by:* SeriesAnalysis + + ENSEMBLE_STAT_PROB_PCT_THRESH + Specify the value for 'prob_pct_thresh' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + + ENSEMBLE_STAT_ECLV_POINTS + Specify the value for 'eclv_points' 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 fc7a0e11d1..30e91aae0d 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -268,6 +268,11 @@ METplus Configuration | :term:`ENSEMBLE_STAT_OUTPUT_FLAG_ORANK` | :term:`ENSEMBLE_STAT_OUTPUT_FLAG_SSVAR` | :term:`ENSEMBLE_STAT_OUTPUT_FLAG_RELP` +| :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PCT` +| :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PSTD` +| :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PJC` +| :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PRC` +| :term:`ENSEMBLE_STAT_OUTPUT_FLAG_ECLV` | :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_LATLON` | :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_MEAN` | :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_STDEV` @@ -288,6 +293,8 @@ METplus Configuration | :term:`ENSEMBLE_STAT_ENS_MEMBER_IDS` | :term:`ENSEMBLE_STAT_CONTROL_ID` | :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG` +| :term:`ENSEMBLE_STAT_PROB_PCT_THRESH` +| :term:`ENSEMBLE_STAT_ECLV_POINTS` | :term:`ENSEMBLE_STAT_VERIFICATION_MASK_TEMPLATE` (optional) | :term:`ENS_VAR_NAME` (optional) | :term:`ENS_VAR_LEVELS` (optional) @@ -507,6 +514,28 @@ see :ref:`How METplus controls MET config file settings`. * - :term:`ENSEMBLE_STAT_NMEP_SMOOTH_WIDTH` - nmep_smooth.type.width +**${METPLUS_PROB_PCT_THRESH}** + +.. list-table:: + :widths: 5 5 + :header-rows: 0 + + * - METplus Config(s) + - MET Config File + * - :term:`ENSEMBLE_STAT_PROB_PCT_THRESH` + - prob_pct_thresh + +**${METPLUS_ECLV_POINTS}** + +.. list-table:: + :widths: 5 5 + :header-rows: 0 + + * - METplus Config(s) + - MET Config File + * - :term:`ENSEMBLE_STAT_ECLV_POINTS` + - eclv_points + **${METPLUS_FCST_FILE_TYPE}** .. list-table:: @@ -795,6 +824,16 @@ see :ref:`How METplus controls MET config file settings`. - output_flag.ssvar * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_RELP` - output_flag.relp + * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PCT` + - output_flag.pct + * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PSTD` + - output_flag.pstd + * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PJC` + - output_flag.pjc + * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_PRC` + - output_flag.prc + * - :term:`ENSEMBLE_STAT_OUTPUT_FLAG_ECLV` + - output_flag.eclv **${METPLUS_ENSEMBLE_FLAG_DICT}** diff --git a/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py b/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py index 1c43f8d476..b342d50380 100644 --- a/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py +++ b/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py @@ -322,6 +322,21 @@ def test_handle_climo_file_variables(metplus_config, config_overrides, ({'ENSEMBLE_STAT_OUTPUT_FLAG_RELP': 'STAT', }, {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {relp = STAT;}'}), + ({'ENSEMBLE_STAT_OUTPUT_FLAG_PCT': 'STAT', }, + {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {pct = STAT;}'}), + + ({'ENSEMBLE_STAT_OUTPUT_FLAG_PSTD': 'STAT', }, + {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {pstd = STAT;}'}), + + ({'ENSEMBLE_STAT_OUTPUT_FLAG_PJC': 'STAT', }, + {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {pjc = STAT;}'}), + + ({'ENSEMBLE_STAT_OUTPUT_FLAG_PRC': 'STAT', }, + {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {prc = STAT;}'}), + + ({'ENSEMBLE_STAT_OUTPUT_FLAG_ECLV': 'STAT', }, + {'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {eclv = STAT;}'}), + ({ 'ENSEMBLE_STAT_OUTPUT_FLAG_ECNT': 'STAT', 'ENSEMBLE_STAT_OUTPUT_FLAG_RPS': 'STAT', @@ -330,12 +345,20 @@ def test_handle_climo_file_variables(metplus_config, config_overrides, 'ENSEMBLE_STAT_OUTPUT_FLAG_ORANK': 'STAT', 'ENSEMBLE_STAT_OUTPUT_FLAG_SSVAR': 'STAT', 'ENSEMBLE_STAT_OUTPUT_FLAG_RELP': 'STAT', + 'ENSEMBLE_STAT_OUTPUT_FLAG_PCT': 'STAT', + 'ENSEMBLE_STAT_OUTPUT_FLAG_PSTD': 'STAT', + 'ENSEMBLE_STAT_OUTPUT_FLAG_PJC': 'STAT', + 'ENSEMBLE_STAT_OUTPUT_FLAG_PRC': 'STAT', + 'ENSEMBLE_STAT_OUTPUT_FLAG_ECLV': 'STAT', }, { 'METPLUS_OUTPUT_FLAG_DICT': ('output_flag = {ecnt = STAT;' - 'rps = STAT;rhist = STAT;' - 'phist = STAT;orank = STAT;' - 'ssvar = STAT;relp = STAT;}')}), + 'rps = STAT;rhist = STAT;' + 'phist = STAT;orank = STAT;' + 'ssvar = STAT;relp = STAT;' + 'pct = STAT;pstd = STAT;' + 'pjc = STAT;prc = STAT;eclv = STAT;' + '}')}), # ensemble_flag ({'ENSEMBLE_STAT_ENSEMBLE_FLAG_LATLON': 'FALSE', }, {'METPLUS_ENSEMBLE_FLAG_DICT': 'ensemble_flag = {latlon = FALSE;}'}), @@ -632,6 +655,12 @@ def test_handle_climo_file_variables(metplus_config, config_overrides, ({'ENSEMBLE_STAT_GRID_WEIGHT_FLAG': 'COS_LAT', }, {'METPLUS_GRID_WEIGHT_FLAG': 'grid_weight_flag = COS_LAT;'}), + ({'ENSEMBLE_STAT_PROB_PCT_THRESH': '==0.25', }, + {'METPLUS_PROB_PCT_THRESH': 'prob_pct_thresh = [==0.25];'}), + + ({'ENSEMBLE_STAT_ECLV_POINTS': '0.05', }, + {'METPLUS_ECLV_POINTS': 'eclv_points = 0.05;'}), + ] ) def test_ensemble_stat_single_field(metplus_config, config_overrides, diff --git a/metplus/wrappers/ensemble_stat_wrapper.py b/metplus/wrappers/ensemble_stat_wrapper.py index 1b424c2ab1..f1457030e1 100755 --- a/metplus/wrappers/ensemble_stat_wrapper.py +++ b/metplus/wrappers/ensemble_stat_wrapper.py @@ -67,6 +67,8 @@ class EnsembleStatWrapper(CompareGriddedWrapper): 'METPLUS_ENS_MEMBER_IDS', 'METPLUS_CONTROL_ID', 'METPLUS_GRID_WEIGHT_FLAG', + 'METPLUS_PROB_PCT_THRESH', + 'METPLUS_ECLV_POINTS', ] # handle deprecated env vars used pre v4.0.0 @@ -75,14 +77,20 @@ class EnsembleStatWrapper(CompareGriddedWrapper): 'CLIMO_STDEV_FILE', ] - OUTPUT_FLAGS = ['ecnt', - 'rps', - 'rhist', - 'phist', - 'orank', - 'ssvar', - 'relp' - ] + OUTPUT_FLAGS = [ + 'ecnt', + 'rps', + 'rhist', + 'phist', + 'orank', + 'ssvar', + 'relp', + 'pct', + 'pstd', + 'pjc', + 'prc', + 'eclv', + ] ENSEMBLE_FLAGS = ['latlon', 'mean', @@ -346,6 +354,13 @@ def create_c_dict(self): extra_args={'remove_quotes': True, 'uppercase': True}) + self.add_met_config(name='prob_pct_thresh', + data_type='list', + extra_args={'remove_quotes': True}) + + self.add_met_config(name='eclv_points', + data_type='float') + # old method of setting MET config values c_dict['ENS_THRESH'] = ( self.config.getstr('config', 'ENSEMBLE_STAT_ENS_THRESH', '1.0') diff --git a/parm/met_config/EnsembleStatConfig_wrapped b/parm/met_config/EnsembleStatConfig_wrapped index 1ed2dd7b21..2cb017645d 100644 --- a/parm/met_config/EnsembleStatConfig_wrapped +++ b/parm/met_config/EnsembleStatConfig_wrapped @@ -71,6 +71,13 @@ ${METPLUS_NBRHD_PROB_DICT} // ${METPLUS_NMEP_SMOOTH_DICT} +//prob_pct_thresh = +${METPLUS_PROB_PCT_THRESH} + +//eclv_points = +${METPLUS_ECLV_POINTS} + + //////////////////////////////////////////////////////////////////////////////// // diff --git a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf index 7730db09d1..dcadd33b87 100644 --- a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf +++ b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf @@ -103,6 +103,8 @@ ENSEMBLE_STAT_DESC = NA OBS_ENSEMBLE_STAT_WINDOW_BEGIN = -5400 OBS_ENSEMBLE_STAT_WINDOW_END = 5400 +#ENSEMBLE_STAT_PROB_PCT_THRESH = ==0.25 +#ENSEMBLE_STAT_ECLV_POINTS = 0.05 ENSEMBLE_STAT_ENS_THRESH = 1.0 @@ -192,6 +194,12 @@ ENSEMBLE_STAT_OUTPUT_FLAG_PHIST = BOTH ENSEMBLE_STAT_OUTPUT_FLAG_ORANK = BOTH ENSEMBLE_STAT_OUTPUT_FLAG_SSVAR = BOTH ENSEMBLE_STAT_OUTPUT_FLAG_RELP = BOTH +#ENSEMBLE_STAT_OUTPUT_FLAG_PCT = BOTH +#ENSEMBLE_STAT_OUTPUT_FLAG_PSTD = BOTH +#ENSEMBLE_STAT_OUTPUT_FLAG_PJC = BOTH +#ENSEMBLE_STAT_OUTPUT_FLAG_PRC = BOTH +#ENSEMBLE_STAT_OUTPUT_FLAG_ECLV = BOTH + ENSEMBLE_STAT_ENSEMBLE_FLAG_LATLON = TRUE ENSEMBLE_STAT_ENSEMBLE_FLAG_MEAN = TRUE From 9790a715fd2633f427c26ce8c97f1a414cdccc2c Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Mon, 7 Mar 2022 09:16:11 -0700 Subject: [PATCH 2/2] per #1464, add support for setting prob_cat_thresh in the wrapped MET config file for EnsembleStat --- docs/Users_Guide/glossary.rst | 5 +++++ docs/Users_Guide/wrappers.rst | 12 ++++++++++++ .../ensemble_stat/test_ensemble_stat_wrapper.py | 3 +++ metplus/wrappers/ensemble_stat_wrapper.py | 5 +++++ parm/met_config/EnsembleStatConfig_wrapped | 5 +++++ .../met_tool_wrapper/EnsembleStat/EnsembleStat.conf | 7 ++++--- 6 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index dc150ce9c2..3c7b7f2a10 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -9152,6 +9152,11 @@ METplus Configuration Glossary | *Used by:* SeriesAnalysis + ENSEMBLE_STAT_PROB_CAT_THRESH + Specify the value for 'prob_cat_thresh' in the MET configuration file for EnsembleStat. + + | *Used by:* EnsembleStat + ENSEMBLE_STAT_PROB_PCT_THRESH Specify the value for 'prob_pct_thresh' in the MET configuration file for EnsembleStat. diff --git a/docs/Users_Guide/wrappers.rst b/docs/Users_Guide/wrappers.rst index fa1c40cc19..fcf6b7c1d2 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -293,6 +293,7 @@ METplus Configuration | :term:`ENSEMBLE_STAT_ENS_MEMBER_IDS` | :term:`ENSEMBLE_STAT_CONTROL_ID` | :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG` +| :term:`ENSEMBLE_STAT_PROB_CAT_THRESH` | :term:`ENSEMBLE_STAT_PROB_PCT_THRESH` | :term:`ENSEMBLE_STAT_ECLV_POINTS` | :term:`ENSEMBLE_STAT_VERIFICATION_MASK_TEMPLATE` (optional) @@ -514,6 +515,17 @@ see :ref:`How METplus controls MET config file settings`. * - :term:`ENSEMBLE_STAT_NMEP_SMOOTH_WIDTH` - nmep_smooth.type.width +**${METPLUS_PROB_CAT_THRESH}** + +.. list-table:: + :widths: 5 5 + :header-rows: 0 + + * - METplus Config(s) + - MET Config File + * - :term:`ENSEMBLE_STAT_PROB_CAT_THRESH` + - prob_cat_thresh + **${METPLUS_PROB_PCT_THRESH}** .. list-table:: diff --git a/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py b/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py index b342d50380..5dd2a2873c 100644 --- a/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py +++ b/internal_tests/pytests/ensemble_stat/test_ensemble_stat_wrapper.py @@ -655,6 +655,9 @@ def test_handle_climo_file_variables(metplus_config, config_overrides, ({'ENSEMBLE_STAT_GRID_WEIGHT_FLAG': 'COS_LAT', }, {'METPLUS_GRID_WEIGHT_FLAG': 'grid_weight_flag = COS_LAT;'}), + ({'ENSEMBLE_STAT_PROB_CAT_THRESH': '<=0.25', }, + {'METPLUS_PROB_CAT_THRESH': 'prob_cat_thresh = [<=0.25];'}), + ({'ENSEMBLE_STAT_PROB_PCT_THRESH': '==0.25', }, {'METPLUS_PROB_PCT_THRESH': 'prob_pct_thresh = [==0.25];'}), diff --git a/metplus/wrappers/ensemble_stat_wrapper.py b/metplus/wrappers/ensemble_stat_wrapper.py index f1457030e1..ef58af0d08 100755 --- a/metplus/wrappers/ensemble_stat_wrapper.py +++ b/metplus/wrappers/ensemble_stat_wrapper.py @@ -67,6 +67,7 @@ class EnsembleStatWrapper(CompareGriddedWrapper): 'METPLUS_ENS_MEMBER_IDS', 'METPLUS_CONTROL_ID', 'METPLUS_GRID_WEIGHT_FLAG', + 'METPLUS_PROB_CAT_THRESH', 'METPLUS_PROB_PCT_THRESH', 'METPLUS_ECLV_POINTS', ] @@ -361,6 +362,10 @@ def create_c_dict(self): self.add_met_config(name='eclv_points', data_type='float') + self.add_met_config(name='prob_cat_thresh', + data_type='list', + extra_args={'remove_quotes': True}) + # old method of setting MET config values c_dict['ENS_THRESH'] = ( self.config.getstr('config', 'ENSEMBLE_STAT_ENS_THRESH', '1.0') diff --git a/parm/met_config/EnsembleStatConfig_wrapped b/parm/met_config/EnsembleStatConfig_wrapped index 2cb017645d..c4846b4d06 100644 --- a/parm/met_config/EnsembleStatConfig_wrapped +++ b/parm/met_config/EnsembleStatConfig_wrapped @@ -71,6 +71,11 @@ ${METPLUS_NBRHD_PROB_DICT} // ${METPLUS_NMEP_SMOOTH_DICT} +//////////////////////////////////////////////////////////////////////////////// + +//prob_cat_thresh = +${METPLUS_PROB_CAT_THRESH} + //prob_pct_thresh = ${METPLUS_PROB_PCT_THRESH} diff --git a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf index dcadd33b87..4e962a9f48 100644 --- a/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf +++ b/parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.conf @@ -103,9 +103,6 @@ ENSEMBLE_STAT_DESC = NA OBS_ENSEMBLE_STAT_WINDOW_BEGIN = -5400 OBS_ENSEMBLE_STAT_WINDOW_END = 5400 -#ENSEMBLE_STAT_PROB_PCT_THRESH = ==0.25 -#ENSEMBLE_STAT_ECLV_POINTS = 0.05 - ENSEMBLE_STAT_ENS_THRESH = 1.0 ENSEMBLE_STAT_ENS_VLD_THRESH = 1.0 @@ -134,6 +131,10 @@ ENSEMBLE_STAT_NMEP_SMOOTH_GAUSSIAN_RADIUS = 120 ENSEMBLE_STAT_NMEP_SMOOTH_METHOD = GAUSSIAN ENSEMBLE_STAT_NMEP_SMOOTH_WIDTH = 1 +#ENSEMBLE_STAT_PROB_CAT_THRESH = +#ENSEMBLE_STAT_PROB_PCT_THRESH = ==0.25 +#ENSEMBLE_STAT_ECLV_POINTS = 0.05 + ENSEMBLE_STAT_MESSAGE_TYPE = ADPSFC ENSEMBLE_STAT_DUPLICATE_FLAG = NONE