hydrodl2 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hydrodl2/__init__.py +122 -0
- hydrodl2/_version.py +34 -0
- hydrodl2/api/__init__.py +3 -0
- hydrodl2/api/methods.py +144 -0
- hydrodl2/core/calc/__init__.py +11 -0
- hydrodl2/core/calc/batch_jacobian.pye +501 -0
- hydrodl2/core/calc/fdj.py +92 -0
- hydrodl2/core/calc/uh_routing.py +105 -0
- hydrodl2/core/calc/utils.py +59 -0
- hydrodl2/core/utils/__init__.py +7 -0
- hydrodl2/core/utils/clean_temp.sh +8 -0
- hydrodl2/core/utils/utils.py +63 -0
- hydrodl2/models/hbv/hbv.py +596 -0
- hydrodl2/models/hbv/hbv_1_1p.py +608 -0
- hydrodl2/models/hbv/hbv_2.py +670 -0
- hydrodl2/models/hbv/hbv_2_hourly.py +897 -0
- hydrodl2/models/hbv/hbv_2_mts.py +377 -0
- hydrodl2/models/hbv/hbv_adj.py +712 -0
- hydrodl2/modules/__init__.py +2 -0
- hydrodl2/modules/data_assimilation/variational_prcp_da.py +1 -0
- hydrodl2-1.3.0.dist-info/METADATA +184 -0
- hydrodl2-1.3.0.dist-info/RECORD +24 -0
- hydrodl2-1.3.0.dist-info/WHEEL +4 -0
- hydrodl2-1.3.0.dist-info/licenses/LICENSE +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Placeholder, example module
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hydrodl2
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: Differentiable Hydrologic Model Library
|
|
5
|
+
Project-URL: Homepage, https://mhpi.github.io/benchmarks/
|
|
6
|
+
Project-URL: Repository, https://github.com/mhpi/hydrodl2
|
|
7
|
+
Project-URL: Documentation, https://github.com/mhpi/hydrodl2/tree/master/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/mhpi/hydrodl2/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/mhpi/hydrodl2/blob/master/docs/CHANGELOG.md
|
|
10
|
+
Author-email: Leo Lonzarich <lglonzaric@gmail.com>, Yalan Song <songyalan1@gmail.com>, Wencong Yang <yangwconion@gmail.com>, Tadd Bindas <taddbindas@gmail.com>
|
|
11
|
+
Maintainer-email: Leo Lonzarich <lglonzaric@gmail.com>
|
|
12
|
+
License: Non-Commercial Software License Agreement
|
|
13
|
+
|
|
14
|
+
By downloading the hydrodl2 software (the βSoftwareβ) you agree to
|
|
15
|
+
the following terms of use:
|
|
16
|
+
Copyright (c) 2020, The Pennsylvania State University (βPSUβ). All rights reserved.
|
|
17
|
+
|
|
18
|
+
1. PSU hereby grants to you a perpetual, nonexclusive and worldwide right, privilege and
|
|
19
|
+
license to use, reproduce, modify, display, and create derivative works of Software for all
|
|
20
|
+
non-commercial purposes only. You may not use Software for commercial purposes without
|
|
21
|
+
prior written consent from PSU. Queries regarding commercial licensing should be directed
|
|
22
|
+
to The Office of Technology Management at 814.865.6277 or otminfo@psu.edu.
|
|
23
|
+
2. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
24
|
+
to endorse or promote products derived from this software without specific prior written
|
|
25
|
+
permission.
|
|
26
|
+
3. This software is provided for non-commercial use only.
|
|
27
|
+
4. Redistribution and use in source and binary forms, with or without modification, are
|
|
28
|
+
permitted provided that redistributions must reproduce the above copyright notice, license,
|
|
29
|
+
list of conditions and the following disclaimer in the documentation and/or other materials
|
|
30
|
+
provided with the distribution.
|
|
31
|
+
|
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS";
|
|
33
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
34
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
35
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
36
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
37
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
38
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
39
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
40
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
41
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Keywords: deep-learning,differentiable-modeling,hybrid-modeling,hydrology,physics-informed,pytorch,scientific-computing
|
|
45
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
46
|
+
Classifier: Intended Audience :: Science/Research
|
|
47
|
+
Classifier: License :: Other/Proprietary License
|
|
48
|
+
Classifier: Operating System :: OS Independent
|
|
49
|
+
Classifier: Programming Language :: Python :: 3
|
|
50
|
+
Classifier: Topic :: Scientific/Engineering
|
|
51
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
52
|
+
Classifier: Topic :: Scientific/Engineering :: Hydrology
|
|
53
|
+
Requires-Python: >=3.9.0
|
|
54
|
+
Requires-Dist: numpy
|
|
55
|
+
Requires-Dist: platformdirs
|
|
56
|
+
Requires-Dist: sourcedefender
|
|
57
|
+
Requires-Dist: torch
|
|
58
|
+
Requires-Dist: tqdm
|
|
59
|
+
Provides-Extra: dev
|
|
60
|
+
Requires-Dist: ipywidgets; extra == 'dev'
|
|
61
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
62
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
63
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
64
|
+
Description-Content-Type: text/markdown
|
|
65
|
+
|
|
66
|
+
# HydroDL2: Differentiable Hydrologic Models
|
|
67
|
+
|
|
68
|
+
<!-- <img src="docs/images/hydrodl2.png" alt="HydroDL2" width="500" height="500"> -->
|
|
69
|
+
|
|
70
|
+
[](https://www.python.org/downloads/)
|
|
71
|
+
[](https://pypi.org/project/hydrodl2/)
|
|
72
|
+
[](https://pytorch.org/)
|
|
73
|
+
|
|
74
|
+
[](https://github.com/mhpi/hydrodl2/actions/workflows/pytest.yaml)
|
|
75
|
+
[](https://github.com/astral-sh/ruff)
|
|
76
|
+
[-yellow?labelColor=333333)](#license)
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
</br>
|
|
81
|
+
|
|
82
|
+
A library of hydrological models developed on PyTorch and designed alongside [πΏMG](https://github.com/mhpi/generic_deltamodel) for the creation of end-to-end [differentiable models](https://www.nature.com/articles/s43017-023-00450-9), enabling parameter learning, bias correction, missing process representation, and more.
|
|
83
|
+
|
|
84
|
+
See [`πΏMG/examples`](https://github.com/mhpi/generic_deltamodel/tree/master/example/hydrology) using HydroDL2-based HBV models for published differentiable parameter learning (dPL) applications.
|
|
85
|
+
|
|
86
|
+
</br>
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv pip install hydrodl2
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For development installs, see [setup](./docs/setup.md).
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## Quick Start
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import hydrodl2
|
|
101
|
+
|
|
102
|
+
# List all available models
|
|
103
|
+
hydrodl2.available_models()
|
|
104
|
+
# {'hbv': ['hbv', 'hbv_1_1p', 'hbv_2', 'hbv_2_hourly', 'hbv_2_mts', 'hbv_adj']}
|
|
105
|
+
|
|
106
|
+
# Load a model class
|
|
107
|
+
Hbv = hydrodl2.load_model('hbv')
|
|
108
|
+
|
|
109
|
+
# Instantiate and use in a differentiable pipeline
|
|
110
|
+
model = Hbv()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Models are standard `torch.nn.Module` subclasses and can be composed with neural networks via [δMG](https://github.com/mhpi/generic_deltamodel) for end-to-end differentiable training.
|
|
114
|
+
|
|
115
|
+
</br>
|
|
116
|
+
|
|
117
|
+
## Available Models
|
|
118
|
+
|
|
119
|
+
| Model | Name | Description |
|
|
120
|
+
|-------|------|-------------|
|
|
121
|
+
| HBV 1.0 | `hbv` | Base differentiable HBV model |
|
|
122
|
+
| HBV 1.1p | `hbv_1_1p` | HBV with capillary rise modification |
|
|
123
|
+
| HBV 2.0 | `hbv_2` | Multi-scale HBV with elevation-dependent parameters |
|
|
124
|
+
| HBV 2.0 Hourly | `hbv_2_hourly` | Sub-daily variant of HBV 2.0 |
|
|
125
|
+
| HBV 2.0 MTS | `hbv_2_mts` | Multi-timescale variant of HBV 2.0 |
|
|
126
|
+
| HBV Adjoint | `hbv_adj` | Implicit scheme with adjoint-based gradients |
|
|
127
|
+
|
|
128
|
+
</br>
|
|
129
|
+
|
|
130
|
+
## Repository Structure
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
.
|
|
134
|
+
βββ src/
|
|
135
|
+
β βββ hydrodl2/
|
|
136
|
+
β βββ api/ # Main API
|
|
137
|
+
β β βββ __init__.py
|
|
138
|
+
β β βββ methods.py # Methods exposed to end-users
|
|
139
|
+
β βββ core/ # Methods used internally
|
|
140
|
+
β βββ models/ # Shared models directory
|
|
141
|
+
β β βββ hbv/ # HBV model variants
|
|
142
|
+
β βββ modules/ # Augmentations for Ξ΄MG models
|
|
143
|
+
βββ docs/
|
|
144
|
+
βββ tests/
|
|
145
|
+
βββ pyproject.toml
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Citation
|
|
149
|
+
|
|
150
|
+
This work is maintained by [MHPI](http://water.engr.psu.edu/shen/) and advised by [Dr. Chaopeng Shen](https://water.engr.psu.edu/shen/). If you find it useful, please cite:
|
|
151
|
+
|
|
152
|
+
> 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
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary>BibTeX</summary>
|
|
156
|
+
|
|
157
|
+
```bibtex
|
|
158
|
+
@article{shen2023differentiable,
|
|
159
|
+
title={Differentiable modelling to unify machine learning and physical models for geosciences},
|
|
160
|
+
author={Shen, Chaopeng and others},
|
|
161
|
+
journal={Nature Reviews Earth \& Environment},
|
|
162
|
+
volume={4},
|
|
163
|
+
number={8},
|
|
164
|
+
pages={552--567},
|
|
165
|
+
year={2023},
|
|
166
|
+
publisher={Nature Publishing Group},
|
|
167
|
+
doi={10.1038/s43017-023-00450-9}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
<!-- ## License
|
|
173
|
+
|
|
174
|
+
HydroDL2 is released under a **Non-Commercial Software License Agreement** by The Pennsylvania State University. It is free for non-commercial use. Commercial use requires prior written consent from PSU. See [LICENSE](./LICENSE) for full terms.
|
|
175
|
+
|
|
176
|
+
For commercial licensing inquiries, contact the Office of Technology Management at 814.865.6277 or otminfo@psu.edu. -->
|
|
177
|
+
|
|
178
|
+
## Contributing
|
|
179
|
+
|
|
180
|
+
We welcome contributions! See [CONTRIBUTING.md](./docs/CONTRIBUTING.md) for details.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
*Please submit an [issue](https://github.com/mhpi/hydrodl2/issues) to report any questions, concerns, or bugs.*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
hydrodl2/__init__.py,sha256=SbRGAJ3txjShRH8oNQPYW53IJ-piXuL3i96Vmful5y8,4295
|
|
2
|
+
hydrodl2/_version.py,sha256=0Oc4EBzGTJOvXX0Vym4evglW1NQPpe8RLn8TdxsKzfs,704
|
|
3
|
+
hydrodl2/api/__init__.py,sha256=dtkUsO7Jr74IAc5cloSy-cVyWathKxbOWFRlp1UoTbw,164
|
|
4
|
+
hydrodl2/api/methods.py,sha256=pKulFU6EturwO1RIq3S4x-vrVx016uMSx-rn6LT6z70,3820
|
|
5
|
+
hydrodl2/core/calc/__init__.py,sha256=PhqjETIQhgwbcBfk4KLi4SksPRnyoP9FRcxAq_Y96NA,274
|
|
6
|
+
hydrodl2/core/calc/batch_jacobian.pye,sha256=t821AKvufpPO2yXaoSSBdqcEV3XtyYPlM0GpJeqI2UA,11002
|
|
7
|
+
hydrodl2/core/calc/fdj.py,sha256=F6l8wyOoeXQQW4Khvu13fDEoOhd7kBu9bliGqR9gMjk,3219
|
|
8
|
+
hydrodl2/core/calc/uh_routing.py,sha256=ojBdM3yole_jMj6Pq-IEIbhOURNV0Kq2frTTtle2fAo,3405
|
|
9
|
+
hydrodl2/core/calc/utils.py,sha256=yjeDn1hfUcLZ54W7HCyFAbYB4RnlKEfn2-FXbK2Fbpo,1274
|
|
10
|
+
hydrodl2/core/utils/__init__.py,sha256=puLCwrSNJZ-EBTmDouHUTpu_tC1WHiTKD0pNv9Bf1e8,137
|
|
11
|
+
hydrodl2/core/utils/clean_temp.sh,sha256=cCk7ixT9VgG4ntZ3s5CT__tM_gie5C1YHSZxPFdhI-8,279
|
|
12
|
+
hydrodl2/core/utils/utils.py,sha256=lw7ihfZSqh0XrdXD3Kt3rvcAQv-ExPFmM86WDrVGXx8,1601
|
|
13
|
+
hydrodl2/models/hbv/hbv.py,sha256=eXO_8r2livte9goFATSCYPLd2w9dlEts2IOR6jd56NU,21996
|
|
14
|
+
hydrodl2/models/hbv/hbv_1_1p.py,sha256=zn6owGL-TtJRRmFNbp8K0i6OHYKbgA9lSgMaxqWLRsc,22513
|
|
15
|
+
hydrodl2/models/hbv/hbv_2.py,sha256=CnDnBaT6kb43PsliP52RbUYcoaPnlpSz3JrXRdNI1KA,24685
|
|
16
|
+
hydrodl2/models/hbv/hbv_2_hourly.py,sha256=OWpji5iYclSU436NlMTsCc6gvSzlecAPzV-5xjy_MCQ,33648
|
|
17
|
+
hydrodl2/models/hbv/hbv_2_mts.py,sha256=qZCQLaR0IsAom2LOejVlgd6yxBaSDfZyUun3KtFck7I,14388
|
|
18
|
+
hydrodl2/models/hbv/hbv_adj.py,sha256=aEFuNb5VeJyd-tSGnAQ2jMx1mZ9eCkQUrw4YxIpOOkw,24289
|
|
19
|
+
hydrodl2/modules/__init__.py,sha256=D-wRwzcIaiMnsDq8-_fus6EPYN_6ZGkW8VeSjOMqqdY,122
|
|
20
|
+
hydrodl2/modules/data_assimilation/variational_prcp_da.py,sha256=t8hCQV5FlI7XyT4ejW4SVjfbFghD8CvGHmlb0zEoIVs,30
|
|
21
|
+
hydrodl2-1.3.0.dist-info/METADATA,sha256=CQLxeoFDKCfVwBoTgXHKvBqFBIE03KV2HGEB-_u5tyg,8494
|
|
22
|
+
hydrodl2-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
23
|
+
hydrodl2-1.3.0.dist-info/licenses/LICENSE,sha256=yDGB6jNoH28KQMIyehPBXbbYmRkOSRUJZfRwa0mXLb4,1975
|
|
24
|
+
hydrodl2-1.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Non-Commercial Software License Agreement
|
|
2
|
+
|
|
3
|
+
By downloading the hydrodl2 software (the βSoftwareβ) you agree to
|
|
4
|
+
the following terms of use:
|
|
5
|
+
Copyright (c) 2020, The Pennsylvania State University (βPSUβ). All rights reserved.
|
|
6
|
+
|
|
7
|
+
1. PSU hereby grants to you a perpetual, nonexclusive and worldwide right, privilege and
|
|
8
|
+
license to use, reproduce, modify, display, and create derivative works of Software for all
|
|
9
|
+
non-commercial purposes only. You may not use Software for commercial purposes without
|
|
10
|
+
prior written consent from PSU. Queries regarding commercial licensing should be directed
|
|
11
|
+
to The Office of Technology Management at 814.865.6277 or otminfo@psu.edu.
|
|
12
|
+
2. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
13
|
+
to endorse or promote products derived from this software without specific prior written
|
|
14
|
+
permission.
|
|
15
|
+
3. This software is provided for non-commercial use only.
|
|
16
|
+
4. Redistribution and use in source and binary forms, with or without modification, are
|
|
17
|
+
permitted provided that redistributions must reproduce the above copyright notice, license,
|
|
18
|
+
list of conditions and the following disclaimer in the documentation and/or other materials
|
|
19
|
+
provided with the distribution.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS";
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
24
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
25
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
26
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
27
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
28
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
29
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
30
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
31
|
+
POSSIBILITY OF SUCH DAMAGE.
|