Skip to content

Commit

Permalink
per #896, add support for setting the hira dictionary in the PointSta…
Browse files Browse the repository at this point in the history
…t wrapped MET config file
  • Loading branch information
georgemccabe committed Dec 15, 2021
1 parent 2c18523 commit f6d7b68
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 8 deletions.
30 changes: 30 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8552,3 +8552,33 @@ METplus Configuration Glossary
Specify the value for 'obs_prepbufr_map' in the MET configuration file for PB2NC.

| *Used by:* PB2NC
POINT_STAT_HIRA_FLAG
Specify the value for 'hira.flag' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_HIRA_WIDTH
Specify the value for 'hira.width' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_HIRA_VLD_THRESH
Specify the value for 'hira.vld_thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_HIRA_COV_THRESH
Specify the value for 'hira.cov_thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_HIRA_SHAPE
Specify the value for 'hira.shape' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_HIRA_PROB_CAT_THRESH
Specify the value for 'hira.prob_cat_thresh' in the MET configuration file for PointStat.

| *Used by:* PointStat
27 changes: 27 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5233,6 +5233,12 @@ Configuration
| :term:`POINT_STAT_CLIMO_STDEV_DAY_INTERVAL`
| :term:`POINT_STAT_CLIMO_STDEV_HOUR_INTERVAL`
| :term:`POINT_STAT_HSS_EC_VALUE`
| :term:`POINT_STAT_HIRA_FLAG`
| :term:`POINT_STAT_HIRA_WIDTH`
| :term:`POINT_STAT_HIRA_VLD_THRESH`
| :term:`POINT_STAT_HIRA_COV_THRESH`
| :term:`POINT_STAT_HIRA_SHAPE`
| :term:`POINT_STAT_HIRA_PROB_CAT_THRESH`
| :term:`FCST_POINT_STAT_WINDOW_BEGIN` (optional)
| :term:`FCST_POINT_STAT_WINDOW_END` (optional)
| :term:`OBS_POINT_STAT_WINDOW_BEGIN` (optional)
Expand Down Expand Up @@ -5640,6 +5646,27 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`POINT_STAT_HSS_EC_VALUE`
- hss_ec_value

**${METPLUS_HIRA_DICT}**

.. list-table::
:widths: 5 5
:header-rows: 0

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_HIRA_FLAG`
- hira.flag
* - :term:`POINT_STAT_HIRA_WIDTH`
- hira.width
* - :term:`POINT_STAT_HIRA_VLD_THRESH`
- hira.vld_thresh
* - :term:`POINT_STAT_HIRA_COV_THRESH`
- hira.cov_thresh
* - :term:`POINT_STAT_HIRA_SHAPE`
- hira.shape
* - :term:`POINT_STAT_HIRA_PROB_CAT_THRESH`
- hira.prob_cat_thresh


.. _py_embed_ingest_wrapper:

Expand Down
33 changes: 33 additions & 0 deletions internal_tests/pytests/point_stat/test_point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,39 @@ def test_met_dictionary_in_var_options(metplus_config):
'{ name = "BOX"; lat_thresh = >=20&&<=40; lon_thresh = >=-110&&<=-90; }')},
{'METPLUS_MASK_LLPNT': 'llpnt = [{ name = "LAT30TO40"; lat_thresh = >=30&&<=40; lon_thresh = NA; }, { name = "BOX"; lat_thresh = >=20&&<=40; lon_thresh = >=-110&&<=-90; }];'}),
({'POINT_STAT_HIRA_FLAG': 'False', },
{'METPLUS_HIRA_DICT': 'hira = {flag = FALSE;}'}),
({'POINT_STAT_HIRA_WIDTH': '2,3,4,5', },
{'METPLUS_HIRA_DICT': 'hira = {width = [2, 3, 4, 5];}'}),
({'POINT_STAT_HIRA_VLD_THRESH': '1.0', },
{'METPLUS_HIRA_DICT': 'hira = {vld_thresh = 1.0;}'}),
({'POINT_STAT_HIRA_COV_THRESH': '==0.25, ==0.5', },
{'METPLUS_HIRA_DICT': 'hira = {cov_thresh = [==0.25, ==0.5];}'}),
({'POINT_STAT_HIRA_SHAPE': 'square', },
{'METPLUS_HIRA_DICT': 'hira = {shape = SQUARE;}'}),
({'POINT_STAT_HIRA_PROB_CAT_THRESH': '>1,<=2', },
{'METPLUS_HIRA_DICT': 'hira = {prob_cat_thresh = [>1, <=2];}'}),
({
'POINT_STAT_HIRA_FLAG': 'False',
'POINT_STAT_HIRA_WIDTH': '2,3,4,5',
'POINT_STAT_HIRA_VLD_THRESH': '1.0',
'POINT_STAT_HIRA_COV_THRESH': '==0.25, ==0.5',
'POINT_STAT_HIRA_SHAPE': 'square',
'POINT_STAT_HIRA_PROB_CAT_THRESH': '>1,<=2',
},
{
'METPLUS_HIRA_DICT': ('hira = {flag = FALSE;width = [2, 3, 4, 5];'
'vld_thresh = 1.0;'
'cov_thresh = [==0.25, ==0.5];'
'shape = SQUARE;'
'prob_cat_thresh = [>1, <=2];}')}),
]
)
def test_point_stat_all_fields(metplus_config, config_overrides,
Expand Down
10 changes: 10 additions & 0 deletions metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_CLIMO_MEAN_DICT',
'METPLUS_CLIMO_STDEV_DICT',
'METPLUS_HSS_EC_VALUE',
'METPLUS_HIRA_DICT',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -238,6 +239,15 @@ def create_c_dict(self):
data_type='float',
metplus_configs=['POINT_STAT_HSS_EC_VALUE'])

self.add_met_config_dict('hira', {
'flag': 'bool',
'width': ('list', 'remove_quotes'),
'vld_thresh': 'float',
'cov_thresh': ('list', 'remove_quotes'),
'shape': ('string', 'remove_quotes, uppercase'),
'prob_cat_thresh': ('list', 'remove_quotes'),
})

if not c_dict['FCST_INPUT_TEMPLATE']:
self.log_error('Must set FCST_POINT_STAT_INPUT_TEMPLATE '
'in config file')
Expand Down
9 changes: 2 additions & 7 deletions parm/met_config/PointStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,8 @@ ${METPLUS_INTERP_DICT}
//
// HiRA verification method
//
hira = {
flag = FALSE;
width = [ 2, 3, 4, 5 ];
vld_thresh = 1.0;
cov_thresh = [ ==0.25 ];
shape = SQUARE;
}
//hira = {
${METPLUS_HIRA_DICT}

////////////////////////////////////////////////////////////////////////////////

Expand Down
8 changes: 7 additions & 1 deletion parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,11 @@ POINT_STAT_MASK_POLY = MET_BASE/poly/LMV.poly
POINT_STAT_MASK_SID =
#POINT_STAT_MASK_LLPNT =


POINT_STAT_MESSAGE_TYPE = ADPUPA, ADPSFC

#POINT_STAT_HIRA_FLAG =
#POINT_STAT_HIRA_WIDTH =
#POINT_STAT_HIRA_VLD_THRESH =
#POINT_STAT_HIRA_COV_THRESH =
#POINT_STAT_HIRA_SHAPE =
#POINT_STAT_HIRA_PROB_CAT_THRESH =

0 comments on commit f6d7b68

Please sign in to comment.