-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #1465 Move mask
to common utilities
#1466
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
Issue #1465 Move mask
to common utilities
#1466
Conversation
… statements, as these checks are already done in the utility functions
@@ -575,8 +575,11 @@ def mask(self, mask: GridDataArray) -> Any: | |||
masked: Package | |||
The package with part masked. | |||
""" | |||
|
|||
return mask_package(self, mask) | |||
result = cast(IPackage, deepcopy(self)) |
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.
Is this cast necessary?
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 otherwise get this error message:
imod\mf6\package.py:580: error: Incompatible types in assignment (expression has type "IPackage", variable has type "Package")
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 tried fixing it, but gave up after an hour, in my search found this interesting post which could clean up interfaces a bit https://levelup.gitconnected.com/python-interfaces-choose-protocols-over-abc-3982e112342e but using Protocols didn't resolve the problem.
remove_expanded_auxiliary_variables_from_dataset(result) | ||
result = mask_package(result, mask) | ||
expand_transient_auxiliary_variables(result) | ||
return result |
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.
What is the return type? IPackage? Package? The type hint is any. We can be more specific
|
Fixes #1465
Description
mask
utilities to common utilities.Package.mask
and refactor itimod.mf6.utilities.dataset.py
toimod.common.utilities.value_filters.py
Checklist
Issue #nr
, e.g.Issue #737