Skip to content

Commit a72876d

Browse files
Merge branch 'develop' into feature/basins-bounds
2 parents 200a4eb + 1d266b6 commit a72876d

File tree

133 files changed

+5327
-1445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+5327
-1445
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,5 @@ results/
183183
!.pylintrc
184184
!.readthedocs.yml
185185
!.github
186+
climada_petals/
187+
climada_python/

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ python:
2525

2626
formats:
2727
- pdf
28+
29+
sphinx:
30+
configuration: doc/conf.py

CHANGELOG.md

Lines changed: 104 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,36 @@ Code freeze date: YYYY-MM-DD
1010

1111
### Dependency Changes
1212

13+
Removed:
14+
15+
- `pandas-datareader`
16+
- `intensity_thres` of `Hazard`, `StormEurope`, and `TropCyclones` object [#1065](https://github.com/CLIMADA-project/climada_python/pull/1065)
17+
- Deprecated method `climada.hazard.trop_cyclone.trop_cyclone.TropCyclone.set_from_tracks` [#1065](https://github.com/CLIMADA-project/climada_python/pull/1065)
18+
1319
### Added
20+
- Added optional parameter to `geo_im_from_array`, `plot_from_gdf`, `plot_rp_imp`, `plot_rp_intensity`,
21+
`plot_intensity`, `plot_fraction`, `_event_plot` to mask plotting when regions are too far from data points [#1047](https://github.com/CLIMADA-project/climada_python/pull/1047). To recreate previous plots (no masking), the parameter can be set to None.
1422
- Added instructions to install Climada petals on Euler cluster in `doc.guide.Guide_Euler.ipynb` [#1029](https://github.com/CLIMADA-project/climada_python/pull/1029)
1523

24+
- `ImpactFunc` and `ImpactFuncSet` now support equality comparisons via `==` [#1027](https://github.com/CLIMADA-project/climada_python/pull/1027)
25+
1626
### Changed
27+
- Changed the default mask_distance in `util.plot.geo_im_from_array` to 0.03 to avoid white gaps in gridded hazard data with comparably low resolution (>80 centroids per axis) [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
28+
- Increased speed of `util.plot.add_shapes` by avoiding for loops, substantially speeding up `Hazard.plot_intensity` and other functions. [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
1729
- `Hazard.local_exceedance_intensity`, `Hazard.local_return_period` and `Impact.local_exceedance_impact`, `Impact.local_return_period`, using the `climada.util.interpolation` module: New default (no binning), binning on decimals, and faster implementation [#1012](https://github.com/CLIMADA-project/climada_python/pull/1012)
30+
- World Bank indicator data is now downloaded directly from their API via the function `download_world_bank_indicator`, instead of relying on the `pandas-datareader` package [#1033](https://github.com/CLIMADA-project/climada_python/pull/1033)
31+
- `Exposures.write_hdf5` pickles geometry data in WKB format, which is faster and more sustainable. [#1051](https://github.com/CLIMADA-project/climada_python/pull/1051)
32+
- The online documentation has been completely overhauled, now uses PyData theme: [#977](https://github.com/CLIMADA-project/climada_python/pull/977)
33+
1834
### Fixed
35+
1936
- NaN plotting issues in `geo_im_from_array`[#1038](https://github.com/CLIMADA-project/climada_python/pull/1038)
37+
- Broken ECMWF links in pydoc of `climada.hazard.storm_europe` relocated. [#944](https://github.com/CLIMADA-project/climada_python/pull/944)
2038

2139
### Deprecated
2240

2341
### Removed
42+
2443
- `climada.util.interpolation.round_to_sig_digits` [#1012](https://github.com/CLIMADA-project/climada_python/pull/1012)
2544

2645
## 6.0.1
@@ -44,27 +63,27 @@ Added:
4463

4564
Updated:
4665

47-
- `cartopy` >=0.23 → >=0.24
48-
- `cfgrib` >=0.9.9,<0.9.10 &rarr; >=0.9
49-
- `dask` >=2024.2,<2024.3 &rarr; >=2025.2
50-
- `eccodes` >=2.27,<2.28 &rarr; >=2.40
51-
- `gdal` >=3.6 &rarr; >=3.10
52-
- `geopandas` >=0.14 &rarr; >=0.14,<1.0
53-
- `h5py` >=3.8 &rarr; >=3.12
54-
- `haversine` >=2.8 &rarr; >=2.9
55-
- `matplotlib-base` >=3.9 &rarr; >=3.10
56-
- `netcdf4` >=1.6 &rarr; >=1.7
57-
- `numba` >=0.60 &rarr; >=0.61
58-
- `pillow` =9.4 &rarr; =11.1
59-
- `pyproj` >=3.5 &rarr; >=3.7
60-
- `pytables` >=3.7 &rarr; >=3.10
61-
- `python` =3.9 &rarr; =3.11
62-
- `rasterio` >=1.3 &rarr; >=1.4
63-
- `scikit-learn` >=1.5 &rarr; >=1.6
64-
- `scipy` >=1.13 &rarr; >=1.14,<1.15
65-
- `tqdm` >=4.66 &rarr; >=4.67
66-
- `xarray` >=2024.6 &rarr; >=2025.1
67-
- `xlsxwriter` >=3.1 &rarr; >=3.2
66+
- `cartopy` >=0.23 >=0.24
67+
- `cfgrib` >=0.9.9,<0.9.10 >=0.9
68+
- `dask` >=2024.2,<2024.3 >=2025.2
69+
- `eccodes` >=2.27,<2.28 >=2.40
70+
- `gdal` >=3.6 >=3.10
71+
- `geopandas` >=0.14 >=0.14,<1.0
72+
- `h5py` >=3.8 >=3.12
73+
- `haversine` >=2.8 >=2.9
74+
- `matplotlib-base` >=3.9 >=3.10
75+
- `netcdf4` >=1.6 >=1.7
76+
- `numba` >=0.60 >=0.61
77+
- `pillow` =9.4 =11.1
78+
- `pyproj` >=3.5 >=3.7
79+
- `pytables` >=3.7 >=3.10
80+
- `python` =3.9 =3.11
81+
- `rasterio` >=1.3 >=1.4
82+
- `scikit-learn` >=1.5 >=1.6
83+
- `scipy` >=1.13 >=1.14,<1.15
84+
- `tqdm` >=4.66 >=4.67
85+
- `xarray` >=2024.6 >=2025.1
86+
- `xlsxwriter` >=3.1 >=3.2
6887

6988
Removed:
7089

@@ -76,7 +95,7 @@ Removed:
7695
- `climada.hazard.tc_tracks.TCTracks.subset_years` function [#1023](https://github.com/CLIMADA-project/climada_python/pull/1023)
7796
- `climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
7897
- Add `osm-flex` package to CLIMADA core [#981](https://github.com/CLIMADA-project/climada_python/pull/981)
79-
- `doc.tutorial.climada_entity_Exposures_osm.ipynb` tutorial explaining how to use `osm-flex`with CLIMADA
98+
- `doc.tutorial.climada_entity_Exposures_osm.ipynb` tutorial explaining how to use `osm-flex` with CLIMADA
8099
- `climada.util.coordinates.bounding_box_global` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
81100
- `climada.util.coordinates.bounding_box_from_countries` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
82101
- `climada.util.coordinates.bounding_box_from_cardinal_bounds` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
@@ -108,8 +127,8 @@ Removed:
108127
- the _geometry_ column of the inherent `GeoDataFrame` is set up at initialization
109128
- latitude and longitude column are no longer present there (the according arrays can be retrieved as properties of the Exposures object: `exp.latitude` instead of `exp.gdf.latitude.values`).
110129
- `Exposures.gdf` has been renamed to `Exposures.data` (it still works though, as it is a property now pointing to the latter)
111-
- the `check` method does not add a default "IMPF_" column to the GeoDataFrame anymore
112-
- Updated IBTrACS version from v4.0 to v4.1 ([#976](https://github.com/CLIMADA-project/climada_python/pull/976)
130+
- the `check` method does not add a default `'IMPF_'` column to the GeoDataFrame anymore
131+
- Updated IBTrACS version from v4.0 to v4.1 [#976](https://github.com/CLIMADA-project/climada_python/pull/976)
113132
- Fix xarray future warning in TCTracks for .dims to .sizes
114133
- Fix hazard.concatenate type test for pathos pools
115134

@@ -143,20 +162,20 @@ Added:
143162

144163
Updated:
145164

146-
- `bottleneck` >=1.3 &rarr; >=1.4
147-
- `cartopy` >=0.22 &rarr; >=0.23
148-
- `contextily` >=1.5 &rarr; >=1.6
149-
- `dask` >=2024.1,<2024.3 &rarr; >=2024.2,<2024.3
150-
- `matplotlib-base` >=3.8 &rarr; >=3.9
151-
- `numba` >=0.59 &rarr; >=0.60
152-
- `numexpr` >=2.9 &rarr; >=2.10
153-
- `pint` >=0.23 &rarr; >=0.24
154-
- `pycountry` >=22.3 &rarr; >=24.6
155-
- `requests` >=2.31 &rarr; >=2.32
156-
- `salib` >=1.4 &rarr; >=1.5
157-
- `scikit-learn` >=1.4 &rarr; >=1.5
158-
- `scipy` >=1.12 &rarr; >=1.13
159-
- `xarray` >=2024.2 &rarr; >=2024.6
165+
- `bottleneck` >=1.3 >=1.4
166+
- `cartopy` >=0.22 >=0.23
167+
- `contextily` >=1.5 >=1.6
168+
- `dask` >=2024.1,<2024.3 >=2024.2,<2024.3
169+
- `matplotlib-base` >=3.8 >=3.9
170+
- `numba` >=0.59 >=0.60
171+
- `numexpr` >=2.9 >=2.10
172+
- `pint` >=0.23 >=0.24
173+
- `pycountry` >=22.3 >=24.6
174+
- `requests` >=2.31 >=2.32
175+
- `salib` >=1.4 >=1.5
176+
- `scikit-learn` >=1.4 >=1.5
177+
- `scipy` >=1.12 >=1.13
178+
- `xarray` >=2024.2 >=2024.6
160179

161180
### Added
162181

@@ -262,17 +281,17 @@ Added:
262281

263282
Updated:
264283

265-
- `contextily` >=1.3 &rarr; >=1.5
266-
- `dask` >=2023 &rarr; >=2024
267-
- `numba` >=0.57 &rarr; >=0.59
268-
- `pandas` >=2.1 &rarr; >=2.1,<2.2
269-
- `pint` >=0.22 &rarr; >=0.23
270-
- `scikit-learn` >=1.3 &rarr; >=1.4
271-
- `scipy` >=1.11 &rarr; >=1.12
272-
- `sparse` >=0.14 &rarr; >=0.15
273-
- `xarray` >=2023.8 &rarr; >=2024.1
274-
- `overpy` =0.6 &rarr; =0.7
275-
- `peewee` =3.16.3 &rarr; =3.17.1
284+
- `contextily` >=1.3 >=1.5
285+
- `dask` >=2023 >=2024
286+
- `numba` >=0.57 >=0.59
287+
- `pandas` >=2.1 >=2.1,<2.2
288+
- `pint` >=0.22 >=0.23
289+
- `scikit-learn` >=1.3 >=1.4
290+
- `scipy` >=1.11 >=1.12
291+
- `sparse` >=0.14 >=0.15
292+
- `xarray` >=2023.8 >=2024.1
293+
- `overpy` =0.6 =0.7
294+
- `peewee` =3.16.3 =3.17.1
276295

277296
Removed:
278297

@@ -281,7 +300,7 @@ Removed:
281300
### Added
282301

283302
- Convenience method `api_client.Client.get_dataset_file`, combining `get_dataset_info` and `download_dataset`, returning a single file objet. [#821](https://github.com/CLIMADA-project/climada_python/pull/821)
284-
- Read and Write methods to and from csv files for the `DiscRates` class. [#818](ttps://github.com/CLIMADA-project/climada_python/pull/818)
303+
- Read and Write methods to and from csv files for the `DiscRates` class. [#818](https://github.com/CLIMADA-project/climada_python/pull/818)
285304
- Add `CalcDeltaClimate` to unsequa module to allow uncertainty and sensitivity analysis of impact change calculations [#844](https://github.com/CLIMADA-project/climada_python/pull/844)
286305
- Add function `safe_divide` in util which handles division by zero and NaN values in the numerator or denominator [#844](https://github.com/CLIMADA-project/climada_python/pull/844)
287306
- Add reset_frequency option for the impact.select() function. [#847](https://github.com/CLIMADA-project/climada_python/pull/847)
@@ -315,13 +334,13 @@ Release date: 2023-09-27
315334

316335
Added:
317336

318-
- `matplotlib-base` None &rarr; >=3.8
337+
- `matplotlib-base` None >=3.8
319338

320339
Changed:
321340

322-
- `geopandas` >=0.13 &rarr; >=0.14
323-
- `pandas` >=1.5,<2.0 &rarr; >=2.1
324-
- `salib` >=1.3.0 &rarr; >=1.4.7
341+
- `geopandas` >=0.13 >=0.14
342+
- `pandas` >=1.5,<2.0 >=2.1
343+
- `salib` >=1.3.0 >=1.4.7
325344

326345
Removed:
327346

@@ -350,37 +369,37 @@ Added:
350369

351370
Changed:
352371

353-
- `cartopy` >=0.20.0,<0.20.3 &rarr; >=0.21
354-
- `cfgrib` >=0.9.7,<0.9.10 &rarr; =0.9.9
355-
- `contextily` >=1.0 &rarr; >=1.3
356-
- `dask` >=2.25 &rarr; >=2023
357-
- `eccodes` [auto] &rarr; =2.27
358-
- `gdal` !=3.4.1 &rarr; >=3.6
359-
- `geopandas` >=0.8 &rarr; >=0.13
360-
- `h5py` >=2.10 &rarr; >=3.8
361-
- `haversine` >=2.3 &rarr; >=2.8
362-
- `matplotlib` >=3.2,< 3.6 &rarr; >=3.7
363-
- `netcdf4` >=1.5 &rarr; >=1.6
364-
- `numba` >=0.51,!=0.55.0 &rarr; >=0.57
365-
- `openpyxl` >=3.0 &rarr; >=3.1
366-
- `pandas-datareader` >=0.9 &rarr; >=0.10
367-
- `pathos` >=0.2 &rarr; >=0.3
368-
- `pint` >=0.15 &rarr; >=0.22
369-
- `proj` !=9.0.0 &rarr; >=9.1
370-
- `pycountry` >=20.7 &rarr; >=22.3
371-
- `pytables` >=3.6 &rarr; >=3.7
372-
- `rasterio` >=1.2.7,<1.3 &rarr; >=1.3
373-
- `requests` >=2.24 &rarr; >=2.31
374-
- `salib` >=1.3.0 &rarr; >=1.4
375-
- `scikit-learn` >=1.0 &rarr; >=1.2
376-
- `scipy` >=1.6 &rarr; >=1.10
377-
- `sparse` >=0.13 &rarr; >=0.14
378-
- `statsmodels` >=0.11 &rarr; >=0.14
379-
- `tabulate` >=0.8 &rarr; >=0.9
380-
- `tqdm` >=4.48 &rarr; >=4.65
381-
- `xarray` >=0.13 &rarr; >=2023.5
382-
- `xlrd` >=1.2 &rarr; >=2.0
383-
- `xlsxwriter` >=1.3 &rarr; >=3.1
372+
- `cartopy` >=0.20.0,<0.20.3 >=0.21
373+
- `cfgrib` >=0.9.7,<0.9.10 =0.9.9
374+
- `contextily` >=1.0 >=1.3
375+
- `dask` >=2.25 >=2023
376+
- `eccodes` [auto] =2.27
377+
- `gdal` !=3.4.1 >=3.6
378+
- `geopandas` >=0.8 >=0.13
379+
- `h5py` >=2.10 >=3.8
380+
- `haversine` >=2.3 >=2.8
381+
- `matplotlib` >=3.2,< 3.6 >=3.7
382+
- `netcdf4` >=1.5 >=1.6
383+
- `numba` >=0.51,!=0.55.0 >=0.57
384+
- `openpyxl` >=3.0 >=3.1
385+
- `pandas-datareader` >=0.9 >=0.10
386+
- `pathos` >=0.2 >=0.3
387+
- `pint` >=0.15 >=0.22
388+
- `proj` !=9.0.0 >=9.1
389+
- `pycountry` >=20.7 >=22.3
390+
- `pytables` >=3.6 >=3.7
391+
- `rasterio` >=1.2.7,<1.3 >=1.3
392+
- `requests` >=2.24 >=2.31
393+
- `salib` >=1.3.0 >=1.4
394+
- `scikit-learn` >=1.0 >=1.2
395+
- `scipy` >=1.6 >=1.10
396+
- `sparse` >=0.13 >=0.14
397+
- `statsmodels` >=0.11 >=0.14
398+
- `tabulate` >=0.8 >=0.9
399+
- `tqdm` >=4.48 >=4.65
400+
- `xarray` >=0.13 >=2023.5
401+
- `xlrd` >=1.2 >=2.0
402+
- `xlsxwriter` >=1.3 >=3.1
384403

385404
Removed:
386405

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ For orientation, these are some categories of possible contributions we can thin
1212
* **New Modules and Utility Functions:** Did you create a function or an entire module you find useful for your work? Maybe you are not the only one! Feel free to simply raise a pull request for functions that improve, e.g., plotting or data handling. As an entire module has to be carefully integrated into the framework, it might help if you talk to us first so we can design the module and plan the next steps. You can do that by raising an issue or starting a [discussion](https://github.com/CLIMADA-project/climada_python/discussions) on GitHub.
1313

1414
A good place to start a personal discussion is our monthly CLIMADA developers call.
15-
Please contact the [lead developers](https://wcr.ethz.ch/research/climada.html) if you want to join.
15+
Please contact the [lead developers](https://climada.ethz.ch/team/) if you want to join.
1616

1717
## Why Should You Contribute?
1818

19-
* You will be listed as author of the CLIMADA repository in the [AUTHORS](AUTHORS.md) file.
19+
* You will be listed as author of the CLIMADA repository in the [AUTHORS][authors] file.
2020
* You will improve the quality of the CLIMADA software for you and for everybody else using it.
2121
* You will gain insights into scientific software development.
2222

@@ -40,7 +40,7 @@ To contribute follow these steps:
4040
```bash
4141
pylint
4242
```
43-
6. Add your name to the [AUTHORS](AUTHORS.md) file.
43+
6. Add your name to the [AUTHORS][authors] file.
4444
7. Push your updates to the remote repository:
4545
4646
```bash
@@ -83,4 +83,5 @@ It also contains a checklist for both pull request authors and reviewers to guid
8383
8484
[docs]: https://climada-python.readthedocs.io/en/latest/
8585
[devguide]: https://climada-python.readthedocs.io/en/latest/#developer-guide
86-
[testing]: https://climada-python.readthedocs.io/en/latest/guide/Guide_Testing.html
86+
[testing]: https://climada-python.readthedocs.io/en/latest/development/Guide_Testing.html
87+
[authors]: https://github.com/CLIMADA-project/climada_python/blob/main/AUTHORS.md

climada/engine/cost_benefit.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,7 @@ def _calc_impact_measures(
10791079
# compute impact for each measure
10801080
for measure in meas_set.get_measure(hazard.haz_type):
10811081
LOGGER.debug("%s impact of measure %s.", when, measure.name)
1082-
imp_tmp, risk_transf = measure.calc_impact(
1083-
exposures, imp_fun_set, hazard, assign_centroids=False
1084-
)
1082+
imp_tmp, risk_transf = measure.calc_impact(exposures, imp_fun_set, hazard)
10851083
impact_meas[measure.name] = dict()
10861084
impact_meas[measure.name]["cost"] = (
10871085
measure.cost,

climada/engine/impact.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ def plot_rp_imp(
11781178
return_periods=(25, 50, 100, 250),
11791179
log10_scale=True,
11801180
axis=None,
1181+
mask_distance=0.03,
11811182
kwargs_local_exceedance_impact=None,
11821183
**kwargs,
11831184
):
@@ -1194,6 +1195,11 @@ def plot_rp_imp(
11941195
plot impact as log10(impact). Default: True
11951196
smooth : bool, optional
11961197
smooth plot to plot.RESOLUTIONxplot.RESOLUTION. Default: True
1198+
mask_distance: float, optional
1199+
Only regions are plotted that are closer to any of the data points than this distance,
1200+
relative to overall plot size. For instance, to only plot values
1201+
at the centroids, use mask_distance=0.03. If None, the plot is not masked.
1202+
Default is 0.03.
11971203
kwargs_local_exceedance_impact: dict
11981204
Dictionary of keyword arguments for the method impact.local_exceedance_impact.
11991205
kwargs : dict, optional
@@ -1242,7 +1248,12 @@ def plot_rp_imp(
12421248
)
12431249

12441250
axis = u_plot.plot_from_gdf(
1245-
impacts_stats, title, column_labels, axis=axis, **kwargs
1251+
impacts_stats,
1252+
title,
1253+
column_labels,
1254+
axis=axis,
1255+
mask_distance=mask_distance,
1256+
**kwargs,
12461257
)
12471258
return axis, impacts_stats_vals
12481259

0 commit comments

Comments
 (0)