diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index 398383bd2a..21b13a018c 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -7569,22 +7569,22 @@ METplus Configuration Glossary | *Used by:* PB2NC TC_PAIRS_CONSENSUS_NAME - Specify the value for nth 'consensus.name' in the MET configuration file for TCPairs. + Specify the value for the nth 'consensus.name' in the MET configuration file for TCPairs. | *Used by:* TCPairs TC_PAIRS_CONSENSUS_MEMBERS - Specify the value for nth 'consensus.members' in the MET configuration file for TCPairs. + Specify the value for the nth 'consensus.members' in the MET configuration file for TCPairs. | *Used by:* TCPairs TC_PAIRS_CONSENSUS_REQUIRED - Specify the value for nth 'consensus.required' in the MET configuration file for TCPairs. + Specify the value for the nth 'consensus.required' in the MET configuration file for TCPairs. | *Used by:* TCPairs TC_PAIRS_CONSENSUS_MIN_REQ - Specify the value for nth 'consensus.min_req' in the MET configuration file for TCPairs. + Specify the value for the nth 'consensus.min_req' in the MET configuration file for TCPairs. | *Used by:* TCPairs @@ -10093,3 +10093,23 @@ METplus Configuration Glossary See :term:`STAT_ANALYSIS_FCST_VALID_END`. | *Used by:* StatAnalysis + + TC_PAIRS_DIAG_NAME + Specify the value for 'diag_name' 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. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_CONVERT_MAP_KEY + Specify the value for the nth 'diag_convert_map.key' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_DIAG_CONVERT_MAP_CONVERT + Specify the value for the nth 'diag_convert_map.convert' 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 2c35d8d20e..6d216db8b1 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -8210,6 +8210,10 @@ 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_CONVERT_MAP_KEY` +| :term:`TC_PAIRS_DIAG_CONVERT_MAP_CONVERT` | .. warning:: **DEPRECATED:** @@ -8492,6 +8496,33 @@ see :ref:`How METplus controls MET config file settings`. * - :term:`TC_PAIRS_INTERP12` - interp12 +**${METPLUS_DIAG_NAME}** + +.. list-table:: + :widths: 5 5 + :header-rows: 0 + + * - METplus Config(s) + - MET Config File + * - :term:`TC_PAIRS_DIAG_NAME` + - diag_name + +**${METPLUS_DIAG_CONVERT_MAP_LIST}** + +.. list-table:: + :widths: 5 5 + :header-rows: 0 + + * - METplus Config(s) + - MET Config File + * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_SOURCE` + - diag_convert_map.source + * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_KEY` + - diag_convert_map.key + * - :term:`TC_PAIRS_DIAG_CONVERT_MAP_CONVERT` + - diag_convert_map.convert + + .. _tcrmw_wrapper: TCRMW 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 b89d6c9f5e..b0316f6650 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 @@ -467,14 +467,14 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides, 'TC_PAIRS_DIAG_SOURCE1': 'TCDIAG', }, {'DIAG_ARG': '-diag TCDIAG /some/path/2014121318.dat'}), - # 42 -diag argument with models + # 43 -diag argument with models ('VALID', { 'TC_PAIRS_DIAG_TEMPLATE1': '/some/path/{valid?fmt=%Y%m%d%H}.dat', 'TC_PAIRS_DIAG_SOURCE1': 'TCDIAG', 'TC_PAIRS_DIAG_MODELS1': 'OFCL, SHIP', }, {'DIAG_ARG': '-diag TCDIAG /some/path/2014121318.dat model=OFCL,SHIP'}), - # 43 2 -diag arguments + # 44 2 -diag arguments ('VALID', { 'TC_PAIRS_DIAG_TEMPLATE1': '/some/path/{valid?fmt=%Y%m%d%H}.dat', 'TC_PAIRS_DIAG_SOURCE1': 'TCDIAG', @@ -485,6 +485,26 @@ 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 + ('VALID', {'TC_PAIRS_DIAG_NAME': 'TC_DIAG, TC_DIAG2', }, + {'METPLUS_DIAG_NAME': 'diag_name = ["TC_DIAG", "TC_DIAG2"];'}), + # 46 + ('VALID', {'TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE': 'TCDIAG', }, + {'METPLUS_DIAG_CONVERT_MAP_LIST': 'diag_convert_map = [{source = "TCDIAG";}];'}), + # 47 + ('VALID', {'TC_PAIRS_DIAG_CONVERT_MAP1_KEY': '(10C),(10KT),(10M/S)', }, + {'METPLUS_DIAG_CONVERT_MAP_LIST': 'diag_convert_map = [{key = ["(10C)", "(10KT)", "(10M/S)"];}];'}), + # 48 + ('VALID', {'TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT': 'x/10', }, + {'METPLUS_DIAG_CONVERT_MAP_LIST': 'diag_convert_map = [{convert(x) = x/10;}];'}), + # 49 + ('VALID', { + 'TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE': 'TCDIAG', + '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;}];'}), + ] ) @pytest.mark.wrapper diff --git a/metplus/wrappers/tc_pairs_wrapper.py b/metplus/wrappers/tc_pairs_wrapper.py index c2b9b3aca2..9c52127ba8 100755 --- a/metplus/wrappers/tc_pairs_wrapper.py +++ b/metplus/wrappers/tc_pairs_wrapper.py @@ -63,6 +63,8 @@ class TCPairsWrapper(CommandBuilder): 'METPLUS_CHECK_DUP', 'METPLUS_INTERP12', 'METPLUS_MATCH_POINTS', + 'METPLUS_DIAG_NAME', + 'METPLUS_DIAG_CONVERT_MAP_LIST', ] WILDCARDS = { @@ -178,6 +180,10 @@ 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_convert_map() + # if unset, set match_points to TRUE to match old default in wrapped if not self.env_var_dict.get('METPLUS_MATCH_POINTS'): self.env_var_dict['METPLUS_MATCH_POINTS'] = 'match_points = TRUE;' @@ -413,7 +419,25 @@ def _handle_consensus(self): if not return_code: self.isOK = False - return return_code + def _handle_diag_convert_map(self): + dict_items = { + 'source': 'string', + 'key': 'list', + 'convert': ('string', 'remove_quotes'), + } + return_code = add_met_config_dict_list(config=self.config, + app_name=self.app_name, + output_dict=self.env_var_dict, + dict_name='diag_convert_map', + dict_items=dict_items) + if not return_code: + self.isOK = False + return + + # change "convert =" to "convert(x) =" + value = self.env_var_dict.get('METPLUS_DIAG_CONVERT_MAP_LIST', '') + value = value.replace('convert =', 'convert(x) =') + self.env_var_dict['METPLUS_DIAG_CONVERT_MAP_LIST'] = value def _handle_diag(self, c_dict): diag_indices = list( diff --git a/parm/met_config/TCPairsConfig_wrapped b/parm/met_config/TCPairsConfig_wrapped index 34f85e1a2f..4ee11dff9b 100644 --- a/parm/met_config/TCPairsConfig_wrapped +++ b/parm/met_config/TCPairsConfig_wrapped @@ -143,6 +143,13 @@ watch_warn = { time_offset = -14400; } + +//diag_name = +${METPLUS_DIAG_NAME} + +//diag_convert_map = { +${METPLUS_DIAG_CONVERT_MAP_LIST} + // // Indicate a version number for the contents of this configuration file. // The value should generally not be modified. 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 092a7f985c..92c98e5525 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 @@ -105,4 +105,9 @@ TC_PAIRS_MISSING_VAL = -9999 #TC_PAIRS_INTERP12 = -#TC_PAIRS_MATCH_POINTS = \ No newline at end of file +#TC_PAIRS_MATCH_POINTS = + +#TC_PAIRS_DIAG_NAME = +#TC_PAIRS_DIAG_CONVERT_MAP1_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 f7b103720a..ca20066421 100644 --- a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf +++ b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf @@ -100,3 +100,8 @@ TC_PAIRS_DLAND_FILE = MET_BASE/tc_data/dland_global_tenth_degree.nc #TC_PAIRS_INTERP12 = #TC_PAIRS_MATCH_POINTS = + +#TC_PAIRS_DIAG_NAME = +#TC_PAIRS_DIAG_CONVERT_MAP1_SOURCE = +#TC_PAIRS_DIAG_CONVERT_MAP1_KEY = +#TC_PAIRS_DIAG_CONVERT_MAP1_CONVERT = \ No newline at end of file