Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Issue #1437 fix recharge from imod5 cap data 2d #1448

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

Merged

Conversation

JoerivanEngelen
Copy link
Contributor

Fixes #1437

Description

primod expects a 2D rate array or single layer array for the dummy MODFLOW6 package, as otherwise the squeeze("layer") it does returns an error. I think the safest for iMOD Python is to return a 2D array with extra layer coordinate. I added some extra tests to test if this RCH package could be clipped and regridded, as in most/all fixtures for clipping/regridding I added packages with layer dimension. Luckily these two extra tests turned out to be mostly for my own peace of mind, as they ran without problems.

Checklist

  • Links to correct issue
  • Update changelog, if changes affect users
  • PR title starts with Issue #nr, e.g. Issue #737
  • Unit tests were added
  • If feature added: Added/extended example

assert np.isnan(rate[:, -1]).all()
assert np.isnan(rate[0, :]).all()
assert np.isnan(rate[-1, :]).all()
assert np.isnan(rate[100, 100]).all()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this one already tested by rate[-1, :] and rate[:, -1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the grid is size 184, 184. So this is a central cell where areas have been set in such a way the cell needs to be deactivated. I set this more explicit now in the test by computing a midpoint cell and assigning values to that.

assert np.isnan(rate[0, 0, :]).all()
assert np.isnan(rate[0, -1, :]).all()
assert np.isnan(rate[:, 100, 100]).all()
assert np.isnan(rate[:, 0]).all()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happend to the extra dimension? Are we using a disv grid now? Or did you drop a coordinate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did drop the dimension, only the coordinate label is preserved. That reminds me: probably good to test for that as well!

Copy link
Contributor Author

@JoerivanEngelen JoerivanEngelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just updated the test you had two comments on, this should avoid any further confusion.

assert np.isnan(rate[0, 0, :]).all()
assert np.isnan(rate[0, -1, :]).all()
assert np.isnan(rate[:, 100, 100]).all()
assert np.isnan(rate[:, 0]).all()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did drop the dimension, only the coordinate label is preserved. That reminds me: probably good to test for that as well!

assert np.isnan(rate[:, -1]).all()
assert np.isnan(rate[0, :]).all()
assert np.isnan(rate[-1, :]).all()
assert np.isnan(rate[100, 100]).all()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the grid is size 184, 184. So this is a central cell where areas have been set in such a way the cell needs to be deactivated. I set this more explicit now in the test by computing a midpoint cell and assigning values to that.

Copy link

@JoerivanEngelen JoerivanEngelen added this pull request to the merge queue Feb 25, 2025
Merged via the queue into master with commit b537f7f Feb 25, 2025
7 checks passed
@JoerivanEngelen JoerivanEngelen deleted the issue_#1437_fix_Recharge_from_imod5_cap_data_2d branch February 25, 2025 12:02
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

Successfully merging this pull request may close these issues.

[Bug] - Recharge.from_imod5_cap_data creates a 3D array, but primod expects a 2D array.
2 participants