Skip to content

Commit

Permalink
updated write_geoms method to check if region is available (#389)
Browse files Browse the repository at this point in the history
added part to check if region is available
  • Loading branch information
panosatha authored Oct 4, 2024
1 parent f6932b3 commit eb074e5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,13 +1328,14 @@ def write_geoms(self):
fn.format(name=name),
)
# At the very last clip based on the region
idx = gpd.sjoin(
self.region.to_crs(geom.crs),
geom,
predicate="contains_properly",
how="inner",
).index_right
geom = geom.loc[idx]
if not self.region.empty:
idx = gpd.sjoin(
self.region.to_crs(geom.crs),
geom,
predicate="contains_properly",
how="inner",
).index_right
geom = geom.loc[idx]
geom.to_file(_fn)

if self.geoms:
Expand Down

0 comments on commit eb074e5

Please sign in to comment.