Skip to content

Commit

Permalink
Feature/seperate front end back end (#4)
Browse files Browse the repository at this point in the history
* Seperate callback_functions

* Move callback and yml to flood_adapt_gui and add comments

* Fix Ruff

* turn rainfall on

* small change to correctly read in .cyc files

* added list_names function to cyclone_track_database.py

* black

---------

Co-authored-by: Daley Adrichem <Daley.Adrichem@deltares.nl>
Co-authored-by: tim-d-w <tim.dewilde@deltares.nl>
Co-authored-by: maartenvanormondt <maarten.vanormondt@deltares.nl>
  • Loading branch information
4 people committed Sep 27, 2023
1 parent 27e4d95 commit 95c4ac5
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 95c4ac5

Please sign in to comment.