Skip to content

Commit

Permalink
consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostBuitink committed Mar 4, 2025
1 parent efd5c8c commit a2ba8bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5016,7 +5016,7 @@ def rivers(self):

## WFLOW specific modification (clip for now) methods

def clip_grid(self, region, buffer=0, align=None, crs=4326, reverse_clip=False):
def clip_grid(self, region, buffer=0, align=None, crs=4326, inverse_clip=False):
"""Clip grid to subbasin.
Parameters
Expand All @@ -5029,8 +5029,8 @@ def clip_grid(self, region, buffer=0, align=None, crs=4326, reverse_clip=False):
Align bounds of region to raster with resolution <align>, by default None
crs: int, optional
Default crs of the grid to clip.
reverse_clip: bool, optional
Flag to perform "reverse clipping": removing an upstream part of the model
inverse_clip: bool, optional
Flag to perform "inverse clipping": removing an upstream part of the model
instead of the subbasin itself, by default False
Returns
Expand Down Expand Up @@ -5058,7 +5058,7 @@ def clip_grid(self, region, buffer=0, align=None, crs=4326, reverse_clip=False):
**region,
)
# Remove upstream part from model
if reverse_clip:
if inverse_clip:
geom = self.basins.overlay(geom, how="difference")
# clip based on subbasin args, geom or bbox
if geom is not None:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_model_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def test_model_inverse_clip(tmpdir, example_wflow_model):
example_wflow_model.read()
# Get number of active pixels from full model
n_pixels_full = example_wflow_model.grid["wflow_subcatch"].sum()
example_wflow_model.clip_grid(region, reverse_clip=True)
example_wflow_model.clip_grid(region, inverse_clip=True)
# Get number of active pixels from inversely clipped model
n_pixels_inverse_clipped = example_wflow_model.grid["wflow_subcatch"].sum()

# Do clipping again, but normally
example_wflow_model.read()
example_wflow_model.clip_grid(region, reverse_clip=False)
example_wflow_model.clip_grid(region, inverse_clip=False)
# Get number of active pixels from clipped model
n_pixels_clipped = example_wflow_model.grid["wflow_subcatch"].sum()

Expand Down

0 comments on commit a2ba8bd

Please sign in to comment.