Skip to content

Commit

Permalink
Update access to centroids dist coast in gdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Chahan Kropf committed Nov 23, 2023
1 parent 847736b commit 756c587
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions climada/hazard/trop_cyclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def from_tracks(
coastal_idx = (np.abs(centroids.lat) <= max_latitude).nonzero()[0]
else:
# Select centroids which are inside max_dist_inland_km and lat <= max_latitude
if not centroids.dist_coast.size:
centroids.set_dist_coast()
coastal_idx = ((centroids.dist_coast <= max_dist_inland_km * 1000)
if 'dist_coast' not in centroids.gdf:
centroids.gdf['dist_coast'] = centroids.get_dist_coast()
coastal_idx = ((centroids.gdf.dist_coast.values <= max_dist_inland_km * 1000)
& (np.abs(centroids.lat) <= max_latitude)).nonzero()[0]

# Filter early with a larger threshold, but inaccurate (lat/lon) distances.
Expand Down

0 comments on commit 756c587

Please sign in to comment.