Skip to main content

jHECHMS

PyPI version License

Dual-backend (JAX + NumPy) implementation of native HEC-HMS hydrological algorithms — 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 jhechms          # NumPy backend
pip install 'jhechms[jax]'    # with JAX (differentiable, JIT)

Quickstart

from jhechms.model import simulate

flow, state = simulate(precip, temp, pet)                    # default parameters
flow, state = simulate(precip, temp, pet, params={"CN": 75}) # 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 jhechms.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

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

pip install symfluence jhechms
# config.yaml (excerpt)
model:
  hydrological_model: HECHMS

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

Model structure

The implementation follows the HEC-HMS Technical Reference Manual (US Army Corps of Engineers, 2000):

  1. Snow — ATI-based temperature-index snow model
  2. Loss — SCS Curve Number continuous method
  3. Transform — Clark unit hydrograph (linear reservoir)
  4. Baseflow — linear-reservoir groundwater

14 calibration parameters (jhechms.parameters.PARAM_BOUNDS).

Testing

pip install -e '.[dev]'
pytest

How to cite

If you use jHECHMS 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

  • Feldman, A. D. (2000). Hydrologic Modeling System HEC-HMS: Technical Reference Manual. Report CPD-74B, U.S. Army Corps of Engineers, Hydrologic Engineering Center, Davis, CA.

License

Apache-2.0. See LICENSE.

Download files

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

Source Distribution

jhechms-0.2.4.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

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

jhechms-0.2.4-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file jhechms-0.2.4.tar.gz.

File metadata

  • Download URL: jhechms-0.2.4.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jhechms-0.2.4.tar.gz
Algorithm Hash digest
SHA256 a8be1dde72af8dedbecd942bad96b0abfe521c5fef03a049eb1dab7ab0296434
MD5 fe6780a0671e7edbe189fa88b9d81017
BLAKE2b-256 3dc5c277418844d97486b637bf94b7f4fc43050a6e7bbe9e4f163973e6fb8e26

See more details on using hashes here.

File details

Details for the file jhechms-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: jhechms-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jhechms-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d53d2218e53c70eed0d2966eb79d0b304ca5d0fbec143b8c9ccba9b518a58ab
MD5 6cc0ea5dd9f302532c3b7344e47fd1f6
BLAKE2b-256 f3966e3a5dd219aa69a1ac790a0ee09889ad3bb8a689fa6e1989917755e5801f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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