-
Notifications
You must be signed in to change notification settings - Fork 3
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
Issue #1260 from imod5 data metaswap #1335
Open
JoerivanEngelen
wants to merge
18
commits into
master
Choose a base branch
from
issue_#1260_from_imod5_data_metaswap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Fixes #1285 # Description - This PR implements ``GridData.from_imod5_data``, which has the following requirements: - Area: Split area in rural & urban area - Active: Split where active/inactive - Landuse: Set urban_landuse to 18 - Rootzone thickness: convert from centimeter to meter - Refactors the ``test_grid_data.py`` to separate cases, reduces code duplication - Add unittest for ``GridData.from_imod5_data`` It has a arguments for regridding, but these don't do anything yet. I wasn't sure if I should keep this to already have a future-proof signature, or not add these, as the regridder arguments only confuse people. I don't think regridding the MetaSWAP iMOD5 grids (like we do with MODFLOW6 data) is a part of iMOD Python now, as we are first focusing on the LHM, for which this is not a hard requirement. # Checklist <!--- Before requesting review, please go through this checklist: --> - [x] Links to correct issue - [ ] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Fixes #1290 # Description Adds from_imod5_data classmethod. Requirements: * Set runon/runoff resistance to downward/upward resistance respectively * Set extra storage coefficient and bottom resistance to 1 * If resistance smaller than 5.0, deactivate resistance by setting it to MetaSWAP nodata value. I also added the ``upward_resistance`` and ``downward_resistance`` to the list with grids which have a subunit coordinate, as a comment in @HendrikKok's script mentioned this was missing, and a required feature.
Fixes #1292 # Description Context: MetaSWAP can map meteorological grids, which have a coarser grid but a very fine time resolution, to its svats. The ``mete_grid.inp`` file contains paths to meteorological information, stored in ASCII grids, and there are separate mapping files ``"svat2precgrid.inp"`` and ``"svat2etrefgrid.inp"``. Nota bene: MetaSWAP has hardcoded filenames for packages, hence why I can search for "mete_grid.inp". Adds the following: - A ``MeteoGridCopy`` class to copy "mete_grid.inp" files, to avoid having to read and write the crazy amount of meteo files that exist in existing databases. - A ``MeteoMapping.from_imod5_data`` method which looks for the first ascii grid in the ``mete_grid.inp`` file, and reads that to derive mappings from meteorological cell to metaswap grid cell. - Add ``Imod5DataDict`` type alias, which can be implemented for other ``from_imod5_data`` methods in the future.
Fixes #1313 # Description Construct an rch-package from iMOD5 data in the CAP package, loaded with the ``open_projectfile_data`` function. Package is used to couple MODFLOW6 to MetaSWAP models. Active cells will have a recharge rate of 0.0. At the moment, MetaSWAP can only be coupled to the first layer, as this is also the case for ``primod``. iMOD Coupler these days supports coupling to other layers as well, but ``primod`` doesn't. Picking this up for iMOD Python and ``primod`` is worthy a separate story. In detail: - Add ``Recharge.from_imod5_cap_data`` class method, to construct an empty Recharge package with 0.0 rate. - Minor refactor: Put ``GridData`` helper functions to ``msw/utilities/imod5_converter.py``, so that they can be reused. # Checklist - [x] Links to correct issue - [x] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Fixes #1311 # Description Adds the following: - ``imod.mf6.LayeredWell.from_imod5_cap_data``, to construct LayeredWells for MODLOW6 from the CAP package in iMOD5 Data. Throws an error if data is provided as point data (IPF, which is read as pandas DataFrame). This has rate 0.0, actual rates will be inserted by in the coupling scheme of iMOD Coupler. - ``imod.mf6.GroundwaterFlowModel.from_imod5_data`` adds Sprinkling well if CAP package present. This does not affect MODFLOW6 model if not coupled to MetaSWAP: The wells have rates 0.0, so will not affect the simulation results. - ``Sprinkling.from_imod5_data`` to construct a Sprinkling package from iMOD5 data. # Checklist <!--- Before requesting review, please go through this checklist: --> - [x] Links to correct issue - [x] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Fixes #1320 # Description The iMOD5 projectfile contains an "EXTRA" section, with files to copy. These files usually contain settings and lookup tables for MetaSWAP, which have no direct relation to cell data. This PR adds CopyFiles package to copy these files. # Checklist - [x] Links to correct issue - [x] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Fixes #1324 # Description Adds a ``ScalingFactors.from_imod5_data`` method. I think, the final missing constructor method. Scaling factors for urban areas are set 1.0, not sure if iMOD5 does this as well @HendrikKok? # Checklist - [x] Links to correct issue - [ ] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Fixes #1316 # Description Adds ``MetaSwapModel.from_imod5_data``, currently only models can be written by turning off validation, that is still something to pick up. - Adds ``MetaSwapModel.from_imod5_data`` - Converts ``Imod5DataDict`` TypeAlias to TypedDict, with which we can avoid a lot of type casting. - Add masking and broadcasting utilities for MetaSWAP iMOD5 data. I could not easily make calls to the MODFLOW6 utilities for masking, as these assumed presence of a layer coordinate and had logic to deal with that, which is irrelevant for MetaSWAP. - Adds ``MetaSwapActive`` dataclass to store masks - Allow user-defined ``settings`` upon initialization, instead of only supporting default settings. - Add ``validate`` argument to ``MetaSwapModel.write`` to turn off model validation upon writing. # Checklist - [x] Links to correct issue - [x] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [x] Unit tests were added - [ ] **If feature added**: Added/extended example
Quality Gate failedFailed conditions |
Manangka
approved these changes
Dec 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blind review. Already reviewed changes
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Dec 13, 2024
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 #1260
Description
Adds
MetaSwapModel.from_imod5_data
Checklist
Issue #nr
, e.g.Issue #737