Skip to content

Deltares/imod_coupler

Repository files navigation

iMOD Coupler

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.toml

In order to receive help for its usage, run

imodc --help

Issues

Deltares colleagues can find the issue tracker at Jira

Contributing

In order to develop on imod_coupler locally, please follow the following steps:

  • Create an access token at the TeamCity build server. Choose permission scope: <Same as current user>.

  • Store the token in your local user environment as TEAMCITY_TOKEN. This token will be used to download artifacts from Teamcity, make sure to store it well.

  • Download and install pixi.

  • Download and install svn. Make sure to install the svn command line tools as well.

  • Download the Git repository of imod_coupler and navigate to the root of the project.

  • Create the environment by executing the following in your terminal:

    pixi run --environment=dev install
  • Install the test dependencies by executing the following in your terminal. It automatically downloads the latest imod_collector and regression imod_collector from the build server. It downloads the MetaSWAP lookup table. It also generates a .env that contains the paths to the downloaded imod_collectors.

    pixi run install-test-dependencies

    install-test-dependencies creates a .env file in the root of the project with the required environment variables pointing to the paths of imod_collector that can be found in the .pixi folder.

  • The tests can then be run with:

    pixi run tests
  • Lint the codebase with:

    pixi run 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.

Debugging

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.

Troubleshooting

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