Skip to main content

DiffHydro

Differentiable Hydrological Pipelines Made Easy

Overview

DiffHydro is a research-oriented Python library for building, assembling, and training fully differentiable hydrological modeling pipelines using PyTorch.

DiffHydro formulates hydrological models as pipelines of operators (catchment interpolation, runoff generation, routing, dams, indundation modules, etc.). If each operator is differentiable, the entire hydrological system can be trained end-to-end using gradient-based optimization.

DiffHydro provides the building blocks and reference pipelines to make this practical, modular, and extensible.

⚠️ Status: DiffHydro is in early development. APIs may change, and the library is primarily intended for research and experimentation.


Key Features

  • End-to-end differentiable hydrological pipelines
  • Modular design: compose models from reusable operators
  • Learnable physical parameters (routing, response functions, etc.)
  • PyTorch-native (GPU-friendly, autograd-compatible)
  • Scalability Important efforts have been put to make very large problem sizes fit into GPU memories.
  • Reference pipelines for common hydrological learning setups
  • Examples on real datasets, from toy problems to larger-scale cases

Library Structure

DiffHydro is organized around four main components:

diffhydro/
├── structs/     # Core data structures
├── modules/     # Individual differentiable operators
├── pipelines/   # High-level model & training pipelines
examples/        # End-to-end usage examples

structs/

Defines the core data structures manipulated throughout the library.


modules/

Contains individual differentiable operators. The current releases includes three main components:

  • Catchment Interpolation
  • Runoff Generation
  • Routing Operator

Each module is designed to be:

  • Differentiable
  • Composable
  • Reusable across pipelines

Expect more components to be added soon.


pipelines/

Provides high-level abstractions for assembling and training models.

This includes:

  • Models: containers that assemble multiple modules and expose learnable parameters
  • Modules: utilities that orchestrate data loading, scheduling, and optimization

Pipelines illustrate typical and recommended usage patterns, but they are not restrictive: advanced users are encouraged to assemble their own pipelines directly from modules.


examples/

Example notebooks demonstrating how to use DiffHydro on actual hydrological problems, covering:

  • Different spatial scales
  • Different levels of physical complexity
  • Both small and large datasets

If you are new to DiffHydro, start here.


Installation

Install from pip:

pip install diffhydro

Or install the latest version directly from source:

git clone https://github.com/TristHas/DiffHydro.git
cd DiffHydro
pip install -e .

Metadata

Release files for diffhydro 0.1.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 diffhydro 0.1.0
File Size Uploaded
diffhydro-0.1.0.tar.gz 19.5 kB Details

Built distribution (wheel)

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

Total release size: 45.8 kB

Release files / diffhydro-0.1.0.tar.gz

Download URL diffhydro-0.1.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6177780651cd131709410380327ed10752ce29f01272be716bd09c8005aa5eec
BLAKE2b-256 checksum
How to use checksums
3b578e29b5d2577b4009afe0b9c86a5451c5af435dc9ad1f02d993d8e72d9324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / diffhydro-0.1.0-py3-none-any.whl

Download URL diffhydro-0.1.0-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18af2647c0c28efb51376bceb2aad4e638edbfb29ad3abf07600f387ba5d99c3
BLAKE2b-256 checksum
How to use checksums
1f1088e0c8ded3d597796d4830581926cb1640c992b25efce0041290e2b43205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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