Skip to main content

iMOD Coupler can be used to couple hydrological kernels

Project description

iMOD Coupler

imod_coupler couples hydrological kernels. It currently focuses on groundwater and supports coupling between MetaSWAP, MODFLOW 6, and Ribasim.

It is a command-line application that can be run via:

imodc /path/to/imod_coupler.toml

For usage information, run:

imodc --help

Issues

Deltares colleagues can find the issue tracker on Jira.

Contributing

Setting up your machine

To develop imod_coupler locally:

  1. Download and install pixi.

  2. Clone the repository and navigate to the project root.

  3. Create the development environment:

    pixi install -e dev
    
  4. Setup the test dependencies:

    pixi run -e dev setup-test-dependencies
    

    This command:

    • Downloads the kernel dependencies (MetaSWAP, MODFLOW 6 & Ribasim) and the regression imod_coupler
    • Downloads the MetaSWAP lookup table
    • Generates a .env file in the project root with environment variables pointing to the downloaded binaries in the .pixi folder
  5. Run the tests:

    pixi run -e dev tests
    
  6. Lint the codebase:

    pixi run -e dev lint
    

Tip: When developing with Visual Studio Code, open the project via open-vscode.bat to launch a new window with the correct environment variables set.

Running acceptance tests

The user acceptance tests currently use the LHM model. More models may be added in the future. These tests can only be run locally on Windows.

  1. Pull the data from the Minio/DVC remote:

    pixi run -e user-acceptance fetch_lhm
    

    This unpacks the LHM model data and the MetaSWAP database required for the tests.

  2. Run the user acceptance tests:

    pixi run -e user-acceptance user_acceptance_test
    

    The tests take approximately 60 minutes to complete.

DVC

Various versions of test data are tracked using DVC, which allows different data versions to exist across branches. The storage bucket is read-only for the public. To push new or updated data, contact one of the project maintainers.

Debugging

When debugging unit tests in Visual Studio Code using the Test Explorer, you may encounter issues because MODFLOW 6 and MetaSWAP can behave unpredictably when initialized and finalized multiple times in the same process.

This does not occur when running (not debugging) unit tests, because a conditional check determines whether to call subprocess.run() or stay within the main thread. See the run_coupler_function fixture for details.

Troubleshooting

If you encounter errors after pulling the latest changes, your pip dependencies may be outdated. Update them by running:

pixi run update-git-dependencies

Creating a release

  1. Update the version number in imod-coupler/__init__.py.

  2. Update the version number in pre-processing/primod/__init__.py.

  3. Add all notable changes to the [Unreleased] section in CHANGELOG.md, using the existing subsections (Added, Fixed, Changed, Removed).

  4. In CHANGELOG.md, rename ## [Unreleased] to ## [vYYYY.MM.X] and add a fresh empty ## [Unreleased] section above it:

    ## [Unreleased]
    
    ### Added
    
    ### Fixed
    
    ### Changed
    
    ### Removed
    
    ## [vYYYY.MM.X]
    ...
    

    You can verify the notes that will be used for the release with:

    python scripts/extract_changelog_notes.py vYYYY.MM.X
    
  5. Commit the changelog and the init file updates:

    git add CHANGELOG.md imod_coupler/__init__.py pre-processing/primod/__init__.py 
    git commit -m "Release vYYYY.MM.X"
    
  6. When the commit has been merged to main or a release branch, switch to that branch and tag the commit:

    git tag vYYYY.MM.X
    
  7. Push the tag:

    git push origin vYYYY.MM.X
    
  8. In TeamCity, select the Deploy project and trigger the Deploy All build, selecting the tag vYYYY.MM.X as the branch. TeamCity will build the artifacts and create the GitHub release using the notes from CHANGELOG.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imod_coupler-2026.6.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imod_coupler-2026.6.0-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file imod_coupler-2026.6.0.tar.gz.

File metadata

  • Download URL: imod_coupler-2026.6.0.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for imod_coupler-2026.6.0.tar.gz
Algorithm Hash digest
SHA256 5a20e363461f1ace8194a4018ebff111f4d983aa17ac5a2fcc37f485fde9d8e2
MD5 83e9c83df72370b0ed9e1a2932269230
BLAKE2b-256 60bca75ce860315d8fafdec140b72c5ea827e302ab65e160a2223d57e41c8bc7

See more details on using hashes here.

File details

Details for the file imod_coupler-2026.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for imod_coupler-2026.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1374772cd84a6bd5f17b3f8dbe3b5a0e6ae6a1d9d3a22a712cc416a5ccb85c0c
MD5 988c4024a1de4334afa603636099e2e5
BLAKE2b-256 078ecad1ec5fae6dc31af1ab4ae10422f1d12e4b50be86439f7b28d5d6b2ac91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page