diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index d8944f2000..3dd5e354dc 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -10094,13 +10094,33 @@ METplus Configuration Glossary | *Used by:* StatAnalysis - TC_PAIRS_DIAG_NAME - Specify the value for 'diag_name' in the MET configuration file for TCPairs. + TC_PAIRS_DIAG_INFO_MAP_DIAG_SOURCE + Specify the value for the nth 'diag_info_map.diag_source' in the MET configuration file for TCPairs. | *Used by:* TCPairs - TC_PAIRS_DIAG_CONVERT_MAP_SOURCE - Specify the value for the nth 'diag_convert_map.source' in the MET configuration file for TCPairs. + TC_PAIRS_DIAG_INFO_MAP_TRACK_SOURCE + Specify the value for the nth 'diag_info_map.track_source' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_INFO_MAP_FIELD_SOURCE + Specify the value for the nth 'diag_info_map.field_source' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_INFO_MAP_MATCH_TO_TRACK + Specify the value for the nth 'diag_info_map.match_to_track' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_INFO_MAP_DIAG_NAME + Specify the value for the nth 'diag_info_map.diag_name' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_CONVERT_MAP_DIAG_SOURCE + Specify the value for the nth 'diag_convert_map.diag_source' in the MET configuration file for TCPairs. | *Used by:* TCPairs diff --git a/docs/Users_Guide/wrappers.rst b/docs/Users_Guide/wrappers.rst index a4d088dbef..cff6d032f6 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -8225,8 +8225,12 @@ METplus Configuration | :term:`TC_PAIRS_CHECK_DUP` | :term:`TC_PAIRS_INTERP12` | :term:`TC_PAIRS_MATCH_POINTS` -| :term:`TC_PAIRS_DIAG_NAME` -| :term:`TC_PAIRS_DIAG_CONVERT_MAP_SOURCE` +| :term:`TC_PAIRS_DIAG_INFO_MAP_DIAG_SOURCE` +| :term:`TC_PAIRS_DIAG_INFO_MAP_TRACK_SOURCE` +| :term:`TC_PAIRS_DIAG_INFO_MAP_FIELD_SOURCE` +| :term:`TC_PAIRS_DIAG_INFO_MAP_MATCH_TO_TRACK` +| :term:`TC_PAIRS_DIAG_INFO_MAP_DIAG_NAME` +| :term:`TC_PAIRS_DIAG_CONVERT_MAP_DIAG_SOURCE` | :term:`TC_PAIRS_DIAG_CONVERT_MAP_KEY` | :term:`TC_PAIRS_DIAG_CONVERT_MAP_CONVERT` | @@ -8511,7 +8515,7 @@ see :ref:`How METplus controls MET config file settings`. * - :term:`TC_PAIRS_INTERP12` - interp12 -**${METPLUS_DIAG_NAME}** +**${METPLUS_DIAG_INFO_MAP_LIST}** .. list-table:: :widths: 5 5 @@ -8519,8 +8523,16 @@ see :ref:`How METplus controls MET config file settings`. * - METplus Config(s) - MET Config File - * - :term:`TC_PAIRS_DIAG_NAME` - - diag_name + * - :term:`TC_PAIRS_DIAG_INFO_MAP_DIAG_SOURCE` + - diag_info_map.diag_source + * - :term:`TC_PAIRS_DIAG_INFO_MAP_TRACK_SOURCE` + - diag_info_map.track_source + * - :term:`TC_PAIRS_DIAG_INFO_MAP_FIELD_SOURCE` + - diag_info_map.field_source + * - :term:`TC_PAIRS_DIAG_INFO_MAP_MATCH_TO_TRACK` + - diag_info_map.match_to_track + * - :term:`TC_PAIRS_DIAG_INFO_MAP_DIAG_NAME` + - diag_info_map.diag_name **${METPLUS_DIAG_CONVERT_MAP_LIST}** @@ -8530,8 +8542,8 @@ see :ref:`How METplus controls MET config file settings`. * - METplus Config(s) - MET Config File - * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_SOURCE` - - diag_convert_map.source + * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_DIAG_SOURCE` + - diag_convert_map.diag_source * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_KEY` - diag_convert_map.key * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_CONVERT` diff --git a/internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py b/internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py index c632947fce..f27b6c2b71 100644 --- a/internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py +++ b/internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py @@ -485,34 +485,64 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides, {'DIAG_ARG': ('-diag TCDIAG /some/path/2014121318.dat ' '-diag LSDIAG_RT /some/path/rt_2014121318.dat ' 'model=OFCL,SHIP')}), - # 45 diag_name - ('VALID', {'TC_PAIRS_DIAG_NAME': 'TC_DIAG, TC_DIAG2', }, - {'METPLUS_DIAG_NAME': 'diag_name = ["TC_DIAG", "TC_DIAG2"];'}), - # 46 diag_convert_map 1 dictionary in list + # 45 diag_convert_map 1 dictionary in list ('VALID', { - 'TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE': 'TCDIAG', + 'TC_PAIRS_DIAG_CONVERT_MAP1_DIAG_SOURCE': 'CIRA_DIAG', 'TC_PAIRS_DIAG_CONVERT_MAP1_KEY': '(10C),(10KT),(10M/S)', 'TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT': 'x/10', }, - {'METPLUS_DIAG_CONVERT_MAP_LIST': 'diag_convert_map = [{source = "TCDIAG";key = ["(10C)", "(10KT)", "(10M/S)"];convert(x) = x/10;}];'}), - # 47 diag_convert_map 2 dictionaries in list + {'METPLUS_DIAG_CONVERT_MAP_LIST': ( + 'diag_convert_map = [{diag_source = "CIRA_DIAG";' + 'key = ["(10C)", "(10KT)", "(10M/S)"];convert(x) = x/10;}];' + )}), + # 46 diag_convert_map 2 dictionaries in list ('VALID', { - 'TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE': 'TCDIAG', + 'TC_PAIRS_DIAG_CONVERT_MAP1_DIAG_SOURCE': 'CIRA_DIAG', 'TC_PAIRS_DIAG_CONVERT_MAP1_KEY': '(10C),(10KT),(10M/S)', 'TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT': 'x/10', - 'TC_PAIRS_DIAG_CONVERT_MAP2_SOURCE': 'LSDIAG_RT', + 'TC_PAIRS_DIAG_CONVERT_MAP2_DIAG_SOURCE': 'SHIPS_DIAG', 'TC_PAIRS_DIAG_CONVERT_MAP2_KEY': 'LAT,LON,CSST,RSST,DSST,DSTA', 'TC_PAIRS_DIAG_CONVERT_MAP2_CONVERT': 'x/100', }, - {'METPLUS_DIAG_CONVERT_MAP_LIST': ('diag_convert_map = [{source = ' - '"TCDIAG";key = ["(10C)", ' - '"(10KT)", "(10M/S)"];' - 'convert(x) = x/10;},' - '{source = "LSDIAG_RT";key = [' - '"LAT", "LON", "CSST", "RSST", ' - '"DSST", "DSTA"];' - 'convert(x) = x/100;}];')}), - + {'METPLUS_DIAG_CONVERT_MAP_LIST': ( + 'diag_convert_map = [{diag_source = "CIRA_DIAG";' + 'key = ["(10C)", "(10KT)", "(10M/S)"];convert(x) = x/10;},' + '{diag_source = "SHIPS_DIAG";key = ["LAT", "LON", "CSST", ' + '"RSST", "DSST", "DSTA"];convert(x) = x/100;}];' + )}), + # 47 diag_info_map 1 dictionary in list + ('VALID', { + 'TC_PAIRS_DIAG_INFO_MAP1_DIAG_SOURCE': 'CIRA_DIAG_RT', + 'TC_PAIRS_DIAG_INFO_MAP1_TRACK_SOURCE': 'GFS', + 'TC_PAIRS_DIAG_INFO_MAP1_FIELD_SOURCE': 'GFS_0p50', + 'TC_PAIRS_DIAG_INFO_MAP1_MATCH_TO_TRACK': 'GFS', + 'TC_PAIRS_DIAG_INFO_MAP1_DIAG_NAME': 'MY_NAME', + }, + {'METPLUS_DIAG_INFO_MAP_LIST': ( + 'diag_info_map = [{diag_source = "CIRA_DIAG_RT";' + 'track_source = "GFS";field_source = "GFS_0p50";' + 'match_to_track = ["GFS"];diag_name = ["MY_NAME"];}];')}), + # 48 diag_info_map 2 dictionaries in list + ('VALID', { + 'TC_PAIRS_DIAG_INFO_MAP1_DIAG_SOURCE': 'CIRA_DIAG_RT', + 'TC_PAIRS_DIAG_INFO_MAP1_TRACK_SOURCE': 'GFS', + 'TC_PAIRS_DIAG_INFO_MAP1_FIELD_SOURCE': 'GFS_0p50', + 'TC_PAIRS_DIAG_INFO_MAP1_MATCH_TO_TRACK': 'GFS', + 'TC_PAIRS_DIAG_INFO_MAP1_DIAG_NAME': 'MY_NAME', + 'TC_PAIRS_DIAG_INFO_MAP2_DIAG_SOURCE': 'SHIPS_DIAG_RT', + 'TC_PAIRS_DIAG_INFO_MAP2_TRACK_SOURCE': 'OFCL', + 'TC_PAIRS_DIAG_INFO_MAP2_FIELD_SOURCE': 'GFS_0p50', + 'TC_PAIRS_DIAG_INFO_MAP2_MATCH_TO_TRACK': 'OFCL', + 'TC_PAIRS_DIAG_INFO_MAP2_DIAG_NAME': 'MY_NAME2', + }, + {'METPLUS_DIAG_INFO_MAP_LIST': ( + 'diag_info_map = [{diag_source = "CIRA_DIAG_RT";' + 'track_source = "GFS";field_source = "GFS_0p50";' + 'match_to_track = ["GFS"];diag_name = ["MY_NAME"];},' + '{diag_source = "SHIPS_DIAG_RT";track_source = "OFCL";' + 'field_source = "GFS_0p50";match_to_track = ["OFCL"]' + ';diag_name = ["MY_NAME2"];}];' + )}), ] ) @pytest.mark.wrapper diff --git a/metplus/wrappers/tc_pairs_wrapper.py b/metplus/wrappers/tc_pairs_wrapper.py index 9c52127ba8..d85cf1fb1a 100755 --- a/metplus/wrappers/tc_pairs_wrapper.py +++ b/metplus/wrappers/tc_pairs_wrapper.py @@ -63,7 +63,7 @@ class TCPairsWrapper(CommandBuilder): 'METPLUS_CHECK_DUP', 'METPLUS_INTERP12', 'METPLUS_MATCH_POINTS', - 'METPLUS_DIAG_NAME', + 'METPLUS_DIAG_INFO_MAP_LIST', 'METPLUS_DIAG_CONVERT_MAP_LIST', ] @@ -180,7 +180,7 @@ def create_c_dict(self): self.add_met_config(name='match_points', data_type='bool') - self.add_met_config(name='diag_name', data_type='list') + self._handle_diag_info_map() self._handle_diag_convert_map() @@ -419,9 +419,25 @@ def _handle_consensus(self): if not return_code: self.isOK = False + def _handle_diag_info_map(self): + dict_items = { + 'diag_source': 'string', + 'track_source': 'string', + 'field_source': 'string', + 'match_to_track': 'list', + 'diag_name': 'list', + } + return_code = add_met_config_dict_list(config=self.config, + app_name=self.app_name, + output_dict=self.env_var_dict, + dict_name='diag_info_map', + dict_items=dict_items) + if not return_code: + self.isOK = False + def _handle_diag_convert_map(self): dict_items = { - 'source': 'string', + 'diag_source': 'string', 'key': 'list', 'convert': ('string', 'remove_quotes'), } diff --git a/parm/met_config/TCPairsConfig_wrapped b/parm/met_config/TCPairsConfig_wrapped index 4ee11dff9b..0a538a2007 100644 --- a/parm/met_config/TCPairsConfig_wrapped +++ b/parm/met_config/TCPairsConfig_wrapped @@ -144,8 +144,8 @@ watch_warn = { } -//diag_name = -${METPLUS_DIAG_NAME} +//diag_info_map = { +${METPLUS_DIAG_INFO_MAP_LIST} //diag_convert_map = { ${METPLUS_DIAG_CONVERT_MAP_LIST} diff --git a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_extra_tropical.conf b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_extra_tropical.conf index 92c98e5525..3b63db308e 100644 --- a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_extra_tropical.conf +++ b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_extra_tropical.conf @@ -107,7 +107,12 @@ TC_PAIRS_MISSING_VAL = -9999 #TC_PAIRS_MATCH_POINTS = -#TC_PAIRS_DIAG_NAME = -#TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_DIAG_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_TRACK_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_FIELD_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_MATCH_TO_TRACK = +#TC_PAIRS_DIAG_INFO_MAP1_DIAG_NAME = + +#TC_PAIRS_DIAG_CONVERT_MAP1_DIAG_SOURCE = #TC_PAIRS_DIAG_CONVERT_MAP1_KEY = #TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT = diff --git a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf index ca20066421..beca82e6d7 100644 --- a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf +++ b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf @@ -101,7 +101,12 @@ TC_PAIRS_DLAND_FILE = MET_BASE/tc_data/dland_global_tenth_degree.nc #TC_PAIRS_MATCH_POINTS = -#TC_PAIRS_DIAG_NAME = -#TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_DIAG_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_TRACK_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_FIELD_SOURCE = +#TC_PAIRS_DIAG_INFO_MAP1_MATCH_TO_TRACK = +#TC_PAIRS_DIAG_INFO_MAP1_DIAG_NAME = + +#TC_PAIRS_DIAG_CONVERT_MAP1_DIAG_SOURCE = #TC_PAIRS_DIAG_CONVERT_MAP1_KEY = -#TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT = \ No newline at end of file +#TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT =