-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #442 clipping msw pkg #1476
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
Conversation
imod/common/utilities/clip.py
Outdated
|
||
# If the first time matches exactly, xarray will have done thing we | ||
# wanted and our work with the time dimension is finished. | ||
if (time_start is not None) and (time_start != first_time): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reverse this if statement to return immediately. This avoid having to need a nested if statement. It also makes it clear that the part in the if statement is additional work
if (time_start is None) or (time_start == first_time):
# xarray has done the what we wanted
return
# More work is needed
...
x_max=x_max, | ||
y_min=y_min, | ||
y_max=y_max, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you cleaned up this method. Really easy to read!
|
Fixes #442 and #542
Description
@HendrikKok asked me to clip a model for him to send it to Wageningen and I thought this would be a trivial exercise, only I realized we still lacked MetaSWAP clipping support. I noticed this was low-hanging fruit, so instead of writing some special one-off script, I thought I might as well add it to iMOD Python immediately.
This PR:
imod.mf6.Package.clip_box
toimod.common.utilities.clip
module.test_common/test_utilities
test_common.py
totest_prepare/test_common.py
Checklist
Issue #nr
, e.g.Issue #737