-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Make iMOD Coupler compatible with iMOD Python 0.18.0: * Use Mf6Wel object instead of WellDisStructuredDis * Provide WEL at write instead of at init. * Derive Mf6Wel package from coupler dict * Drop unused "layer" coord that was causing trouble * Set fill value to -1 for rasterio >=1.3.10 * Set dtype explicitly after imod-python update. Otherwise defaults to using the dtype of like, which is an integer. This causes problem for the fill value "nan" which the ribamod coupling depends on. * Use special method to get diskey, for future support of unstructured grids * Make sprinkling optional and improve function name. * Add unittest for get_mf6_pkgs_with_coupling_dict * Update remove sprinkling function, as initialization of Coupling object is not necessary anymore. * Add pandera dependency * Use python-build instead of build, as build-feedstock has been archived * Force pandas > 2.0, otherwise ribasim-test-models doesn't work * fix mypy error: unused type: ignore comment * Cast to geodataframe to work around mypy error.
- Loading branch information
1 parent
640055d
commit 18b1020
Showing
17 changed files
with
6,307 additions
and
3,188 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Module containing mixins for specific kernels, for example MODFLOW.""" | ||
|
||
from imod.mf6 import Modflow6Simulation, StructuredDiscretization | ||
from imod.mf6.mf6_wel_adapter import Mf6Wel | ||
|
||
|
||
class MetaModMixin: | ||
"""MetaSWAP-Modflow coupling specific methods.""" | ||
|
||
@staticmethod | ||
def get_mf6_pkgs_for_metaswap( | ||
coupling_dict: dict[str, str], mf6_simulation: Modflow6Simulation | ||
) -> tuple[StructuredDiscretization, Mf6Wel | None]: | ||
""" | ||
Get names of DIS and possibly WEL packages from coupling_dict then fetch | ||
these MODFLOW 6 packages from simulation. | ||
""" | ||
mf6_model_key = coupling_dict["mf6_model"] | ||
gwf_model = mf6_simulation[mf6_model_key] | ||
mf6_dis_key = gwf_model._get_diskey() | ||
mf6_dis_pkg = gwf_model[mf6_dis_key] | ||
|
||
mf6_wel_pkg = None | ||
if "mf6_msw_well_pkg" in coupling_dict.keys(): | ||
mf6_well_key = coupling_dict["mf6_msw_well_pkg"] | ||
mf6_wel_pkg = gwf_model.prepare_wel_for_mf6(mf6_well_key, True, True) | ||
return mf6_dis_pkg, mf6_wel_pkg |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.