Skip to content

Commit a9235c0

Browse files
Merge branch 'feature/exposures_crs' into feature/wisc-relocation
2 parents f7bff5d + ac03762 commit a9235c0

File tree

108 files changed

+8533
-6356
lines changed

Some content is hidden

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

108 files changed

+8533
-6356
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
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior/error:
15+
1.
16+
17+
Code example:
18+
```python
19+
# Your code here
20+
```
21+
22+
**Expected behavior**
23+
A clear and concise description of what you expected to happen.
24+
25+
**Screenshots**
26+
If applicable, add screenshots to help explain your problem.
27+
28+
**Climada Version:** [Version or branch]
29+
30+
**System Information (please complete the following information):**
31+
- Operating system and version: [e.g. Ubuntu 22.04, macOS 14.3.1, Windows 10]
32+
- Python version: [e.g. 3.10]
33+
(to obtain this information execute > import sys >print(sys.version))
34+
35+
**Additional context**
36+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Code feature request
3+
about: Suggest an idea to improve the code
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
-
2828
name: Checkout Repo
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030
-
3131
# Store the current date to use it as cache key for the environment
3232
name: Get current date
@@ -64,7 +64,7 @@ jobs:
6464
-
6565
name: Upload Coverage Reports
6666
if: always()
67-
uses: actions/upload-artifact@v3
67+
uses: actions/upload-artifact@v4
6868
with:
6969
name: coverage-report-unittests-py${{ matrix.python-version }}
7070
path: coverage/

.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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@
2929
* Raphael Portmann
3030
* Nicolas Colombi
3131
* Leonie Villiger
32+
* Kam Lam Yeung
33+
* Sarah Hülsen
34+
* Timo Schmid
35+
* Luca Severino
36+
* Samuel Juhel

CHANGELOG.md

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,135 @@ Code freeze date: YYYY-MM-DD
1010

1111
### Dependency Changes
1212

13-
### Added
14-
1513
### Changed
1614

15+
- Remove content tables and make minor improvements (fix typos and readability) in
16+
CLIMADA tutorials. [#872](https://github.com/CLIMADA-project/climada_python/pull/872)
17+
- 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)
18+
- 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)
19+
1720
### Fixed
1821

