Skip to content

Commit

Permalink
feature 1213 obs_quality_inc/exc (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Nov 15, 2021
1 parent 7094e0a commit b021341
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 14 deletions.
22 changes: 20 additions & 2 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6661,11 +6661,19 @@ METplus Configuration Glossary

| *Used by:* MODE
POINT_STAT_OBS_QUALITY
Specify the value for 'obs_quality' in the MET configuration file for PointStat.
POINT_STAT_OBS_QUALITY_INC
Specify the value for 'obs_quality_inc' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_OBS_QUALITY_EXC
Specify the value for 'obs_quality_exc' in the MET configuration file for PointStat.

| *Used by:* PointStat
POINT_STAT_OBS_QUALITY
.. warning:: **DEPRECATED:** Please use :term:`POINT_STAT_OBS_QUALITY_INC` instead.

POINT_STAT_OUTPUT_FLAG_FHO
Specify the value for 'output_flag.fho' in the MET configuration file for PointStat.

Expand Down Expand Up @@ -8257,3 +8265,13 @@ METplus Configuration Glossary
Specify the value for 'ens.file_type' in the MET configuration file for GenEnsProd.

| *Used by:* GenEnsProd
ENSEMBLE_STAT_OBS_QUALITY_INC
Specify the value for 'obs_quality_inc' in the MET configuration file for EnsembleStat.

| *Used by:* EnsembleStat
ENSEMBLE_STAT_OBS_QUALITY_EXC
Specify the value for 'obs_quality_exc' in the MET configuration file for EnsembleStat.

| *Used by:* EnsembleStat
44 changes: 40 additions & 4 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ METplus Configuration
| :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_NMEP`
| :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_RANK`
| :term:`ENSEMBLE_STAT_ENSEMBLE_FLAG_WEIGHT`
| :term:`ENSEMBLE_STAT_OBS_QUALITY_INC`
| :term:`ENSEMBLE_STAT_OBS_QUALITY_EXC`
| :term:`ENSEMBLE_STAT_MET_CONFIG_OVERRIDES`
| :term:`ENSEMBLE_STAT_VERIFICATION_MASK_TEMPLATE` (optional)
| :term:`ENS_VAR<n>_NAME` (optional)
Expand Down Expand Up @@ -829,6 +831,28 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`ENSEMBLE_STAT_OUTPUT_PREFIX`
- output_prefix

**${METPLUS_OBS_QUALITY_INC}**

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

* - METplus Config(s)
- MET Config File
* - :term:`ENSEMBLE_STAT_OBS_QUALITY_INC`
- obs_quality_inc

**${METPLUS_OBS_QUALITY_EXC}**

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

* - METplus Config(s)
- MET Config File
* - :term:`ENSEMBLE_STAT_OBS_QUALITY_EXC`
- obs_quality_exc

**${METPLUS_MET_CONFIG_OVERRIDES}**

.. list-table::
Expand Down Expand Up @@ -4854,7 +4878,8 @@ Configuration
| :term:`POINT_STAT_CLIMO_CDF_BINS`
| :term:`POINT_STAT_CLIMO_CDF_CENTER_BINS`
| :term:`POINT_STAT_CLIMO_CDF_WRITE_BINS`
| :term:`POINT_STAT_OBS_QUALITY`
| :term:`POINT_STAT_OBS_QUALITY_INC`
| :term:`POINT_STAT_OBS_QUALITY_EXC`
| :term:`POINT_STAT_OUTPUT_FLAG_FHO`
| :term:`POINT_STAT_OUTPUT_FLAG_CTC`
| :term:`POINT_STAT_OUTPUT_FLAG_CTS`
Expand Down Expand Up @@ -5196,16 +5221,27 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`POINT_STAT_CLIMO_CDF_WRITE_BINS`
- climo_cdf.write_bins

**${METPLUS_OBS_QUALITY}**
**${METPLUS_OBS_QUALITY_INC}**

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_OBS_QUALITY_INC`
- obs_quality_inc

**${METPLUS_OBS_QUALITY_EXC}**

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

* - METplus Config(s)
- MET Config File
* - :term:`POINT_STAT_OBS_QUALITY`
- obs_quality
* - :term:`POINT_STAT_OBS_QUALITY_EXC`
- obs_quality_exc

**${METPLUS_OUTPUT_FLAG_DICT}**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ def test_handle_climo_file_variables(metplus_config, config_overrides,
'type = [{method = GAUSSIAN;width = 1;}];}'
)
}),
({'ENSEMBLE_STAT_OBS_QUALITY_INC': '2,3,4', },
{'METPLUS_OBS_QUALITY_INC': 'obs_quality_inc = ["2", "3", "4"];'}),
({'ENSEMBLE_STAT_OBS_QUALITY_EXC': '5,6,7', },
{'METPLUS_OBS_QUALITY_EXC': 'obs_quality_exc = ["5", "6", "7"];'}),
]
)
Expand Down
6 changes: 5 additions & 1 deletion internal_tests/pytests/point_stat/test_point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ def test_met_dictionary_in_var_options(metplus_config):
{
'METPLUS_CLIMO_CDF_DICT': 'climo_cdf = {cdf_bins = 1.0;center_bins = TRUE;write_bins = FALSE;}'}),
({'POINT_STAT_OBS_QUALITY_INC': '2,3,4', },
{'METPLUS_OBS_QUALITY_INC': 'obs_quality_inc = ["2", "3", "4"];'}),
({'POINT_STAT_OBS_QUALITY_EXC': '5,6,7', },
{'METPLUS_OBS_QUALITY_EXC': 'obs_quality_exc = ["5", "6", "7"];'}),
({'POINT_STAT_OBS_QUALITY': '1, 2, 3', },
{'METPLUS_OBS_QUALITY': 'obs_quality = ["1", "2", "3"];'}),
{'METPLUS_OBS_QUALITY_INC': 'obs_quality_inc = ["1", "2", "3"];'}),
({'POINT_STAT_OUTPUT_FLAG_FHO': 'BOTH', },
{'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {fho = BOTH;}'}),
Expand Down
15 changes: 15 additions & 0 deletions metplus/wrappers/ensemble_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class EnsembleStatWrapper(CompareGriddedWrapper):
'METPLUS_OUTPUT_FLAG_DICT',
'METPLUS_ENSEMBLE_FLAG_DICT',
'METPLUS_OUTPUT_PREFIX',
'METPLUS_OBS_QUALITY_INC',
'METPLUS_OBS_QUALITY_EXC',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -299,6 +301,19 @@ def create_c_dict(self):

c_dict['MASK_POLY_TEMPLATE'] = self.read_mask_poly()

self.add_met_config(
name='obs_quality_inc',
data_type='list',
metplus_configs=['ENSEMBLE_STAT_OBS_QUALITY_INC',
'ENSEMBLE_STAT_OBS_QUALITY_INCLUDE']
)
self.add_met_config(
name='obs_quality_exc',
data_type='list',
metplus_configs=['ENSEMBLE_STAT_OBS_QUALITY_EXC',
'ENSEMBLE_STAT_OBS_QUALITY_EXCLUDE']
)

# old method of setting MET config values
c_dict['ENS_THRESH'] = (
self.config.getstr('config', 'ENSEMBLE_STAT_ENS_THRESH', '1.0')
Expand Down
13 changes: 10 additions & 3 deletions metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_MASK_SID',
'METPLUS_OUTPUT_PREFIX',
'METPLUS_CLIMO_CDF_DICT',
'METPLUS_OBS_QUALITY',
'METPLUS_OBS_QUALITY_INC',
'METPLUS_OBS_QUALITY_EXC',
'METPLUS_OUTPUT_FLAG_DICT',
'METPLUS_INTERP_DICT',
'METPLUS_CLIMO_MEAN_DICT',
Expand Down Expand Up @@ -194,9 +195,15 @@ def create_c_dict(self):
False)
)

self.add_met_config(name='obs_quality',
self.add_met_config(name='obs_quality_inc',
data_type='list',
metplus_configs=['POINT_STAT_OBS_QUALITY'])
metplus_configs=['POINT_STAT_OBS_QUALITY_INC',
'POINT_STAT_OBS_QUALITY_INCLUDE',
'POINT_STAT_OBS_QUALITY'])
self.add_met_config(name='obs_quality_exc',
data_type='list',
metplus_configs=['POINT_STAT_OBS_QUALITY_EXC',
'POINT_STAT_OBS_QUALITY_EXCLUDE'])

self.handle_flags('output')

Expand Down
8 changes: 7 additions & 1 deletion parm/met_config/EnsembleStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ obs = {
${METPLUS_MESSAGE_TYPE}
sid_exc = [];
obs_thresh = [ NA ];
obs_quality = [];

//obs_quality_inc =
${METPLUS_OBS_QUALITY_INC}

//obs_quality_exc =
${METPLUS_OBS_QUALITY_EXC}

${METPLUS_DUPLICATE_FLAG}
obs_summary = NONE;
obs_perc_value = 50;
Expand Down
9 changes: 7 additions & 2 deletions parm/met_config/PointStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ obs = {
// message_type =
${METPLUS_MESSAGE_TYPE}
sid_exc = [];
//obs_quality =
${METPLUS_OBS_QUALITY}

//obs_quality_inc =
${METPLUS_OBS_QUALITY_INC}

//obs_quality_exc =
${METPLUS_OBS_QUALITY_EXC}

duplicate_flag = NONE;
obs_summary = NONE;
obs_perc_value = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ ENSEMBLE_STAT_ENSEMBLE_FLAG_NMEP = FALSE
ENSEMBLE_STAT_ENSEMBLE_FLAG_RANK = TRUE
ENSEMBLE_STAT_ENSEMBLE_FLAG_WEIGHT = FALSE

#ENSEMBLE_STAT_OBS_QUALITY_INC =
#ENSEMBLE_STAT_OBS_QUALITY_EXC =

# Ensemble Variables and levels as specified in the ens field dictionary
# of the MET configuration file. Specify as ENS_VARn_NAME, ENS_VARn_LEVELS,
# (optional) ENS_VARn_OPTION
Expand Down
4 changes: 3 additions & 1 deletion parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ LOOP_ORDER = processes
# or the value of the environment variable METPLUS_PARM_BASE if set
POINT_STAT_CONFIG_FILE ={PARM_BASE}/met_config/PointStatConfig_wrapped

#POINT_STAT_OBS_QUALITY = 1, 2, 3

#POINT_STAT_OBS_QUALITY_INC = 1, 2, 3
#POINT_STAT_OBS_QUALITY_EXC =

POINT_STAT_CLIMO_MEAN_TIME_INTERP_METHOD = NEAREST
#POINT_STAT_CLIMO_STDEV_TIME_INTERP_METHOD =
Expand Down

0 comments on commit b021341

Please sign in to comment.