Skip to content

Commit 381316b

Browse files
author
Chahan Kropf
committed
Merge remote-tracking branch 'origin/develop' into feature/check_meas_tuto
2 parents c9c4e22 + 0cb35ca commit 381316b

Some content is hidden

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

49 files changed

+3609
-315
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in
5+
# the repo. Unless a later match takes precedence, they will
6+
# be requested for review when someone opens a pull request.
7+
* @emanuel-schmid @chahank @peanutfun

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# Do not abort other tests if only a single one fails
2323
fail-fast: false
2424
matrix:
25-
python-version: ["3.10", "3.11"]
25+
python-version: ["3.10", "3.11", "3.12"]
2626

2727
steps:
2828
-

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
ref: ${{ github.event.pull_request.head.sha }}
1717
-
1818
name: Checkout target commit
19-
run: git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{ github.event.pull_request.base.ref }}
19+
run: git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=50 origin ${{ github.event.pull_request.base.ref }}
2020
-
2121
name: Set up Python 3.11
2222
uses: actions/setup-python@v5

.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/

AUTHORS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(authors)=
21
# CLIMADA List of Authors
32

43
* Gabriela Aznar-Siguan

CHANGELOG.md

Lines changed: 103 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,33 @@ Code freeze date: YYYY-MM-DD
1010

1111
### Dependency Changes
1212

