geoaquacrop 0.1.0__tar.gz

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.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Josias Lang-Ritter, Christopher Bowden, Seyed Hossein Hosseini, Henrikki Tenkanen, Timothy Foster
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: geoaquacrop
3
+ Version: 0.1.0
4
+ Summary: Unified entry point to the GeoAquaCrop toolchain: preprocessing, gridded simulation, and visualisation
5
+ Author: Josias Lang-Ritter, Chris Bowden, Seyed Hossein Hosseini, Henrikki Tenkanen, Tim Foster
6
+ Maintainer-email: Josias Lang-Ritter <josias.lang-ritter@aalto.fi>, Chris Bowden <christopher.bowden@manchester.ac.uk>, Seyed Hossein Hosseini <seyed.h.hosseini@aalto.fi>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/aquacropos/geoaquacrop
9
+ Project-URL: Documentation, https://geoaquacrop.readthedocs.io
10
+ Project-URL: Preprocessing, https://github.com/aquacropos/geoaquacrop_preprocess
11
+ Project-URL: Simulation, https://github.com/aquacropos/geoaquacrop_simulate
12
+ Project-URL: Visualization, https://github.com/aquacropos/geoaquacrop_visualize
13
+ Keywords: aquacrop,crop model,water productivity,gridded,agriculture
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Scientific/Engineering :: Hydrology
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: geoaquacrop_preprocess>=0.1
23
+ Requires-Dist: geoaquacrop_simulate>=0.1
24
+ Requires-Dist: geoaquacrop_visualize>=0.1
25
+ Provides-Extra: docs
26
+ Requires-Dist: sphinx>=7; extra == "docs"
27
+ Requires-Dist: furo; extra == "docs"
28
+ Dynamic: license-file
29
+
30
+ # GeoAquaCrop
31
+
32
+ > Run AquaCrop-OSPy over large regions in gridded format — from raw global datasets to interactive results.
33
+
34
+ ![Python](https://img.shields.io/badge/python-3.11%2B-blue) ![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue)
35
+
36
+ ## One import, three stages
37
+
38
+ ```python
39
+ import geoaquacrop as gac
40
+
41
+ gac.preprocess.run(...) # download & harmonise the input datasets
42
+ gac.simulate.run(...) # run AquaCrop for every grid cell
43
+ gac.visualize.run() # explore the results
44
+ ```
45
+
46
+ That is the whole API. Each stage is a separately maintained package, but you
47
+ never need to know their names: `geoaquacrop` presents them as one library.
48
+
49
+ ```
50
+ gac.preprocess -> gac.simulate -> gac.visualize
51
+ ```
52
+
53
+ | Stage | What it does | Documentation |
54
+ | ----- | ------------ | ------------- |
55
+ | `gac.preprocess` | Downloads and harmonises climate, soil, crop calendar and crop area data onto a common grid for a given polygon and period | [readthedocs](https://geoaquacrop-preprocessing.readthedocs.io/en/stable/) |
56
+ | `gac.simulate` | Runs AquaCrop per grid cell in parallel; optional yield bias-correction and calibration against observations | [readthedocs](https://geoaquacrop-simulate.readthedocs.io) |
57
+ | `gac.visualize` | Interactive Dash/Plotly dashboard for exploring simulation outputs and climate inputs | [readthedocs](https://geoaquacrop-visualize.readthedocs.io/en/latest/) |
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ conda create -n geoaquacrop python=3.11
63
+ conda activate geoaquacrop
64
+ python -m pip install --pre geoaquacrop
65
+ ```
66
+
67
+ The `--pre` flag is needed while the toolchain is in beta (`0.1.0b1`); pip skips
68
+ pre-release versions otherwise. This installs all three stages.
69
+
70
+ **For past climate data** you also need a free [Copernicus CDS account](https://cds.climate.copernicus.eu/)
71
+ and API token — see the preprocessing documentation.
72
+
73
+ <details>
74
+ <summary>Installing a single stage</summary>
75
+
76
+ Each stage also works standalone, with the same function names:
77
+
78
+ ```bash
79
+ python -m pip install geoaquacrop_preprocess # data preparation only
80
+ python -m pip install geoaquacrop_simulate # simulation only
81
+ python -m pip install geoaquacrop_visualize # visualisation only
82
+ ```
83
+
84
+ ```python
85
+ import geoaquacrop_simulate as simulate
86
+ summary_file, daily_file = simulate.run(data_path='...', start_date='...',
87
+ end_date='...', crop='Wheat_winter')
88
+ ```
89
+
90
+ `gac.simulate.run` and `geoaquacrop_simulate.run` are the same function, so
91
+ code written against either keeps working.
92
+ </details>
93
+
94
+ ## End-to-end example
95
+
96
+ A complete run for one region, using only `gac`.
97
+
98
+ ```python
99
+ import geoaquacrop as gac
100
+
101
+ # 1. prepare the input data
102
+ gac.preprocess.run(
103
+ domain_shape_path='high_plains.geojson', # polygon, EPSG:4326
104
+ start_year=2011,
105
+ end_year=2013,
106
+ api_token='your-copernicus-api-token',
107
+ cell_resolution=0.05,
108
+ workingdirectory='/data/high_plains',
109
+ )
110
+
111
+ # 2. run the simulation
112
+ summary_file, daily_file = gac.simulate.run(
113
+ data_path='/data/high_plains/processed', # fills all four input paths
114
+ start_date='2011/01/01',
115
+ end_date='2013/12/31',
116
+ crop='Wheat_winter',
117
+ irrigation='rainfed',
118
+ output_dir='outputs',
119
+ )
120
+
121
+ # 3. explore the results
122
+ gac.visualize.run() # then open http://localhost:8050
123
+ ```
124
+
125
+ ## What each stage offers
126
+
127
+ ```python
128
+ gac.preprocess.run(...) # prepare every dataset
129
+ gac.preprocess.weather(...) # or re-run a single step
130
+ gac.preprocess.soil(...)
131
+ gac.preprocess.crop_calendar(...)
132
+ gac.preprocess.crop_area(...)
133
+
134
+ gac.simulate.run(data_path=..., ...) # simulate; returns (summary, daily)
135
+ gac.simulate.example_config() # inspect every available setting
136
+ gac.simulate.input_requirements() # print required files and units
137
+ gac.simulate.build_reference(...) # per-year, region-level yield reference
138
+ gac.simulate.correct(config) # bias-correct a saved run, no re-run
139
+ gac.simulate.compare([...]) # comparison figures and statistics
140
+ gac.simulate.load_results(path) # saved results as tidy per-year points
141
+
142
+ gac.visualize.run() # start the dashboard
143
+ ```
144
+
145
+ Importing `geoaquacrop` is cheap: each stage — and its dependencies — loads only
146
+ when you first use it. If a stage is not installed, calling it tells you exactly
147
+ what to install.
148
+
149
+ ## Which stage do I need?
150
+
151
+ - **Model outputs for a region, starting from nothing** — all three.
152
+ - **Already have gridded climate, soil and crop inputs** — `gac.simulate` alone.
153
+ - **Already have simulation outputs** — `gac.visualize` alone.
154
+
155
+ ## Documentation
156
+
157
+ - **This toolchain** — <https://geoaquacrop.readthedocs.io>
158
+ - **Preprocessing** — <https://geoaquacrop-preprocessing.readthedocs.io/en/stable/>
159
+ - **Simulation** — <https://geoaquacrop-simulate.readthedocs.io>
160
+ - **Visualisation** — <https://geoaquacrop-visualize.readthedocs.io/en/latest/>
161
+
162
+ Contributors: see [the stage package standard](https://geoaquacrop.readthedocs.io/en/latest/standard.html)
163
+ for the naming and API contract each stage follows.
164
+
165
+ ## Citation
166
+
167
+ If you use GeoAquaCrop in published work, please cite the toolchain and the
168
+ underlying [AquaCrop-OSPy](https://github.com/aquacropos/aquacrop) model.
169
+
170
+ ## License
171
+
172
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,143 @@
1
+ # GeoAquaCrop
2
+
3
+ > Run AquaCrop-OSPy over large regions in gridded format — from raw global datasets to interactive results.
4
+
5
+ ![Python](https://img.shields.io/badge/python-3.11%2B-blue) ![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue)
6
+
7
+ ## One import, three stages
8
+
9
+ ```python
10
+ import geoaquacrop as gac
11
+
12
+ gac.preprocess.run(...) # download & harmonise the input datasets
13
+ gac.simulate.run(...) # run AquaCrop for every grid cell
14
+ gac.visualize.run() # explore the results
15
+ ```
16
+
17
+ That is the whole API. Each stage is a separately maintained package, but you
18
+ never need to know their names: `geoaquacrop` presents them as one library.
19
+
20
+ ```
21
+ gac.preprocess -> gac.simulate -> gac.visualize
22
+ ```
23
+
24
+ | Stage | What it does | Documentation |
25
+ | ----- | ------------ | ------------- |
26
+ | `gac.preprocess` | Downloads and harmonises climate, soil, crop calendar and crop area data onto a common grid for a given polygon and period | [readthedocs](https://geoaquacrop-preprocessing.readthedocs.io/en/stable/) |
27
+ | `gac.simulate` | Runs AquaCrop per grid cell in parallel; optional yield bias-correction and calibration against observations | [readthedocs](https://geoaquacrop-simulate.readthedocs.io) |
28
+ | `gac.visualize` | Interactive Dash/Plotly dashboard for exploring simulation outputs and climate inputs | [readthedocs](https://geoaquacrop-visualize.readthedocs.io/en/latest/) |
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ conda create -n geoaquacrop python=3.11
34
+ conda activate geoaquacrop
35
+ python -m pip install --pre geoaquacrop
36
+ ```
37
+
38
+ The `--pre` flag is needed while the toolchain is in beta (`0.1.0b1`); pip skips
39
+ pre-release versions otherwise. This installs all three stages.
40
+
41
+ **For past climate data** you also need a free [Copernicus CDS account](https://cds.climate.copernicus.eu/)
42
+ and API token — see the preprocessing documentation.
43
+
44
+ <details>
45
+ <summary>Installing a single stage</summary>
46
+
47
+ Each stage also works standalone, with the same function names:
48
+
49
+ ```bash
50
+ python -m pip install geoaquacrop_preprocess # data preparation only
51
+ python -m pip install geoaquacrop_simulate # simulation only
52
+ python -m pip install geoaquacrop_visualize # visualisation only
53
+ ```
54
+
55
+ ```python
56
+ import geoaquacrop_simulate as simulate
57
+ summary_file, daily_file = simulate.run(data_path='...', start_date='...',
58
+ end_date='...', crop='Wheat_winter')
59
+ ```
60
+
61
+ `gac.simulate.run` and `geoaquacrop_simulate.run` are the same function, so
62
+ code written against either keeps working.
63
+ </details>
64
+
65
+ ## End-to-end example
66
+
67
+ A complete run for one region, using only `gac`.
68
+
69
+ ```python
70
+ import geoaquacrop as gac
71
+
72
+ # 1. prepare the input data
73
+ gac.preprocess.run(
74
+ domain_shape_path='high_plains.geojson', # polygon, EPSG:4326
75
+ start_year=2011,
76
+ end_year=2013,
77
+ api_token='your-copernicus-api-token',
78
+ cell_resolution=0.05,
79
+ workingdirectory='/data/high_plains',
80
+ )
81
+
82
+ # 2. run the simulation
83
+ summary_file, daily_file = gac.simulate.run(
84
+ data_path='/data/high_plains/processed', # fills all four input paths
85
+ start_date='2011/01/01',
86
+ end_date='2013/12/31',
87
+ crop='Wheat_winter',
88
+ irrigation='rainfed',
89
+ output_dir='outputs',
90
+ )
91
+
92
+ # 3. explore the results
93
+ gac.visualize.run() # then open http://localhost:8050
94
+ ```
95
+
96
+ ## What each stage offers
97
+
98
+ ```python
99
+ gac.preprocess.run(...) # prepare every dataset
100
+ gac.preprocess.weather(...) # or re-run a single step
101
+ gac.preprocess.soil(...)
102
+ gac.preprocess.crop_calendar(...)
103
+ gac.preprocess.crop_area(...)
104
+
105
+ gac.simulate.run(data_path=..., ...) # simulate; returns (summary, daily)
106
+ gac.simulate.example_config() # inspect every available setting
107
+ gac.simulate.input_requirements() # print required files and units
108
+ gac.simulate.build_reference(...) # per-year, region-level yield reference
109
+ gac.simulate.correct(config) # bias-correct a saved run, no re-run
110
+ gac.simulate.compare([...]) # comparison figures and statistics
111
+ gac.simulate.load_results(path) # saved results as tidy per-year points
112
+
113
+ gac.visualize.run() # start the dashboard
114
+ ```
115
+
116
+ Importing `geoaquacrop` is cheap: each stage — and its dependencies — loads only
117
+ when you first use it. If a stage is not installed, calling it tells you exactly
118
+ what to install.
119
+
120
+ ## Which stage do I need?
121
+
122
+ - **Model outputs for a region, starting from nothing** — all three.
123
+ - **Already have gridded climate, soil and crop inputs** — `gac.simulate` alone.
124
+ - **Already have simulation outputs** — `gac.visualize` alone.
125
+
126
+ ## Documentation
127
+
128
+ - **This toolchain** — <https://geoaquacrop.readthedocs.io>
129
+ - **Preprocessing** — <https://geoaquacrop-preprocessing.readthedocs.io/en/stable/>
130
+ - **Simulation** — <https://geoaquacrop-simulate.readthedocs.io>
131
+ - **Visualisation** — <https://geoaquacrop-visualize.readthedocs.io/en/latest/>
132
+
133
+ Contributors: see [the stage package standard](https://geoaquacrop.readthedocs.io/en/latest/standard.html)
134
+ for the naming and API contract each stage follows.
135
+
136
+ ## Citation
137
+
138
+ If you use GeoAquaCrop in published work, please cite the toolchain and the
139
+ underlying [AquaCrop-OSPy](https://github.com/aquacropos/aquacrop) model.
140
+
141
+ ## License
142
+
143
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "geoaquacrop"
7
+ version = "0.1.0"
8
+ description = "Unified entry point to the GeoAquaCrop toolchain: preprocessing, gridded simulation, and visualisation"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Josias Lang-Ritter" },
15
+ { name = "Chris Bowden" },
16
+ { name = "Seyed Hossein Hosseini" },
17
+ { name = "Henrikki Tenkanen" },
18
+ { name = "Tim Foster" },
19
+ ]
20
+ maintainers = [
21
+ { name = "Josias Lang-Ritter", email = "josias.lang-ritter@aalto.fi" },
22
+ { name = "Chris Bowden", email = "christopher.bowden@manchester.ac.uk" },
23
+ { name = "Seyed Hossein Hosseini", email = "seyed.h.hosseini@aalto.fi" },
24
+ ]
25
+ keywords = ["aquacrop", "crop model", "water productivity", "gridded", "agriculture"]
26
+
27
+ classifiers = [
28
+ "Development Status :: 4 - Beta",
29
+ "Intended Audience :: Science/Research",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Topic :: Scientific/Engineering :: Hydrology",
33
+ ]
34
+
35
+ # The meta-package installs the three components. Version floors only, so each
36
+ # can be released independently without a coordinated bump here.
37
+ dependencies = [
38
+ "geoaquacrop_preprocess>=0.1",
39
+ "geoaquacrop_simulate>=0.1",
40
+ "geoaquacrop_visualize>=0.1",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ docs = ["sphinx>=7", "furo"]
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/aquacropos/geoaquacrop"
48
+ Documentation = "https://geoaquacrop.readthedocs.io"
49
+ Preprocessing = "https://github.com/aquacropos/geoaquacrop_preprocess"
50
+ Simulation = "https://github.com/aquacropos/geoaquacrop_simulate"
51
+ Visualization = "https://github.com/aquacropos/geoaquacrop_visualize"
52
+
53
+ # The umbrella ships the `geoaquacrop` façade package (a thin, lazily-imported
54
+ # wrapper over the three stage packages) plus the dependency metadata.
55
+ [tool.setuptools.packages.find]
56
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ """GeoAquaCrop — gridded FAO AquaCrop from raw data to results.
2
+
3
+ A single, stable entry point to the three toolchain packages::
4
+
5
+ import geoaquacrop as gac
6
+
7
+ gac.preprocess.run(...) # download & harmonise input datasets
8
+ gac.simulate.run(config) # simulate every grid cell
9
+ gac.visualize.run(...) # explore the results
10
+
11
+ Each stage is also installable and usable on its own
12
+ (``geoaquacrop_preprocess``, ``geoaquacrop_simulate``, ``geoaquacrop_visualize``);
13
+ this package is a thin, curated façade over them, so the names here stay
14
+ stable even if the internals move.
15
+
16
+ Submodules are imported lazily: ``import geoaquacrop`` is cheap, and the heavy
17
+ dependencies of a stage are only loaded when you first touch that stage.
18
+ """
19
+ from importlib import import_module as _import_module
20
+
21
+ __all__ = ["preprocess", "simulate", "visualize"]
22
+ __version__ = "0.1.0b1"
23
+
24
+ _SUBMODULES = frozenset(__all__)
25
+
26
+
27
+ def __getattr__(name):
28
+ """Import a stage on first use (PEP 562)."""
29
+ if name in _SUBMODULES:
30
+ module = _import_module(f"{__name__}.{name}")
31
+ globals()[name] = module
32
+ return module
33
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
34
+
35
+
36
+ def __dir__():
37
+ public = [k for k in globals() if not k.startswith("_")]
38
+ return sorted(set(public) | _SUBMODULES)
@@ -0,0 +1,87 @@
1
+ """Shared helper for the stage façades."""
2
+ from importlib import import_module
3
+
4
+ # stage -> (distribution name, import name, purpose)
5
+
6
+ STAGES = {
7
+ "preprocess": {
8
+ "distribution": "geoaquacrop_preprocess",
9
+ "module": "geoaquacrop_preprocess",
10
+ "purpose": "input data preparation",
11
+ },
12
+ "simulate": {
13
+ "distribution": "geoaquacrop_simulate",
14
+ "module": "geoaquacrop_simulate",
15
+ "purpose": "gridded simulation",
16
+ },
17
+ "visualize": {
18
+ "distribution": "geoaquacrop_visualize",
19
+ "module": "geoaquacrop_visualize",
20
+ "purpose": "result visualisation",
21
+ },
22
+ }
23
+
24
+
25
+ def require(stage):
26
+ """Import the package behind a stage, or explain how to install it.
27
+
28
+ Parameters
29
+ ----------
30
+ stage : str
31
+ One of ``"preprocess"``, ``"simulate"``, ``"visualize"``.
32
+
33
+ Returns
34
+ -------
35
+ module
36
+ The imported stage package.
37
+
38
+ Raises
39
+ ------
40
+ ImportError
41
+ If the stage is not installed, with the command needed to install it.
42
+ """
43
+ spec = STAGES[stage]
44
+ try:
45
+ return import_module(spec["module"])
46
+ except ImportError as exc:
47
+ raise ImportError(
48
+ f"{spec['distribution']} is required for {spec['purpose']} but is "
49
+ f"not installed.\n"
50
+ f" python -m pip install {spec['distribution']}\n"
51
+ f"or install the whole toolchain with:\n"
52
+ f" python -m pip install geoaquacrop"
53
+ ) from exc
54
+
55
+
56
+ def delegate(stage, name):
57
+ """Return the callable a stage package exports under ``name``.
58
+
59
+ Stage packages export their public API at package level (see the stage
60
+ standard), so the façade looks up exactly one name and fails loudly if it
61
+ is absent or not callable.
62
+
63
+ Parameters
64
+ ----------
65
+ stage : str
66
+ One of ``"preprocess"``, ``"simulate"``, ``"visualize"``.
67
+ name : str
68
+ The attribute to fetch from that stage package.
69
+
70
+ Returns
71
+ -------
72
+ callable
73
+
74
+ Raises
75
+ ------
76
+ AttributeError
77
+ If the stage package does not export ``name`` as a callable.
78
+ """
79
+ pkg = require(stage)
80
+ fn = getattr(pkg, name, None)
81
+ if not callable(fn):
82
+ exported = ", ".join(sorted(getattr(pkg, "__all__", []))) or "nothing"
83
+ raise AttributeError(
84
+ f"{pkg.__name__} does not export a callable {name!r}. "
85
+ f"It exports: {exported}. See the GeoAquaCrop stage standard."
86
+ )
87
+ return fn
@@ -0,0 +1,44 @@
1
+ """Input data preparation — :mod:`geoaquacrop.preprocess`.
2
+
3
+ Façade over the ``geoaquacrop_preprocess`` package::
4
+
5
+ import geoaquacrop as gac
6
+
7
+ gac.preprocess.run(domain_shape_path='region.geojson', start_year=2011,
8
+ end_year=2013, api_token='...', cell_resolution=0.05,
9
+ workingdirectory='/data/region')
10
+
11
+ :func:`run` prepares every dataset a simulation needs. The per-dataset helpers
12
+ re-run a single step; each requires the stage package to export that step at
13
+ package level (see the stage standard), and raises an explicit error if the
14
+ installed version does not.
15
+ """
16
+ from ._util import delegate
17
+
18
+ __all__ = ["run", "weather", "soil", "crop_calendar", "crop_area"]
19
+
20
+
21
+ def run(*args, **kwargs):
22
+ """Download and harmonise every input dataset for a domain and period."""
23
+ return delegate("preprocess", "run")(
24
+ *args, **kwargs)
25
+
26
+
27
+ def weather(*args, **kwargs):
28
+ """Prepare the climate inputs only."""
29
+ return delegate("preprocess", "weather")(*args, **kwargs)
30
+
31
+
32
+ def soil(*args, **kwargs):
33
+ """Prepare the soil inputs only."""
34
+ return delegate("preprocess", "soil")(*args, **kwargs)
35
+
36
+
37
+ def crop_calendar(*args, **kwargs):
38
+ """Prepare the crop calendar (planting day, season length) only."""
39
+ return delegate("preprocess", "crop_calendar")(*args, **kwargs)
40
+
41
+
42
+ def crop_area(*args, **kwargs):
43
+ """Prepare the crop area mask only."""
44
+ return delegate("preprocess", "crop_area")(*args, **kwargs)
@@ -0,0 +1,85 @@
1
+ """Gridded AquaCrop simulation — :mod:`geoaquacrop.simulate`.
2
+
3
+ Façade over the ``geoaquacrop_simulate`` package::
4
+
5
+ import geoaquacrop as gac
6
+
7
+ summary_file, daily_file = gac.simulate.run(
8
+ data_path='/data/region/processed',
9
+ start_date='2011/01/01', end_date='2013/12/31',
10
+ crop='Wheat_winter', irrigation='rainfed')
11
+
12
+ Every name here is re-exported from ``geoaquacrop_simulate``; the two are
13
+ interchangeable, so code written against either keeps working.
14
+ """
15
+ from ._util import delegate, require
16
+
17
+ __all__ = ["run", "example_config", "input_requirements", "build_reference",
18
+ "correct", "compare", "load_results"]
19
+
20
+
21
+ def run(config=None, **kwargs):
22
+ """Run a simulation for every cell in the domain.
23
+
24
+ Settings are given as keyword arguments::
25
+
26
+ gac.simulate.run(data_path='/data/region/processed',
27
+ start_date='2011/01/01', end_date='2013/12/31',
28
+ crop='Wheat_winter', irrigation='rainfed')
29
+
30
+ ``data_path`` fills all four input paths at once. See
31
+ :func:`example_config` for every available setting, or the stage
32
+ documentation for the full reference.
33
+
34
+ Parameters
35
+ ----------
36
+ config : dict, optional
37
+ A configuration dictionary to start from, for programmatic use; any
38
+ keyword argument overrides the matching entry.
39
+ **kwargs
40
+ Simulation settings such as ``data_path``, ``start_date``,
41
+ ``end_date``, ``crop``, ``irrigation``, ``output_dir``, ``correction``.
42
+
43
+ Returns
44
+ -------
45
+ tuple
46
+ ``(summary_file, daily_file)``, or ``(None, None)`` if the call only
47
+ corrected an already-saved run.
48
+ """
49
+ return delegate("simulate", "run")(config, **kwargs)
50
+
51
+
52
+ def example_config():
53
+ """Return the example configuration, to inspect the available settings.
54
+
55
+ Not a required step: :func:`run` takes the same settings as keyword
56
+ arguments. Useful for seeing every key and its default.
57
+ """
58
+ return delegate("simulate", "example_config")()
59
+
60
+
61
+ def input_requirements():
62
+ """Print the input files a simulation needs, with units and naming."""
63
+ return delegate("simulate", "input_requirements")()
64
+
65
+
66
+ def build_reference(**kwargs):
67
+ """Build a per-year, region-level yield reference from a boundary file and
68
+ a statistics table."""
69
+ return delegate("simulate", "build_reference")(**kwargs)
70
+
71
+
72
+ def correct(config, logger=None):
73
+ """Bias-correct or calibrate an already-saved run, without re-simulating."""
74
+ return delegate("simulate", "correct")(config, logger=logger)
75
+
76
+
77
+ def compare(args=None):
78
+ """Compare corrected runs against the reference: per-year maps, region
79
+ difference maps, a domain time series and a statistics table."""
80
+ return delegate("simulate", "compare")(args)
81
+
82
+
83
+ def load_results(path, value_col="Dry yield (tonne/ha)", start_year=None):
84
+ """Load a saved ``summary_results_*.pkl`` as tidy per-year points."""
85
+ return delegate("simulate", "load_results")(path, value_col, start_year)
@@ -0,0 +1,16 @@
1
+ """Result visualisation — :mod:`geoaquacrop.visualize`.
2
+
3
+ Façade over the ``geoaquacrop_visualize`` package::
4
+
5
+ import geoaquacrop as gac
6
+
7
+ gac.visualize.run() # starts the dashboard, then open the printed URL
8
+ """
9
+ from ._util import delegate
10
+
11
+ __all__ = ["run"]
12
+
13
+
14
+ def run(*args, **kwargs):
15
+ """Start the interactive dashboard."""
16
+ return delegate("visualize", "run")(*args, **kwargs)
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: geoaquacrop
3
+ Version: 0.1.0
4
+ Summary: Unified entry point to the GeoAquaCrop toolchain: preprocessing, gridded simulation, and visualisation
5
+ Author: Josias Lang-Ritter, Chris Bowden, Seyed Hossein Hosseini, Henrikki Tenkanen, Tim Foster
6
+ Maintainer-email: Josias Lang-Ritter <josias.lang-ritter@aalto.fi>, Chris Bowden <christopher.bowden@manchester.ac.uk>, Seyed Hossein Hosseini <seyed.h.hosseini@aalto.fi>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/aquacropos/geoaquacrop
9
+ Project-URL: Documentation, https://geoaquacrop.readthedocs.io
10
+ Project-URL: Preprocessing, https://github.com/aquacropos/geoaquacrop_preprocess
11
+ Project-URL: Simulation, https://github.com/aquacropos/geoaquacrop_simulate
12
+ Project-URL: Visualization, https://github.com/aquacropos/geoaquacrop_visualize
13
+ Keywords: aquacrop,crop model,water productivity,gridded,agriculture
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Scientific/Engineering :: Hydrology
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: geoaquacrop_preprocess>=0.1
23
+ Requires-Dist: geoaquacrop_simulate>=0.1
24
+ Requires-Dist: geoaquacrop_visualize>=0.1
25
+ Provides-Extra: docs
26
+ Requires-Dist: sphinx>=7; extra == "docs"
27
+ Requires-Dist: furo; extra == "docs"
28
+ Dynamic: license-file
29
+
30
+ # GeoAquaCrop
31
+
32
+ > Run AquaCrop-OSPy over large regions in gridded format — from raw global datasets to interactive results.
33
+
34
+ ![Python](https://img.shields.io/badge/python-3.11%2B-blue) ![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue)
35
+
36
+ ## One import, three stages
37
+
38
+ ```python
39
+ import geoaquacrop as gac
40
+
41
+ gac.preprocess.run(...) # download & harmonise the input datasets
42
+ gac.simulate.run(...) # run AquaCrop for every grid cell
43
+ gac.visualize.run() # explore the results
44
+ ```
45
+
46
+ That is the whole API. Each stage is a separately maintained package, but you
47
+ never need to know their names: `geoaquacrop` presents them as one library.
48
+
49
+ ```
50
+ gac.preprocess -> gac.simulate -> gac.visualize
51
+ ```
52
+
53
+ | Stage | What it does | Documentation |
54
+ | ----- | ------------ | ------------- |
55
+ | `gac.preprocess` | Downloads and harmonises climate, soil, crop calendar and crop area data onto a common grid for a given polygon and period | [readthedocs](https://geoaquacrop-preprocessing.readthedocs.io/en/stable/) |
56
+ | `gac.simulate` | Runs AquaCrop per grid cell in parallel; optional yield bias-correction and calibration against observations | [readthedocs](https://geoaquacrop-simulate.readthedocs.io) |
57
+ | `gac.visualize` | Interactive Dash/Plotly dashboard for exploring simulation outputs and climate inputs | [readthedocs](https://geoaquacrop-visualize.readthedocs.io/en/latest/) |
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ conda create -n geoaquacrop python=3.11
63
+ conda activate geoaquacrop
64
+ python -m pip install --pre geoaquacrop
65
+ ```
66
+
67
+ The `--pre` flag is needed while the toolchain is in beta (`0.1.0b1`); pip skips
68
+ pre-release versions otherwise. This installs all three stages.
69
+
70
+ **For past climate data** you also need a free [Copernicus CDS account](https://cds.climate.copernicus.eu/)
71
+ and API token — see the preprocessing documentation.
72
+
73
+ <details>
74
+ <summary>Installing a single stage</summary>
75
+
76
+ Each stage also works standalone, with the same function names:
77
+
78
+ ```bash
79
+ python -m pip install geoaquacrop_preprocess # data preparation only
80
+ python -m pip install geoaquacrop_simulate # simulation only
81
+ python -m pip install geoaquacrop_visualize # visualisation only
82
+ ```
83
+
84
+ ```python
85
+ import geoaquacrop_simulate as simulate
86
+ summary_file, daily_file = simulate.run(data_path='...', start_date='...',
87
+ end_date='...', crop='Wheat_winter')
88
+ ```
89
+
90
+ `gac.simulate.run` and `geoaquacrop_simulate.run` are the same function, so
91
+ code written against either keeps working.
92
+ </details>
93
+
94
+ ## End-to-end example
95
+
96
+ A complete run for one region, using only `gac`.
97
+
98
+ ```python
99
+ import geoaquacrop as gac
100
+
101
+ # 1. prepare the input data
102
+ gac.preprocess.run(
103
+ domain_shape_path='high_plains.geojson', # polygon, EPSG:4326
104
+ start_year=2011,
105
+ end_year=2013,
106
+ api_token='your-copernicus-api-token',
107
+ cell_resolution=0.05,
108
+ workingdirectory='/data/high_plains',
109
+ )
110
+
111
+ # 2. run the simulation
112
+ summary_file, daily_file = gac.simulate.run(
113
+ data_path='/data/high_plains/processed', # fills all four input paths
114
+ start_date='2011/01/01',
115
+ end_date='2013/12/31',
116
+ crop='Wheat_winter',
117
+ irrigation='rainfed',
118
+ output_dir='outputs',
119
+ )
120
+
121
+ # 3. explore the results
122
+ gac.visualize.run() # then open http://localhost:8050
123
+ ```
124
+
125
+ ## What each stage offers
126
+
127
+ ```python
128
+ gac.preprocess.run(...) # prepare every dataset
129
+ gac.preprocess.weather(...) # or re-run a single step
130
+ gac.preprocess.soil(...)
131
+ gac.preprocess.crop_calendar(...)
132
+ gac.preprocess.crop_area(...)
133
+
134
+ gac.simulate.run(data_path=..., ...) # simulate; returns (summary, daily)
135
+ gac.simulate.example_config() # inspect every available setting
136
+ gac.simulate.input_requirements() # print required files and units
137
+ gac.simulate.build_reference(...) # per-year, region-level yield reference
138
+ gac.simulate.correct(config) # bias-correct a saved run, no re-run
139
+ gac.simulate.compare([...]) # comparison figures and statistics
140
+ gac.simulate.load_results(path) # saved results as tidy per-year points
141
+
142
+ gac.visualize.run() # start the dashboard
143
+ ```
144
+
145
+ Importing `geoaquacrop` is cheap: each stage — and its dependencies — loads only
146
+ when you first use it. If a stage is not installed, calling it tells you exactly
147
+ what to install.
148
+
149
+ ## Which stage do I need?
150
+
151
+ - **Model outputs for a region, starting from nothing** — all three.
152
+ - **Already have gridded climate, soil and crop inputs** — `gac.simulate` alone.
153
+ - **Already have simulation outputs** — `gac.visualize` alone.
154
+
155
+ ## Documentation
156
+
157
+ - **This toolchain** — <https://geoaquacrop.readthedocs.io>
158
+ - **Preprocessing** — <https://geoaquacrop-preprocessing.readthedocs.io/en/stable/>
159
+ - **Simulation** — <https://geoaquacrop-simulate.readthedocs.io>
160
+ - **Visualisation** — <https://geoaquacrop-visualize.readthedocs.io/en/latest/>
161
+
162
+ Contributors: see [the stage package standard](https://geoaquacrop.readthedocs.io/en/latest/standard.html)
163
+ for the naming and API contract each stage follows.
164
+
165
+ ## Citation
166
+
167
+ If you use GeoAquaCrop in published work, please cite the toolchain and the
168
+ underlying [AquaCrop-OSPy](https://github.com/aquacropos/aquacrop) model.
169
+
170
+ ## License
171
+
172
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/geoaquacrop/__init__.py
5
+ src/geoaquacrop/_util.py
6
+ src/geoaquacrop/preprocess.py
7
+ src/geoaquacrop/simulate.py
8
+ src/geoaquacrop/visualize.py
9
+ src/geoaquacrop.egg-info/PKG-INFO
10
+ src/geoaquacrop.egg-info/SOURCES.txt
11
+ src/geoaquacrop.egg-info/dependency_links.txt
12
+ src/geoaquacrop.egg-info/requires.txt
13
+ src/geoaquacrop.egg-info/top_level.txt
@@ -0,0 +1,7 @@
1
+ geoaquacrop_preprocess>=0.1
2
+ geoaquacrop_simulate>=0.1
3
+ geoaquacrop_visualize>=0.1
4
+
5
+ [docs]
6
+ sphinx>=7
7
+ furo
@@ -0,0 +1 @@
1
+ geoaquacrop