Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy_bathymetry fills channels when fill_channels=False #194

Open
aekiss opened this issue Oct 22, 2024 · 0 comments
Open

tidy_bathymetry fills channels when fill_channels=False #194

aekiss opened this issue Oct 22, 2024 · 0 comments

Comments

@aekiss
Copy link
Contributor

aekiss commented Oct 22, 2024

Looks like some repeated code here. Should lines 1376-1382 be removed? Otherwise tidy_bathymetry fills horizontal and vertical (but not diagonal) channels when fill_channels is false.

## Now fill in all one-cell-wide channels
newmask = xr.where(
ocean_mask * (land_mask.shift(nx=1) + land_mask.shift(nx=-1)) == 2, 1, 0
)
newmask += xr.where(
ocean_mask * (land_mask.shift(ny=1) + land_mask.shift(ny=-1)) == 2, 1, 0
)
if fill_channels == True:
## fill in all one-cell-wide horizontal channels
newmask = xr.where(
ocean_mask * (land_mask.shift(nx=1) + land_mask.shift(nx=-1)) == 2,
1,
0,
)
newmask += xr.where(
ocean_mask * (land_mask.shift(ny=1) + land_mask.shift(ny=-1)) == 2,
1,
0,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant