Skip to content

Commit

Permalink
Corrections regarding WARNING versus ERROR confusion in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Apr 18, 2024
1 parent 86fbaf6 commit ad40afa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions python/ctsm/site_and_regional/single_point_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ def check_dom_pft(self):
- 0 - NAT_PFT-1 range
or
- NAT_PFT - MAX_PFT range
- give a warning: mixed land units should be checked
- give an error: mixed land units not possible
-------------
Raises:
Error (ArgumentTypeError):
If any dom_pft is bigger than MAX_PFT.
Error (ArgumentTypeError):
If any dom_pft is less than 1.
Warning:
Error (ArgumentTypeError):
If mixed land units are chosen.
dom_pft values are both in range of (0 - NAT_PFT-1) and (NAT_PFT - MAX_PFT).
Expand Down Expand Up @@ -214,14 +214,12 @@ def check_dom_pft(self):
logger.info(
"WARNING, you trying to run with generic crops (16 PFT surface dataset)"
)
# raise argparse.ArgumentTypeError(err_msg)

# -- check if all dom_pft are in the same range:
if min_dom_pft < NAT_PFT <= max_dom_pft:
err_msg = (
"WARNING, you are subsetting using mixed land "
"units that have both natural pfts and crop cfts. Check "
"your surface dataset."
"You are subsetting using mixed land units that have both "
"natural pfts and crop cfts. Check your surface dataset. "
)
raise argparse.ArgumentTypeError(err_msg)

Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/test/test_unit_singlept_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_check_dom_pft_mixed_range(self):
single_point.dom_pft = [1, 5, 15]
single_point.num_pft = 78
with self.assertRaisesRegex(
argparse.ArgumentTypeError, "WARNING, you are subsetting using mixed land*"
argparse.ArgumentTypeError, "You are subsetting using mixed land*"
):
single_point.check_dom_pft()

Expand Down

0 comments on commit ad40afa

Please sign in to comment.