Skip to content

Commit 286aa34

Browse files
Merge branch 'develop' into feature/suppress_xarray_cast_warnings
2 parents e21926b + 1dae5a7 commit 286aa34

File tree

118 files changed

+2972
-2700
lines changed

Some content is hidden

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

118 files changed

+2972
-2700
lines changed

.github/scripts/make_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
"""This script is part of the GitHub CI make-release pipeline
33
4-
It reads the version number from climada/_version.py and then uses the `gh` cli
4+
It reads the version number from climada*/_version.py and then uses the `gh` cli
55
to create the new release.
66
77
"""

.github/scripts/prepare_release.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ def bump_version_number(version_number: str, level: str) -> str:
3939
major, minor, patch = version_number.split(".")
4040
if level == "major":
4141
major = str(int(major)+1)
42+
minor = "0"
43+
patch = "0"
4244
elif level == "minor":
4345
minor = str(int(minor)+1)
46+
patch = "0"
4447
elif level == "patch":
4548
patch = str(int(patch)+1)
4649
else:
@@ -111,7 +114,7 @@ def update_changelog(nvn):
111114
if "release date: " in line.lower():
112115
today = time.strftime("%Y-%m-%d")
113116
lines[i] = f"Release date: {today}"
114-
changelog.write("\n".join(lines).replace("\n\n", "\n"))
117+
changelog.write(re.sub("\n+$", "\n", "\n".join(lines)))
115118
changelog.write("\n")
116119
return GitFile('CHANGELOG.md')
117120

