From d26d9bc8113bfcc1338f43a0084d0f6123025b83 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Wed, 10 Jan 2024 14:18:23 -0700 Subject: [PATCH] Feature #2430 TCPairs consensus.diag_required and consensus.diag_min_req (#2439) --- docs/Users_Guide/glossary.rst | 10 ++++++ docs/Users_Guide/wrappers.rst | 6 ++++ .../tc_pairs/test_tc_pairs_wrapper.py | 36 +++++++++++++++---- metplus/wrappers/tc_pairs_wrapper.py | 2 ++ .../TCPairs/TCPairs_extra_tropical.conf | 2 ++ .../TCPairs/TCPairs_tropical.conf | 2 ++ 6 files changed, 52 insertions(+), 6 deletions(-) diff --git a/docs/Users_Guide/glossary.rst b/docs/Users_Guide/glossary.rst index 385a5d4097..671e6cc037 100644 --- a/docs/Users_Guide/glossary.rst +++ b/docs/Users_Guide/glossary.rst @@ -7397,6 +7397,16 @@ METplus Configuration Glossary | *Used by:* TCPairs + TC_PAIRS_CONSENSUS_DIAG_REQUIRED + Specify the value for the nth 'consensus.diag_required' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + + TC_PAIRS_CONSENSUS_DIAG_MIN_REQ + Specify the value for the nth 'consensus.diag_min_req' in the MET configuration file for TCPairs. + + | *Used by:* TCPairs + TC_PAIRS_CONSENSUS_WRITE_MEMBERS Specify the value for the nth 'consensus.write_members' in the MET configuration file for TCPairs. diff --git a/docs/Users_Guide/wrappers.rst b/docs/Users_Guide/wrappers.rst index e6e94d3203..321ca160c6 100644 --- a/docs/Users_Guide/wrappers.rst +++ b/docs/Users_Guide/wrappers.rst @@ -9529,6 +9529,8 @@ METplus Configuration | :term:`TC_PAIRS_CONSENSUS_MEMBERS` | :term:`TC_PAIRS_CONSENSUS_REQUIRED` | :term:`TC_PAIRS_CONSENSUS_MIN_REQ` +| :term:`TC_PAIRS_CONSENSUS_DIAG_REQUIRED` +| :term:`TC_PAIRS_CONSENSUS_DIAG_MIN_REQ` | :term:`TC_PAIRS_CONSENSUS_WRITE_MEMBERS` | :term:`TC_PAIRS_SKIP_LEAD_SEQ` | :term:`TC_PAIRS_RUN_ONCE` @@ -9821,6 +9823,10 @@ ${METPLUS_CONSENSUS_LIST} - consensus.required * - :term:`TC_PAIRS_CONSENSUS_MIN_REQ` - consensus.min_req + * - :term:`TC_PAIRS_CONSENSUS_DIAG_REQUIRED` + - consensus.diag_required + * - :term:`TC_PAIRS_CONSENSUS_DIAG_MIN_REQ` + - consensus.diag_min_req * - :term:`TC_PAIRS_CONSENSUS_WRITE_MEMBERS` - consensus.write_members 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 0edb935b29..c19aa85daa 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 @@ -369,29 +369,41 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides, 'TC_PAIRS_CONSENSUS1_MEMBERS': 'member1a, member1b', 'TC_PAIRS_CONSENSUS1_REQUIRED': 'true, false', 'TC_PAIRS_CONSENSUS1_MIN_REQ': '1', + 'TC_PAIRS_CONSENSUS1_DIAG_REQUIRED': 'false, true', + 'TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ': '2', 'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false',}, {'METPLUS_CONSENSUS_LIST': ( 'consensus = [{name = "name1";members = ["member1a", "member1b"];' - 'required = [true, false];min_req = 1;write_members = FALSE;}];' + 'required = [true, false];min_req = 1;' + 'diag_required = [false, true];diag_min_req = 2;' + 'write_members = FALSE;}];' )}), # 14: consensus 2 dictionaries ('INIT', {'TC_PAIRS_CONSENSUS1_NAME': 'name1', 'TC_PAIRS_CONSENSUS1_MEMBERS': 'member1a, member1b', 'TC_PAIRS_CONSENSUS1_REQUIRED': 'true, false', 'TC_PAIRS_CONSENSUS1_MIN_REQ': '1', + 'TC_PAIRS_CONSENSUS1_DIAG_REQUIRED': 'false, true', + 'TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ': '2', 'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false', 'TC_PAIRS_CONSENSUS2_NAME': 'name2', 'TC_PAIRS_CONSENSUS2_MEMBERS': 'member2a, member2b', 'TC_PAIRS_CONSENSUS2_REQUIRED': 'false, true', 'TC_PAIRS_CONSENSUS2_MIN_REQ': '2', + 'TC_PAIRS_CONSENSUS2_DIAG_REQUIRED': 'true, false', + 'TC_PAIRS_CONSENSUS2_DIAG_MIN_REQ': '3', 'TC_PAIRS_CONSENSUS2_WRITE_MEMBERS': 'true', }, {'METPLUS_CONSENSUS_LIST': ( 'consensus = [' '{name = "name1";members = ["member1a", "member1b"];' - 'required = [true, false];min_req = 1;write_members = FALSE;},' + 'required = [true, false];min_req = 1;' + 'diag_required = [false, true];diag_min_req = 2;' + 'write_members = FALSE;},' '{name = "name2";members = ["member2a", "member2b"];' - 'required = [false, true];min_req = 2;write_members = TRUE;}];' + 'required = [false, true];min_req = 2;' + 'diag_required = [true, false];diag_min_req = 3;' + 'write_members = TRUE;}];' )}), # 15: valid_exc ('INIT', {'TC_PAIRS_VALID_EXCLUDE': '20141031_14'}, @@ -455,29 +467,41 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides, 'TC_PAIRS_CONSENSUS1_MEMBERS': 'member1a, member1b', 'TC_PAIRS_CONSENSUS1_REQUIRED': 'true, false', 'TC_PAIRS_CONSENSUS1_MIN_REQ': '1', + 'TC_PAIRS_CONSENSUS1_DIAG_REQUIRED': 'false, true', + 'TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ': '2', 'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false',}, {'METPLUS_CONSENSUS_LIST': ( 'consensus = [{name = "name1";members = ["member1a", "member1b"];' - 'required = [true, false];min_req = 1;write_members = FALSE;}];' + 'required = [true, false];min_req = 1;' + 'diag_required = [false, true];diag_min_req = 2;' + 'write_members = FALSE;}];' )}), # 35: consensus 2 dictionaries ('VALID', {'TC_PAIRS_CONSENSUS1_NAME': 'name1', 'TC_PAIRS_CONSENSUS1_MEMBERS': 'member1a, member1b', 'TC_PAIRS_CONSENSUS1_REQUIRED': 'true, false', 'TC_PAIRS_CONSENSUS1_MIN_REQ': '1', + 'TC_PAIRS_CONSENSUS1_DIAG_REQUIRED': 'false, true', + 'TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ': '2', 'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false', 'TC_PAIRS_CONSENSUS2_NAME': 'name2', 'TC_PAIRS_CONSENSUS2_MEMBERS': 'member2a, member2b', 'TC_PAIRS_CONSENSUS2_REQUIRED': 'false, true', 'TC_PAIRS_CONSENSUS2_MIN_REQ': '2', + 'TC_PAIRS_CONSENSUS2_DIAG_REQUIRED': 'true, false', + 'TC_PAIRS_CONSENSUS2_DIAG_MIN_REQ': '3', 'TC_PAIRS_CONSENSUS2_WRITE_MEMBERS': 'true', }, {'METPLUS_CONSENSUS_LIST': ( 'consensus = [' '{name = "name1";members = ["member1a", "member1b"];' - 'required = [true, false];min_req = 1;write_members = FALSE;},' + 'required = [true, false];min_req = 1;' + 'diag_required = [false, true];diag_min_req = 2;' + 'write_members = FALSE;},' '{name = "name2";members = ["member2a", "member2b"];' - 'required = [false, true];min_req = 2;write_members = TRUE;}];' + 'required = [false, true];min_req = 2;' + 'diag_required = [true, false];diag_min_req = 3;' + 'write_members = TRUE;}];' )}), # 36: valid_exc ('VALID', {'TC_PAIRS_VALID_EXCLUDE': '20141031_14'}, diff --git a/metplus/wrappers/tc_pairs_wrapper.py b/metplus/wrappers/tc_pairs_wrapper.py index 6df53af8f0..f1b726e3f7 100755 --- a/metplus/wrappers/tc_pairs_wrapper.py +++ b/metplus/wrappers/tc_pairs_wrapper.py @@ -411,6 +411,8 @@ def _handle_consensus(self): 'members': 'list', 'required': ('list', 'remove_quotes'), 'min_req': 'int', + 'diag_required': ('list', 'remove_quotes'), + 'diag_min_req': 'int', 'write_members': 'bool', } return_code = add_met_config_dict_list(config=self.config, 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 e2db247609..e5a0bcf1eb 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 @@ -103,6 +103,8 @@ TC_PAIRS_MISSING_VAL = -9999 #TC_PAIRS_CONSENSUS1_MEMBERS = #TC_PAIRS_CONSENSUS1_REQUIRED = #TC_PAIRS_CONSENSUS1_MIN_REQ = +#TC_PAIRS_CONSENSUS1_DIAG_REQUIRED = +#TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ = #TC_PAIRS_CONSENSUS1_WRITE_MEMBERS = #TC_PAIRS_CHECK_DUP = 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 2df99931c2..e68b5d45f3 100644 --- a/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf +++ b/parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf @@ -96,6 +96,8 @@ TC_PAIRS_DLAND_FILE = MET_BASE/tc_data/dland_global_tenth_degree.nc #TC_PAIRS_CONSENSUS1_MEMBERS = #TC_PAIRS_CONSENSUS1_REQUIRED = #TC_PAIRS_CONSENSUS1_MIN_REQ = +#TC_PAIRS_CONSENSUS1_DIAG_REQUIRED = +#TC_PAIRS_CONSENSUS1_DIAG_MIN_REQ = #TC_PAIRS_CONSENSUS1_WRITE_MEMBERS = #TC_PAIRS_CHECK_DUP =