Skip to content

Commit

Permalink
Minor tweaks and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mandli committed Jun 3, 2024
1 parent 4579554 commit 860ba23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/python/geoclaw/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,9 @@ class SurgeData(clawpack.clawutil.data.ClawData):
'rankine': 5,
'modified-rankine': 6,
'DeMaria': 7
'willoughby': 9,
}
storm_spec_not_implemented = ['CLE']
storm_spec_not_implemented = ['CLE', 'willoughby']

def __init__(self):
super(SurgeData,self).__init__()
Expand Down
28 changes: 15 additions & 13 deletions src/python/geoclaw/surge/storm.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
TCVitals_Basins = {"L": "North Atlantic",
"E": "North East Pacific",
"C": "North Central Pacific",
"W": "North West Pacific",
"B": "Bay of Bengal (North Indian Ocean)",
"A": "Arabian Sea (North Indian Ocean)",
"Q": "South Atlantic",
"P": "South Pacific",
"S": "South Indian Ocean"}
"W": "North West Pacific",
"B": "Bay of Bengal (North Indian Ocean)",
"A": "Arabian Sea (North Indian Ocean)",
"Q": "South Atlantic",
"P": "South Pacific",
"S": "South Indian Ocean"}

# Tropical Cyclone Designations
# see https://www.nrlmry.navy.mil/atcf_web/docs/database/new/abrdeck.html
Expand Down Expand Up @@ -209,10 +209,12 @@ def __init__(self, path=None, file_format="ATCF", **kwargs):
# Basic object support
def __str__(self):
r""""""
output = "Name: %s" % self.name
output = "\n".join((output, "Dates: %s - %s" % (self.t[0].isoformat(),
self.t[-1].isoformat())
))
output = f"Name: {self.name}\n"
if isinstance(self.t[0], datetime.datetime):
output += f"Dates: {self.t[0].isoformat()}"
output += f" - {self.t[-1].isoformat()}"
else:
output += f"Dates: {self.t[0]} - {self.t[-1]}"
return output

def __repr__(self):
Expand Down Expand Up @@ -379,7 +381,7 @@ def num_converter(x):
for c in ["LAT", "LON", "VMAX", "MSLP", "ROUTER", "RMW",
"RAD", "RAD1", "RAD2", "RAD3", "RAD4"]:
df[c] = df[c].where(df[c] != 0, np.nan) # value 0 means NaN
df[c] = df.groupby("DATE")[c].bfill()
df[c] = df.groupby("DATE")[c].fillna(methos="bfill")
df = df.groupby("DATE").first()

# Wind profile (occasionally missing for older ATCF storms)
Expand Down Expand Up @@ -904,9 +906,9 @@ def write_geoclaw(self, path, force=False, skip=True, verbose=False,
fill_dict.update({"storm_radius": lambda t, storm: 500e3})
# Handle older interface that had specific fill functions
if "max_wind_radius_fill" in kwargs.keys():
fill_dict.update({"max_wind_radius": max_wind_radius_fill})
fill_dict.update({"max_wind_radius": kwargs['max_wind_radius_fill']})
if "storm_radius_fill" in kwargs.keys():
fill_dict.update({"storm_radius": storm_radius_fill})
fill_dict.update({"storm_radius": kwargs['storm_radius_fill']})

# Loop through each line of data and if the line is valid, perform the
# necessary work to write it out. Otherwise either raise an exception
Expand Down

0 comments on commit 860ba23

Please sign in to comment.