Skip to main content

MRRpy

License: MIT Python Docs

Rainfall–runoff and flood routing for any basin on Earth, from a DEM and a storm.

MRRpy, the Multi-Mechanism Runoff and Routing model, is a distributed, physics-based flood model in Python. It traces the drainage network of a DEM, works out how much rain runs off (SCS Curve Number, or Green–Ampt infiltration, saturated source areas (VSA-OPM) and impervious cities in any combination), and routes the water through every grid cell and sub-grid river channel with a kinematic, Muskingum–Cunge or semi-implicit diffusion wave. You get the outlet hydrograph, flood maps and a water-balance check. It runs offline with your own data, or fetches DEMs, NASA IMERG rain, soil and land cover from Google Earth Engine. Set it up in a Jupyter form, a terminal wizard, Python or QGIS; it runs on a CPU or an NVIDIA GPU.

📖 Documentation

Full docs, guides and API reference → mrrpy.readthedocs.io

Learn the science interactively → the MRRpy course

Installation

pip install "MRRpy[all]"       # recommended: Earth Engine + Jupyter form + USGS data
pip install "MRRpy[all,gpu]"   # + NVIDIA GPU acceleration (needs CUDA 12.x)
pip install MRRpy              # minimal: Python API, CLI, QGIS plugin

Quick example

from MRRpy import Config, run_pipeline

cfg = Config(DEM_PATH="dem.tif", OUTPUT_DIR="results/",
             OUTPUT_POINT=(27.632, 85.293),   # (lat, lon) of the outlet
             TARGET_CRS_EPSG="EPSG:32645")    # a projection in metres (UTM zone)
run_pipeline(cfg)                             # → results/hydrograph.csv

Or from the command line:

MRRpy wizard                    # answer a few questions → run.yaml
MRRpy run -c run.yaml           # process_dem + routing

Prefer a form? In Jupyter, MRRpy.ConfigForm() is a step-by-step form like the QGIS plugin (pip install "MRRpy[notebook]"). Prefer a file? MRRpy init-config -o run.yaml writes a commented template, and MRRpy explain <SETTING> explains any setting.

Water depth and river discharge spreading over the whole Kathmandu-valley DEM

One storm over a whole DEM, animated with MRRpy.animate_fields(out, ["depth", "discharge"]): water depth, river flow drawn wider where it is larger, and the hydrograph.

What it offers

  • DEM → watershed — reproject, pit-fill, D8 flow direction/accumulation and delineation (pysheds or pyflwdir) — or route the whole DEM with no outlet (MODEL_AREA="whole_dem").
  • Flood maps — save depth/discharge maps over time, then animate the flow spreading (animate_fields) or export peak-depth GeoTIFFs (export_peak_maps).
  • Runoff generation — none · coefficient · raster · scs_cn · physical; for physical, VSA saturation-excess + Green-Ampt + impervious as composable mechanisms.
  • Flood routing — kinematic wave, Muskingum–Cunge, or a semi-implicit diffusion wave (backwater, flat valleys, large stable steps), with sub-grid river channels sized from the 2-year flood and an always-on water-balance check.
  • Satellite forcing — optional DEM download, IMERG rainfall, GCN250 curve numbers, SERVES soil deficit, SoilGrids, HiHydroSoil, LULC/LCZ via Google Earth Engine (every option also works offline with your own files).
  • Weather-model rain and forecasts — hourly or 15-minute rain from Open-Meteo (ECMWF, GFS, ICON, ERA5, …) for any past storm or a forecast up to 16 days ahead; no account needed.
  • CPU / GPU — one code path (NumPy or CuPy), automatic CPU fallback.
  • Interfaces for every taste — Python API, a MRRpy CLI with a question-and-answer wizard, a Jupyter form, and a QGIS plugin, all driven by one Config object.

License

MIT © Saurav Bhattarai.

Metadata

Release files for MRRpy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MRRpy 1.0.0
File Size Uploaded Provenance Actions
mrrpy-1.0.0.tar.gz 298.9 kB With provenance Details for mrrpy-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for MRRpy 1.0.0
File Interpreter ABI Platform Actions
mrrpy-1.0.0-py3-none-any.whl Python 3 none any Details for mrrpy-1.0.0-py3-none-any.whl

Total release size: 630.3 kB

Release files / mrrpy-1.0.0.tar.gz

Download URL mrrpy-1.0.0.tar.gz
Size 298.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb68e838906ccad345ed6d3bfd821be42f7506b12f453d86be2052fe0404f20
BLAKE2b-256 checksum
How to use checksums
8f5e440fed8e65ffb70f5c35c7a33fe51c94fa415942c1581d604aa389b8cc18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / mrrpy-1.0.0-py3-none-any.whl

Download URL mrrpy-1.0.0-py3-none-any.whl
Size 331.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76171b2e8b8e87ebe034f1e4ec194d0b5e60dd85427fabbc43e649def207736f
BLAKE2b-256 checksum
How to use checksums
6ebc6ec9f96537055a414ba13ed11af2156e7e22ce27faa5b2ce1e3481984b2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for MRRpy 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mrrpy-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page