Skip to content

Commit

Permalink
per #896, add support for setting censor_thresh and censor_val in Gri…
Browse files Browse the repository at this point in the history
…dStat wrapped MET config file, ci-run-all-diff
  • Loading branch information
georgemccabe committed Dec 16, 2021
1 parent 0e4c94f commit 4481662
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8663,3 +8663,13 @@ METplus Configuration Glossary
Specify the value for 'ct_stats_flag' in the MET configuration file for MODE.

| *Used by:* MODE
GRID_STAT_CENSOR_THRESH
Specify the value for 'censor_thresh' in the MET configuration file for GridStat.

| *Used by:* GridStat
GRID_STAT_CENSOR_VAL
Specify the value for 'censor_val' in the MET configuration file for GridStat.

| *Used by:* GridStat
25 changes: 25 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,8 @@ METplus Configuration
| :term:`GRID_STAT_DISTANCE_MAP_BETA_VALUE_N`
| :term:`GRID_STAT_FOURIER_WAVE_1D_BEG`
| :term:`GRID_STAT_FOURIER_WAVE_1D_END`
| :term:`GRID_STAT_CENSOR_THRESH`
| :term:`GRID_STAT_CENSOR_VAL`
| :term:`GRID_STAT_MASK_GRID` (optional)
| :term:`GRID_STAT_MASK_POLY` (optional)
| :term:`GRID_STAT_MET_CONFIG_OVERRIDES`
Expand Down Expand Up @@ -3281,6 +3283,29 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`GRID_STAT_FOURIER_WAVE_1D_END`
- fourier.wave_1d_end

**${METPLUS_CENSOR_THRESH}**

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

* - METplus Config(s)
- MET Config File
* - :term:`GRID_STAT_CENSOR_THRESH`
- censor_thresh

**${METPLUS_CENSOR_VAL}**

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

* - METplus Config(s)
- MET Config File
* - :term:`GRID_STAT_CENSOR_VAL`
- censor_val


.. _ioda2nc_wrapper:

IODA2NC
Expand Down
6 changes: 6 additions & 0 deletions internal_tests/pytests/grid_stat/test_grid_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,11 @@ def test_handle_climo_file_variables(metplus_config, config_overrides,
'GRID_STAT_FOURIER_WAVE_1D_END': '3,9,20',},
{'METPLUS_FOURIER_DICT': ('fourier = {wave_1d_beg = [0, 4, 10];'
'wave_1d_end = [3, 9, 20];}')}),
({'GRID_STAT_CENSOR_THRESH': '>12000,<5000', },
{'METPLUS_CENSOR_THRESH': 'censor_thresh = [>12000, <5000];'}),
({'GRID_STAT_CENSOR_VAL': '12000, 5000', },
{'METPLUS_CENSOR_VAL': 'censor_val = [12000, 5000];'}),
]
)
Expand Down Expand Up @@ -626,6 +631,7 @@ def test_grid_stat_single_field(metplus_config, config_overrides,
item.startswith(env_var_key)), None)
assert(match is not None)
actual_value = match.split('=', 1)[1]
print(f"ENV VAR: {env_var_key}")
if env_var_key == 'METPLUS_FCST_FIELD':
assert(actual_value == fcst_fmt)
elif env_var_key == 'METPLUS_OBS_FIELD':
Expand Down
10 changes: 10 additions & 0 deletions metplus/wrappers/grid_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class GridStatWrapper(CompareGriddedWrapper):
'METPLUS_HSS_EC_VALUE',
'METPLUS_DISTANCE_MAP_DICT',
'METPLUS_FOURIER_DICT',
'METPLUS_CENSOR_THRESH',
'METPLUS_CENSOR_VAL',
]

# handle deprecated env vars used pre v4.0.0
Expand Down Expand Up @@ -252,6 +254,14 @@ def create_c_dict(self):
'wave_1d_end': ('list', 'remove_quotes'),
})

self.add_met_config(name='censor_thresh',
data_type='list',
extra_args={'remove_quotes': True})

self.add_met_config(name='censor_val',
data_type='list',
extra_args={'remove_quotes': True})

return c_dict

def set_environment_variables(self, time_info):
Expand Down
6 changes: 4 additions & 2 deletions parm/met_config/GridStatConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ ${METPLUS_REGRID_DICT}

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

censor_thresh = [];
censor_val = [];
//censor_thresh =
${METPLUS_CENSOR_THRESH}
//censor_val =
${METPLUS_CENSOR_VAL}
cat_thresh = [];
cnt_thresh = [ NA ];
cnt_logic = UNION;
Expand Down
3 changes: 3 additions & 0 deletions parm/use_cases/met_tool_wrapper/GridStat/GridStat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,6 @@ GRID_STAT_NC_PAIRS_FLAG_APPLY_MASK = FALSE

#GRID_STAT_FOURIER_WAVE_1D_BEG =
#GRID_STAT_FOURIER_WAVE_1D_END =

#GRID_STAT_CENSOR_THRESH =
#GRID_STAT_CENSOR_VAL =

0 comments on commit 4481662

Please sign in to comment.