| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
I have some comments!
Sorry, something went wrong.
review comment Co-authored-by: Joeri van Engelen <joerivanengelen@hotmail.com>
review comment Co-authored-by: Joeri van Engelen <joerivanengelen@hotmail.com>
…/Deltares/imod-python into issue_#969_imod5_import_recharge
| # create an array indicating in which cells rch is active | ||
| is_rch_cell = allocate_rch_cells( | ||
| ALLOCATION_OPTION.at_first_active, | ||
| target_grid, |
There was a problem hiding this comment.
The active grid (idomain == 1) should be inserted here. This comes from the regridded discretization package. So you therefore require an extra argument to the from_imod5_data method, namely the regridded discretization package.
For an example of the API of the allocate_<pkg>_cells, see: https://deltares.github.io/imod-python/user-guide/09-topsystem.html#allocate-river-cells
Sorry, something went wrong.
There was a problem hiding this comment.
done
Sorry, something went wrong.
| @pytest.mark.usefixtures("imod5_dataset") | ||
| def test_planar_rch_from_imod5_constant(imod5_dataset, tmp_path): | ||
| data = deepcopy(imod5_dataset) | ||
| target_grid = data["khv"]["kh"] |
There was a problem hiding this comment.
We do not test if the regridding works now... I don't think we need to that for each package, but having one where it is tested helps I think. Could you add a test where you regrid this case to a very coarse grid?
Sorry, something went wrong.
There was a problem hiding this comment.
in the latest version of this changeset we use the discretization package as the target grid, and it is much finer than the target_grid = data["khv"]["kh"] that was used earlier. So now it is regridding.
That aside, xugrid does as far as I know the same operation, whether the target grid matches the input grid exactly or not. So it goes through the same code path no matter what target grid we provide.
Sorry, something went wrong.
There was a problem hiding this comment.
Some minor comments, approving in advance
Sorry, something went wrong.
| def from_imod5_data( | ||
| cls, | ||
| imod5_data: dict[str, dict[str, GridDataArray]], | ||
| discretization_package: StructuredDiscretization, |
There was a problem hiding this comment.
I think this can be shortened to:
| discretization_package: StructuredDiscretization, | |
| dis_pkg: StructuredDiscretization, |
As DIS is an abbreviation used by MODFLOW6 and pkg is a very common abbreviation for "package".
Sorry, something went wrong.
There was a problem hiding this comment.
done
Sorry, something went wrong.
| imod5_data: dict | ||
| Dictionary with iMOD5 data. This can be constructed from the | ||
| :func:`imod.formats.prj.open_projectfile_data` method. | ||
| target_grid: GridDataArray | ||
| The grid that should be used for the new package. Does not | ||
| need to be identical to one of the input grids. | ||
| regridder_types: dict, optional | ||
| Optional dictionary with regridder types for a specific variable. | ||
| Use this to override default regridding methods. |
There was a problem hiding this comment.
Please update docstring with extra dis_pkg/discretization_package argument.
Sorry, something went wrong.
There was a problem hiding this comment.
done
Sorry, something went wrong.
| data = data[0] | ||
| # Fix data for ibound as it contains floating values like 0.34, 0.25 etc. | ||
| ibound = data["bnd"]["ibound"] | ||
| ibound = ibound.where(ibound <= 0, 1) | ||
| data["bnd"]["ibound"] = ibound | ||
| _load_imod5_data_in_memory(data) | ||
| return data |
There was a problem hiding this comment.
This cleanup also occurs in the tests test_mf6_dis.py, please remove the ibound cleanup from these tests.
Also: You might get some increased performance by first loading the data into memory and then cleaning up ibound.
Sorry, something went wrong.
There was a problem hiding this comment.
done
Sorry, something went wrong.
review comment Co-authored-by: Joeri van Engelen <joerivanengelen@hotmail.com>
| Back | FazBrowse Home | New Git URL |
Fixes #969
Description
implements importing recharge packages from a project file. The recharge can be imported using a planar grid,
in which case it assigns the recharge to the uppermost active cell for each column.
The recharge can also be imported from a non-planar (so fully 3d) grid in which case it is just regridded to the target grid.
Checklist