Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ ENV/
# pytest cache files
*.pytest_cache*

.idea/workspace.xml
.idea/sonarlint*
.idea

# tilda files generated by emacs
*~
Expand Down
18 changes: 0 additions & 18 deletions .idea/METplus.iml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

15 changes: 15 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14979,3 +14979,18 @@ METplus Configuration Glossary
Specify the value for 'ss_index_vld_thresh' in the MET configuration file for StatAnalysis.

| *Used by:* StatAnalysis

GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D
Specify the value for 'output_flag.histogram_1d' in the MET configuration file for GridDiag.

| *Used by:* GridDiag

GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D
Specify the value for 'output_flag.histogram_2d' in the MET configuration file for GridDiag.

| *Used by:* GridDiag

GRID_DIAG_OUTPUT_FLAG_INFO_THEORY
Specify the value for 'output_flag.info_theory' in the MET configuration file for GridDiag.

| *Used by:* GridDiag
21 changes: 20 additions & 1 deletion docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3272,7 +3272,10 @@ METplus Configuration
| :term:`GRID_DIAG_INC_INIT_TIMES`
| :term:`GRID_DIAG_ALLOW_MISSING_INPUTS`
| :term:`GRID_DIAG_INPUT_THRESH`
|
| :term:`GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D`
| :term:`GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D`
| :term:`GRID_DIAG_OUTPUT_FLAG_INFO_THEORY`


.. _grid-diag-met-conf:

Expand Down Expand Up @@ -3396,6 +3399,22 @@ ${METPLUS_MASK_DICT}

.. note:: Since the default value in the MET config file for 'grid' is grid = [ "FULL" ];, setting GRID_DIAG_MASK_GRID to an empty string will result in a value of grid = []; in the MET config file.

