Skip to content

Commit

Permalink
per #2054, add support for setting consensus.write_members in TCPairs…
Browse files Browse the repository at this point in the history
… wrapper
  • Loading branch information
georgemccabe committed Feb 22, 2023
1 parent 63405c6 commit 12aae83
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7613,6 +7613,11 @@ METplus Configuration Glossary

| *Used by:* TCPairs
TC_PAIRS_CONSENSUS<n>_WRITE_MEMBERS
Specify the value for the nth 'consensus.write_members' in the MET configuration file for TCPairs.

| *Used by:* TCPairs
FCST_SERIES_ANALYSIS_PROB_THRESH
Threshold values to be used for probabilistic data in series_analysis. The value can be a single item or a comma separated list of items that must start with a comparison operator (>,>=,==,!=,<,<=,gt,ge,eq,ne,lt,le).

Expand Down
4 changes: 4 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8314,6 +8314,7 @@ METplus Configuration
| :term:`TC_PAIRS_CONSENSUS<n>_MEMBERS`
| :term:`TC_PAIRS_CONSENSUS<n>_REQUIRED`
| :term:`TC_PAIRS_CONSENSUS<n>_MIN_REQ`
| :term:`TC_PAIRS_CONSENSUS<n>_WRITE_MEMBERS`
| :term:`TC_PAIRS_SKIP_LEAD_SEQ`
| :term:`TC_PAIRS_RUN_ONCE`
| :term:`TC_PAIRS_CHECK_DUP`
Expand Down Expand Up @@ -8589,6 +8590,9 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
- consensus.required
* - :term:`TC_PAIRS_CONSENSUS<n>_MIN_REQ`
- consensus.min_req
* - :term:`TC_PAIRS_CONSENSUS<n>_WRITE_MEMBERS`
- consensus.write_members


**${METPLUS_CHECK_DUP}**

Expand Down
26 changes: 16 additions & 10 deletions internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,27 +338,30 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides,
('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_MIN_REQ': '1',
'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false',},
{'METPLUS_CONSENSUS_LIST': (
'consensus = [{name = "name1";members = ["member1a", "member1b"];'
'required = [true, false];min_req = 1;}];'
'required = [true, false];min_req = 1;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_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_MIN_REQ': '2',
'TC_PAIRS_CONSENSUS2_WRITE_MEMBERS': 'true',
},
{'METPLUS_CONSENSUS_LIST': (
'consensus = ['
'{name = "name1";members = ["member1a", "member1b"];'
'required = [true, false];min_req = 1;},'
'required = [true, false];min_req = 1;write_members = FALSE;},'
'{name = "name2";members = ["member2a", "member2b"];'
'required = [false, true];min_req = 2;}];'
'required = [false, true];min_req = 2;write_members = TRUE;}];'
)}),
# 15: valid_exc
('INIT', {'TC_PAIRS_VALID_EXCLUDE': '20141031_14'},
Expand Down Expand Up @@ -421,27 +424,30 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides,
('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_MIN_REQ': '1',
'TC_PAIRS_CONSENSUS1_WRITE_MEMBERS': 'false',},
{'METPLUS_CONSENSUS_LIST': (
'consensus = [{name = "name1";members = ["member1a", "member1b"];'
'required = [true, false];min_req = 1;}];'
'required = [true, false];min_req = 1;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_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_MIN_REQ': '2',
'TC_PAIRS_CONSENSUS2_WRITE_MEMBERS': 'true',
},
{'METPLUS_CONSENSUS_LIST': (
'consensus = ['
'{name = "name1";members = ["member1a", "member1b"];'
'required = [true, false];min_req = 1;},'
'required = [true, false];min_req = 1;write_members = FALSE;},'
'{name = "name2";members = ["member2a", "member2b"];'
'required = [false, true];min_req = 2;}];'
'required = [false, true];min_req = 2;write_members = TRUE;}];'
)}),
# 36: valid_exc
('VALID', {'TC_PAIRS_VALID_EXCLUDE': '20141031_14'},
Expand Down
2 changes: 1 addition & 1 deletion metplus/util/doc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def print_doc_text(tool_name, input_dict):

print("---------------------------------------------")
print('\n==================================================\n')
print(f"In internal/tests/pytests/{tool_name}/"
print(f"In internal/tests/pytests/wrappers/{tool_name}/"
f"test_{tool_name}_wrapper.py"
"\n\nAdd the following items to "
"the tests to ensure the new items are set properly. Note: "
Expand Down
1 change: 1 addition & 0 deletions metplus/wrappers/tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def _handle_consensus(self):
'members': 'list',
'required': ('list', 'remove_quotes'),
'min_req': 'int',
'write_members': 'bool',
}
return_code = add_met_config_dict_list(config=self.config,
app_name=self.app_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ TC_PAIRS_MISSING_VAL = -9999
#TC_PAIRS_CONSENSUS1_MEMBERS =
#TC_PAIRS_CONSENSUS1_REQUIRED =
#TC_PAIRS_CONSENSUS1_MIN_REQ =
#TC_PAIRS_CONSENSUS1_WRITE_MEMBERS =

#TC_PAIRS_CHECK_DUP =

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ 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_WRITE_MEMBERS =

#TC_PAIRS_CHECK_DUP =

Expand Down

0 comments on commit 12aae83

Please sign in to comment.