Skip to content

Commit

Permalink
per #2622, support setting climo_mean and climo_stdev dictionary valu…
Browse files Browse the repository at this point in the history
…es inside fcst and obs dictionaries for grid_stat, ensemble_stat, point_stat, and series_analysis. Quietly add support for setting climo dictionaries inside the ens dictionary for gen_ens_prod -- this support is not needed because there is only 1 dictionary that may contain the climo dicts, but adding support for completeness so it can be assumed that {APP_NAME}_{DICT}_{SUBDICT}_{VAR} is supported, e.g. GEN_ENS_PROD_ENS_CLIMO_MEAN_REGRID_METHOD
  • Loading branch information
georgemccabe committed Sep 17, 2024
1 parent 5b5c37d commit ec2b013
Show file tree
Hide file tree
Showing 24 changed files with 2,387 additions and 33 deletions.
720 changes: 720 additions & 0 deletions docs/Users_Guide/glossary.rst

Large diffs are not rendered by default.

600 changes: 599 additions & 1 deletion docs/Users_Guide/wrappers.rst

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion internal/tests/pytests/util/met_config/test_met_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def test_read_climo_field(metplus_config, config_overrides, expected_value):
@pytest.mark.util
def test_handle_climo_dict(metplus_config, config_overrides, expected_value):
app_name = 'app'
sub_groups = ('fcst', 'obs')
for climo_type in ('MEAN', 'STDEV'):
expected_var = f'METPLUS_CLIMO_{climo_type}_DICT'
config = metplus_config
Expand All @@ -144,7 +145,7 @@ def test_handle_climo_dict(metplus_config, config_overrides, expected_value):
value_sub = value.replace('<type>', climo_type.lower())
config.set('config', key_sub, value_sub)

