-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #1525 repeat stress args #1544
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
@@ -71,6 +71,10 @@ class BoundaryCondition(Package, abc.ABC): | |||
""" | |||
|
|||
def __init__(self, allargs: Mapping[str, GridDataArray | float | int | bool | str]): | |||
if "repeat_stress" in allargs.keys() and isinstance( |
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.
Why does this have to be called before the base constructor?
Can't we do the same as we do for concentration?
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.
No unfortunately not, the repeat_stress
data has to be converted from a dict to a xr.DataArray
of the right shape, before it can be merged to a xr.Dataset
.
The "concentration" logic is more concise if we do it after the call to super().__init__()
: The call expand_transient_auxiliary_variables(self)
HAS to be done after super.__init__()
. The deletion of variables could also be moved before the merge to a dataset, but that would require two if statements just for the concentration, hence why I moved everything after super.__init__()
.
I added some comments in the code to explain this.
imod/tests/test_mf6/test_mf6_riv.py
Outdated
np.datetime64("2000-01-03"), | ||
np.datetime64("2000-01-04"), | ||
] | ||
time_da = xr.DataArray([1, 2], dims=["time"], coords={"time": globaltimes[:2]}) |
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 does [1, 2] mean?
Could you assign it to a variable before using it?
meaningful_name = [1, 2]
time_da = xr.DataArray(meaningful_name , dims=["time"], coords={"time": globaltimes[:2]})
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've given it a more meaningful name and data: Now as seasonal factors, that better represents how repeat_stresses are used in practice: To set seasonal boundary conditions, in this case a summer and winter stage.
|
Fixes #1525
Description
Add support to directly provide repeat_stresses as dictionary. As issue states: Simplifies API for users a lot, as they don't need to search for the obscure utility function
get_period_stess
.Checklist
Issue #nr
, e.g.Issue #737