Skip to content

Bugfix/leadtime multilandfall #94

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions stormworkflow/prep/hurricane_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,21 @@ def trackstart_from_file(
return None

leadtime_dict = pd.read_json(leadtime_file, orient='index')
# Sort table by landfall time
leadtime_table = leadtime_dict.drop(columns='leadtime').merge(
leadtime_dict.leadtime.apply(
lambda x: pd.Series({v: k for k, v in x.items()})
).apply(pd.to_datetime, format='%Y%m%d%H'),
left_index=True,
right_index=True
).set_index('ALnumber')
).set_index('ALnumber').sort_values([0])

if nhc_code.lower() not in leadtime_table.index:
return None

storm_all_times = leadtime_table.loc[[nhc_code.lower()]].dropna()
if len(storm_all_times) > 1:
storm_all_times = storm_all_times.iloc[0]
storm_all_times = storm_all_times.iloc[[0]]
if leadtime not in storm_all_times:
return None

Expand Down