handle_climo_dict(config, app_name, output_dict)
handle_climo_dict(config, app_name, output_dict, sub_groups=sub_groups)
print(output_dict)
expected_sub = expected_value.replace('<type>', climo_type.lower())
assert output_dict[expected_var] == expected_sub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,178 @@ def test_ensemble_stat_field_info(metplus_config, config_overrides,
({'TIME_OFFSET_WARNING': 2, 'ENSEMBLE_STAT_TIME_OFFSET_WARNING': 4},
{'METPLUS_TIME_OFFSET_WARNING': 'time_offset_warning = 4;'}),
# fcst climo_mean
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_FILE_NAME': '/some/climo_mean/file.txt', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {file_name = ["/some/climo_mean/file.txt"];}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_FIELD': '{name="UGRD"; level=["P850","P500","P250"];}', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {field = [{name="UGRD"; level=["P850","P500","P250"];}];}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_METHOD': 'NEAREST', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {method = NEAREST;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_WIDTH': '1', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {width = 1;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_VLD_THRESH': '0.5', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {vld_thresh = 0.5;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_SHAPE': 'SQUARE', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {shape = SQUARE;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_TIME_INTERP_METHOD': 'NEAREST', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {time_interp_method = NEAREST;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_MATCH_MONTH': 'True', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {match_month = TRUE;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_DAY_INTERVAL': '30', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {day_interval = 30;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_DAY_INTERVAL': 'NA', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {day_interval = NA;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_HOUR_INTERVAL': '12', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {hour_interval = 12;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_HOUR_INTERVAL': 'NA', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': 'climo_mean = {hour_interval = NA;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_MEAN_FILE_NAME': '/some/climo_mean/file.txt',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_FIELD': '{name="CLM_NAME"; level="(0,0,*,*)";}',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_METHOD': 'NEAREST',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_WIDTH': '1',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_VLD_THRESH': '0.5',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_REGRID_SHAPE': 'SQUARE',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_TIME_INTERP_METHOD': 'NEAREST',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_MATCH_MONTH': 'True',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_DAY_INTERVAL': '30',
'ENSEMBLE_STAT_FCST_CLIMO_MEAN_HOUR_INTERVAL': '12', },
{'METPLUS_FCST_CLIMO_MEAN_DICT': ('climo_mean = {file_name = '
'["/some/climo_mean/file.txt"];'
'field = [{name="CLM_NAME"; level="(0,0,*,*)";}];'
'regrid = {method = NEAREST;width = 1;'
'vld_thresh = 0.5;shape = SQUARE;}'
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
# fcst climo_stdev
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_FILE_NAME': '/some/climo_stdev/file.txt', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {file_name = ["/some/climo_stdev/file.txt"];}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_FIELD': '{name="UGRD"; level=["P850","P500","P250"];}', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {field = [{name="UGRD"; level=["P850","P500","P250"];}];}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_METHOD': 'NEAREST', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {method = NEAREST;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_WIDTH': '1', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {width = 1;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_VLD_THRESH': '0.5', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {vld_thresh = 0.5;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_SHAPE': 'SQUARE', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {shape = SQUARE;}}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_TIME_INTERP_METHOD': 'NEAREST', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {time_interp_method = NEAREST;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_MATCH_MONTH': 'True', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {match_month = TRUE;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_DAY_INTERVAL': '30', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {day_interval = 30;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_DAY_INTERVAL': 'NA', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {day_interval = NA;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_HOUR_INTERVAL': '12', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {hour_interval = 12;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_HOUR_INTERVAL': 'NA', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': 'climo_stdev = {hour_interval = NA;}'}),
({'ENSEMBLE_STAT_FCST_CLIMO_STDEV_FILE_NAME': '/some/climo_stdev/file.txt',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_FIELD': '{name="CLM_NAME"; level="(0,0,*,*)";}',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_METHOD': 'NEAREST',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_WIDTH': '1',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_VLD_THRESH': '0.5',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_REGRID_SHAPE': 'SQUARE',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_TIME_INTERP_METHOD': 'NEAREST',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_MATCH_MONTH': 'True',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_DAY_INTERVAL': '30',
'ENSEMBLE_STAT_FCST_CLIMO_STDEV_HOUR_INTERVAL': '12', },
{'METPLUS_FCST_CLIMO_STDEV_DICT': ('climo_stdev = {file_name = '
'["/some/climo_stdev/file.txt"];'
'field = [{name="CLM_NAME"; level="(0,0,*,*)";}];'
'regrid = {method = NEAREST;width = 1;'
'vld_thresh = 0.5;shape = SQUARE;}'
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
# obs climo_mean
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_FILE_NAME': '/some/climo_mean/file.txt', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {file_name = ["/some/climo_mean/file.txt"];}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_FIELD': '{name="UGRD"; level=["P850","P500","P250"];}', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {field = [{name="UGRD"; level=["P850","P500","P250"];}];}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_METHOD': 'NEAREST', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {method = NEAREST;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_WIDTH': '1', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {width = 1;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_VLD_THRESH': '0.5', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {vld_thresh = 0.5;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_SHAPE': 'SQUARE', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {regrid = {shape = SQUARE;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_TIME_INTERP_METHOD': 'NEAREST', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {time_interp_method = NEAREST;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_MATCH_MONTH': 'True', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {match_month = TRUE;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_DAY_INTERVAL': '30', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {day_interval = 30;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_DAY_INTERVAL': 'NA', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {day_interval = NA;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_HOUR_INTERVAL': '12', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {hour_interval = 12;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_HOUR_INTERVAL': 'NA', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': 'climo_mean = {hour_interval = NA;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_MEAN_FILE_NAME': '/some/climo_mean/file.txt',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_FIELD': '{name="CLM_NAME"; level="(0,0,*,*)";}',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_METHOD': 'NEAREST',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_WIDTH': '1',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_VLD_THRESH': '0.5',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_REGRID_SHAPE': 'SQUARE',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_TIME_INTERP_METHOD': 'NEAREST',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_MATCH_MONTH': 'True',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_DAY_INTERVAL': '30',
'ENSEMBLE_STAT_OBS_CLIMO_MEAN_HOUR_INTERVAL': '12', },
{'METPLUS_OBS_CLIMO_MEAN_DICT': ('climo_mean = {file_name = '
'["/some/climo_mean/file.txt"];'
'field = [{name="CLM_NAME"; level="(0,0,*,*)";}];'
'regrid = {method = NEAREST;width = 1;'
'vld_thresh = 0.5;shape = SQUARE;}'
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
# obs climo_stdev
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_FILE_NAME': '/some/climo_stdev/file.txt', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {file_name = ["/some/climo_stdev/file.txt"];}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_FIELD': '{name="UGRD"; level=["P850","P500","P250"];}', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {field = [{name="UGRD"; level=["P850","P500","P250"];}];}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_METHOD': 'NEAREST', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {method = NEAREST;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_WIDTH': '1', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {width = 1;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_VLD_THRESH': '0.5', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {vld_thresh = 0.5;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_SHAPE': 'SQUARE', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {regrid = {shape = SQUARE;}}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_TIME_INTERP_METHOD': 'NEAREST', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {time_interp_method = NEAREST;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_MATCH_MONTH': 'True', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {match_month = TRUE;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_DAY_INTERVAL': '30', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {day_interval = 30;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_DAY_INTERVAL': 'NA', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {day_interval = NA;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_HOUR_INTERVAL': '12', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {hour_interval = 12;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_HOUR_INTERVAL': 'NA', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': 'climo_stdev = {hour_interval = NA;}'}),
({'ENSEMBLE_STAT_OBS_CLIMO_STDEV_FILE_NAME': '/some/climo_stdev/file.txt',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_FIELD': '{name="CLM_NAME"; level="(0,0,*,*)";}',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_METHOD': 'NEAREST',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_WIDTH': '1',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_VLD_THRESH': '0.5',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_REGRID_SHAPE': 'SQUARE',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_TIME_INTERP_METHOD': 'NEAREST',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_MATCH_MONTH': 'True',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_DAY_INTERVAL': '30',
'ENSEMBLE_STAT_OBS_CLIMO_STDEV_HOUR_INTERVAL': '12', },
{'METPLUS_OBS_CLIMO_STDEV_DICT': ('climo_stdev = {file_name = '
'["/some/climo_stdev/file.txt"];'
'field = [{name="CLM_NAME"; level="(0,0,*,*)";}];'
'regrid = {method = NEAREST;width = 1;'
'vld_thresh = 0.5;shape = SQUARE;}'
'time_interp_method = NEAREST;'
'match_month = TRUE;day_interval = 30;'
'hour_interval = 12;}')}),
]
)
@pytest.mark.wrapper_c
Expand Down
Loading

0 comments on commit ec2b013

Please sign in to comment.