Skip to content

Commit c61b780

Browse files
Merge branch 'develop' into feature/remove_intensity_thres
2 parents 6f0969d + c500fd8 commit c61b780

File tree

120 files changed

+5057
-1252
lines changed

Some content is hidden

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

120 files changed

+5057
-1252
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: 95 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,28 @@ Removed:
1515
- `pandas-datareader`
1616

1717
### 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.
1820
- 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)
1921

22+
- `ImpactFunc` and `ImpactFuncSet` now support equality comparisons via `==` [#1027](https://github.com/CLIMADA-project/climada_python/pull/1027)
23+
2024
### Changed
25+
2126
- `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)
2227
- 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)
2330

2431
### Fixed
32+
2533
- 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)
2635

2736
### Deprecated
2837

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

3242
## 6.0.1
@@ -50,27 +60,27 @@ Added:
5060

5161
Updated:
5262

53-
- `cartopy` >=0.23 → >=0.24
54-
- `cfgrib` >=0.9.9,<0.9.10 &rarr; >=0.9
55-
- `dask` >=2024.2,<2024.3 &rarr; >=2025.2
56-
- `eccodes` >=2.27,<2.28 &rarr; >=2.40
57-
- `gdal` >=3.6 &rarr; >=3.10
58-
- `geopandas` >=0.14 &rarr; >=0.14,<1.0
59-
- `h5py` >=3.8 &rarr; >=3.12
60-
- `haversine` >=2.8 &rarr; >=2.9
61-
- `matplotlib-base` >=3.9 &rarr; >=3.10
62-
- `netcdf4` >=1.6 &rarr; >=1.7
63-
- `numba` >=0.60 &rarr; >=0.61
64-
- `pillow` =9.4 &rarr; =11.1
65-
- `pyproj` >=3.5 &rarr; >=3.7
66-
- `pytables` >=3.7 &rarr; >=3.10
67-
- `python` =3.9 &rarr; =3.11
68-
- `rasterio` >=1.3 &rarr; >=1.4
69-
- `scikit-learn` >=1.5 &rarr; >=1.6
70-
- `scipy` >=1.13 &rarr; >=1.14,<1.15
71-
- `tqdm` >=4.66 &rarr; >=4.67
72-
- `xarray` >=2024.6 &rarr; >=2025.1
73-
- `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
7484

7585
Removed:
7686

@@ -81,7 +91,7 @@ Removed:
8191
- `climada.hazard.tc_tracks.TCTracks.subset_years` function [#1023](https://github.com/CLIMADA-project/climada_python/pull/1023)
8292
- `climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
8393
- Add `osm-flex` package to CLIMADA core [#981](https://github.com/CLIMADA-project/climada_python/pull/981)
84-
- `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
8595
- `climada.util.coordinates.bounding_box_global` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
8696
- `climada.util.coordinates.bounding_box_from_countries` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
8797
- `climada.util.coordinates.bounding_box_from_cardinal_bounds` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
@@ -113,8 +123,8 @@ Removed:
113123
- the _geometry_ column of the inherent `GeoDataFrame` is set up at initialization
114124
- 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`).
115125
- `Exposures.gdf` has been renamed to `Exposures.data` (it still works though, as it is a property now pointing to the latter)
116-
- the `check` method does not add a default "IMPF_" column to the GeoDataFrame anymore
117-
- 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)
118128
- Fix xarray future warning in TCTracks for .dims to .sizes
119129
- Fix hazard.concatenate type test for pathos pools
120130

@@ -148,20 +158,20 @@ Added:
148158

149159
Updated:
150160

151-
- `bottleneck` >=1.3 &rarr; >=1.4
152-
- `cartopy` >=0.22 &rarr; >=0.23
153-
- `contextily` >=1.5 &rarr; >=1.6
154-
- `dask` >=2024.1,<2024.3 &rarr; >=2024.2,<2024.3
155-
- `matplotlib-base` >=3.8 &rarr; >=3.9
156-
- `numba` >=0.59 &rarr; >=0.60
157-
- `numexpr` >=2.9 &rarr; >=2.10
158-
- `pint` >=0.23 &rarr; >=0.24
159-
- `pycountry` >=22.3 &rarr; >=24.6
160-
- `requests` >=2.31 &rarr; >=2.32
161-
- `salib` >=1.4 &rarr; >=1.5
162-
- `scikit-learn` >=1.4 &rarr; >=1.5
163-
- `scipy` >=1.12 &rarr; >=1.13
164-
- `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
165175

166176
### Added
167177

@@ -267,17 +277,17 @@ Added:
267277

268278
Updated:
269279

270-
- `contextily` >=1.3 &rarr; >=1.5
271-
- `dask` >=2023 &rarr; >=2024
272-
- `numba` >=0.57 &rarr; >=0.59
273-
- `pandas` >=2.1 &rarr; >=2.1,<2.2
274-
- `pint` >=0.22 &rarr; >=0.23
275-
- `scikit-learn` >=1.3 &rarr; >=1.4
276-
- `scipy` >=1.11 &rarr; >=1.12
277-
- `sparse` >=0.14 &rarr; >=0.15
278-
- `xarray` >=2023.8 &rarr; >=2024.1
279-
- `overpy` =0.6 &rarr; =0.7
280-
- `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
281291

282292
Removed:
283293

@@ -286,7 +296,7 @@ Removed:
286296
### Added
287297

288298
- 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)
289-
- Read and Write methods to and from csv files for the `DiscRates` class. [#818](ttps://github.com/CLIMADA-project/climada_python/pull/818)
299+
- Read and Write methods to and from csv files for the `DiscRates` class. [#818](https://github.com/CLIMADA-project/climada_python/pull/818)
290300
- 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)
291301
- 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)
292302
- Add reset_frequency option for the impact.select() function. [#847](https://github.com/CLIMADA-project/climada_python/pull/847)
@@ -320,13 +330,13 @@ Release date: 2023-09-27
320330

321331
Added:
322332

323-
- `matplotlib-base` None &rarr; >=3.8
333+
- `matplotlib-base` None >=3.8
324334

325335
Changed:
326336

327-
- `geopandas` >=0.13 &rarr; >=0.14
328-
- `pandas` >=1.5,<2.0 &rarr; >=2.1
329-
- `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
330340

331341
Removed:
332342

@@ -355,37 +365,37 @@ Added:
355365

356366
Changed:
357367

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

390400
Removed:
391401

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

climada/engine/unsequa/calc_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ def make_sample(self, N, sampling_method="saltelli", sampling_kwargs=None):
223223
The 'ff' sampling method does not require a value for the N parameter.
224224
The inputed N value is hence ignored in the sampling process in the case
225225
of this method.
226-
The 'ff' sampling method requires a number of uncerainty parameters to be
226+
The 'ff' sampling method requires a number of uncertainty parameters to be
227227
a power of 2. The users can generate dummy variables to achieve this
228228
requirement. Please refer to https://salib.readthedocs.io/en/latest/api.html
229229
for more details.
230230
231231
See Also
232232
--------
233233
SALib.sample: sampling methods from SALib SALib.sample
234-
https://salib.readthedocs.io/en/latest/api.html
234+
https://salib.readthedocs.io/en/latest/api.html
235235
236236
"""
237237

climada/engine/unsequa/calc_cost_benefit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353

5454

5555
class CalcCostBenefit(Calc):
56-
"""
57-
Cost Benefit uncertainty analysis class
56+
"""Cost Benefit uncertainty analysis class
5857
5958
This is the base class to perform uncertainty analysis on the outputs of
6059
climada.engine.costbenefit.CostBenefit().

climada/engine/unsequa/unc_output.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,9 @@ class UncOutput:
8484
samples_df : pandas.DataFrame
8585
Values of the sampled uncertainty parameters. It has n_samples rows
8686
and one column per uncertainty parameter.
87-
sampling_method : str
88-
Name of the sampling method from SAlib.
89-
https://salib.readthedocs.io/en/latest/api.html#
90-
n_samples : int
91-
Effective number of samples (number of rows of samples_df)
92-
param_labels : list
93-
Name of all the uncertainty parameters
9487
distr_dict : dict
9588
Comon flattened dictionary of all the distr_dict of all input variables.
9689
It represents the distribution of all the uncertainty parameters.
97-
problem_sa : dict
98-
The description of the uncertainty variables and their
99-
distribution as used in SALib.
100-
https://salib.readthedocs.io/en/latest/basics.html.
10190
"""
10291

10392
_metadata = [
@@ -192,6 +181,7 @@ def check_salib(self, sensitivity_method):
192181
def sampling_method(self):
193182
"""
194183
Returns the sampling method used to generate self.samples_df
184+
See: https://salib.readthedocs.io/en/latest/api.html#
195185
196186
Returns
197187
-------

0 commit comments

Comments
 (0)