Skip to main content

Differentiable hydrological pipelines built on DiffRoute and PyTorch

Project description

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 .

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

diffhydro-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

diffhydro-0.1.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file diffhydro-0.1.0.tar.gz.

File metadata

  • Download URL: diffhydro-0.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for diffhydro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6177780651cd131709410380327ed10752ce29f01272be716bd09c8005aa5eec
MD5 80d26fd6546a3754228a72ac46e2e4b9
BLAKE2b-256 3b578e29b5d2577b4009afe0b9c86a5451c5af435dc9ad1f02d993d8e72d9324

See more details on using hashes here.

File details

Details for the file diffhydro-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: diffhydro-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for diffhydro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18af2647c0c28efb51376bceb2aad4e638edbfb29ad3abf07600f387ba5d99c3
MD5 1373f7e933e1e965e431f4d810c9b8ca
BLAKE2b-256 1f1088e0c8ded3d597796d4830581926cb1640c992b25efce0041290e2b43205

See more details on using hashes here.

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