Skip to content

Commit

Permalink
Per #1369, add support for setting grid_weight_flag in the wrapped En…
Browse files Browse the repository at this point in the history
…sembleStat config file
  • Loading branch information
georgemccabe committed Jan 26, 2022
1 parent baacb56 commit 9af5166
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/Users_Guide/glossary.rst
Expand Up @@ -8759,3 +8759,8 @@ METplus Configuration Glossary
:term:`ENSEMBLE_STAT_ENS_VLD_THRESH`.

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

| *Used by:* EnsembleStat
13 changes: 13 additions & 0 deletions docs/Users_Guide/wrappers.rst
Expand Up @@ -281,6 +281,7 @@ METplus Configuration
| :term:`ENSEMBLE_STAT_MET_CONFIG_OVERRIDES`
| :term:`ENSEMBLE_STAT_ENS_MEMBER_IDS`
| :term:`ENSEMBLE_STAT_CONTROL_ID`
| :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG`
| :term:`ENSEMBLE_STAT_VERIFICATION_MASK_TEMPLATE` (optional)
| :term:`ENS_VAR<n>_NAME` (optional)
| :term:`ENS_VAR<n>_LEVELS` (optional)
Expand Down Expand Up @@ -890,6 +891,18 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`ENSEMBLE_STAT_MET_CONFIG_OVERRIDES`
- n/a

**${METPLUS_GRID_WEIGHT_FLAG}**

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

* - METplus Config(s)
- MET Config File
* - :term:`ENSEMBLE_STAT_GRID_WEIGHT_FLAG`
- grid_weight_flag


.. _example_wrapper:

Example
Expand Down
Expand Up @@ -553,6 +553,9 @@ def test_handle_climo_file_variables(metplus_config, config_overrides,
({'ENSEMBLE_STAT_CONTROL_ID': '0', },
{'METPLUS_CONTROL_ID': 'control_id = "0";'}),
({'ENSEMBLE_STAT_GRID_WEIGHT_FLAG': 'COS_LAT', },
{'METPLUS_GRID_WEIGHT_FLAG': 'grid_weight_flag = COS_LAT;'}),
]
)
def test_ensemble_stat_single_field(metplus_config, config_overrides,
Expand Down
6 changes: 6 additions & 0 deletions metplus/wrappers/ensemble_stat_wrapper.py
Expand Up @@ -66,6 +66,7 @@ class EnsembleStatWrapper(CompareGriddedWrapper):
'METPLUS_OBS_QUALITY_EXC',
'METPLUS_ENS_MEMBER_IDS',
'METPLUS_CONTROL_ID',
'METPLUS_GRID_WEIGHT_FLAG',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -330,6 +331,11 @@ def create_c_dict(self):
self.add_met_config(name='control_id',
data_type='string')

self.add_met_config(name='grid_weight_flag',
data_type='string',
extra_args={'remove_quotes': True,
'uppercase': True})

# old method of setting MET config values
c_dict['ENS_THRESH'] = (
self.config.getstr('config', 'ENSEMBLE_STAT_ENS_THRESH', '1.0')
Expand Down
4 changes: 3 additions & 1 deletion parm/met_config/EnsembleStatConfig_wrapped
Expand Up @@ -223,7 +223,9 @@ rng = {

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

grid_weight_flag = NONE;
//grid_weight_flag =
${METPLUS_GRID_WEIGHT_FLAG}

${METPLUS_OUTPUT_PREFIX}
//version = "V9.0";

Expand Down
Expand Up @@ -212,3 +212,5 @@ ENSEMBLE_STAT_ENSEMBLE_FLAG_WEIGHT = FALSE

#ENSEMBLE_STAT_ENS_MEMBER_IDS =
#ENSEMBLE_STAT_CONTROL_ID =

#ENSEMBLE_STAT_GRID_WEIGHT_FLAG =

0 comments on commit 9af5166

Please sign in to comment.