13+
Removed:
14+
15+
- `pandas-datareader`
16+
1317
### Added
18+
- Added optional parameter to `geo_im_from_array`, `plot_from_gdf`, `plot_rp_imp`, `plot_rp_intensity`,
19+
`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.
20+
- 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)
21+
22+
- `ImpactFunc` and `ImpactFuncSet` now support equality comparisons via `==` [#1027](https://github.com/CLIMADA-project/climada_python/pull/1027)
1423

1524
### Changed
25+
1626
- `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)
27+
- 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)
28+
- `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)
29+
- The online documentation has been completely overhauled, now uses PyData theme: [#977](https://github.com/CLIMADA-project/climada_python/pull/977)
30+
1731
### Fixed
1832

33+
- NaN plotting issues in `geo_im_from_array`[#1038](https://github.com/CLIMADA-project/climada_python/pull/1038)
34+
- Broken ECMWF links in pydoc of `climada.hazard.storm_europe` relocated. [#944](https://github.com/CLIMADA-project/climada_python/pull/944)
35+
1936
### Deprecated
2037

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

2442
## 6.0.1
@@ -42,27 +60,27 @@ Added:
4260

4361
Updated:
4462

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

6785
Removed:
6886

@@ -73,7 +91,7 @@ Removed:
7391
- `climada.hazard.tc_tracks.TCTracks.subset_years` function [#1023](https://github.com/CLIMADA-project/climada_python/pull/1023)
7492
- `climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
7593
- Add `osm-flex` package to CLIMADA core [#981](https://github.com/CLIMADA-project/climada_python/pull/981)
76-
- `doc.tutorial.climada_entity_Exposures_osm.ipynb` tutorial explaining how to use `osm-flex`with CLIMADA
94+
- `doc.tutorial.climada_entity_Exposures_osm.ipynb` tutorial explaining how to use `osm-flex` with CLIMADA
7795
- `climada.util.coordinates.bounding_box_global` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
7896
- `climada.util.coordinates.bounding_box_from_countries` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
7997
- `climada.util.coordinates.bounding_box_from_cardinal_bounds` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
@@ -105,8 +123,8 @@ Removed:
105123
- the _geometry_ column of the inherent `GeoDataFrame` is set up at initialization
106124
- 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`).
107125
- `Exposures.gdf` has been renamed to `Exposures.data` (it still works though, as it is a property now pointing to the latter)
108-
- the `check` method does not add a default "IMPF_" column to the GeoDataFrame anymore
109-
- Updated IBTrACS version from v4.0 to v4.1 ([#976](https://github.com/CLIMADA-project/climada_python/pull/976)
126+
- the `check` method does not add a default `'IMPF_'` column to the GeoDataFrame anymore
127+
- Updated IBTrACS version from v4.0 to v4.1 [#976](https://github.com/CLIMADA-project/climada_python/pull/976)
110128
- Fix xarray future warning in TCTracks for .dims to .sizes
111129
- Fix hazard.concatenate type test for pathos pools
112130

@@ -140,20 +158,20 @@ Added:
140158

141159
Updated:
142160

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

158176
### Added
159177

@@ -188,6 +206,7 @@ CLIMADA tutorials. [#872](https://github.com/CLIMADA-project/climada_python/pull
188206
- `Impact.from_hdf5` now calls `str` on `event_name` data that is not strings, and issue a warning then [#894](https://github.com/CLIMADA-project/climada_python/pull/894)
189207
- `Impact.write_hdf5` now throws an error if `event_name` is does not contain strings exclusively [#894](https://github.com/CLIMADA-project/climada_python/pull/894)
190208
- Split `climada.hazard.trop_cyclone` module into smaller submodules without affecting module usage [#911](https://github.com/CLIMADA-project/climada_python/pull/911)
209+
- `yearly_steps` parameter of `TropCyclone.apply_climate_scenario_knu` has been made explicit [#991](https://github.com/CLIMADA-project/climada_python/pull/991)
191210

192211
### Fixed
193212

@@ -258,17 +277,17 @@ Added:
258277

259278
Updated:
260279

261-
- `contextily` >=1.3 &rarr; >=1.5
262-
- `dask` >=2023 &rarr; >=2024
263-
- `numba` >=0.57 &rarr; >=0.59
264-
- `pandas` >=2.1 &rarr; >=2.1,<2.2
265-
- `pint` >=0.22 &rarr; >=0.23
266-
- `scikit-learn` >=1.3 &rarr; >=1.4
267-
- `scipy` >=1.11 &rarr; >=1.12
268-
- `sparse` >=0.14 &rarr; >=0.15
269-
- `xarray` >=2023.8 &rarr; >=2024.1
270-
- `overpy` =0.6 &rarr; =0.7
271-
- `peewee` =3.16.3 &rarr; =3.17.1
280+
- `contextily` >=1.3 >=1.5
281+
- `dask` >=2023 >=2024
282+
- `numba` >=0.57 >=0.59
283+
- `pandas` >=2.1 >=2.1,<2.2
284+
- `pint` >=0.22 >=0.23
285+
- `scikit-learn` >=1.3 >=1.4
286+
- `scipy` >=1.11 >=1.12
287+
- `sparse` >=0.14 >=0.15
288+
- `xarray` >=2023.8 >=2024.1
289+
- `overpy` =0.6 =0.7
290+
- `peewee` =3.16.3 =3.17.1
272291

273292
Removed:
274293

@@ -311,13 +330,13 @@ Release date: 2023-09-27
311330

312331
Added:
313332

314-
- `matplotlib-base` None &rarr; >=3.8
333+
- `matplotlib-base` None >=3.8
315334

316335
Changed:
317336

318-
- `geopandas` >=0.13 &rarr; >=0.14
319-
- `pandas` >=1.5,<2.0 &rarr; >=2.1
320-
- `salib` >=1.3.0 &rarr; >=1.4.7
337+
- `geopandas` >=0.13 >=0.14
338+
- `pandas` >=1.5,<2.0 >=2.1
339+
- `salib` >=1.3.0 >=1.4.7
321340

322341
Removed:
323342

@@ -346,37 +365,37 @@ Added:
346365

347366
Changed:
348367

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

381400
Removed:
382401

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ CLIMADA is divided into two parts (two repositories):
1616
1. the core [climada_python](https://github.com/CLIMADA-project/climada_python) contains all the modules necessary for the probabilistic impact, the averted damage, uncertainty and forecast calculations. Data for hazard, exposures and impact functions can be obtained from the [data API](https://github.com/CLIMADA-project/climada_python/blob/main/doc/tutorial/climada_util_api_client.ipynb). [Litpop](https://github.com/CLIMADA-project/climada_python/blob/main/doc/tutorial/climada_entity_LitPop.ipynb) is included as demo Exposures module, and [Tropical cyclones](https://github.com/CLIMADA-project/climada_python/blob/main/doc/tutorial/climada_hazard_TropCyclone.ipynb) is included as a demo Hazard module.
1717
2. the petals [climada_petals](https://github.com/CLIMADA-project/climada_petals) contains all the modules for generating data (e.g., TC_Surge, WildFire, OpenStreeMap, ...). Most development is done here. The petals builds-upon the core and does not work as a stand-alone.
1818

19-
It is recommend for new users to begin with the core (1) and the [tutorials](https://github.com/CLIMADA-project/climada_python/tree/main/doc/tutorial) therein.
19+
For new users, we recommend to begin with the core (1) and the [tutorials](https://github.com/CLIMADA-project/climada_python/tree/main/doc/tutorial) therein.
2020

21-
This is the Python (3.9+) version of CLIMADA - please see [here](https://github.com/davidnbresch/climada) for backward compatibility with the MATLAB version.
21+
This is the Python version of CLIMADA - please see [here](https://github.com/davidnbresch/climada) for backward compatibility with the MATLAB version.
2222

2323
## Getting started
2424

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.01,
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.01. If None, the plot is not masked.
1202+
Default is 0.01.
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)