sadc-cft 6.0.2__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.
- sadc_cft-6.0.2/PKG-INFO +306 -0
- sadc_cft-6.0.2/README.md +274 -0
- sadc_cft-6.0.2/pyproject.toml +74 -0
- sadc_cft-6.0.2/setup.cfg +4 -0
- sadc_cft-6.0.2/src/cft/__init__.py +0 -0
- sadc_cft-6.0.2/src/cft/__main__.py +94 -0
- sadc_cft-6.0.2/src/cft/cft.ico +0 -0
- sadc_cft-6.0.2/src/cft/cft.ui +121 -0
- sadc_cft-6.0.2/src/cft/dictionaries/crossvalidator_config.json +5 -0
- sadc_cft-6.0.2/src/cft/dictionaries/data_sources.json +562 -0
- sadc_cft-6.0.2/src/cft/dictionaries/deep_config.json +6 -0
- sadc_cft-6.0.2/src/cft/dictionaries/preprocessor_config.json +5 -0
- sadc_cft-6.0.2/src/cft/dictionaries/regressor_config.json +8 -0
- sadc_cft-6.0.2/src/cft/download.py +135 -0
- sadc_cft-6.0.2/src/cft/download.ui +565 -0
- sadc_cft-6.0.2/src/cft/forecast.py +656 -0
- sadc_cft-6.0.2/src/cft/forecast.ui +515 -0
- sadc_cft-6.0.2/src/cft/functions/__init__.py +0 -0
- sadc_cft-6.0.2/src/cft/functions/functions_download.py +1072 -0
- sadc_cft-6.0.2/src/cft/functions/functions_forecast.py +3843 -0
- sadc_cft-6.0.2/src/cft/functions/functions_verification.py +1887 -0
- sadc_cft-6.0.2/src/cft/functions/functions_zoning.py +107 -0
- sadc_cft-6.0.2/src/cft/gl.py +1 -0
- sadc_cft-6.0.2/src/cft/synthesis.py +524 -0
- sadc_cft-6.0.2/src/cft/synthesis.ui +560 -0
- sadc_cft-6.0.2/src/cft/verification.py +620 -0
- sadc_cft-6.0.2/src/cft/verification.ui +1115 -0
- sadc_cft-6.0.2/src/cft/zoning.py +843 -0
- sadc_cft-6.0.2/src/cft/zoning.ui +925 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/PKG-INFO +306 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/SOURCES.txt +33 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/dependency_links.txt +1 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/entry_points.txt +7 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/requires.txt +22 -0
- sadc_cft-6.0.2/src/sadc_cft.egg-info/top_level.txt +1 -0
sadc_cft-6.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sadc-cft
|
|
3
|
+
Version: 6.0.2
|
|
4
|
+
Summary: Climate Forecasting Tool package to support generation of seasonal forecast by SADC CSC and National Met Services
|
|
5
|
+
Author-email: Piotr Wolski <wolski@csag.uct.ac.za>, Sunshine Gamedze <sgamedze@sadc.int>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sadccsc/cft
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: pandas
|
|
12
|
+
Requires-Dist: geopandas
|
|
13
|
+
Requires-Dist: xarray
|
|
14
|
+
Requires-Dist: rioxarray
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Requires-Dist: shapely
|
|
17
|
+
Requires-Dist: rasterio
|
|
18
|
+
Requires-Dist: rasterstats
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: statsmodels
|
|
21
|
+
Requires-Dist: netCDF4
|
|
22
|
+
Requires-Dist: cftime
|
|
23
|
+
Requires-Dist: geojson
|
|
24
|
+
Requires-Dist: descartes
|
|
25
|
+
Requires-Dist: geocube
|
|
26
|
+
Requires-Dist: GDAL
|
|
27
|
+
Requires-Dist: requests
|
|
28
|
+
Requires-Dist: matplotlib
|
|
29
|
+
Requires-Dist: cartopy
|
|
30
|
+
Requires-Dist: PyQt5
|
|
31
|
+
Requires-Dist: cdsapi
|
|
32
|
+
|
|
33
|
+
# cft
|
|
34
|
+
Climate Forecasting Toolbox
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
INTRODUCTION
|
|
38
|
+
------------
|
|
39
|
+
The Climate Forecasting Toolbox is a Python based tool for statistical climate forecasting.
|
|
40
|
+
|
|
41
|
+
CREDITS
|
|
42
|
+
=======
|
|
43
|
+
Piotr Wolski (wolski@csag.uct.ac.za)
|
|
44
|
+
Sunshine Gamedze (sgamedze@sadc.int)
|
|
45
|
+
|
|
46
|
+
Oringinal developer (2017-2022):
|
|
47
|
+
Thembani Moitlhobogi
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Development history
|
|
52
|
+
=======
|
|
53
|
+
Current version is developed under funding from First Rains project.
|
|
54
|
+
|
|
55
|
+
Development in 2023-2025 has been funded under SADC CSC ClimSA project.
|
|
56
|
+
|
|
57
|
+
In November 2022, the software has been ported from the original personal github repo https://github.com/taxmanyana/cft to https://github.com/sadc-csc/cft
|
|
58
|
+
|
|
59
|
+
Original version developed during 2010-2017 under funding from SADC CSC project SARCIS-DR.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
SOURCE CODE
|
|
63
|
+
------------
|
|
64
|
+
From version 6.0.0, the CFT code is available as pip package https://pypi.org/project/sadc-cft/
|
|
65
|
+
From version 4.0.0, the CFT code is maintained at: https://github.com/sadc-csc
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Basic functionality of v5 and later:
|
|
69
|
+
------------
|
|
70
|
+
Five modules:
|
|
71
|
+
data download (including from CDS from v6.0)
|
|
72
|
+
forecast (updated in v5)
|
|
73
|
+
zoning (since v3)
|
|
74
|
+
verification (since v4)
|
|
75
|
+
synthesis (since v4)
|
|
76
|
+
|
|
77
|
+
Download module
|
|
78
|
+
------------
|
|
79
|
+
Downloads following data types from sources:
|
|
80
|
+
|
|
81
|
+
1) gridded predictors from CDS:
|
|
82
|
+
- SST, GPH, rainfall, air temperature from all models (save UKMO one) available on CDS in July 2026.
|
|
83
|
+
2) gridded predictand from CDS:
|
|
84
|
+
- rainfall and temperatures from CDS ERA5 dataset
|
|
85
|
+
3) gridded predictors from IRIDL (legacy):
|
|
86
|
+
- SST
|
|
87
|
+
4) gridded predictand from IRIDL (legacy):
|
|
88
|
+
- CHIPRS precipitation
|
|
89
|
+
5) gridded forecast and hindcast data from IRIDL (legacy):
|
|
90
|
+
- SST, precipitation and geopotential height for three models from NMME that were operational in August 2025
|
|
91
|
+
6) teleconnection indices from JMA (because they have lowest latency)
|
|
92
|
+
- IOD, Nino3, Nino4
|
|
93
|
+
|
|
94
|
+
Data are downloaded to user-selected directory
|
|
95
|
+
All data are converted to a format ingestible by CFT
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
Forecast module
|
|
99
|
+
------------
|
|
100
|
+
Takes two types of data as predictand:
|
|
101
|
+
- gridded data
|
|
102
|
+
- station data
|
|
103
|
+
|
|
104
|
+
Takes three types of data as predictor:
|
|
105
|
+
- observed teleconnection indices
|
|
106
|
+
- observed gridded data (SST)
|
|
107
|
+
- forecasted gridded fields (not yet implemented)
|
|
108
|
+
|
|
109
|
+
Produces forecast for:
|
|
110
|
+
- grid - if predictand is gridded
|
|
111
|
+
- zones - if predictand is either gridded or station data, with spatial aggregation of data into zonal average, and generation of forecast for that zonal average
|
|
112
|
+
- points - if predictand is station data
|
|
113
|
+
|
|
114
|
+
Allows three pre-processing approaches:
|
|
115
|
+
- PCR - gridded predictor is processed to derive Principal Components (aka EOFs), and these are used in a statistical model as predictors. This can be applied to gridded predictor, and any type of predictand.
|
|
116
|
+
- CCA - canonical components are derived from predictor and predictand data
|
|
117
|
+
- no preprocessing - this can be applied to gridded predictor and any type of predictand.
|
|
118
|
+
implements the following statistical models:
|
|
119
|
+
- OLS regression
|
|
120
|
+
- MLP regression
|
|
121
|
+
- Decision trees
|
|
122
|
+
- Random Forest
|
|
123
|
+
- Lasso regression
|
|
124
|
+
- Ridge regression
|
|
125
|
+
|
|
126
|
+
Two types of forecast are calculated:
|
|
127
|
+
- deterministic forecast
|
|
128
|
+
- tercile probabilistic forecast
|
|
129
|
+
|
|
130
|
+
Tercile forecast is also presented as a 4-category forecast, where normal category is split into normal-to-above and normal-to-below. No probabilities are allocated to these two categories.
|
|
131
|
+
|
|
132
|
+
All forecasts are cross-validated.
|
|
133
|
+
|
|
134
|
+
Two cross-validation approaches are possible:
|
|
135
|
+
- leave-one-out
|
|
136
|
+
- k-fold
|
|
137
|
+
|
|
138
|
+
Skill indices are calculated through cross-validation from out-of-fold predictions. The following skill indices are included:
|
|
139
|
+
- ROC score (above, below, normal)
|
|
140
|
+
- RPSS
|
|
141
|
+
- correlation
|
|
142
|
+
- Heidke skill score for highest probability category
|
|
143
|
+
- ignorance score
|
|
144
|
+
- reliability score
|
|
145
|
+
- Brier skill score
|
|
146
|
+
- 2AFC
|
|
147
|
+
|
|
148
|
+
Probabilistic forecast are calibrated using quantile mapping approach:
|
|
149
|
+
- quantile transform is developed based on overlapping hindcast and observed predictand data
|
|
150
|
+
- transform is applied to hindcast and forecast data
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
Other modules - zoning, verification, synthesis
|
|
155
|
+
------------
|
|
156
|
+
|
|
157
|
+
In v5.1 zoning module has been adapted to run under v5 environment.
|
|
158
|
+
|
|
159
|
+
Other packages were not updated in v5.0 , thus not described here explicitly
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Requirements:
|
|
163
|
+
------------
|
|
164
|
+
python 3.12
|
|
165
|
+
python packages:
|
|
166
|
+
# scientific / data stack - used throughout functions_forecast.py
|
|
167
|
+
"numpy",
|
|
168
|
+
"pandas",
|
|
169
|
+
"geopandas",
|
|
170
|
+
"xarray",
|
|
171
|
+
"rioxarray",
|
|
172
|
+
"scipy",
|
|
173
|
+
"shapely",
|
|
174
|
+
"rasterio",
|
|
175
|
+
"rasterstats",
|
|
176
|
+
"scikit-learn",
|
|
177
|
+
"statsmodels",
|
|
178
|
+
"netCDF4",
|
|
179
|
+
"cftime",
|
|
180
|
+
"geojson",
|
|
181
|
+
"descartes",
|
|
182
|
+
"geocube",
|
|
183
|
+
"GDAL", # provides the 'osgeo' module (zoning.py's ogr usage)
|
|
184
|
+
"requests",
|
|
185
|
+
|
|
186
|
+
# plotting / mapping
|
|
187
|
+
"matplotlib",
|
|
188
|
+
"cartopy",
|
|
189
|
+
|
|
190
|
+
# GUI
|
|
191
|
+
"PyQt5",
|
|
192
|
+
|
|
193
|
+
#CDS api
|
|
194
|
+
"cdsapi",
|
|
195
|
+
|
|
196
|
+
Installation
|
|
197
|
+
------------
|
|
198
|
+
|
|
199
|
+
Python environment
|
|
200
|
+
=======
|
|
201
|
+
|
|
202
|
+
Installation should be done into a dedicated Python environment.
|
|
203
|
+
|
|
204
|
+
This requires installation of either:
|
|
205
|
+
- Ancaconda framework (bulky, >1GB) https://www.anaconda.com/download/success
|
|
206
|
+
- Miniforge (installs both Conda and Mamba) - https://github.com/conda-forge/miniforge
|
|
207
|
+
- Micromamba (installs Mamba - lightweight, but for advanced users) https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Once installed, create a python enviroment e.g.
|
|
211
|
+
|
|
212
|
+
mamba create --name cft-env python=3.12
|
|
213
|
+
|
|
214
|
+
note - it is recommended that python 3.12 is used for version 6.0
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
Prerequisites
|
|
218
|
+
=======
|
|
219
|
+
The sadc-cft package is installed with pip, but pip does not handle GDAL libraries well. These have to be preinstalled using conda or mamba:
|
|
220
|
+
|
|
221
|
+
(one has to activate the cft environment first, of course)
|
|
222
|
+
mamba activate cft-env
|
|
223
|
+
|
|
224
|
+
(and then:)
|
|
225
|
+
mamba install -c conda-forge gdal=3.13.2
|
|
226
|
+
|
|
227
|
+
Installation with pip
|
|
228
|
+
=======
|
|
229
|
+
Once gdal is installed, sadc-cft package is installed using pip.
|
|
230
|
+
|
|
231
|
+
pip install sadc-cft
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
confirm that installation is complete:
|
|
235
|
+
|
|
236
|
+
python cft
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
How to use - GUI
|
|
240
|
+
------------
|
|
241
|
+
|
|
242
|
+
The main GUI of sadc-cft can be invoked as follows:
|
|
243
|
+
|
|
244
|
+
(one has to activate the cft environment first, of course)
|
|
245
|
+
mamba activate cft-env
|
|
246
|
+
|
|
247
|
+
(and then simply:)
|
|
248
|
+
cft
|
|
249
|
+
|
|
250
|
+
(or:)
|
|
251
|
+
|
|
252
|
+
python -m cft
|
|
253
|
+
|
|
254
|
+
Individual components (forecast, verification, synthesis, zoning and download) can be started directly as follows:
|
|
255
|
+
|
|
256
|
+
>forecast-tool
|
|
257
|
+
|
|
258
|
+
(or:)
|
|
259
|
+
|
|
260
|
+
python -m cft.forecast
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
How to use - without GUI
|
|
264
|
+
------------
|
|
265
|
+
|
|
266
|
+
individual packages can be invoked in Python without GUI.
|
|
267
|
+
|
|
268
|
+
from cft.forecast import computeModelNoGui
|
|
269
|
+
|
|
270
|
+
and then run as follows:
|
|
271
|
+
|
|
272
|
+
computeModelNoGui(config)
|
|
273
|
+
|
|
274
|
+
where config is a dictionary containing forecast model configuration entries e.g.
|
|
275
|
+
|
|
276
|
+
config={'rootDir': '../test',
|
|
277
|
+
'predictorYear': 2026,
|
|
278
|
+
'predictorMonth': 'Jun',
|
|
279
|
+
'fcstTargetSeas': 'Aug-Oct',
|
|
280
|
+
'fcstTargetYear': 2026,
|
|
281
|
+
'climEndYr': 2015,
|
|
282
|
+
'climStartYr': 1994,
|
|
283
|
+
'predictorExtents': {'minLon': -180.0,
|
|
284
|
+
'maxLon': 180.0,
|
|
285
|
+
'minLat': -60.0,
|
|
286
|
+
'maxLat': 60.0},
|
|
287
|
+
'predictorFileName': '/work/code/csc/cft/test/GPH850_System9_CDS_Jun_s300s200e150e250_1981-2026.nc',
|
|
288
|
+
'predictorVar': 'z',
|
|
289
|
+
'predictorCode': 'z',
|
|
290
|
+
'crossval': 'KF',
|
|
291
|
+
'preproc': 'PCR',
|
|
292
|
+
'regression': 'OLS',
|
|
293
|
+
'timeAggregation': 'mean',
|
|
294
|
+
'predictandFileName': '../test/PRCP_CHIRPSp25_IRIDL_Aug-Oct_s340s200e150e250_1981-2025.nc',
|
|
295
|
+
'predictandVar': 'prcp',
|
|
296
|
+
'predictandCategory': 'temperature',
|
|
297
|
+
'predictandMissingValue': '-999',
|
|
298
|
+
'zonesFile': None,
|
|
299
|
+
'zonesAttribute': 'Name',
|
|
300
|
+
'zonesAggregate': False,
|
|
301
|
+
'regridPredictand': False,
|
|
302
|
+
'overlayFile': '../gis/sadc/gadm41_ZAF_1.json'
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
(more to follow...)
|
|
306
|
+
|
sadc_cft-6.0.2/README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# cft
|
|
2
|
+
Climate Forecasting Toolbox
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
INTRODUCTION
|
|
6
|
+
------------
|
|
7
|
+
The Climate Forecasting Toolbox is a Python based tool for statistical climate forecasting.
|
|
8
|
+
|
|
9
|
+
CREDITS
|
|
10
|
+
=======
|
|
11
|
+
Piotr Wolski (wolski@csag.uct.ac.za)
|
|
12
|
+
Sunshine Gamedze (sgamedze@sadc.int)
|
|
13
|
+
|
|
14
|
+
Oringinal developer (2017-2022):
|
|
15
|
+
Thembani Moitlhobogi
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Development history
|
|
20
|
+
=======
|
|
21
|
+
Current version is developed under funding from First Rains project.
|
|
22
|
+
|
|
23
|
+
Development in 2023-2025 has been funded under SADC CSC ClimSA project.
|
|
24
|
+
|
|
25
|
+
In November 2022, the software has been ported from the original personal github repo https://github.com/taxmanyana/cft to https://github.com/sadc-csc/cft
|
|
26
|
+
|
|
27
|
+
Original version developed during 2010-2017 under funding from SADC CSC project SARCIS-DR.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
SOURCE CODE
|
|
31
|
+
------------
|
|
32
|
+
From version 6.0.0, the CFT code is available as pip package https://pypi.org/project/sadc-cft/
|
|
33
|
+
From version 4.0.0, the CFT code is maintained at: https://github.com/sadc-csc
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Basic functionality of v5 and later:
|
|
37
|
+
------------
|
|
38
|
+
Five modules:
|
|
39
|
+
data download (including from CDS from v6.0)
|
|
40
|
+
forecast (updated in v5)
|
|
41
|
+
zoning (since v3)
|
|
42
|
+
verification (since v4)
|
|
43
|
+
synthesis (since v4)
|
|
44
|
+
|
|
45
|
+
Download module
|
|
46
|
+
------------
|
|
47
|
+
Downloads following data types from sources:
|
|
48
|
+
|
|
49
|
+
1) gridded predictors from CDS:
|
|
50
|
+
- SST, GPH, rainfall, air temperature from all models (save UKMO one) available on CDS in July 2026.
|
|
51
|
+
2) gridded predictand from CDS:
|
|
52
|
+
- rainfall and temperatures from CDS ERA5 dataset
|
|
53
|
+
3) gridded predictors from IRIDL (legacy):
|
|
54
|
+
- SST
|
|
55
|
+
4) gridded predictand from IRIDL (legacy):
|
|
56
|
+
- CHIPRS precipitation
|
|
57
|
+
5) gridded forecast and hindcast data from IRIDL (legacy):
|
|
58
|
+
- SST, precipitation and geopotential height for three models from NMME that were operational in August 2025
|
|
59
|
+
6) teleconnection indices from JMA (because they have lowest latency)
|
|
60
|
+
- IOD, Nino3, Nino4
|
|
61
|
+
|
|
62
|
+
Data are downloaded to user-selected directory
|
|
63
|
+
All data are converted to a format ingestible by CFT
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Forecast module
|
|
67
|
+
------------
|
|
68
|
+
Takes two types of data as predictand:
|
|
69
|
+
- gridded data
|
|
70
|
+
- station data
|
|
71
|
+
|
|
72
|
+
Takes three types of data as predictor:
|
|
73
|
+
- observed teleconnection indices
|
|
74
|
+
- observed gridded data (SST)
|
|
75
|
+
- forecasted gridded fields (not yet implemented)
|
|
76
|
+
|
|
77
|
+
Produces forecast for:
|
|
78
|
+
- grid - if predictand is gridded
|
|
79
|
+
- zones - if predictand is either gridded or station data, with spatial aggregation of data into zonal average, and generation of forecast for that zonal average
|
|
80
|
+
- points - if predictand is station data
|
|
81
|
+
|
|
82
|
+
Allows three pre-processing approaches:
|
|
83
|
+
- PCR - gridded predictor is processed to derive Principal Components (aka EOFs), and these are used in a statistical model as predictors. This can be applied to gridded predictor, and any type of predictand.
|
|
84
|
+
- CCA - canonical components are derived from predictor and predictand data
|
|
85
|
+
- no preprocessing - this can be applied to gridded predictor and any type of predictand.
|
|
86
|
+
implements the following statistical models:
|
|
87
|
+
- OLS regression
|
|
88
|
+
- MLP regression
|
|
89
|
+
- Decision trees
|
|
90
|
+
- Random Forest
|
|
91
|
+
- Lasso regression
|
|
92
|
+
- Ridge regression
|
|
93
|
+
|
|
94
|
+
Two types of forecast are calculated:
|
|
95
|
+
- deterministic forecast
|
|
96
|
+
- tercile probabilistic forecast
|
|
97
|
+
|
|
98
|
+
Tercile forecast is also presented as a 4-category forecast, where normal category is split into normal-to-above and normal-to-below. No probabilities are allocated to these two categories.
|
|
99
|
+
|
|
100
|
+
All forecasts are cross-validated.
|
|
101
|
+
|
|
102
|
+
Two cross-validation approaches are possible:
|
|
103
|
+
- leave-one-out
|
|
104
|
+
- k-fold
|
|
105
|
+
|
|
106
|
+
Skill indices are calculated through cross-validation from out-of-fold predictions. The following skill indices are included:
|
|
107
|
+
- ROC score (above, below, normal)
|
|
108
|
+
- RPSS
|
|
109
|
+
- correlation
|
|
110
|
+
- Heidke skill score for highest probability category
|
|
111
|
+
- ignorance score
|
|
112
|
+
- reliability score
|
|
113
|
+
- Brier skill score
|
|
114
|
+
- 2AFC
|
|
115
|
+
|
|
116
|
+
Probabilistic forecast are calibrated using quantile mapping approach:
|
|
117
|
+
- quantile transform is developed based on overlapping hindcast and observed predictand data
|
|
118
|
+
- transform is applied to hindcast and forecast data
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Other modules - zoning, verification, synthesis
|
|
123
|
+
------------
|
|
124
|
+
|
|
125
|
+
In v5.1 zoning module has been adapted to run under v5 environment.
|
|
126
|
+
|
|
127
|
+
Other packages were not updated in v5.0 , thus not described here explicitly
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
Requirements:
|
|
131
|
+
------------
|
|
132
|
+
python 3.12
|
|
133
|
+
python packages:
|
|
134
|
+
# scientific / data stack - used throughout functions_forecast.py
|
|
135
|
+
"numpy",
|
|
136
|
+
"pandas",
|
|
137
|
+
"geopandas",
|
|
138
|
+
"xarray",
|
|
139
|
+
"rioxarray",
|
|
140
|
+
"scipy",
|
|
141
|
+
"shapely",
|
|
142
|
+
"rasterio",
|
|
143
|
+
"rasterstats",
|
|
144
|
+
"scikit-learn",
|
|
145
|
+
"statsmodels",
|
|
146
|
+
"netCDF4",
|
|
147
|
+
"cftime",
|
|
148
|
+
"geojson",
|
|
149
|
+
"descartes",
|
|
150
|
+
"geocube",
|
|
151
|
+
"GDAL", # provides the 'osgeo' module (zoning.py's ogr usage)
|
|
152
|
+
"requests",
|
|
153
|
+
|
|
154
|
+
# plotting / mapping
|
|
155
|
+
"matplotlib",
|
|
156
|
+
"cartopy",
|
|
157
|
+
|
|
158
|
+
# GUI
|
|
159
|
+
"PyQt5",
|
|
160
|
+
|
|
161
|
+
#CDS api
|
|
162
|
+
"cdsapi",
|
|
163
|
+
|
|
164
|
+
Installation
|
|
165
|
+
------------
|
|
166
|
+
|
|
167
|
+
Python environment
|
|
168
|
+
=======
|
|
169
|
+
|
|
170
|
+
Installation should be done into a dedicated Python environment.
|
|
171
|
+
|
|
172
|
+
This requires installation of either:
|
|
173
|
+
- Ancaconda framework (bulky, >1GB) https://www.anaconda.com/download/success
|
|
174
|
+
- Miniforge (installs both Conda and Mamba) - https://github.com/conda-forge/miniforge
|
|
175
|
+
- Micromamba (installs Mamba - lightweight, but for advanced users) https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
Once installed, create a python enviroment e.g.
|
|
179
|
+
|
|
180
|
+
mamba create --name cft-env python=3.12
|
|
181
|
+
|
|
182
|
+
note - it is recommended that python 3.12 is used for version 6.0
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
Prerequisites
|
|
186
|
+
=======
|
|
187
|
+
The sadc-cft package is installed with pip, but pip does not handle GDAL libraries well. These have to be preinstalled using conda or mamba:
|
|
188
|
+
|
|
189
|
+
(one has to activate the cft environment first, of course)
|
|
190
|
+
mamba activate cft-env
|
|
191
|
+
|
|
192
|
+
(and then:)
|
|
193
|
+
mamba install -c conda-forge gdal=3.13.2
|
|
194
|
+
|
|
195
|
+
Installation with pip
|
|
196
|
+
=======
|
|
197
|
+
Once gdal is installed, sadc-cft package is installed using pip.
|
|
198
|
+
|
|
199
|
+
pip install sadc-cft
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
confirm that installation is complete:
|
|
203
|
+
|
|
204
|
+
python cft
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
How to use - GUI
|
|
208
|
+
------------
|
|
209
|
+
|
|
210
|
+
The main GUI of sadc-cft can be invoked as follows:
|
|
211
|
+
|
|
212
|
+
(one has to activate the cft environment first, of course)
|
|
213
|
+
mamba activate cft-env
|
|
214
|
+
|
|
215
|
+
(and then simply:)
|
|
216
|
+
cft
|
|
217
|
+
|
|
218
|
+
(or:)
|
|
219
|
+
|
|
220
|
+
python -m cft
|
|
221
|
+
|
|
222
|
+
Individual components (forecast, verification, synthesis, zoning and download) can be started directly as follows:
|
|
223
|
+
|
|
224
|
+
>forecast-tool
|
|
225
|
+
|
|
226
|
+
(or:)
|
|
227
|
+
|
|
228
|
+
python -m cft.forecast
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
How to use - without GUI
|
|
232
|
+
------------
|
|
233
|
+
|
|
234
|
+
individual packages can be invoked in Python without GUI.
|
|
235
|
+
|
|
236
|
+
from cft.forecast import computeModelNoGui
|
|
237
|
+
|
|
238
|
+
and then run as follows:
|
|
239
|
+
|
|
240
|
+
computeModelNoGui(config)
|
|
241
|
+
|
|
242
|
+
where config is a dictionary containing forecast model configuration entries e.g.
|
|
243
|
+
|
|
244
|
+
config={'rootDir': '../test',
|
|
245
|
+
'predictorYear': 2026,
|
|
246
|
+
'predictorMonth': 'Jun',
|
|
247
|
+
'fcstTargetSeas': 'Aug-Oct',
|
|
248
|
+
'fcstTargetYear': 2026,
|
|
249
|
+
'climEndYr': 2015,
|
|
250
|
+
'climStartYr': 1994,
|
|
251
|
+
'predictorExtents': {'minLon': -180.0,
|
|
252
|
+
'maxLon': 180.0,
|
|
253
|
+
'minLat': -60.0,
|
|
254
|
+
'maxLat': 60.0},
|
|
255
|
+
'predictorFileName': '/work/code/csc/cft/test/GPH850_System9_CDS_Jun_s300s200e150e250_1981-2026.nc',
|
|
256
|
+
'predictorVar': 'z',
|
|
257
|
+
'predictorCode': 'z',
|
|
258
|
+
'crossval': 'KF',
|
|
259
|
+
'preproc': 'PCR',
|
|
260
|
+
'regression': 'OLS',
|
|
261
|
+
'timeAggregation': 'mean',
|
|
262
|
+
'predictandFileName': '../test/PRCP_CHIRPSp25_IRIDL_Aug-Oct_s340s200e150e250_1981-2025.nc',
|
|
263
|
+
'predictandVar': 'prcp',
|
|
264
|
+
'predictandCategory': 'temperature',
|
|
265
|
+
'predictandMissingValue': '-999',
|
|
266
|
+
'zonesFile': None,
|
|
267
|
+
'zonesAttribute': 'Name',
|
|
268
|
+
'zonesAggregate': False,
|
|
269
|
+
'regridPredictand': False,
|
|
270
|
+
'overlayFile': '../gis/sadc/gadm41_ZAF_1.json'
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
(more to follow...)
|
|
274
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sadc-cft"
|
|
7
|
+
version = "6.0.2"
|
|
8
|
+
description = "Climate Forecasting Tool package to support generation of seasonal forecast by SADC CSC and National Met Services"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors=[
|
|
13
|
+
{name="Piotr Wolski", email="wolski@csag.uct.ac.za"},
|
|
14
|
+
{name="Sunshine Gamedze",email="sgamedze@sadc.int"}
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
# scientific / data stack - used throughout functions_forecast.py
|
|
18
|
+
"numpy",
|
|
19
|
+
"pandas",
|
|
20
|
+
"geopandas",
|
|
21
|
+
"xarray",
|
|
22
|
+
"rioxarray",
|
|
23
|
+
"scipy",
|
|
24
|
+
"shapely",
|
|
25
|
+
"rasterio",
|
|
26
|
+
"rasterstats",
|
|
27
|
+
"scikit-learn",
|
|
28
|
+
"statsmodels",
|
|
29
|
+
"netCDF4",
|
|
30
|
+
"cftime",
|
|
31
|
+
"geojson",
|
|
32
|
+
"descartes",
|
|
33
|
+
"geocube",
|
|
34
|
+
"GDAL", # provides the 'osgeo' module (zoning.py's ogr usage)
|
|
35
|
+
"requests",
|
|
36
|
+
|
|
37
|
+
# plotting / mapping
|
|
38
|
+
"matplotlib",
|
|
39
|
+
"cartopy",
|
|
40
|
+
|
|
41
|
+
# GUI
|
|
42
|
+
"PyQt5",
|
|
43
|
+
|
|
44
|
+
#CDS api
|
|
45
|
+
"cdsapi",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://github.com/sadccsc/cft"
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
cft = "cft.__main__:main"
|
|
56
|
+
forecast-tool = "cft.forecast:main"
|
|
57
|
+
download-tool = "cft.download:main"
|
|
58
|
+
synthesis-tool = "cft.synthesis:main"
|
|
59
|
+
verification-tool = "cft.verification:main"
|
|
60
|
+
zoning-tool = "cft.zoning:main"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# [project.scripts] or [project.gui-scripts]
|
|
64
|
+
# the firs will show terminal window alongside each app on Windows.
|
|
65
|
+
# No difference on Mac/Linux.
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.packages.find]
|
|
68
|
+
where = ["src"]
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.package-data]
|
|
71
|
+
# adjust these globs once you know the real folder layout -
|
|
72
|
+
# e.g. if functions_forecast.py's "dictionaries" folder actually lives
|
|
73
|
+
# under cft/ rather than cft/functions/, move the entry accordingly
|
|
74
|
+
cft = ["*.ui", "dictionaries/*.json", "*.ico"]
|
sadc_cft-6.0.2/setup.cfg
ADDED
|
File without changes
|