Skip to main content

Differentiable Earth System Coupler

Project description

dCoupler

Differentiable Earth System Coupler — a PyTorch-based framework for building differentiable coupling graphs between hydrological and earth system model components.

Quickstart

pip install dcoupler
import torch
import dcoupler as dc

# Define two components
class Bucket(dc.DifferentiableComponent):
    ...

class Router(dc.DifferentiableComponent):
    ...

# Build coupling graph
graph = dc.CouplingGraph()
graph.add_component(bucket)
graph.add_component(router)
graph.connect("bucket", "runoff", "router", "lateral_inflow")

# Run forward
outputs = graph.forward(external_inputs, n_timesteps=365, dt=86400)

# Optimize via backprop
loss = loss_fn(outputs, observations)
loss.backward()
optimizer.step()

Component Types

Type Gradient Use Case
DifferentiableComponent PyTorch autograd Pure PyTorch models
JAXComponent JAX vjp via bridge JAX models (XAJ, SAC-SMA, Snow-17)
ProcessComponent None / finite diff External executables (SUMMA, MESH)
EnzymeComponent Enzyme AD C++ models with Enzyme

All component types implement the BMIMixin protocol for standardized lifecycle management (initialize/update/finalize).

Optional Dependencies

pip install dcoupler[jax]     # JAX bridge support
pip install dcoupler[models]  # cfuse + droute components
pip install dcoupler[all]     # Everything

License

Apache 2.0 — see LICENSE for details.

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

dcoupler-0.2.0.tar.gz (40.2 kB view details)

Uploaded Source

Built Distribution

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

dcoupler-0.2.0-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file dcoupler-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for dcoupler-0.2.0.tar.gz
Algorithm Hash digest
SHA256 df6ab1d9a8700e8c16719aaba06428be8ad4c4bc5229b33d3e012ecf88b37033
MD5 2e73c7b89788e6c18d4a69727b8541dd
BLAKE2b-256 15cb9e9b424605923d0c655d4f18e3c12c921d169634b11cf53937eadfd11cc8

See more details on using hashes here.

File details

Details for the file dcoupler-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dcoupler-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 752d6ad4fe5a89032a1d8fbab1cc6ec4a9e39ab617fd866e272fc80eec7ea47f
MD5 b41d5355263c063b9047c64389ef3ae7
BLAKE2b-256 175d24da103def5a928632ef7a0a0b0c0f71b0becb1192de0c93be043be2f425

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