Skip to content

Commit

Permalink
added list_names function to cyclone_track_database.py
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanormondt committed Sep 25, 2023
1 parent 719e35b commit 6edbd7e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cht_cyclones/cyclone_track_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ def get_track(self, index):

return tc

def list_names(self, index=None):
if index is not None:
return [self.name[i] for i in index]
else:
return self.name

def to_gdf(self, index=None):
"""
Returns a geopandas dataframe of the tracks.
Expand Down Expand Up @@ -254,6 +260,8 @@ def filter(
year=None,
year_min=None,
year_max=None,
vmax_min=None,
vmax_max=None,
):
"""
Filter the database and return the indices of the filtered tracks.
Expand Down Expand Up @@ -293,6 +301,11 @@ def filter(
if not year_max:
year_max = 9999

if not vmax_min:
vmax_min = 0.0
if not vmax_max:
vmax_max = 9999.0

# Filter by basin
if basin:
ibasin = np.array(
Expand All @@ -311,6 +324,12 @@ def filter(
else:
iyear = np.arange(0, self.nstorms)

# # Filter by vmax
# if vmax_min and vmax_max:
# ivmax = np.where((self.year >= year_min) & (self.year <= year_max))[0]
# else:
# iyear = np.arange(0, self.nstorms)

# Filter by name
if name:
iname = np.array(
Expand Down

0 comments on commit 6edbd7e

Please sign in to comment.