Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from_nhc_code bug for same-year events with the same name #78

Open
SorooshMani-NOAA opened this issue Apr 24, 2023 · 2 comments
Open

from_nhc_code bug for same-year events with the same name #78

SorooshMani-NOAA opened this issue Apr 24, 2023 · 2 comments

Comments

@SorooshMani-NOAA
Copy link
Collaborator

Try:

storm = stormevents.StormEvent.from_nhc_code('EP182022')

Now if you inspect the storm, it's actually picking Julia from AL basin! That's because of search-by-name done in the constructor and then picking the "first" occurrence of the name in the list:

storms = nhc_storms(year=year)
storms = storms[storms["name"].str.contains(name.upper())]
if len(storms) > 0:
self.__entry = storms.iloc[0]

Looking at the storms list from 2022:

           name class  year basin  number       source start_date            end_date
nhc_code
.
.
.
AL132022  JULIA    HU  2022    AL      13  GIS_ARCHIVE        NaT                 NaT
.
.
.
EP182022  JULIA    HU  2022    EP      18              2022-10-02 2022-10-10 18:00:00
.
.
.
@SorooshMani-NOAA SorooshMani-NOAA changed the title When event names are shared (e.g. between AL and EP) from_nhc_code might run into issue from_nhc_code bug for same-year events with the same name Apr 24, 2023
@SorooshMani-NOAA
Copy link
Collaborator Author

We need to re-enable the test for status of storm after fixing this ticket. The commented out test that was failing is:

# TODO: fails due to issue #78
# How could it pass before in early 2023?!
# storms = nhc_storms()
# latest_storm_entry = storms[
# ((storms["class"] == "HU") | (storms["class"] == "TS"))
# & (storms["number"] < 60)
# ].iloc[-1]
# latest_storm = StormEvent.from_nhc_code(latest_storm_entry.name)
# age = datetime.today() - latest_storm_entry["end_date"]
# if pandas.isna(latest_storm_entry["end_date"]) or age < timedelta(days=1):
# if datetime.today() - latest_storm_entry["start_date"] > timedelta(days=30):
# assert latest_storm.status == StormStatus.HISTORICAL
# else:
# assert latest_storm.status == StormStatus.REALTIME
# else:
# assert latest_storm.status == StormStatus.HISTORICAL

This issue started showing up in April 2023 during #79 for Hurricane Julia (latest 2022 HU storm)

@zacharyburnett
Copy link
Collaborator

Ah, that's a blunder 😅 I forgot to account for two storms with the same name in the same year in different basins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants