Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
16 stars 0 forks source link

Issue #960 regrid method refactor #1054

Closed JoerivanEngelen closed 1 month ago

JoerivanEngelen commented 1 month ago

Fixes #960 and #1000

Description

Adds regrid schemes which replaces the dictionaries under _regrid_method with pydantic dataclasses. Pydantic comes with input validation base on type annotation, so requires no extra code. See documentation here This requires pydantic as extra dependency, so is added as dependency.

I kept _regrid_method as a class variable, as it gave problems as an attribute with imod.mf6.Package.from_file classmethod, where attributes are not forwarded.

I created a new namespace: imod.mf6.regrid where we can store all Regridding related stuff. Probably good to move other public API there as well later on, namely the imod.mf6.utilities.regridder_types.RegridderType and imod.mf6.utilities.regrid.RegridderWeightsCache. As these are more than just utilities: They are essential objects for users to do their regridding at the moment.

Checklist