Skip to main content

JAX-based differentiable hydrological modeling framework implementing FUSE and routing

Project description

jFUSE logo

JAX-based differentiable hydrological modeling framework implementing FUSE

CI PyPI version Python versions License

A fully differentiable JAX implementation of the Framework for Understanding Structural Errors (FUSE) hydrological model from Clark et al. (2008), with Muskingum-Cunge routing.

Note: jFUSE is in active development

Features

  • Fully differentiable: Automatic differentiation through the entire model using JAX
  • JIT-compiled: Fast execution with XLA compilation
  • FUSE decision file compatible: Read standard FUSE decision files to configure model structure
  • Muskingum-Cunge routing: Network-based streamflow routing with adaptive parameters
  • Gradient-based calibration: Built-in calibration with optax optimizers
  • GPU-ready: Seamless scaling to GPU with JAX

Requirements

  • Python >= 3.11
  • JAX >= 0.4.0
  • equinox >= 0.11.0
  • optax >= 0.1.7
  • numpy
  • xarray (for NetCDF I/O)

Installation

# Clone or download the package
git clone https://github.com/symfluence-org/jFUSE.git
cd jfuse

# Install in development mode
pip install -e .

# Or install with all dependencies
pip install -e ".[dev]"

# Or install with PyPi
pip install jfuse          # CPU
pip install jfuse[gpu]     # CUDA

Command Line Interface

jFUSE provides a CLI compatible with FUSE file manager format:

# Run simulation
jfuse run fm_catch.txt bow_at_banff

# Run gradient-based calibration
jfuse run fm_catch.txt bow_at_banff --mode=calib --method=gradient

# Show file manager configuration
jfuse info fm_catch.txt

Download Example Data

We provide a ready-to-use example dataset for jFUSE (lumped and distributed setups).

Download the ZIP release asset and unzip it into a data/ folder:

wget https://github.com/symfluence-org/jFUSE/releases/latest/download/jfuse-example-data.zip
unzip jfuse-example-data.zip
mv jfuse-example-data data

Lumped configuration example

This example calibrates a lumped jFUSE model using ERA5 forcing.

jfuse run \
  data/domain_Bow_at_Banff_lumped_era5/settings/FUSE/fm_catch.txt \
  Bow_at_Banff_lumped_era5 \
  --mode=calib \
  --method=gradient \
  --loss=kge \
  --lr=0.01 \
  --epochs=500 \
  --plot

Distributed configuration example

This example calibrates a distributed jFUSE model using a Muskingum–Cunge routing network.

jfuse run \
  data/domain_Bow_at_Banff_distributed/settings/FUSE/fm_catch.txt \
  Bow_at_Banff_distributed \
  --mode=calib \
  --method=gradient \
  --network=data/domain_Bow_at_Banff_distributed/settings/mizuRoute/topology.nc \
  --obs-file=data/domain_Bow_at_Banff_distributed/observations/streamflow/preprocessed/Bow_at_Banff_distributed_streamflow_processed.csv \
  --loss=kge,nse \
  --lr=0.01 \
  --epochs=1000 \
  --plot

License

GNU General Public License v3.0 (GPL-3.0-only) - see LICENSE file for details.

jFUSE implements the FUSE model of Clark et al. (2008); the original FUSE (NCAR/FUSE) is licensed GPL-3.0, and jFUSE is distributed under the same license.

References

  • Clark, M. P., et al. (2008). Framework for Understanding Structural Errors (FUSE). Water Resources Research, 44, W00B02.
  • Cunge, J. A. (1969). On the subject of a flood propagation computation method (Muskingum method). Journal of Hydraulic Research, 7(2), 205-230.

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

jfuse-0.2.1.tar.gz (123.8 kB view details)

Uploaded Source

Built Distribution

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

jfuse-0.2.1-py3-none-any.whl (126.7 kB view details)

Uploaded Python 3

File details

Details for the file jfuse-0.2.1.tar.gz.

File metadata

  • Download URL: jfuse-0.2.1.tar.gz
  • Upload date:
  • Size: 123.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for jfuse-0.2.1.tar.gz
Algorithm Hash digest
SHA256 11c24d19876f81d800afbdaa3fce431a2ba99a5bd3a472fbe143c84f0fbb7333
MD5 a6abfc841a619ffa8edfc0c65bdc5a7b
BLAKE2b-256 634f435af181dfc8b30f70499705929bf047e055690c167d8208d9fd17ef088b

See more details on using hashes here.

File details

Details for the file jfuse-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: jfuse-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 126.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for jfuse-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e164a273da6d20e9589f619ae71810934e5248ea603a04095350a5f72b904e7a
MD5 96b7d0cef5de2cbf4bc444a9b402c83b
BLAKE2b-256 7a6a3cb20712be6b2774d62f32953d59f649131d3175a3c520040b3f65d90af7

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