cavapy 0.1.0__py3-none-any.whl → 0.1.2__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.
Potentially problematic release.
This version of cavapy might be problematic. Click here for more details.
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
Copyright (c) Food and Agriculture Organization of the United Nations. All rights reserved.
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
Copyright (c) Food and Agriculture Organization of the United Nations. All rights reserved.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: cavapy
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: CAVA Python package. Retrive and analyze climate data.
|
|
5
|
+
Home-page: https://github.com/Risk-Team/cavapy
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: Riccardo Soldan
|
|
8
|
+
Author-email: riccardosoldan@hotmail.it
|
|
9
|
+
Requires-Python: >=3.11,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Dist: bottleneck (>=1.4.2,<2.0.0)
|
|
17
|
+
Requires-Dist: dask (>=2024.11.2,<2025.0.0)
|
|
18
|
+
Requires-Dist: geopandas (>=0.14.4,<0.15.0)
|
|
19
|
+
Requires-Dist: llvmlite (==0.43.0)
|
|
20
|
+
Requires-Dist: matplotlib (>=3.9.2,<4.0.0)
|
|
21
|
+
Requires-Dist: netcdf4 (>=1.7.2,<2.0.0)
|
|
22
|
+
Requires-Dist: xclim (>=0.53.2,<0.54.0)
|
|
23
|
+
Project-URL: Repository, https://github.com/Risk-Team/cavapy
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# cavapy: CORDEX-CORE Climate Data Access Simplified
|
|
27
|
+
|
|
28
|
+
## Introduction
|
|
29
|
+
|
|
30
|
+
`cavapy` is a Python library designed to streamline the retrieval of CORDEX-CORE climate models hosted on THREDDS servers at the University of Cantabria. Using the Open-source Project for a Network Data Access Protocol (**OPeNDAP**), users can directly access and subset datasets without the need to download large NetCDF files. This capability is part of the Climate and Agriculture Risk Visualization and Assessment (CAVA) [project](https://risk-team.github.io/CAVAanalytics/articles/CAVA.html), which focuses on providing high-resolution climate data for scientific, environmental, and agricultural applications.
|
|
31
|
+
|
|
32
|
+
With `cavapy`, users can efficiently integrate CORDEX-CORE data into their workflows, making it an ideal resource for hydrological and crop modeling, among other climate-sensitive analyses. Additionally, `cavapy` enables bias correction, potentially enhancing the precision and usability of the data for a wide range of applications.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Data Source
|
|
37
|
+
|
|
38
|
+
The climate data provided by `cavapy` is hosted on the THREDDS data server of the University of Cantabria as part of the CAVA project. CAVA is a collaborative effort by FAO, the University of Cantabria, the University of Cape Town, and Predictia, aimed at democratising accessibility and usability of climate information.
|
|
39
|
+
|
|
40
|
+
### Key Datasets:
|
|
41
|
+
- **CORDEX-CORE Simulations**: Dynamically downscaled high-resolution (25 km) climate models, used in the IPCC AR5 report, featuring simulations from:
|
|
42
|
+
- 3 Global Climate Models (GCMs)
|
|
43
|
+
- 2 Regional Climate Models (RCMs)
|
|
44
|
+
- Two Representative Concentration Pathways (RCPs: RCP4.5 and RCP8.5)
|
|
45
|
+
- **Reanalyses and Observational Datasets**:
|
|
46
|
+
- ERA5
|
|
47
|
+
- W5E5 v2
|
|
48
|
+
|
|
49
|
+
These datasets provide robust inputs for climate and environmental modeling, supporting scientific and policy-driven decision-making.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Available Variables
|
|
54
|
+
|
|
55
|
+
`cavapy` grants access to critical climate variables, enabling integration into diverse modeling frameworks. The variables currently available include:
|
|
56
|
+
|
|
57
|
+
- **Daily Maximum Temperature (tasmax)**: °C
|
|
58
|
+
- **Daily Minimum Temperature (tasmin)**: °C
|
|
59
|
+
- **Daily Precipitation (pr)**: mm
|
|
60
|
+
- **Daily Relative Humidity (hurs)**: %
|
|
61
|
+
- **Daily Wind Speed (sfcWind)**: 2 m level, m/s
|
|
62
|
+
- **Daily Solar Radiation (rsds)**: W/m²
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
cavapy can be installed with pip. Ensure that you are not using a python version > 3.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
conda create -n test python=3.11
|
|
71
|
+
conda activate test
|
|
72
|
+
pip install cavapy
|
|
73
|
+
```
|
|
74
|
+
## Process
|
|
75
|
+
|
|
76
|
+
The get_climate_data function performs automatically:
|
|
77
|
+
- Data retrieval in parallel
|
|
78
|
+
- Unit conversion
|
|
79
|
+
- Convert into a Gregorian calendar (CORDEX-CORE models do not have a full 365 days calendar) through linear interpolation
|
|
80
|
+
- Bias correction using the empirical quantile mapping (optional)
|
|
81
|
+
|
|
82
|
+
## Example usage
|
|
83
|
+
|
|
84
|
+
Depending on the interest, downloading climate data can be done in a few different ways. Note that GCM stands for General Circulation Model while RCP stands for Regional Climate Model. As the climate data comes from the CORDEX-CORE initiative, users can choose between 3 different GCMs downscaled with two RCMs. In total, there are six simulations for any given domain (except for CAS-22 where only three are available).
|
|
85
|
+
Since bias-correction requires both the historical run of the CORDEX model and the observational dataset (in this case ERA5), even when the historical argument is set to False, the historical run will be used for learning the bias correction factor.
|
|
86
|
+
|
|
87
|
+
It takes about 10 minutes to run each of the tasks below. For bigger areas/country, the computational time increases. For example, for Zambia it takes about 30 minutes.
|
|
88
|
+
|
|
89
|
+
### Bias-corrected climate projections
|
|
90
|
+
**By default all available climate variables are used. You can specify a subset with the variable argument**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
import cavapy
|
|
94
|
+
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=True, historical=False)
|
|
95
|
+
```
|
|
96
|
+
### Non bias-corrected climate projections
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
import cavapy
|
|
100
|
+
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=False, historical=False)
|
|
101
|
+
```
|
|
102
|
+
### Bias-corrected climate projections plus the historical run
|
|
103
|
+
|
|
104
|
+
This is useful when assessing changes in crop yield from the historical period. In this case, we provide the bias-corrected historical run of the climate models plus the bias-corrected projections.
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
import cavapy
|
|
108
|
+
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=True, historical=True)
|
|
109
|
+
```
|
|
110
|
+
### Observations only (ERA5)
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
import cavapy
|
|
114
|
+
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=True, bias_correction=True, historical=True, years_obs=range(1980,2019))
|
|
115
|
+
```
|
|
116
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
cavapy.py,sha256=hie9HYVNepHlAiUF7zT0I1Y6Yghf-8WiVm2LLKddeB0,23903
|
|
2
|
+
cavapy-0.1.2.dist-info/LICENSE,sha256=1etyG4_n-Tb3yoNMwQ38g_WxXFQ4E_ZCjZc-AGYPc9U,1151
|
|
3
|
+
cavapy-0.1.2.dist-info/METADATA,sha256=zig0HriF0p6YpEAOAyy07vOCD33lt7sv9ZRUSzVQJ_0,6002
|
|
4
|
+
cavapy-0.1.2.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
|
5
|
+
cavapy-0.1.2.dist-info/RECORD,,
|