imod
An open source project to make working with MODFLOW groundwater models in Python easier.
https://github.com/deltares/imod-python
Category: Hydrosphere
Sub Category: Freshwater and Hydrology
Keywords from Contributors
groundwater imod MODFLOW hydrology water-resources modflow water-management earth-science qgis-plugin 3d-viewer
Last synced: about 13 hours ago
JSON representation
Repository metadata
🐍🧰 Make massive MODFLOW models
- Host: GitHub
- URL: https://github.com/deltares/imod-python
- Owner: Deltares
- License: mit
- Created: 2023-12-08T13:57:59.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2026-08-12T09:04:55.000Z (1 day ago)
- Last Synced: 2026-08-12T13:50:20.886Z (1 day ago)
- Language: Python
- Homepage: https://deltares.github.io/imod-python/
- Size: 73.2 MB
- Stars: 40
- Watchers: 8
- Forks: 10
- Open Issues: 190
- Releases: 34
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
README.rst
.. image:: https://dpcbuild.deltares.nl/app/rest/builds/buildType:id:iMOD6_IMODPython_Windows_Tests/statusIcon.svg
:target: https://github.com/Deltares/imod-python/commits/master/
.. image:: https://img.shields.io/pypi/l/imod
:target: https://choosealicense.com/licenses/mit/
.. image:: https://img.shields.io/conda/vn/conda-forge/imod.svg
:target: https://github.com/conda-forge/imod-feedstock
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json
:target: https://pixi.sh
.. image:: https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038
:target: https://scientific-python.org/specs/spec-0000/
The ``imod`` Python package is an open source project to make working with
MODFLOW groundwater models in Python easier. It builds on top of popular
packages such as `xarray`_, `pandas`_, `geopandas`_, `dask`_, and `rasterio`_
to provide a versatile toolset for working with large groundwater modeling
datasets. Some of its core functionalities are:
* Preparing and modifying data from a variety of GIS, scientific, and MODFLOW
file formats;
* Regridding, clipping, masking, and splitting MODFLOW 6 models;
* Fast writing of data to MODFLOW-based models;
* Selecting and evaluating, e.g. for time series comparison or water budgets;
* Visualizing cross sections, time series, or 3D animations.
We currently support the following MODFLOW-based kernels:
* `USGS MODFLOW 6`_, structured (DIS) and discretization by vertices (DISV)
grids only. Not all advanced stress packages are supported (only LAK and UZF)
* `iMOD-WQ`_, which integrates SEAWAT (density-dependent
groundwater flow) and MT3DMS (multi-species reactive transport calculations)
Development currently focuses on supporting more MODFLOW 6 functionalities.
iMOD-WQ has been sunset and will no longer be developed.
Why ``imod``?
=============
1\. Easily create grid-based model packages
-------------------------------------------
Seamlessly integrate your GIS rasters or meshes with MODFLOW 6, by using `xarray`_
and `xugrid`_ arrays, for structured and unstructured grids, respectively, to
create grid-based model packages.
.. code-block:: python
import imod
# Open Geotiff with elevation data as xarray DataArray
elevation = imod.rasterio.open("elevation.tif")
# Create idomain grid
layer_template = xr.DataArray([1, 1, 1], dims=('layer',), coords={'layer': [1, 2, 3]})
idomain = layer_template * xr.ones_like(elevation).astype(int)
# Compute bottom elevations of model layers
layer_thickness = xr.DataArray([10.0, 20.0, 10.0], dims=('layer',), coords={'layer': [1, 2, 3]})
bottom = elevation - layer_thickness.cumsum(dim='layer')
# Create MODFLOW 6 DIS package
dis_pkg = imod.mf6.StructuredDiscretization(
idomain=idomain, top=elevation, bottom=bottom.transpose("layer", "y", "x")
)
2\. Assign wells based on data at hand, instead of the model grid
-----------------------------------------------------------------
Assign wells based on x, y coordinates and filter screen depths, instead of
layer, row and column:
.. code-block:: python
# Specify well locations
x = [150_200.0, 160_800.0]
y = [450_300.0, 460_200.0]
# Specify well screen depths
screen_top = [0.0, 0.0]
screen_bottom = [-4.0, -10.0]
# Specify flow rate, which changes over time.
weltimes = pd.date_range("2000-01-01", "2000-01-03", freq="2D")
well_rates_period1 = [0.5, 1.0]
well_rates_period2 = [2.5, 3.0]
rate = xr.DataArray([well_rates_period1, well_rates_period2], coords={"time": weltimes}, dims=("time","index"))
# Now construct the Well package
wel_pkg = imod.mf6.Well(x=x, y=y, rate=rate, screen_top=screen_top, screen_bottom=screen_bottom)
iMOD Python will take care of the rest and assign the wells to the correct model
layers upon writing the model. It will furthermore distribute well rates based
on transmissivities. To verify how wells will be assigned to MODFLOW 6 cells before
writing the entire simulation, you can use the following command:
.. code-block:: python
# Wells have been distributed across two model layers based on screen depths.
wel_mf6_pkg = wel_pkg.to_mf6(idomain, top, bottom, k=1.0)
print(wel_mf6_pkg["cellid"])
# Well rates have been distributed based on screen overlap
print(wel_mf6_pkg["rate"])
3\. Utilities to assign 2D river grids to 3D model layers
---------------------------------------------------------
A common problem in groundwater modeling is to assign 2D river or drain grids to
3D model layers. iMOD Python has utilities to do this, supporting all kinds of
different methods. Furthermore, it can help you distribute the conductance
across layers.
`See examples here `_
4\. Create stress periods based on times assigned to boundary conditions
--------------------------------------------------------------------------
MODFLOW 6 requires that all stress periods are defined in the time discretization
package. However, usually boundary conditions are defined at inconsistent
times. iMOD Python can help you to create a time discretization package that is
consistent, based on all the unique times assigned to the boundary conditions.
`See futher explanation here `_
.. code-block:: python
# First add the packages to the simulation. NOTE: To get a functional model,
# more packages are needed than these two.
simulation = imod.mf6.Modflow6Simulation("example")
simulation["gwf"] = imod.mf6.GroundwaterFlowModel()
simulation["gwf"]["dis"] = dis_pkg
simulation["gwf"]["wel"] = wel_pkg
# Create a time discretization based on the times assigned to the packages.
# Specify the end time of the simulation as one of the additional_times
simulation.create_time_discretization(additional_times=["2000-01-07"])
# Note that timesteps in well package are also inserted in the time
# discretization
print(simulation["time_discretization"].dataset)
5\. Regridding MODFLOW 6 models to different grids
--------------------------------------------------
Regrid MODFLOW 6 models to different grids, even from structured to unstructured
grids. iMOD Python takes care of properly scaling the input parameters. You can
also configure scaling methods yourself for each input parameter, for example
when you want to upscale drainage elevations with the minimum instead of the
average.
.. code-block:: python
sim_regridded = simulation.regrid_like(new_unstructured_grid)
# Notice that discretization has converted to VerticesDiscretization (DISV)
print(sim_regridded["gwf"]["dis"])
`See further explanation here `_
6\. Clip MODFLOW 6 models to a bounding box
-------------------------------------------
To reduce the size of your model, you can clip it to a bounding box. This is
useful for example when you want to create a smaller model for testing purposes.
.. code-block:: python
sim_clipped = simulation.clip_box(x_min=125_000, x_max=175_000, y_min=425_000, y_max=475_000)
You can even provide states for the model, which will be set on the model boundaries of the clipped model.
.. code-block:: python
# Create a grid of zeros, which will be used to
# set as heads at the boundaries of clipped parts.
head_for_boundary = xr.zeros_like(idomain, dtype=float)
states_for_boundary = {"gwf": head_for_boundary}
sim_clipped = simulation.clip_box(
x_min=125_000, x_max=175_000, y_min=425_000, y_max=475_000, states_for_boundary=states_for_boundary
)
# Notice that a Constant Head (CHD) package has been created for the clipped
# model.
print(sim_clipped["gwf"])
7\. Performant writing of MODFLOW 6 models
------------------------------------------
iMOD Python efficiently writes MODFLOW 6 models to disk, especially large models.
Tests we have conducted for the Dutch National Groundwater Model (LHM) show that
iMOD Python can write a model with 21.84 million cells 5 to 60 times faster (for
respectively 1 and 365 stress periods) than the alternative `Flopy`_ package.
Furthermore ``imod`` can even write models that are larger than the available
memory, using `dask`_ arrays.
*NOTE:* iMOD developers work alongside the Flopy development team and contribute
to both projects.
8\. Import your iMOD5 models
----------------------------
Models made with `iMOD5`_ can be imported into iMOD Python, provided that they are
defined in a projectfile.
.. code-block:: python
# Open projectfile data
imod5_data, period_data = imod.formats.prj.open_projectfile_data("path/to/projectfile.prj")
# Specify times for the simulation, this will be used to resample iMOD5 wells
# to and to set the time discretization
times = [np.datetime64("2000-01-01"), np.datetime64("2000-01-02"), np.datetime64("2000-01-03")]
# Create a simulation object
simulation = imod.mf6.Modflow6Simulation.from_imod5_data(imod5_data, period_data, times)
`See this page for a full list of supported iMO5 functionalities. `_
Why not ``imod``?
=================
1\. You want to make a small, synthetic model
---------------------------------------------
If you are not interested in deriving models from spatial data, but just want to
allocate boundary conditions based on layer, row, column numbers, or create a
model of a 2D cross-section: You are better off using `Flopy`_. If you want to
complexify this model with a lot of stress periods and run into slow writing
speeds, consider using ``imod`` for performance.
2\. Not all MODFLOW 6 features are supported
--------------------------------------------
Currently, we don't support the following MODFLOW 6 features:
- timeseries files
- DISU package
- Groundwater Energy Model (GWE)
- Streamflow routing (SFR) package (`in development `_)
- Ghost Node Correction (GNC) package
- Multi-aquifer well (MAW) package
- Water mover (MVR) package
- Particle tracking (PRT)
Most of these features can be implemented with some effort, but we have not
prioritized them yet. The exceptions are the DISU package and the timeseries
files, which would require significant work to our backend. As a result, we will
likely not support these two features in the foreseeable future. If you need any of the
other features, feel free to open an issue on our GitHub page.
Additional links
================
Documentation: https://deltares.github.io/imod-python
Source code: https://github.com/Deltares/imod-python
Issues: https://github.com/Deltares/imod-python/issues
.. _Deltares: https://www.deltares.nl
.. _dask: https://dask.org/
.. _xarray: http://xarray.pydata.org/
.. _xugrid: https://deltares.github.io/xugrid/
.. _pandas: http://pandas.pydata.org/
.. _rasterio: https://rasterio.readthedocs.io/en/latest/
.. _geopandas: http://geopandas.org/
.. _netCDF: https://www.unidata.ucar.edu/software/netcdf/
.. _USGS MODFLOW 6: https://www.usgs.gov/software/modflow-6-usgs-modular-hydrologic-model
.. _iMOD-WQ: https://oss.deltares.nl/web/imod
.. _iMOD5: https://oss.deltares.nl/web/imod
.. _Flopy: https://flopy.readthedocs.io/en/latest/
Owner metadata
- Name: Deltares
- Login: Deltares
- Email: oss@deltares.nl
- Kind: organization
- Description: Deltares is an independent institute for applied research in the field of water and subsurface.
- Website: https://www.deltares.nl/en/
- Location: Delft, The Netherlands
- Twitter: deltares
- Company:
- Icon url: https://avatars.githubusercontent.com/u/6613768?v=4
- Repositories: 74
- Last ynced at: 2023-03-03T19:30:55.614Z
- Profile URL: https://github.com/Deltares
GitHub Events
Total
- Release event: 10
- Delete event: 321
- Pull request event: 396
- Fork event: 3
- Issues event: 421
- Watch event: 8
- Issue comment event: 697
- Push event: 630
- Pull request review event: 341
- Pull request review comment event: 294
- Create event: 362
Last Year
- Release event: 2
- Delete event: 72
- Pull request event: 48
- Fork event: 1
- Issues event: 66
- Watch event: 1
- Issue comment event: 90
- Push event: 143
- Pull request review comment event: 38
- Pull request review event: 39
- Create event: 92
Committers metadata
Last synced: 1 day ago
Total Commits: 2,421
Total Committers: 33
Avg Commits per committer: 73.364
Development Distribution Score (DDS): 0.625
Commits in past year: 142
Committers in past year: 9
Avg Commits per committer in past year: 15.778
Development Distribution Score (DDS) in past year: 0.514
| Name | Commits | |
|---|---|---|
| Huite Bootsma | h****a@g****m | 908 |
| JoerivanEngelen | j****n@h****m | 732 |
| Martijn Visser | m****r@g****m | 236 |
| luit slooten | l****n@d****l | 111 |
| Deltares service account | 1****t | 108 |
| Sunny Titus | 7****a | 93 |
| Joost Delsman | j****n@d****l | 58 |
| jdelsman | j****n@g****m | 30 |
| Tess op den Kelder | T****r@d****l | 29 |
| Tess op den Kelder | t****r@h****m | 22 |
| Hofer-Julian | j****r@g****g | 14 |
| Joost Delsman | J****n@d****l | 13 |
| HendrikKok | 5****k | 11 |
| Niels Mulder | N****r@d****l | 7 |
| Jarno Verkaik | v****k | 7 |
| TobiasMulder | t****r@d****l | 6 |
| Huite Bootsma | h****a@g****m | 6 |
| rleander73 | l****r@d****l | 5 |
| Janneke Pouwels | j****s@d****l | 4 |
| Claire Donnelly | 8****s | 4 |
| Simon Buijs | b****n@g****m | 3 |
| Vincent Gao | g****0@g****m | 2 |
| Marnix | 1****x | 2 |
| wpbonelli | w****i@g****m | 1 |
| Joachim Hunink | j****k@d****l | 1 |
| Steijn van | s****1@b****l | 1 |
| Thijs Hendrikx | T****x@d****l | 1 |
| Vince Kaandorp | v****p@g****m | 1 |
| nielsmulderdeltares | n****s@g****m | 1 |
| titus | t****s@T****y | 1 |
| and 3 more... | ||
Committer domains:
- deltares.nl: 11
- uu.nl: 1
- gnome.org: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 728
Total pull requests: 973
Average time to close issues: 6 months
Average time to close pull requests: 7 days
Total issue authors: 27
Total pull request authors: 16
Average comments per issue: 1.11
Average comments per pull request: 0.91
Merged pull request: 770
Bot issues: 0
Bot pull requests: 0
Past year issues: 81
Past year pull requests: 94
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 4 days
Past year issue authors: 15
Past year pull request authors: 10
Past year average comments per issue: 1.12
Past year average comments per pull request: 1.29
Past year merged pull request: 67
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- Manangka (284)
- JoerivanEngelen (276)
- luitjansl (52)
- Huite (45)
- HendrikKok (14)
- FransRoelofsen (9)
- WouterSwierstra (9)
- verkaik (7)
- jc-hunink (4)
- JaccoHoogewoud (3)
- TeunvanWoerkom (3)
- CasvHWSBrabantseDelta (3)
- OnnoEbbens (2)
- guilherme-ehn (2)
- sebmeng (2)
Top Pull Request Authors
- JoerivanEngelen (434)
- deltares-service-account (177)
- luitjansl (148)
- Manangka (133)
- Huite (31)
- HendrikKok (15)
- verkaik (10)
- rleander73 (5)
- ClaireDons (4)
- M-D-J (4)
- deltamarnix (4)
- visr (2)
- gaoflow (2)
- wpbonelli (2)
- Ydrolog (1)
Top Issue Labels
- bug (109)
- backwards_compatibility (58)
- enhancement (56)
- documentation (48)
- story (24)
- type::story (11)
- needs tests (9)
- performance (8)
- package checks (8)
- Deltares (8)
- refactor (7)
- status::done (7)
- task (6)
- legacy_regridder (6)
- release::0.14.0 (5)
- type::bug (4)
- spike (4)
- has attachment (4)
- priority (4)
- discussion (4)
- status::accepted (3)
- subdomain (2)
- setup (2)
- ci (2)
- good first issue (2)
- status::refined (2)
- status::in progress (2)
- tests (2)
- clipping (2)
- logging (2)
Top Pull Request Labels
- tests (2)
- status::review (1)
- type::bug (1)
- enhancement (1)
- refactor (1)
Package metadata
- Total packages: 4
-
Total downloads:
- pypi: 2,277 last-month
- Total dependent packages: 4 (may contain duplicates)
- Total dependent repositories: 11 (may contain duplicates)
- Total versions: 89
- Total maintainers: 5
proxy.golang.org: github.com/deltares/imod-python
- Homepage:
- Documentation: https://pkg.go.dev/github.com/deltares/imod-python#section-documentation
- Licenses: mit
- Latest release: v0.10.0 (published about 6 years ago)
- Last Synced: 2026-08-12T13:02:55.772Z (1 day ago)
- Versions: 14
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.401%
- Average: 5.583%
- Dependent repos count: 5.764%
proxy.golang.org: github.com/Deltares/imod-python
- Homepage:
- Documentation: https://pkg.go.dev/github.com/Deltares/imod-python#section-documentation
- Licenses: mit
- Latest release: v0.10.0 (published about 6 years ago)
- Last Synced: 2026-08-12T13:03:39.029Z (1 day ago)
- Versions: 14
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.401%
- Average: 5.583%
- Dependent repos count: 5.764%
pypi.org: imod
Make massive MODFLOW models!
- Homepage: https://github.com/Deltares/imod-python
- Documentation: https://deltares.github.io/imod-python/
- Licenses: MIT License
- Latest release: 1.1.0 (published 10 days ago)
- Last Synced: 2026-08-12T13:02:25.381Z (1 day ago)
- Versions: 51
- Dependent Packages: 4
- Dependent Repositories: 7
- Downloads: 2,277 Last month
-
Rankings:
- Dependent packages count: 1.597%
- Dependent repos count: 5.645%
- Average: 7.542%
- Downloads: 15.384%
- Maintainers (5)
conda-forge.org: imod
The imod Python package is an open source project to make working with MODFLOW groundwater models in Python easier. It builds on top of popular packages such as xarray, pandas, geopandas, dask, and rasterio to provide a versatile toolset for working with (large) groundwater (modeling) data.
- Homepage: https://github.com/Deltares/imod-python
- Licenses: MIT
- Latest release: 0.11.4 (published almost 4 years ago)
- Last Synced: 2026-04-01T02:01:08.813Z (5 months ago)
- Versions: 10
- Dependent Packages: 0
- Dependent Repositories: 4
-
Rankings:
- Dependent repos count: 16.027%
- Average: 33.783%
- Dependent packages count: 51.54%
Dependencies
- org.jetbrains.kotlin:kotlin-script-runtime ${kotlin.version} compile
- org.jetbrains.kotlin:kotlin-stdlib-jdk8 ${kotlin.version} compile
- org.jetbrains.teamcity:configs-dsl-kotlin-latest ${teamcity.dsl.version} compile
- org.jetbrains.teamcity:configs-dsl-kotlin-plugins-latest 1.0-SNAPSHOT compile
- actions/checkout v4 composite
- yesolutions/mirror-action 1708f16cdb28634fd3ba10c5c79abc91f5578a14 composite
- mcr.microsoft.com/windows/server ltsc2022 build
Score: 16.673946073078774