Skip to content

Commit

Permalink
Storm name match 2 (#95)
Browse files Browse the repository at this point in the history
* Fix name matching logic

* Style fix

Ignoring automated test (ran locally) due to tests getting stuck!
  • Loading branch information
SorooshMani-NOAA authored Mar 14, 2024
1 parent 9d93366 commit e9e1ae2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stormevents/nhc/atcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_atcf_entry(
if storm_number is not None:
storms = storms[storms["number"] == storm_number]
if storm_name is not None:
storms = storms[storms["name"].str.contains(storm_name.upper())]
storms = storms[storms["name"].str.fullmatch(storm_name.upper())]

if len(storms) > 0:
storms["name"] = storms["name"].str.strip()
Expand Down
3 changes: 3 additions & 0 deletions tests/test_atcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ def test_atcf_entry():
with pytest.raises(ValueError):
get_atcf_entry(year=2018, basin="EP", storm_number=99)

assert get_atcf_entry(year=2020, storm_name="BETA")["name"] == "BETA"
assert get_atcf_entry(year=2020, storm_name="ETA")["name"] == "ETA"

assert storm_1["name"] == "FLORENCE"
assert storm_2["basin"] == "AL" and storm_2["number"] == 6

0 comments on commit e9e1ae2

Please sign in to comment.