Skip to main content

jTOPMODEL

PyPI version License

Dual-backend (JAX + NumPy) implementation of the topography-based TOPMODEL rainfall–runoff model — usable standalone or as a SYMFLUENCE plugin.

Part of the SYMFLUENCE JAX-native model family — self-contained packages that run standalone (NumPy fallback, no JAX required) and register automatically with SYMFLUENCE when installed alongside it.

Features

  • Differentiable: automatic differentiation through the full simulation (JAX)
  • Fast: JIT compilation via lax.scan; vmap for ensembles; GPU-capable
  • Dependency-light: pure-NumPy fallback when JAX is not installed
  • Plugin architecture: auto-registers with SYMFLUENCE via entry points

Installation

pip install jtopmodel          # NumPy backend
pip install 'jtopmodel[jax]'    # with JAX (differentiable, JIT)

Quickstart

from jtopmodel.model import simulate

flow, state = simulate(precip, temp, pet)                       # default parameters
flow, state = simulate(precip, temp, pet, params={"SZM": 0.03}) # override any subset

Gradient-based calibration

The JAX backend makes the full simulation differentiable end-to-end, so model parameters can be calibrated with gradient descent:

import jax
from jtopmodel.losses import kge_loss, get_kge_gradient_fn

grad_fn = get_kge_gradient_fn(precip, temp, pet, observed)
value, grads = grad_fn(params)          # dKGE/dparam for every parameter

nse_loss / kge_loss and their gradient factories are JIT-compatible and work with any optax optimizer. Within SYMFLUENCE the same interface powers the ADAM and L-BFGS calibration options.

Use with SYMFLUENCE

jtopmodel registers with SYMFLUENCE through the symfluence.plugins entry point — installation is the integration:

pip install symfluence jtopmodel
# config.yaml (excerpt)
model:
  hydrological_model: TOPMODEL

SYMFLUENCE then handles forcing preparation, calibration, evaluation, and benchmarking for the model with no further wiring.

Model structure

TOPMODEL (Beven & Kirkby, 1979) with three routines:

  1. Snow — degree-day with rain/snow partition
  2. TOPMODEL core — exponential-transmissivity baseflow, saturation-excess overland flow, root-zone / unsaturated-zone accounting
  3. Routing — linear-reservoir channel routing

A parametric (discretized normal) topographic-index distribution avoids DEM preprocessing. 11 calibration parameters (jtopmodel.parameters.PARAM_BOUNDS).

Testing

pip install -e '.[dev]'
pytest

How to cite

If you use jTOPMODEL in your research, please cite the SYMFLUENCE companion papers, which describe the design of the JAX-native model family (registry integration, differentiability, and the calibration experiments they enable):

Eythorsson, D., et al. (2026). The registry as social contract: Architectural patterns for community hydrological modeling. Water Resources Research (submitted).

Eythorsson, D., et al. (2026). From configuration to prediction: Multi-model, multi-basin experiments with SYMFLUENCE. Water Resources Research (submitted).

Citation metadata for this package is provided in CITATION.cff; a version-specific DOI is minted via Zenodo for each GitHub release.

References

License

Apache-2.0. See LICENSE.

Metadata

Release files for jtopmodel 0.2.4

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

Source distribution (sdist)

Source distribution for jtopmodel 0.2.4
File Size Uploaded Provenance Actions
jtopmodel-0.2.4.tar.gz 36.6 kB Without provenance Details for jtopmodel-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 82.7 kB

Release files / jtopmodel-0.2.4.tar.gz

Download URL jtopmodel-0.2.4.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7d37329c5babc838322f07e26e93fdb3aa80f37a09c40573700df423aaff66d7
BLAKE2b-256 checksum
How to use checksums
0e40e0ca2c16c89905f33193574bec3b0dd68a619e6e7e9939018daa80f88138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / jtopmodel-0.2.4-py3-none-any.whl

Download URL jtopmodel-0.2.4-py3-none-any.whl
Size 46.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7e714a1584470443ad98a097abd13ca3e0d1fec058c8ee1131811956937f024
BLAKE2b-256 checksum
How to use checksums
fd5ecdb9d7549435ad9f5e6e0163d00c9d8e6a8209035bcb3d397399b132859e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for jtopmodel 0.2.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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