Issue #1823 regrid imod5 cap data#1824
Merged
JoerivanEngelen merged 20 commits intomasterfrom Apr 30, 2026
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
… The preservation of the dtype has the advantage that it allows treating it as a DataArray for masking.
Co-authored-by: Copilot <copilot@github.com>
Manangka
approved these changes
Apr 29, 2026
| def regrid_imod5_data( | ||
| imod5_data: Imod5DataDict, | ||
| target_dis: StructuredDiscretization, | ||
| regridder_types: Optional[CapDataRegridMethod] = None, |
Collaborator
There was a problem hiding this comment.
Instead of this being optional you can assign it a default value of CapDataRegridMethod(). That way you can remove the if None statement at line 147
Contributor
Author
There was a problem hiding this comment.
Yes, I did it this way to keep things consistent with how regridder_types are provided in the mf6 module. Looking at the mf6 module, I think there with the current setup it is the best way to do things, but here it isn't really necessary. I'll provide the default value of CapDataRegridMethod() to MetaSwapModel.from_imod5_data.
…lue. Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #1823
Description
Regrid iMOD5 CAP data immediately to MODFLOW6 discretization in
MetaSwapModel.from_imod5_data. I'm doing this regridding prior to calling the individualfrom_imod5_datamethods of each MetaSwap package as we can then be sure that all grids in the iMOD5 CAP data are on to the right grid (which is not necessarily the case with the data in projectfile), before other grid operations likeget_cell_area_from_imod5_dataare done. Furthermore, the keys in the CAP data differ from the variable names in packages.This differs slightly from the approach in the MODFLOW6 module, where regridding is done in
Package.from_imod5_data.Fixes the following:
_regrid_arrayreturn a DataArray without any dimensions instead of a numpy array if_scalar is True, this is consistent with the type annotation, and has the advantage that these scalars can be broadcasted without having to do additional type conversions in the masking operation later.Checklist
Issue #nr, e.g.Issue #737pixi run generate-sbomand committed changes