22+
- 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)
23+
24+
### Added
25+
26+
- Generic s-shaped impact function via `ImpactFunc.from_poly_s_shape` [#878](https://github.com/CLIMADA-project/climada_python/pull/878)
27+
- climada.hazard.centroids.centr.Centroids.get_area_pixel
28+
- climada.hazard.centroids.centr.Centroids.get_dist_coast
29+
- climada.hazard.centroids.centr.Centroids.get_elevation
30+
- climada.hazard.centroids.centr.Centroids.get_meta
31+
- climada.hazard.centroids.centr.Centroids.get_pixel_shapes
32+
- climada.hazard.centroids.centr.Centroids.to_crs
33+
- climada.hazard.centroids.centr.Centroids.to_default_crs
34+
- climada.hazard.centroids.centr.Centroids.write_csv
35+
- climada.hazard.centroids.centr.Centroids.write_excel
36+
1937
### Deprecated
2038

39+
- climada.hazard.centroids.centr.Centroids.from_lat_lon
40+
- climada.hazard.centroids.centr.Centroids.def set_area_pixel
41+
- climada.hazard.centroids.centr.Centroids.def set_area_approx
42+
- climada.hazard.centroids.centr.Centroids.set_dist_coast
43+
- climada.hazard.centroids.centr.Centroids.empty_geometry_points
44+
- climada.hazard.centroids.centr.Centroids.set_meta_to_lat_lon
45+
- climada.hazard.centroids.centr.Centroids.set_lat_lon_to_meta
46+
2147
### Removed
2248

49+
- climada.hazard.base.Hazard.clear
50+
- climada.hazard.base.Hazard.raster_to_vector
51+
- climada.hazard.base.Hazard.read_mat
52+
- climada.hazard.base.Hazard.reproject_raster
53+
- climada.hazard.base.Hazard.set_vector
54+
- climada.hazard.base.Hazard.vector_to_raster
55+
- climada.hazard.centroids.centr.Centroids.calc_pixels_polygons
56+
- climada.hazard.centroids.centr.Centroids.check
57+
- climada.hazard.centroids.centr.Centroids.clear
58+
- climada.hazard.centroids.centr.Centroids.equal
59+
- climada.hazard.centroids.centr.Centroids.from_mat
60+
- climada.hazard.centroids.centr.Centroids.from_base_grid
61+
- climada.hazard.centroids.centr.Centroids.read_excel
62+
- climada.hazard.centroids.centr.Centroids.read_hdf5
63+
- climada.hazard.centroids.centr.Centroids.read_mat
64+
- climada.hazard.centroids.centr.Centroids.set_elevation
65+
- climada.hazard.centroids.centr.Centroids.set_geometry_points
66+
- climada.hazard.centroids.centr.Centroids.set_lat_lon
67+
- climada.hazard.centroids.centr.Centroids.set_raster_file
68+
- climada.hazard.centroids.centr.Centroids.set_raster_from_pnt_bounds
69+
- climada.hazard.centroids.centr.Centroids.set_vector_file
70+
- climada.hazard.centroids.centr.Centroids.values_from_raster_files
71+
- climada.hazard.centroids.centr.Centroids.values_from_vector_files
72+
- climada.hazard.centroids.centr.generate_nat_earth_centroids
73+
- `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)
74+
75+
## 4.1.1
76+
77+
Release date: 2024-02-21
78+
79+
### Fixed
80+
81+
- Fix `util.coordinates.latlon_bounds` for cases where the specified buffer is very large so that the bounds cover more than the full longitudinal range `[-180, 180]` [#839](https://github.com/CLIMADA-project/climada_python/pull/839)
82+
- Fix `climada.hazard.trop_cyclone` for TC tracks crossing the antimeridian [#839](https://github.com/CLIMADA-project/climada_python/pull/839)
83+
84+
## 4.1.0
85+
86+
Release date: 2024-02-14
87+
88+
### Dependency Changes
89+
90+
Added:
91+
92+
- `pyproj` >=3.5
93+
- `numexpr` >=2.9
94+
95+
Updated:
96+
97+
- `contextily` >=1.3 → >=1.5
98+
- `dask` >=2023 → >=2024
99+
- `numba` >=0.57 → >=0.59
100+
- `pandas` >=2.1 &rarr; >=2.1,<2.2
101+
- `pint` >=0.22 &rarr; >=0.23
102+
- `scikit-learn` >=1.3 &rarr; >=1.4
103+
- `scipy` >=1.11 &rarr; >=1.12
104+
- `sparse` >=0.14 &rarr; >=0.15
105+
- `xarray` >=2023.8 &rarr; >=2024.1
106+
- `overpy` =0.6 &rarr; =0.7
107+
- `peewee` =3.16.3 &rarr; =3.17.1
108+
109+
Removed:
110+
111+
- `proj` (in favor of `pyproj`)
112+
113+
### Added
114+
115+
- 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)
116+
- Read and Write methods to and from csv files for the `DiscRates` class. [#818](ttps://github.com/CLIMADA-project/climada_python/pull/818)
117+
- 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)
118+
- 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)
119+
- Add reset_frequency option for the impact.select() function. [#847](https://github.com/CLIMADA-project/climada_python/pull/847)
120+
121+
### Changed
122+
123+
- Update Developer and Installation Guides for easier accessibility by new developers. [808](https://github.com/CLIMADA-project/climada_python/pull/808)
124+
- Add `shapes` argument to `geo_im_from_array` to allow flexible turning on/off of plotting coastline in `plot_intensity`. [#805](https://github.com/CLIMADA-project/climada_python/pull/805)
125+
- Update `CONTRIBUTING.md` to better explain types of contributions to this repository [#797](https://github.com/CLIMADA-project/climada_python/pull/797)
126+
- The default tile layer in Exposures maps is not Stamen Terrain anymore, but [CartoDB Positron](https://github.com/CartoDB/basemap-styles). Affected methods are `climada.engine.Impact.plot_basemap_eai_exposure`,`climada.engine.Impact.plot_basemap_impact_exposure` and `climada.entity.Exposures.plot_basemap`. [#798](https://github.com/CLIMADA-project/climada_python/pull/798)
127+
- Recommend using Mamba instead of Conda for installing CLIMADA [#809](https://github.com/CLIMADA-project/climada_python/pull/809)
128+
- `Hazard.from_xarray_raster` now allows arbitrary values as 'event' coordinates [#837](https://github.com/CLIMADA-project/climada_python/pull/837)
129+
- `climada.test.get_test_file` now compares the version of the requested test dataset with the version of climada itself and selects the most appropriate dataset. In this way a test file can be updated without the need of changing the code of the unittest. [#822](https://github.com/CLIMADA-project/climada_python/pull/822)
130+
- Explicitly require `pyproj` instead of `proj` (the latter is now implicitly required) [#845](https://github.com/CLIMADA-project/climada_python/pull/845)
131+
132+
### Fixed
133+
134+
- `Hazard.from_xarray_raster` now stores strings as default values for `Hazard.event_name` [#795](https://github.com/CLIMADA-project/climada_python/pull/795)
135+
- Fix the dist_approx util function when used with method="geosphere" and log=True and points that are very close. [#792](https://github.com/CLIMADA-project/climada_python/pull/792)
136+
- `climada.util.yearsets.sample_from_poisson`: fix a bug ([#819](https://github.com/CLIMADA-project/climada_python/issues/819)) and inconsistency that occurs when lambda events per year (`lam`) are set to 1. [[#823](https://github.com/CLIMADA-project/climada_python/pull/823)]
137+
- In the TropCyclone class in the Holland model 2008 and 2010 implementation, a doublecounting of translational velocity is removed [#833](https://github.com/CLIMADA-project/climada_python/pull/833)
138+
- `climada.util.test.test_finance` and `climada.test.test_engine` updated to recent input data from worldbank [#841](https://github.com/CLIMADA-project/climada_python/pull/841)
139+
- Set `nodefaults` in Conda environment specs because `defaults` are not compatible with conda-forge [#845](https://github.com/CLIMADA-project/climada_python/pull/845)
140+
- Avoid redundant calls to `np.unique` in `Impact.impact_at_reg` [#848](https://github.com/CLIMADA-project/climada_python/pull/848)
141+
23142
## 4.0.1
24143

25144
Release date: 2023-09-27

CONTRIBUTING.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
# CLIMADA Contribution Guide
22

3-
Thank you for contributing to CLIMADA!
3+
We welcome any contribution to CLIMADA and want to express our thanks to everybody who contributes.
44

5-
## Overview
5+
## What Warrants a Contribution?
6+
7+
Anything!
8+
For orientation, these are some categories of possible contributions we can think of:
9+
10+
* **Technical problems and bugs:** Did you encounter a problem when using CLIMADA? Raise an [issue](https://github.com/CLIMADA-project/climada_python/issues) in our repository, providing a description or ideally a code replicating the error. Did you already find a solution to the problem? Please raise a pull request to help us resolve the issue!
11+
* **Documentation and Tutorial Updates:** Found a typo in the documentation? Is a tutorial lacking some information you find important? Simply fix a line, or add a paragraph. We are happy to incorporate you additions! Please raise a pull request!
12+
* **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.
13+
14+
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.
16+
17+
## Why Should You Contribute?
18+
19+
* You will be listed as author of the CLIMADA repository in the [AUTHORS](AUTHORS.md) file.
20+
* You will improve the quality of the CLIMADA software for you and for everybody else using it.
21+
* You will gain insights into scientific software development.
22+
23+
## Minimal Steps to Contribute
624

725
Before you start, please have a look at our [Developer Guide][devguide].
826

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ This is the Python (3.9+) version of CLIMADA - please see [here](https://github.
2121
## Getting started
2222

2323
CLIMADA runs on Windows, macOS and Linux.
24-
The released versions of the CLIMADA core can be installed directly through Anaconda:
24+
The released versions of CLIMADA are available from [conda-forge](https://anaconda.org/conda-forge/climada).
25+
Use the [Mamba](https://mamba.readthedocs.io/en/latest/) package manager to install it:
2526

2627
```shell
27-
conda install -c conda-forge climada
28+
mamba install -c conda-forge climada
2829
```
2930

30-
It is **highly recommended** to install CLIMADA into a **separate** Anaconda environment.
31+
It is **highly recommended** to install CLIMADA into a **separate** Conda environment.
3132
See the [installation guide](https://climada-python.readthedocs.io/en/latest/guide/install.html) for further information.
3233

3334
Follow the [tutorials](https://climada-python.readthedocs.io/en/stable/tutorial/1_main_climada.html) in a Jupyter Notebook to see what can be done with CLIMADA and how.
@@ -61,7 +62,9 @@ Please use the following logo if you are presenting results obtained with or thr
6162

6263
## Contributing
6364

64-
See the [Contribution Guide](CONTRIBUTING.md).
65+
We welcome any contribution to this repository, be it bugfixes and other code changes and additions, documentation improvements, or tutorial updates.
66+
67+
If you would like to contribute, please refer to our [Contribution Guide](CONTRIBUTING.md).
6568

6669
## Versioning
6770

climada/_version.py

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

0 commit comments

Comments
 (0)