.github/scripts/setup_devbranch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ def setup_devbranch():
104104
Just changes files, all `git` commands are in the setup_devbranch.sh file.
105105
"""
106106
main_version = get_last_version().strip('v')
107-
108-
dev_version = f"{main_version}-dev"
107+
semver = main_version.split(".")
108+
semver[-1] = f"{int(semver[-1]) + 1}-dev"
109+
dev_version = ".".join(semver)
109110

110111
update_setup(dev_version)
111112
update_version(dev_version)

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: GitHub CI
2+
3+
# Execute this for every push
4+
on: [push]
5+
6+
# Use bash explicitly for being able to enter the conda environment
7+
defaults:
8+
run:
9+
shell: bash -l {0}
10+
11+
jobs:
12+
build-and-test:
13+
name: Build Env, Install, Unit Tests
14+
runs-on: ubuntu-latest
15+
permissions:
16+
# For publishing results
17+
checks: write
18+
19+
# Run this test for different Python versions
20+
strategy:
21+
# Do not abort other tests if only a single one fails
22+
fail-fast: false
23+
matrix:
24+
python-version: ["3.9", "3.10", "3.11"]
25+
26+
steps:
27+
-
28+
name: Checkout Repo
29+
uses: actions/checkout@v3
30+
-
31+
# Store the current date to use it as cache key for the environment
32+
name: Get current date
33+
id: date
34+
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
35+
-
36+
name: Create Environment with Mamba
37+
uses: mamba-org/setup-micromamba@v1
38+
with:
39+
environment-name: climada_env_${{ matrix.python-version }}
40+
environment-file: requirements/env_climada.yml
41+
create-args: >-
42+
python=${{ matrix.python-version }}
43+
make
44+
init-shell: >-
45+
bash
46+
# Persist environment for branch, Python version, single day
47+
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
48+
-
49+
name: Install CLIMADA
50+
run: |
51+
python -m pip install ".[test]"
52+
-
53+
name: Run Unit Tests
54+
run: |
55+
make unit_test
56+
-
57+
name: Publish Test Results
58+
uses: EnricoMi/publish-unit-test-result-action@v2
59+
if: always()
60+
with:
61+
junit_files: tests_xml/tests.xml
62+
check_name: "Unit Test Results Python ${{ matrix.python-version }}"
63+
comment_mode: "off"
64+
-
65+
name: Upload Coverage Reports
66+
if: always()
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: coverage-report-unittests-py${{ matrix.python-version }}
70+
path: coverage/

.github/workflows/make-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
with:
2929
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
3030
- name: Prepare new release
31-
run: .github/scripts/prepare_release.py ${{ inputs.level }}
31+
run: python .github/scripts/prepare_release.py ${{ inputs.level }}
3232
env:
3333
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
3434
- name: Publish
35-
run: .github/scripts/make_release.py
35+
run: python .github/scripts/make_release.py
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/postrelease-setup-devbranch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
with:
2020
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2121
- name: Update files
22-
run: .github/scripts/setup_devbranch.sh
22+
run: bash .github/scripts/setup_devbranch.sh
2323
env:
2424
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

CHANGELOG.md

Lines changed: 103 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,99 @@ Release date: YYYY-MM-DD
66

77
Code freeze date: YYYY-MM-DD
88

9+
### Description
10+
11+
### Dependency Changes
12+
13+
### Added
14+
15+
### Changed
16+
17+
### Fixed
18+
19+
### Deprecated
20+
21+
### Removed
22+
23+
## 4.0.1
24+
25+
Release date: 2023-09-27
26+
27+
### Dependency Changes
28+
29+
Added:
30+
31+
- `matplotlib-base` None → >=3.8
32+
33+
Changed:
34+
35+
- `geopandas` >=0.13 → >=0.14
36+
- `pandas` >=1.5,<2.0 &rarr; >=2.1
37+
38+
Removed:
39+
40+
- `matplotlib` >=3.7
41+
42+
### Changed
43+
44+
- Rearranged file-system structure: `data` directory moved into `climada` package directory. [#781](https://github.com/CLIMADA-project/climada_python/pull/781)
45+
46+
### Fixed
47+
48+
- `climada.util.coordinates.get_country_code` bug, occurring with non-standard longitudinal coordinates around the anti-meridian. [#770](https://github.com/CLIMADA-project/climada_python/issues/770)
49+
50+
## 4.0.0
51+
52+
Release date: 2023-09-01
53+
954
### Dependency Updates
1055

1156
Added:
1257

1358
- `pytest` [#726](https://github.com/CLIMADA-project/climada_python/pull/726)
1459
- `pytest-cov` [#726](https://github.com/CLIMADA-project/climada_python/pull/726)
1560
- `pytest-subtests` [#726](https://github.com/CLIMADA-project/climada_python/pull/726)
61+
- `unittest-xml-reporting`
1662

1763
Changed:
1864

65+
- `cartopy` >=0.20.0,<0.20.3 &rarr; >=0.21
66+
- `cfgrib` >=0.9.7,<0.9.10 &rarr; =0.9.9
67+
- `contextily` >=1.0 &rarr; >=1.3
68+
- `dask` >=2.25 &rarr; >=2023
69+
- `eccodes` [auto] &rarr; =2.27
70+
- `gdal` !=3.4.1 &rarr; >=3.6
71+
- `geopandas` >=0.8 &rarr; >=0.13
72+
- `h5py` >=2.10 &rarr; >=3.8
73+
- `haversine` >=2.3 &rarr; >=2.8
74+
- `matplotlib` >=3.2,< 3.6 &rarr; >=3.7
75+
- `netcdf4` >=1.5 &rarr; >=1.6
76+
- `numba` >=0.51,!=0.55.0 &rarr; >=0.57
77+
- `openpyxl` >=3.0 &rarr; >=3.1
78+
- `pandas-datareader` >=0.9 &rarr; >=0.10
79+
- `pathos` >=0.2 &rarr; >=0.3
80+
- `pint` >=0.15 &rarr; >=0.22
81+
- `proj` !=9.0.0 &rarr; >=9.1
82+
- `pycountry` >=20.7 &rarr; >=22.3
83+
- `pytables` >=3.6 &rarr; >=3.7
84+
- `rasterio` >=1.2.7,<1.3 &rarr; >=1.3
85+
- `requests` >=2.24 &rarr; >=2.31
86+
- `salib` >=1.3.0 &rarr; >=1.4
87+
- `scikit-learn` >=1.0 &rarr; >=1.2
88+
- `scipy` >=1.6 &rarr; >=1.10
89+
- `sparse` >=0.13 &rarr; >=0.14
90+
- `statsmodels` >=0.11 &rarr; >=0.14
91+
- `tabulate` >=0.8 &rarr; >=0.9
92+
- `tqdm` >=4.48 &rarr; >=4.65
93+
- `xarray` >=0.13 &rarr; >=2023.5
94+
- `xlrd` >=1.2 &rarr; >=2.0
95+
- `xlsxwriter` >=1.3 &rarr; >=3.1
96+
1997
Removed:
2098

2199
- `nbsphinx` [#712](https://github.com/CLIMADA-project/climada_python/pull/712)
22100
- `pandoc` [#712](https://github.com/CLIMADA-project/climada_python/pull/712)
101+
- `xmlrunner`
23102

24103
### Added
25104

@@ -29,7 +108,10 @@ Removed:
29108
- 'Extra' requirements `doc`, `test`, and `dev` for Python package [#712](https://github.com/CLIMADA-project/climada_python/pull/712)
30109
- Added method `Exposures.centroids_total_value` to replace the functionality of `Exposures.affected_total_value`. This method is temporary and deprecated. [#702](https://github.com/CLIMADA-project/climada_python/pull/702)
31110
- New method `climada.util.api_client.Client.purge_cache`: utility function to remove outdated files from the local file system to free disk space.
32-
([#737](https://github.com/CLIMADA-project/climada_python/pull/737))
111+
([#737](https://github.com/CLIMADA-project/climada_python/pull/737))
112+
- New attribute `climada.hazard.Hazard.haz_type`: used for assigning impacts to hazards. In previous versions this information was stored in the now removed `climada.hazard.tag.Tag` class. [#736](https://github.com/CLIMADA-project/climada_python/pull/736)
113+
- New attribute `climada.entity.exposures.Exposures.description`: used for setting the default title in plots from plotting mathods `plot_hexbin` and `plot_scatter`. In previous versions this information was stored in the deprecated `climada.entity.tag.Tag` class. [#756](https://github.com/CLIMADA-project/climada_python/pull/756)
114+
- Added advanced examples in unsequa tutorial for coupled input variables and for handling efficiently the loading of multiple large files [#766](https://github.com/CLIMADA-project/climada_python/pull/766)
33115

34116
### Changed
35117

@@ -50,30 +132,47 @@ Removed:
50132
- Use `pytest` for executing tests [#726](https://github.com/CLIMADA-project/climada_python/pull/726)
51133
- Users can opt-out of the climada specific logging definitions and freely configure logging to their will, by setting the config value `logging.managed` to `false`. [#724](https://github.com/CLIMADA-project/climada_python/pull/724)
52134
- Add option to read additional variables from IBTrACS when using `TCTracks.from_ibtracs_netcdf` [#728](https://github.com/CLIMADA-project/climada_python/pull/728)
53-
- The `haz_type` attribute has been moved from `climada.hazard.tag.Tag` to `climada.hazard.Hazard` itself. [#736](https://github.com/CLIMADA-project/climada_python/pull/736)
54135
- New file format for `TCTracks` I/O with better performance. This change is not backwards compatible: If you stored `TCTracks` objects with `TCTracks.write_hdf5`, reload the original data and store them again. [#735](https://github.com/CLIMADA-project/climada_python/pull/735)
55136
- Add option to load only a subset when reading TC tracks using `TCTracks.from_simulations_emanuel`. [#741](https://github.com/CLIMADA-project/climada_python/pull/741)
56137
- Set `save_mat` to `False` in the `unsequa` module [#746](https://github.com/CLIMADA-project/climada_python/pull/746)
57138
- `list_dataset_infos` from `climada.util.api_client.Client`: the `properties` argument, a `dict`, can now have `None` as values. Before, only strings and lists of strings were allowed. Setting a particular property to `None` triggers a search for datasets where this property is not assigned. [#752](https://github.com/CLIMADA-project/climada_python/pull/752)
58139
- Reduce memory requirements of `TropCyclone.from_tracks` [#749](https://github.com/CLIMADA-project/climada_python/pull/749)
59140
- Support for different wind speed and pressure units in `TCTracks` when running `TropCyclone.from_tracks` [#749](https://github.com/CLIMADA-project/climada_python/pull/749)
141+
- The title of plots created by the `Exposures` methods `plot_hexbin` and `plot_scatter` can be set as a method argument. [#756](https://github.com/CLIMADA-project/climada_python/pull/756)
142+
- Changed the parallel package from Pathos to Multiproess in the unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763)
143+
- Updated installation instructions to use conda for core and petals [#776](https://github.com/CLIMADA-project/climada_python/pull/776)
60144

61145
### Fixed
62146

63147
- `util.lines_polys_handler` solve polygon disaggregation issue in metre-based projection [#666](https://github.com/CLIMADA-project/climada_python/pull/666)
64148
- Problem with `pyproj.CRS` as `Impact` attribute, [#706](https://github.com/CLIMADA-project/climada_python/issues/706). Now CRS is always stored as `str` in WKT format.
149+
- Correctly handle assertion errors in `Centroids.values_from_vector_files` and fix the associated test [#768](https://github.com/CLIMADA-project/climada_python/pull/768/)
150+
- Text in `Forecast` class plots can now be adjusted [#769](https://github.com/CLIMADA-project/climada_python/issues/769)
151+
- `Impact.impact_at_reg` now supports impact matrices where all entries are zero [#773](https://github.com/CLIMADA-project/climada_python/pull/773)
152+
- upgrade pathos 0.3.0 -> 0.3.1 issue [#761](https://github.com/CLIMADA-project/climada_python/issues/761) (for unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763))
153+
- Fix bugs with pandas 2.0 (iteritems -> items, append -> concat) (fix issue [#700](https://github.com/CLIMADA-project/climada_python/issues/700) for unsequa module) [#763](https://github.com/CLIMADA-project/climada_python/pull/763))
154+
- Remove matplotlib styles in unsequa module (fixes issue [#758](https://github.com/CLIMADA-project/climada_python/issues/758)) [#763](https://github.com/CLIMADA-project/climada_python/pull/763)
65155

66156
### Deprecated
67157

68158
- `Centroids.from_geodataframe` and `Centroids.from_pix_bounds` [#721](https://github.com/CLIMADA-project/climada_python/pull/721)
69159
- `Impact.tot_value`: Use `Exposures.affected_total_value` to compute the total value affected by a hazard intensity above a custom threshold [#702](https://github.com/CLIMADA-project/climada_python/pull/702)
70-
- `climada.hazard.tag.Tag` and `climada.entity.tag.Tag`. [#736](https://github.com/CLIMADA-project/climada_python/pull/736). They were unified into `climada.util.tag.Tag`. Note: the latter is to be deprecated and removed in a future version as well.
160+
- `climada.entity.tag.Tag`. [#779](https://github.com/CLIMADA-project/climada_python/pull/779). The class is not used anymore but had to be kept for reading Exposures HDF5 files that were created with previous versions of CLIMADA.
71161

72162
### Removed
73163

74164
- `Centroids.set_raster_from_pix_bounds` [#721](https://github.com/CLIMADA-project/climada_python/pull/721)
75165
- `requirements/env_developer.yml` environment specs. Use 'extra' requirements when installing the Python package instead [#712](https://github.com/CLIMADA-project/climada_python/pull/712)
76-
- `Impact.tag` attribute. This change is not backwards-compatible with respect to the files written and read by the `Impact` class [#743](https://github.com/CLIMADA-project/climada_python/pull/743)
166+
- The `climada.entitity.tag.Tag` class, together with `Impact.tag`, `Exposures.tag`, `ImpactFuncSet.tag`, `MeasuresSet.tag`, `Hazard.tag` attributes.
167+
This may break backwards-compatibility with respect to the files written and read by the `Impact` class.
168+
[#736](https://github.com/CLIMADA-project/climada_python/pull/736),
169+
[#743](https://github.com/CLIMADA-project/climada_python/pull/743),
170+
[#753](https://github.com/CLIMADA-project/climada_python/pull/753),
171+
[#754](https://github.com/CLIMADA-project/climada_python/pull/754),
172+
[#756](https://github.com/CLIMADA-project/climada_python/pull/756),
173+
[#767](https://github.com/CLIMADA-project/climada_python/pull/767),
174+
[#779](https://github.com/CLIMADA-project/climada_python/pull/779)
175+
- `impact.tot_value` attribute removed from unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763)
77176

78177
## v3.3.2
79178

@@ -101,10 +200,6 @@ Patch-relaese with altered base config file so that the basic installation test
101200

102201
Release date: 2023-02-17
103202

104-
Code freeze date: 2023-02-05
105-
106-
### Description
107-
108203
### Dependency Changes
109204

110205
new:
@@ -194,4 +289,3 @@ updated:
194289
- `climada.enginge.impact.Impact.calc()` and `climada.enginge.impact.Impact.calc_impact_yearset()`
195290
[#436](https://github.com/CLIMADA-project/climada_python/pull/436).
196291

197-
### Removed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ install_test : ## Test installation was successful
2929

3030
.PHONY : data_test
3131
data_test : ## Test data APIs
32-
python test_data_api.py
32+
python script/jenkins/test_data_api.py
3333

3434
.PHONY : notebook_test
3535
notebook_test : ## Test notebooks in doc/tutorial
36-
python test_notebooks.py
36+
python script/jenkins/test_notebooks.py report
3737

3838
.PHONY : integ_test
3939
integ_test : ## Integration tests execution with xml reports

0 commit comments

Comments
 (0)