Skip to main content

Differentiable Hydrologic Model Library

Reason this release was yanked:

Includes insecure pye file.

Project description

HydroDL2: Differentiable Hydrologic Models

Python PyPI version PyTorch

Build Ruff License



A library of hydrological models developed on PyTorch and designed alongside 𝛿MG for the creation of end-to-end differentiable models, enabling parameter learning, bias correction, missing process representation, and more.

See 𝛿MG/examples using HydroDL2-based HBV models for published differentiable parameter learning (dPL) applications.


Installation

uv pip install hydrodl2

For development installs, see setup.

Quick Start

import hydrodl2

# List all available models
hydrodl2.available_models()
# {'hbv': ['hbv', 'hbv_1_1p', 'hbv_2', 'hbv_2_hourly', 'hbv_2_mts', 'hbv_adj']}

# Load a model class
Hbv = hydrodl2.load_model('hbv')

# Instantiate and use in a differentiable pipeline
model = Hbv()

Models are standard torch.nn.Module subclasses and can be composed with neural networks via δMG for end-to-end differentiable training.


Available Models

Model Name Description
HBV 1.0 hbv Base differentiable HBV model
HBV 1.1p hbv_1_1p HBV with capillary rise modification
HBV 2.0 hbv_2 Multi-scale HBV with elevation-dependent parameters
HBV 2.0 Hourly hbv_2_hourly Sub-daily variant of HBV 2.0
HBV 2.0 MTS hbv_2_mts Multi-timescale variant of HBV 2.0
HBV Adjoint hbv_adj Implicit scheme with adjoint-based gradients

Repository Structure

.
├── src/
│   └── hydrodl2/
│       ├── api/                   # Main API
│       │   ├── __init__.py
│       │   └── methods.py         # Methods exposed to end-users
│       ├── core/                  # Methods used internally
│       ├── models/                # Shared models directory
│       │   └── hbv/               # HBV model variants
│       └── modules/               # Augmentations for δMG models
├── docs/
├── tests/
└── pyproject.toml

Citation

This work is maintained by MHPI and advised by Dr. Chaopeng Shen. If you find it useful, please cite:

Shen, C., et al. (2023). Differentiable modelling to unify machine learning and physical models for geosciences. Nature Reviews Earth & Environment, 4(8), 552--567. https://doi.org/10.1038/s43017-023-00450-9

BibTeX
@article{shen2023differentiable,
  title={Differentiable modelling to unify machine learning and physical models for geosciences},
  author={Shen, Chaopeng and others},
  journal={Nature Reviews Earth \& Environment},
  volume={4},
  number={8},
  pages={552--567},
  year={2023},
  publisher={Nature Publishing Group},
  doi={10.1038/s43017-023-00450-9}
}

Contributing

We welcome contributions! See CONTRIBUTING.md for details.


Please submit an issue to report any questions, concerns, or bugs.

Project details


Download files

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

Source Distribution

hydrodl2-1.3.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

hydrodl2-1.3.0-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file hydrodl2-1.3.0.tar.gz.

File metadata

  • Download URL: hydrodl2-1.3.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hydrodl2-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e930f695daf54e6a7e839896f3413efcb8669b2ea5ff98907b020ad963d598be
MD5 9a3e33b84f090a1fb228cf62d935f536
BLAKE2b-256 e61512f5e2b5837f18789886d8ef169131a9b5d043b71f53a42140cbdfbc812e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hydrodl2-1.3.0.tar.gz:

Publisher: build-wheels.yaml on mhpi/hydrodl2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hydrodl2-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: hydrodl2-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hydrodl2-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84b21dac8d410f1e765e39d920a643177da19b2b841fa1e416ae665e2b1cb2c8
MD5 1f806bd8f4788d1e8c6efa19b6d39be7
BLAKE2b-256 c501b93785d7d333fdee658e3bcdd647f5ced07d31a67fba5406f6797a945238

See more details on using hashes here.

Provenance

The following attestation bundles were made for hydrodl2-1.3.0-py3-none-any.whl:

Publisher: build-wheels.yaml on mhpi/hydrodl2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page