This release is a pre-release and may not be stable for production use.
pyrunoff
pyrunoff is a Python library for hydrologic runoff and routing calculations. It exposes reusable routing components for rainfall losses, unit hydrograph transformation, baseflow, reach routing, and reservoir routing.
Documentation: https://darshanbaral.github.io/pyrunoff/
Installation
We recommend installing with uv for a fast, reproducible Python environment.
The current PyPI release is an alpha release, and requires Python 3.14 or later. pip commands include --pre to select this prerelease.
Recommended: Install with Numba acceleration
uv add "pyrunoff[with-numba]"
# or
python -m pip install --pre "pyrunoff[with-numba]"
Numba compiles numerical kernels for faster execution on long time series.
Install without Numba
uv add pyrunoff
# or
python -m pip install --pre pyrunoff
Without Numba, the library still works but runs its numerical kernels in Python mode, which may be slower for long simulations.
Core API
The library provides:
RainfallSeries,DischargeSeries,ElevationSeries, andStorageSeriesfor time-indexed dataInitialConstantandDeficitConstantloss models, with typed output dataclassesClarkUhfor Clark unit-hydrograph transformationLinearReservoirfor baseflow routingMuskingumfor channel routing, returningMuskingumOutputLevelPoolfor reservoir routing, returningLevelPoolOutputnseandkgemodel-performance metrics inpyrunoff.metricsNetworkfor topological ordering of flow paths inpyrunoff.utils.networkModelfor routing rainfall through a network of basins, reaches, junctions and reservoirs, withload_model,load_paramsandload_rainfallfor reading its inputs from files
The library is designed as a modular toolkit for composing hydrologic routing operations in Python.
Quick start
import pandas as pd
from pyrunoff.baseflow import LinearReservoir
from pyrunoff.loss import InitialConstant
from pyrunoff.reach import Muskingum
from pyrunoff.transform import ClarkUh
from pyrunoff.utils import RainfallSeries
# Example rainfall data
rain = pd.Series(
[0.0, 0.8, 1.4, 0.4, 0.0, 0.0],
index=pd.date_range("2024-01-01", periods=6, freq="1h"),
)
rain_series = RainfallSeries(rain, sorted=True)
# 1) Compute losses
loss_model = InitialConstant(
rainfall_series=rain_series,
initial_loss=0.25,
constant_loss=0.15,
)
loss_output = loss_model.route()
# 2) Transform excess precipitation into direct runoff
clark = ClarkUh(
rainfall_series=loss_output.excess,
basin_area=1000.0,
tc=pd.Timedelta(hours=2),
storage_r=pd.Timedelta(hours=3),
)
direct_runoff = clark.route()
# 3) Generate baseflow
baseflow = LinearReservoir(
rainfall_series=loss_output.total_loss,
gw_fraction=0.7,
k=pd.Timedelta(hours=6),
basin_area=1000.0,
).route()
# 4) Route channel flow with Muskingum
routed_flow = (
Muskingum(
inflow_series=direct_runoff,
k=pd.Timedelta(hours=2),
x=0.25,
)
.route()
.total_outflow
)
print(direct_runoff.data)
print(baseflow.data)
print(routed_flow.data)
Documentation
The documentation covers:
- Network models: the model, parameter and rainfall files, and running a model
- Methods: using each loss, transform, baseflow and routing method on its own, and the performance metrics
- Time series: time series types, time steps and network ordering
- API reference: every class and function, with parameter units and constraints
Metadata
Release files for pyrunoff 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyrunoff-0.1.0a2.tar.gz | 144.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyrunoff-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 184.2 kB
Release files / pyrunoff-0.1.0a2.tar.gz
| Download URL | pyrunoff-0.1.0a2.tar.gz |
|---|---|
| Size | 144.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33a2c78eb4f29f0de96051e0cd0cc893eef88c8feaed8566376524fb518f4b3c
|
|
BLAKE2b-256 checksum How to use checksums |
a68e9f1a4765e2b3a911fa11c8b2905fe5cd7cfc8960ed584a2c51efd285734c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency logRelease files / pyrunoff-0.1.0a2-py3-none-any.whl
| Download URL | pyrunoff-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 39.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4179f9815eb078a4bfb83308b211c54acc0ad3332cf0294819363754835a104
|
|
BLAKE2b-256 checksum How to use checksums |
b1347c86d77087beecae4ae3b28a4646863e7de15aee91067bec55fcc568db39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency log