Skip to content

Commit 54cc800

Browse files
Merge branch 'develop'
2 parents 8f89ce1 + 70ddc93 commit 54cc800

File tree

107 files changed

+14870
-7234
lines changed

Some content is hidden

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

107 files changed

+14870
-7234
lines changed

.coveragerc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# .coveragerc to control coverage.py
22

33
[run]
4-
# Also report branch coverage
5-
branch = True
4+
# skip test files
5+
omit =
6+
*/test*/*
67
# Set concurrency type for correct coverage of multi-processing code
78
concurrency = multiprocessing
89

@@ -14,12 +15,3 @@ source = climada/
1415
exclude_also =
1516
# Main code is not run
1617
if __name__ == .__main__.:
17-
18-
# Abtract methods are not run
19-
@(abc\.)?abstractmethod
20-
21-
# Never fail when reporting
22-
ignore_errors = True
23-
24-
[html]
25-
directory = coverage

.github/workflows/ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ on: [push]
66
# Use bash explicitly for being able to enter the conda environment
77
defaults:
88
run:
9-
shell: bash -l {0}
9+
shell: bash -el {0}
1010

1111
jobs:
1212
build-and-test:
13-
name: Build Env, Install, Unit Tests
13+
name: 'Core / Unit Test Pipeline'
1414
runs-on: ubuntu-latest
1515
permissions:
1616
# For publishing results
@@ -41,8 +41,6 @@ jobs:
4141
create-args: >-
4242
python=${{ matrix.python-version }}
4343
make
44-
init-shell: >-
45-
bash
4644
# Persist environment for branch, Python version, single day
4745
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
4846
-
@@ -59,12 +57,22 @@ jobs:
5957
if: always()
6058
with:
6159
junit_files: tests_xml/tests.xml
62-
check_name: "Unit Test Results Python ${{ matrix.python-version }}"
60+
check_name: "Core / Unit Test Results (${{ matrix.python-version }})"
6361
comment_mode: "off"
6462
-
6563
name: Upload Coverage Reports
6664
if: always()
6765
uses: actions/upload-artifact@v4
6866
with:
69-
name: coverage-report-unittests-py${{ matrix.python-version }}
67+
name: coverage-report-core-unittests-py${{ matrix.python-version }}
7068
path: coverage/
69+
70+
test-petals:
71+
name: Petals Compatibility
72+
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@develop
73+
needs: build-and-test
74+
with:
75+
core_branch: ${{ github.ref }}
76+
petals_branch: develop
77+
permissions:
78+
checks: write

.readthedocs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ build:
55
tools:
66
python: "mambaforge-4.10"
77

8+
# Append fixed Python version to requirements
9+
jobs:
10+
pre_create_environment:
11+
- echo " - python=3.9" >> requirements/env_climada.yml
12+
813
conda:
9-
environment: requirements/env_docs.yml
14+
environment: requirements/env_climada.yml
1015

1116
python:
1217
install:

AUTHORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
* Raphael Portmann
3030
* Nicolas Colombi
3131
* Leonie Villiger
32+
* Timo Schmid
3233
* Kam Lam Yeung
3334
* Sarah Hülsen
3435
* Timo Schmid
36+
* Luca Severino
3537
* Samuel Juhel
38+
* Valentin Gebhart

CHANGELOG.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,118 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
Release date: YYYY-MM-DD
6+
7+
Code freeze date: YYYY-MM-DD
8+
9+
### Description
10+
11+
### Dependency Changes
12+
13+
Added:
14+
15+
- `bayesian-optimization`
16+
- `seaborn` >=0.13
17+
18+
Updated:
19+
20+
- `bottleneck` >=1.3 → >=1.4
21+
- `cartopy` >=0.22 → >=0.23
22+
- `contextily` >=1.5 → >=1.6
23+
- `dask` >=2024.1,<2024.3 &rarr; >=2024.2,<2024.3
24+
- `matplotlib-base` >=3.8 &rarr; >=3.9
25+
- `numba` >=0.59 &rarr; >=0.60
26+
- `numexpr` >=2.9 &rarr; >=2.10
27+
- `pint` >=0.23 &rarr; >=0.24
28+
- `pycountry` >=22.3 &rarr; >=24.6
29+
- `requests` >=2.31 &rarr; >=2.32
30+
- `salib` >=1.4 &rarr; >=1.5
31+
- `scikit-learn` >=1.4 &rarr; >=1.5
32+
- `scipy` >=1.12 &rarr; >=1.13
33+
- `xarray` >=2024.2 &rarr; >=2024.6
34+
35+
### Added
36+
37+
- GitHub actions workflow for CLIMADA Petals compatibility tests [#855](https://github.com/CLIMADA-project/climada_python/pull/855)
38+
- `climada.util.calibrate` module for calibrating impact functions [#692](https://github.com/CLIMADA-project/climada_python/pull/692)
39+
40+
### Changed
41+
42+
- Use Geopandas GeoDataFrame.plot() for centroids plotting function [896](https://github.com/CLIMADA-project/climada_python/pull/896)
43+
- Update SALib sensitivity and sampling methods from newest version (SALib 1.4.7) [#828](https://github.com/CLIMADA-project/climada_python/issues/828)
44+
- Allow for computation of relative and absolute delta impacts in `CalcDeltaClimate`
45+
- Remove content tables and make minor improvements (fix typos and readability) in
46+
CLIMADA tutorials. [#872](https://github.com/CLIMADA-project/climada_python/pull/872)
47+
- Centroids complete overhaul. Most function should be backward compatible. Internal data is stored in a geodataframe attribute. Raster are now stored as points, and the meta attribute is removed. Several methds were deprecated or removed. [#787](https://github.com/CLIMADA-project/climada_python/pull/787)
48+
- Improved error messages produced by `ImpactCalc.impact()` in case impact function in the exposures is not found in impf_set [#863](https://github.com/CLIMADA-project/climada_python/pull/863)
49+
- Update the Holland et al. 2010 TC windfield model and introduce `model_kwargs` parameter to adjust model parameters [#846](https://github.com/CLIMADA-project/climada_python/pull/846)
50+
- Changed module structure: `climada.hazard.Hazard` has been split into the modules `base`, `io` and `plot` [#871](https://github.com/CLIMADA-project/climada_python/pull/871)
51+
- Ensure `csr_matrix` stored in `climada.hazard.Hazard` have consistent data format and store no explicit zeros when initializing `ImpactCalc` [#893](https://github.com/CLIMADA-project/climada_python/pull/893)
52+
- `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)
53+
- `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)
54+
- Split `climada.hazard.trop_cyclone` module into smaller submodules without affecting module usage [#911](https://github.com/CLIMADA-project/climada_python/pull/911)
55+
56+
### Fixed
57+
58+
- Avoid an issue where a Hazard subselection would have a fraction matrix with only zeros as entries by throwing an error [#866](https://github.com/CLIMADA-project/climada_python/pull/866)
59+
- Allow downgrading the Python bugfix version to improve environment compatibility [#900](https://github.com/CLIMADA-project/climada_python/pull/900)
60+
- Fix broken links in `CONTRIBUTING.md` [#900](https://github.com/CLIMADA-project/climada_python/pull/900)
61+
- When writing `TCTracks` to NetCDF, only apply compression to `float` or `int` data types. This fixes a downstream issue, see [climada_petals#135](https://github.com/CLIMADA-project/climada_petals/issues/135) [#911](https://github.com/CLIMADA-project/climada_python/pull/911)
62+
63+
### Added
64+
65+
- Method `Hazard.check_matrices` for bringing the stored CSR matrices into "canonical format" [#893](https://github.com/CLIMADA-project/climada_python/pull/893)
66+
- Generic s-shaped impact function via `ImpactFunc.from_poly_s_shape` [#878](https://github.com/CLIMADA-project/climada_python/pull/878)
67+
- climada.hazard.centroids.centr.Centroids.get_area_pixel
68+
- climada.hazard.centroids.centr.Centroids.get_dist_coast
69+
- climada.hazard.centroids.centr.Centroids.get_elevation
70+
- climada.hazard.centroids.centr.Centroids.get_meta
71+
- climada.hazard.centroids.centr.Centroids.get_pixel_shapes
72+
- climada.hazard.centroids.centr.Centroids.to_crs
73+
- climada.hazard.centroids.centr.Centroids.to_default_crs
74+
- climada.hazard.centroids.centr.Centroids.write_csv
75+
- climada.hazard.centroids.centr.Centroids.write_excel
76+
77+
### Deprecated
78+
79+
- climada.hazard.centroids.centr.Centroids.from_lat_lon
80+
- climada.hazard.centroids.centr.Centroids.def set_area_pixel
81+
- climada.hazard.centroids.centr.Centroids.def set_area_approx
82+
- climada.hazard.centroids.centr.Centroids.set_dist_coast
83+
- climada.hazard.centroids.centr.Centroids.empty_geometry_points
84+
- climada.hazard.centroids.centr.Centroids.set_meta_to_lat_lon
85+
- climada.hazard.centroids.centr.Centroids.set_lat_lon_to_meta
86+
- `scheduler` parameter in `climada.util.coordinates.set_df_geometry_points`, as dask is not used anymore, leaving all calculation to shapely [#912](https://github.com/CLIMADA-project/climada_python/pull/912)
87+
88+
### Removed
89+
90+
- climada.hazard.base.Hazard.clear
91+
- climada.hazard.base.Hazard.raster_to_vector
92+
- climada.hazard.base.Hazard.read_mat
93+
- climada.hazard.base.Hazard.reproject_raster
94+
- climada.hazard.base.Hazard.set_vector
95+
- climada.hazard.base.Hazard.vector_to_raster
96+
- climada.hazard.centroids.centr.Centroids.calc_pixels_polygons
97+
- climada.hazard.centroids.centr.Centroids.check
98+
- climada.hazard.centroids.centr.Centroids.clear
99+
- climada.hazard.centroids.centr.Centroids.equal
100+
- climada.hazard.centroids.centr.Centroids.from_mat
101+
- climada.hazard.centroids.centr.Centroids.from_base_grid
102+
- climada.hazard.centroids.centr.Centroids.read_excel
103+
- climada.hazard.centroids.centr.Centroids.read_hdf5
104+
- climada.hazard.centroids.centr.Centroids.read_mat
105+
- climada.hazard.centroids.centr.Centroids.set_elevation
106+
- climada.hazard.centroids.centr.Centroids.set_geometry_points
107+
- climada.hazard.centroids.centr.Centroids.set_lat_lon
108+
- climada.hazard.centroids.centr.Centroids.set_raster_file
109+
- climada.hazard.centroids.centr.Centroids.set_raster_from_pnt_bounds
110+
- climada.hazard.centroids.centr.Centroids.set_vector_file
111+
- climada.hazard.centroids.centr.Centroids.values_from_raster_files
112+
- climada.hazard.centroids.centr.Centroids.values_from_vector_files
113+
- climada.hazard.centroids.centr.generate_nat_earth_centroids
114+
- `requirements/env_docs.yml`. The regular environment specs are now used to build the online documentation [#687](https://github.com/CLIMADA-project/climada_python/pull/687)
115+
3116
## 4.1.1
4117

5118
Release date: 2024-02-21
@@ -81,6 +194,7 @@ Changed:
81194

82195
- `geopandas` >=0.13 &rarr; >=0.14
83196
- `pandas` >=1.5,<2.0 &rarr; >=2.1
197+
- `salib` >=1.3.0 &rarr; >=1.4.7
84198

85199
Removed:
86200

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Please contact the [lead developers](https://wcr.ethz.ch/research/climada.html)
2222

2323
## Minimal Steps to Contribute
2424

25-
Before you start, please have a look at our [Developer Guide][devguide].
25+
Before you start, please have a look at our Developer Guide section in the [CLIMADA Docs][docs].
2626

2727
To contribute follow these steps:
2828

@@ -65,21 +65,22 @@ To contribute follow these steps:
6565
6666
## Resources
6767
68-
The CLIMADA documentation provides a [Developer Guide][devguide].
68+
The [CLIMADA documentation][docs] provides several Developer Guides.
6969
Here's a selection of the commonly required information:
7070

7171
* How to use Git and GitHub for CLIMADA development: [Development and Git and CLIMADA](https://climada-python.readthedocs.io/en/latest/guide/Guide_Git_Development.html)
72-
* Coding instructions for CLIMADA: [Python Dos and Don'ts](https://climada-python.readthedocs.io/en/latest/guide/Guide_PythonDos-n-Donts.html), [Performance Tips](https://climada-python.readthedocs.io/en/latest/guide/Guide_Py_Performance.html), [CLIMADA Conventions](https://climada-python.readthedocs.io/en/latest/guide/Guide_Miscellaneous.html)
73-
* How to execute tests in CLIMADA: [Testing and Continuous Integration][testing]
72+
* Coding instructions for CLIMADA: [Python Dos and Don'ts](https://climada-python.readthedocs.io/en/latest/guide/Guide_PythonDos-n-Donts.html), [Performance Tips](https://climada-python.readthedocs.io/en/latest/guide/Guide_Py_Performance.html), [CLIMADA Conventions](https://climada-python.readthedocs.io/en/latest/guide/Guide_CLIMADA_conventions.html)
73+
* How to execute tests in CLIMADA: [Testing][testing] and [Continuous Integration](https://climada-python.readthedocs.io/en/latest/guide/Guide_continuous_integration_GitHub_actions.html)
7474
7575
## Pull Requests
7676
7777
After developing a new feature, fixing a bug, or updating the tutorials, you can create a [pull request](https://docs.github.com/en/pull-requests) to have your changes reviewed and then merged into the CLIMADA code base.
7878
To ensure that your pull request can be reviewed quickly and easily, please have a look at the _Resources_ above before opening a pull request.
79-
In particular, please check out the [Pull Request instructions](https://climada-python.readthedocs.io/en/latest/guide/Guide_Git_Development.html#Pull-requests).
79+
In particular, please check out the [Pull Request instructions](https://climada-python.readthedocs.io/en/latest/guide/Guide_Git_Development.html#pull-requests).
8080
8181
We provide a description template for pull requests that helps you provide the essential information for reviewers.
8282
It also contains a checklist for both pull request authors and reviewers to guide the review process.
8383
84+
[docs]: https://climada-python.readthedocs.io/en/latest/
8485
[devguide]: https://climada-python.readthedocs.io/en/latest/#developer-guide
85-
[testing]: https://climada-python.readthedocs.io/en/latest/guide/Guide_Continuous_Integration_and_Testing.html
86+
[testing]: https://climada-python.readthedocs.io/en/latest/guide/Guide_Testing.html

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
PYTEST_JUNIT_ARGS = --junitxml=tests_xml/tests.xml
66

77
PYTEST_COV_ARGS = \
8-
--cov --cov-config=.coveragerc --cov-report html --cov-report xml \
9-
--cov-report term:skip-covered
8+
--cov --cov-config=.coveragerc --cov-report html:coverage \
9+
--cov-report xml:coverage.xml --cov-report term:skip-covered
1010

1111
PYTEST_ARGS = $(PYTEST_JUNIT_ARGS) $(PYTEST_COV_ARGS)
1212

climada/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.1.1'
1+
__version__ = '4.1.2-dev'

climada/conf/climada.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"cache_db": "{local_data.system}/.downloads.db",
6868
"cache_enabled": true,
6969
"cache_dir": "{local_data.system}/.apicache",
70-
"supported_hazard_types": ["river_flood", "tropical_cyclone", "storm_europe", "relative_cropyield", "wildfire", "earthquake", "flood"],
71-
"supported_exposures_types": ["litpop", "crop_production", "ssp_population"]
70+
"supported_hazard_types": ["river_flood", "tropical_cyclone", "storm_europe", "relative_cropyield", "wildfire", "earthquake", "flood", "hail", "aqueduct_coastal_flood"],
71+
"supported_exposures_types": ["litpop", "crop_production", "ssp_population", "crops"]
7272
}
7373
}

climada/engine/forecast.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from matplotlib.ticker import PercentFormatter, ScalarFormatter
3232
from matplotlib.colors import ListedColormap, BoundaryNorm
3333
import cartopy.crs as ccrs
34+
from matplotlib import colormaps as cm
3435
import pyproj
3536
import shapely
3637
from cartopy.io import shapereader
@@ -88,7 +89,7 @@
8889
warnprob_colors_extended = np.repeat(warnprob_colors, 10, axis=0)
8990
CMAP_WARNPROB = ListedColormap(warnprob_colors_extended)
9091
# colors for impact forecast
91-
color_map_pre = plt.get_cmap("plasma", 90)
92+
color_map_pre = cm.get_cmap("plasma").resampled(90)
9293
impact_colors = color_map_pre(np.linspace(0, 1, 90))
9394
white_extended = np.repeat([[255 / 255, 255 / 255, 255 / 255, 1]], 10, axis=0)
9495
impact_colors_extended = np.append(white_extended, impact_colors, axis=0)

0 commit comments

Comments
 (0)