${METPLUS_OUTPUT_FLAG_DICT}
"""""""""""""""""""""""""""

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

* - METplus Config(s)
- MET Config File
* - :term:`GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D`
- output_flag.histogram_1d
* - :term:`GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D`
- output_flag.histogram_2d
* - :term:`GRID_DIAG_OUTPUT_FLAG_INFO_THEORY`
- output_flag.info_theory

${METPLUS_MET_CONFIG_OVERRIDES}
"""""""""""""""""""""""""""""""

Expand Down
11 changes: 6 additions & 5 deletions internal/scripts/dev_tools/add_met_config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ def _get_output_item(dict_items, met_config_name):
if not dict_items:
return 'VALUE'

item_name, child_name, *_ = met_config_name.split('.')[1:]
value = 'VALUE;'
if child_name:
value = f"{{{child_name} = VALUE;}}"
return f"{item_name} = {value}"
item_name, *rest = met_config_name.split('.')[1:]
child_name = rest[0] if rest else None
if not child_name:
return f"{item_name} = VALUE;"

return f"{item_name} = {{{child_name} = VALUE;}}"


def doc_util_usage():
Expand Down
28 changes: 23 additions & 5 deletions internal/tests/pytests/wrappers/grid_diag/test_grid_diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,20 @@ def test_get_config_file(metplus_config):
{'METPLUS_CENSOR_VAL': 'censor_val = [12000, 5000];'}),

({'GRID_DIAG_MASK_GRID': 'FULL', },
{'METPLUS_MASK_DICT': 'mask = {grid = "FULL";}'}),
{'METPLUS_MASK_DICT': 'mask = {grid = ["FULL"];}'}),

({'GRID_DIAG_MASK_POLY': 'MET_BASE/poly/EAST.poly', },
{'METPLUS_MASK_DICT': 'mask = {poly = "MET_BASE/poly/EAST.poly";}'}),
{'METPLUS_MASK_DICT': 'mask = {poly = ["MET_BASE/poly/EAST.poly"];}'}),

({'GRID_DIAG_MASK_GRID': 'FULL',
'GRID_DIAG_MASK_POLY': 'MET_BASE/poly/EAST.poly',},
{'METPLUS_MASK_DICT': ('mask = {grid = "FULL";'
'poly = "MET_BASE/poly/EAST.poly";}')}),
'GRID_DIAG_MASK_POLY': 'MET_BASE/poly/EAST.poly', },
{'METPLUS_MASK_DICT': ('mask = {grid = ["FULL"];'
'poly = ["MET_BASE/poly/EAST.poly"];}')}),

({'GRID_DIAG_MASK_GRID': 'FULL,DTC165',
'GRID_DIAG_MASK_POLY': 'MET_BASE/poly/EAST.poly, MET_BASE/poly/WEST.poly', },
{'METPLUS_MASK_DICT': ('mask = {grid = ["FULL", "DTC165"];'
'poly = ["MET_BASE/poly/EAST.poly", "MET_BASE/poly/WEST.poly"];}')}),

({'GRID_DIAG_REGRID_TO_GRID': 'FCST',},
{'METPLUS_REGRID_DICT': 'regrid = {to_grid = FCST;}'}),
Expand Down Expand Up @@ -331,7 +336,20 @@ def test_get_config_file(metplus_config):
),
]
}),
({'GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D': 'true', },
{'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {histogram_1d = TRUE;}'}),

({'GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D': 'false', },
{'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {histogram_2d = FALSE;}'}),

({'GRID_DIAG_OUTPUT_FLAG_INFO_THEORY': 'True', },
{'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {info_theory = TRUE;}'}),

({'GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D': 'true',
'GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D': 'false',
'GRID_DIAG_OUTPUT_FLAG_INFO_THEORY': 'True',
},
{'METPLUS_OUTPUT_FLAG_DICT': 'output_flag = {histogram_1d = TRUE;histogram_2d = FALSE;info_theory = TRUE;}'}),
]
)
@pytest.mark.wrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ def test_ioda2nc_missing_inputs(metplus_config, get_test_data_dir, run_all_and_c
'IODA2NC_NMSG': '10',
},
{}, ' -iodafile *INPUT_DIR*/other/file.nc -valid_beg 20200309_12 -valid_end 20200310_12 -nmsg 10'),

# 40 quality_mark_thresh threshold value
({'IODA2NC_QUALITY_MARK_THRESH': '<=2||==9', },
{'METPLUS_QUALITY_MARK_THRESH': 'quality_mark_thresh = <=2||==9;'}, ''),
]
)
@pytest.mark.wrapper
Expand Down
3 changes: 3 additions & 0 deletions internal/tests/pytests/wrappers/pb2nc/test_pb2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ def test_find_input_files(metplus_config, offsets, offset_to_find):
({'PB2NC_QUALITY_MARK_THRESH': '3', },
{'METPLUS_QUALITY_MARK_THRESH': 'quality_mark_thresh = 3;'}),

({'PB2NC_QUALITY_MARK_THRESH': '<=2||==9', },
{'METPLUS_QUALITY_MARK_THRESH': 'quality_mark_thresh = <=2||==9;'}),

({'PB2NC_TIME_SUMMARY_FLAG': 'True', },
{'METPLUS_TIME_SUMMARY_DICT': 'time_summary = {flag = TRUE;}'}),

Expand Down
11 changes: 10 additions & 1 deletion metplus/wrappers/grid_diag_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GridDiagWrapper(RuntimeFreqWrapper):
'METPLUS_CENSOR_VAL',
'METPLUS_DATA_DICT',
'METPLUS_MASK_DICT',
'METPLUS_OUTPUT_FLAG_DICT',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
Expand All @@ -43,6 +44,12 @@ class GridDiagWrapper(RuntimeFreqWrapper):
'VERIF_MASK',
]

OUTPUT_FLAGS = [
'histogram_1d',
'histogram_2d',
'info_theory',
]

def __init__(self, config, instance=None):
self.app_name = "grid_diag"
self.app_path = os.path.join(config.getdir('MET_BIN_DIR'),
Expand Down Expand Up @@ -84,10 +91,12 @@ def create_c_dict(self):

self.handle_description()

self.handle_mask(single_value=True)
self.handle_mask(single_value=False)

self.handle_censor_val_and_thresh()

self.handle_flags('OUTPUT')

c_dict['VAR_LIST_TEMP'] = parse_var_list(self.config,
data_type='FCST',
met_tool=self.app_name,
Expand Down
3 changes: 2 additions & 1 deletion metplus/wrappers/ioda2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def create_c_dict(self):
extra_args={'remove_quotes': True})
self.add_met_config(name='missing_thresh', data_type='list',
extra_args={'remove_quotes': True})
self.add_met_config(name='quality_mark_thresh', data_type='int')
self.add_met_config(name='quality_mark_thresh', data_type='string',
extra_args={'remove_quotes': True})
self.handle_time_summary_dict()

return c_dict
Expand Down
9 changes: 3 additions & 6 deletions metplus/wrappers/pb2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,17 @@ def create_c_dict(self):
c_dict['ALLOW_MULTIPLE_FILES'] = True
c_dict['SUPPORTS_FILE_LIST'] = False

self.add_met_config(name='pb_report_type',
data_type='list',
metplus_configs=['PB2NC_PB_REPORT_TYPE'],
self.add_met_config(name='pb_report_type', data_type='list',
extra_args={'remove_quotes': True})

# get level_range beg and end
self.add_met_config_window('level_range')

self.add_met_config(name='level_category', data_type='list',
metplus_configs=['PB2NC_LEVEL_CATEGORY'],
extra_args={'remove_quotes': True})

self.add_met_config(name='quality_mark_thresh', data_type='int',
metplus_configs=['PB2NC_QUALITY_MARK_THRESH'])
self.add_met_config(name='quality_mark_thresh', data_type='string',
extra_args={'remove_quotes': True})

self.add_met_config(name='obs_bufr_map', data_type='list',
extra_args={'remove_quotes': True})
Expand Down
3 changes: 3 additions & 0 deletions parm/met_config/GridDiagConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ ${METPLUS_DATA_DICT}
//mask = {
${METPLUS_MASK_DICT}

//output_flag = {
${METPLUS_OUTPUT_FLAG_DICT}

tmp_dir = "${MET_TMP_DIR}";

${METPLUS_MET_CONFIG_OVERRIDES}
4 changes: 4 additions & 0 deletions parm/use_cases/met_tool_wrapper/GridDiag/GridDiag.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ GRID_DIAG_CONFIG_FILE = {PARM_BASE}/met_config/GridDiagConfig_wrapped
#GRID_DIAG_REGRID_CENSOR_VAL =

GRID_DIAG_MASK_POLY = MET_BASE/poly/SAO.poly

#GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_1D =
#GRID_DIAG_OUTPUT_FLAG_HISTOGRAM_2D =
#GRID_DIAG_OUTPUT_FLAG_INFO_THEORY =