The imod_coupler is used to couple hydrological kernels.
It currently focuses on groundwater and supports coupling between MetaSWAP and Modflow6.
It as command line app that can be run via
imodc /path/to/imod_coupler.tomlIn order to receive help for its usage, run
imodc --helpDeltares colleagues can find the issue tracker at Jira
In order to develop on imod_coupler locally, please follow the following steps:
-
Download and install pixi.
-
Download the Git repository of
imod_couplerand navigate to the root of the project. -
Create the environment by executing the following in your terminal:
pixi install -e dev
-
Install the test dependencies by executing the following in your terminal.
pixi run -e dev install-test-dependencies
It automatically downloads the imod coupler dependencies (MetaSWAP, MODFLOW6 & Ribasim) and regression imod_collector. It downloads the MetaSWAP lookup table. It also generates a
.envthat contains the paths to the downloaded imod_collectors.install-test-dependenciescreates a.envfile in the root of the project with the required environment variables pointing to the paths of imod_collector that can be found in the.pixifolder.
-
The tests can then be run with:
pixi run -e dev tests
-
Lint the codebase with:
pixi run -e dev lint
-
When developing with visual studio code, it is recommended to open the application via
open-vscode.bat. This will open the application in a new vscode window with the correct environment variables set.
The model currently used for the user acceptance tests is the LHM model, but more models might be added in the future. You can run the user acceptance tests locally on a Windows machine by following these steps:
- Pull the data from the Minio/DVC remote by running the following command in the root of the repository:
pixi run -e user-acceptance fetch_lhmThis will unpack the LHM model data and the MetaSWAP database, which are used for the user acceptance tests.
- Run the user acceptance tests by running the following command in the root of the repository.
pixi run -e user-acceptance user_acceptance_testThe test should take about 50 minutes to complete.
Various versions of data are being tracked using DVC. This makes it possible to have different versions of data avaialble on different branches. The bucket in which this data resides is set to readonly for the public. If you want to push new/updated data to the bucket, please contact one of the project maintainers.
When debugging the unit tests in visual studio code with the test explorer, you can encounter some problems. Both MODFLOW 6 and MetaSWAP might behave unpredicateble when being initialized and finalized multiple times.
When you only run, not debug, unit tests, this is not the case, since there is a switch statement that determines if we should call subprocess.run(), or stay within the main thread.
See the fixture for run_coupler_function for more information.
If you encounter errors while running the tests, it might be that your pip dependencies are outdated. This happens when you have pulled the latest changes from imod_coupler. In that case you need to update the pip dependencies as well. Try running:
pixi run update-git-dependencies