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

Skip to content

Issue #1462 move clip utilities #1464

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
merged 7 commits into from
Feb 27, 2025

Conversation

JoerivanEngelen
Copy link
Contributor

@JoerivanEngelen JoerivanEngelen commented Feb 27, 2025

Fixes #1462

Description

  • Moves clip utilities from imod.mf6.utilities to imod.common.utilities
  • Moves hfb utilities from imod.mf6.utilities to imod.common.utilities
  • Moves grid utilities from imod.mf6.utilities to imod.common.utilities
  • Move temporary removal and setting again of auxiliary variables (a MODFLOW6 affair) to the imod.mf6.Package.regrid_like method.
  • Fix Sonarcloud issue: np.where(active > 0) == np.nonzero(active > 0), the latter is more explicit.

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

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 a mf6 specific utility? Or is it also needed for msw? or something else?
If it is mf6 only then i think you can better leave it in the mf6.utilitlies module

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, renamed to imod/common/utilities/line_data.py also renamed some of the methods to have less confusing names.

@@ -624,7 +626,11 @@ def regrid_like(
similar to the one used in input argument "target_grid"
"""
try:
if hasattr(self, "auxiliary_data_fields"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm this is also something that can be cleaned up using interfaces. In the future we ma y introduce an IAuxiliaryData interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might be a possiblity, I'm not sure as it would be a very MODFLOW6 specific interface.

Other idea, somewhat relevant to your remark: What would reduce code complexity somewhat and be nice here is creating a decorator which removes auxiliary fields before calling a function and then adds them again. Still a bit on the fence, as I find decorators harder to debug.

Copy link

@JoerivanEngelen JoerivanEngelen merged commit 739dd8c into master Feb 27, 2025
5 of 7 checks passed
@JoerivanEngelen JoerivanEngelen deleted the issue_#1462_move_clip_utilities branch February 27, 2025 12:21
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.

Move clip from imod.mf6.utilities to imod.common.utilities
2 participants