Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
68646c2
Add uv-lock to pre-commit hooks
peanutfun Apr 30, 2026
017b804
Update dependency groups and add uv.lock
peanutfun Apr 30, 2026
7f1f80e
Update GitHub actions and readthedocs config
peanutfun Apr 30, 2026
dd0b8f3
ci: Fix setup-uv version
peanutfun Apr 30, 2026
8f22d94
readthedocs: Install libgdal via APT
peanutfun Apr 30, 2026
3af8041
Invoke uv via Makefile
peanutfun Apr 30, 2026
f95a1bc
rtd: Use latest Ubuntu LTS
peanutfun Apr 30, 2026
9a43de2
rtd: Try conda again
peanutfun Apr 30, 2026
5bb73b1
Require pandas <3.0
peanutfun Apr 30, 2026
3cd2b03
pre-commit: Add hook exporting doc requirements
peanutfun Apr 30, 2026
4bf46e2
rtd: Use exported requirements.txt for installation
peanutfun Apr 30, 2026
443aa67
rtd: Add environment file for docs referencing requirements
peanutfun Apr 30, 2026
dc893e6
Move doc environment file
peanutfun Apr 30, 2026
9195a68
rtd: Fix file path
peanutfun Apr 30, 2026
6732de6
rtd: Add Python version to conda environment
peanutfun Apr 30, 2026
9db855c
Add numpy as extra to gdal dependency
peanutfun Jun 3, 2026
caa8c9a
Install openssl in base conda image
peanutfun Jun 3, 2026
f2574bd
Try GDAL v3.13
peanutfun Jun 3, 2026
f64dfba
Avoid GDAL binaries
peanutfun Jun 3, 2026
ccda0fe
uv: Use non-managed Python, try to build gdal and rasterio
peanutfun Jun 4, 2026
e896359
ci: Install Python with micromamba
peanutfun Jun 4, 2026
6413b88
Use rasterio instead of gdal for file reading
peanutfun Jun 5, 2026
7314c01
Remove gdal from dependencies
peanutfun Jun 5, 2026
8f728bc
ci: Stop using mamba, install make
peanutfun Jun 5, 2026
231491d
ci: Fix action version
peanutfun Jun 5, 2026
633f782
Merge branch 'develop' into add-uv-config
peanutfun Jun 8, 2026
9c4a872
Consolidate requirements for pure pip install
peanutfun Jun 8, 2026
196cdd4
Fix integration tests
peanutfun Jun 8, 2026
89a9f34
rtd: Switch to uv
peanutfun Jun 8, 2026
608428a
ci: Add pipeline for integration tests
peanutfun Jun 8, 2026
3976e60
ci: Configure data dir and cache data
peanutfun Jun 8, 2026
f997051
ci: Fix 'unzip' command
peanutfun Jun 8, 2026
c5aa047
Remove pre-commit hook for doc requirements
peanutfun Jun 8, 2026
292fddf
ci: Try adapting climada.conf
peanutfun Jun 8, 2026
f322b0f
ci: Update Zenodo DOI and try debugging unzip
peanutfun Jun 8, 2026
236f854
ci: Fix configuration file paths
peanutfun Jun 8, 2026
e804207
ci: Update Zenodo DOI
peanutfun Jun 8, 2026
8dd69a5
ci: Fix Zenodo DOI
peanutfun Jun 8, 2026
14c6b67
Add script and pre-commit hook for compiling Conda env
peanutfun Jun 10, 2026
2f04c95
Remove optional dependencies
peanutfun Jun 10, 2026
307f5ac
Make conda-env hook not use uv
peanutfun Jun 10, 2026
c0d5208
ci: Overwrite when unzipping
peanutfun Jun 18, 2026
687d586
ci: Cache the Zenodo download, not the unzipped files
peanutfun Jun 18, 2026
10b4d1e
Fix integration tests
peanutfun Jun 18, 2026
a1ea4e7
Use pip install for unit tests. Require integration tests to pass
peanutfun Jun 18, 2026
6a0ff2e
ci: Use plain pip for unit tests
peanutfun Jun 18, 2026
01ab7f9
Remove uv commands from Makefile
peanutfun Jun 18, 2026
1d62420
ci: Update test results reporting
peanutfun Jun 18, 2026
fb097f9
ci: Fix bug in version specs
peanutfun Jun 18, 2026
0d6cc38
ci: Enable uv cache
peanutfun Jun 18, 2026
450ab18
ci: Improve step names
peanutfun Jun 18, 2026
be61130
Skip forecast plot test for matplotlib > 3.10
peanutfun Jun 19, 2026
561612c
Update conda env when script is changed
peanutfun Jun 24, 2026
dbe777b
Add comment to the beginning of automatically generated env file
peanutfun Jun 24, 2026
a0f4226
ci: Report integration tests and update checkout action
peanutfun Jun 24, 2026
9f6ce52
Remove unused files
peanutfun Jun 24, 2026
1da790f
Merge branch 'develop' into add-uv-config
peanutfun Jun 24, 2026
b400fef
ci: Always run publish-test-results
peanutfun Jul 2, 2026
a803784
Merge branch 'develop' into add-uv-config
peanutfun Aug 17, 2026
d9a9e4b
Pin affine<3.0
peanutfun Aug 19, 2026
9c16173
Add conda-forge package conversions
peanutfun Aug 20, 2026
fb83130
Allow Python 3.13
peanutfun Oct 28, 2026
3636ad6
Merge branch 'develop' into add-uv-config
peanutfun Nov 9, 2026
965edaa
Update pre-commit config and align dependencies
peanutfun Nov 10, 2026
de5e8b0
Fix eccodes requirements
peanutfun Nov 10, 2026
d167d2b
Restrict pyarrow to <26
peanutfun Nov 10, 2026
37701e3
ci: Add pipeline for building and testing with Mamba
peanutfun Nov 10, 2026
f0a8f84
ci: Upgrade Python versions and fix variable expansion
peanutfun Nov 10, 2026
f452a73
Add requirements/transform.yml
peanutfun Nov 10, 2026
9f234bf
Add xlrd as requirement
peanutfun Nov 10, 2026
4cf7587
ci: Always save data cache for integration tests
peanutfun Nov 10, 2026
7a73332
Remove obsolete make_conda_env.py
peanutfun Nov 10, 2026
ca1b83e
Skip geopandas resolution test
peanutfun Nov 10, 2026
67a077d
ci: Trigger 'add-uv-config' branch in Petals
peanutfun Nov 10, 2026
a9bd9ec
ci: Use pip to install dependencies in integration tests
peanutfun Nov 11, 2026
ad75752
ci: Fix python version, add cfgrib diagnostic output
peanutfun Nov 11, 2026
433b700
ci: Use UV for some tasks in integration tests
peanutfun Nov 11, 2026
2ffccea
Upgrade uv.lock
peanutfun Nov 11, 2026
89714e0
Revert "ci: Use pip to install dependencies in integration tests"
peanutfun Nov 11, 2026
f990719
ci: Run python commands with uv
peanutfun Nov 11, 2026
a1e5cc7
Add eccodeslib to requirement
peanutfun Nov 11, 2026
2b2ced3
Update dependency specs
peanutfun Nov 11, 2026
21d05a4
Update installation instructions
peanutfun Nov 12, 2026
4324d30
Finalize install instructions and reformat
peanutfun Nov 16, 2026
ef5dacc
Merge branch 'develop' into add-uv-config
emanuel-schmid Nov 18, 2026
dcb5c59
Drop eccodeslib requirement for non-Windows installations
peanutfun Nov 19, 2026
a004f58
Revert "Drop eccodeslib requirement for non-Windows installations"
peanutfun Nov 23, 2026
c3e9366
Only require eccodeslib for non-Windows platforms
peanutfun Nov 23, 2026
7236bad
Remove sphinx_tabs and rely on sphinx-design for tabs
peanutfun Nov 25, 2026
51a39c3
Fix intendation issues in install guide
peanutfun Nov 25, 2026
4283420
rtd: Switch to pip install requirements.txt
peanutfun Nov 30, 2026
c21b3c9
rtd: Fix typo
peanutfun Nov 30, 2026
3acc58c
Revert "rtd: Fix typo"
peanutfun Dec 1, 2026
9b45915
Revert "rtd: Switch to pip install requirements.txt"
peanutfun Dec 1, 2026
db5c875
ci: Use latest package versions in integration tests
peanutfun Dec 1, 2026
400bd04
Add documentation on uv dependency management
peanutfun Dec 1, 2026
aa7c9d2
Merge branch 'develop' into add-uv-config
peanutfun Dec 1, 2026
ab0a49a
Fix typo in docs
peanutfun Dec 1, 2026
d5f68a3
Revert "Skip forecast plot test for matplotlib > 3.10"
peanutfun Dec 1, 2026
6a56c5d
Merge branch 'develop' into add-uv-config
emanuel-schmid Dec 3, 2026
7a4a33a
amend to 1298 fix
emanuel-schmid Dec 3, 2026
7e4c73b
Update pre-commit repo for pyproject-to-conda-env
peanutfun Dec 3, 2026
93fcae2
remove explicit fiona dependency
emanuel-schmid Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 182 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ defaults:
run:
shell: bash -el {0}

env:
CLIMADA_DATA_DOI: 10.5281/zenodo.20595842
PYTHON_VERSION: "3.12"

jobs:

# --- UNIT TESTS --- #
build-and-test:
name: 'Core / Unit Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
# For publishing results
checks: write

# Run this test for different Python versions
strategy:
Expand All @@ -37,7 +40,174 @@ jobs:
steps:
-
name: Checkout Repo
uses: actions/checkout@v6
uses: actions/checkout@v7
-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
-
name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ./
pip install --group test
-
name: Run Unit Tests
run: |
make unit_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: test-results-core-unittests-py${{ matrix.python-version }}
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/

# --- INTEGRATION TESTS --- #
integration-test:
name: 'Core / Integration Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20

# NOTE: We use uv because we need 'uvx zenodo_get' to download the Zenodo data.
# The dependencies could also be handled with pip. We install the latest
# available package versions with 'uv sync --upgrade'

steps:
-
name: Checkout Repo
uses: actions/checkout@v7

# --- Modify paths in climada.conf ---
-
name: Write climada.conf system data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.system
value: ${{ github.workspace }}/climada/data
-
name: Write climada.conf demo data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.demo
value: ${{ github.workspace }}/climada/demo
-
run: |
cat climada.conf
# ---

-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
enable-cache: true
cache-suffix: integrationtest
-
name: Install dependencies
run: |
uv sync --upgrade --group test
-
name: Check cfgrib
run: |
uv run -- python -m cfgrib selfcheck
uv run -- python -c "import xarray as xr; print(xr.backends.list_engines().keys())"
-
name: Restore testing data cache
id: cache-testing-data
uses: actions/cache/restore@v5
with:
path: climada.zip
key: ${{ env.CLIMADA_DATA_DOI }}
-
# NOTE: This will skip downloading if 'climada.zip' exists
name: Download and unzip testing data
run: |
uvx zenodo_get ${{ env.CLIMADA_DATA_DOI }}
unzip -o climada.zip -d ${{ github.workspace }}
-
name: Run Integration Tests
run: |
uv run -- make integ_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: test-results-core-integrationtests
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-integrationtests
path: coverage/
-
# NOTE: We use the explicit save step to store the cache also if tests fail
name: Save testing data cache
if: ${{ !cancelled() && steps.cache-testing-data.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v5
with:
path: climada.zip
key: ${{ env.CLIMADA_DATA_DOI }}

# --- PUBLISH TESTS --- #
publish-test-results:
name: "Core / Publish Test Results"
if: ${{ always() }} # For reporting, run this job even if the previous jobs fail
needs: [build-and-test, integration-test]
runs-on: ubuntu-latest
permissions:
checks: write
steps:
-
name: Download Test Results
uses: actions/download-artifact@v8
with:
pattern: test-results-core*
path: results
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "results/**/*.xml"
check_name: "Core / Test Results"
comment_mode: "off"

# --- MAMBA UNIT TESTS --- #
mamba-pipeline:
name: 'Core / Mamba Unit Tests'
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
-
name: Checkout Repo
uses: actions/checkout@v7
-
# Store the current date to use it as cache key for the environment
name: Get current date
Expand All @@ -47,43 +217,30 @@ jobs:
name: Create Environment with Mamba
uses: mamba-org/setup-micromamba@v3
with:
environment-name: climada_env_${{ matrix.python-version }}
environment-name: climada_env_${{ env.PYTHON_VERSION }}
environment-file: requirements/env_climada.yml
create-args: >-
python=${{ matrix.python-version }}
python=${{ env.PYTHON_VERSION }}
make
# Persist environment for branch, Python version, single day
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
cache-environment-key: env-${{ github.ref }}-${{ env.PYTHON_VERSION }}-${{ steps.date.outputs.date }}
-
name: Install CLIMADA
run: |
python -m pip install "./[dev]"
python -m pip install -e ./
python -m pip install --group test
-
name: Run Unit Tests
run: |
make unit_test
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: tests_xml/tests.xml
check_name: "Core / Unit Test Results (${{ matrix.python-version }})"
comment_mode: "off"
-
name: Upload Coverage Reports
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/

# --- PETALS COMPATIBILITY --- #
test-petals:
name: Petals Compatibility
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@develop
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@add-uv-config
needs: build-and-test
with:
core_branch: ${{ github.ref }}
petals_branch: develop
petals_branch: add-uv-config
permissions:
checks: write
9 changes: 6 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: GitHub CI
# Execute this for every pull request (opened, reopened, and synchronized)
on: [pull_request]

env:
PYTHON_VERSION: "3.12"

jobs:
pre-commit-checks:
name: 'Core / Pre-Commit Checks'
Expand All @@ -18,10 +21,10 @@ jobs:
name: Checkout target commit
run: git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=50 origin ${{ github.event.pull_request.base.ref }}
-
name: Set up Python 3.12
uses: actions/setup-python@v5
name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
python-version: ${{ env.PYTHON_VERSION }}
-
# Store the current date to use it as cache key
name: Get current date
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ repos:
rev: '24.4.2'
hooks:
- id: black-jupyter

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: uv-lock

- repo: https://github.com/CLIMADA-project/pyproject-to-conda-env
rev: v1.2.0
hooks:
- id: pyproject_to_conda_env
files: ^(pyproject\.toml|requirements/(transform|env_climada)\.yml)$
args: [pyproject.toml, -t, requirements/transform.yml, -o, requirements/env_climada.yml]
18 changes: 5 additions & 13 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ sphinx:
configuration: doc/conf.py

build:
os: "ubuntu-22.04"
os: "ubuntu-26.04"
tools:
python: "mambaforge-4.10"

# Pin Python version in requirements
jobs:
pre_create_environment:
- echo " - python=3.12" >> requirements/env_climada.yml

conda:
environment: requirements/env_climada.yml
python: "3.12"

python:
install:
- method: pip
path: .
extra_requirements:
- method: uv
command: sync
groups:
- doc

formats:
Expand Down
8 changes: 2 additions & 6 deletions climada/engine/test/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import unittest
from pathlib import Path

import fiona
import geopandas as gpd
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -148,11 +147,8 @@ def test_Forecast_plot(self):
resolution="10m", category="cultural", name="admin_1_states_provinces"
)
if not cantons_file.exists():
with fiona.open(adm1_shape_file, "r") as source:
with fiona.open(cantons_file, "w", **source.meta) as sink:
for f in source:
if f["properties"]["adm0_a3"] == "CHE":
sink.write(f)
cantons = gpd.read_file(adm1_shape_file, where="adm0_a3 = 'CHE'")
cantons.to_file(cantons_file)
## test plotting functions
# should save plot without failing
forecast.plot_imp_map(
Expand Down
10 changes: 3 additions & 7 deletions climada/entity/exposures/litpop/nightlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import rasterio
import scipy.sparse as sparse
from affine import Affine
from osgeo import gdal
from PIL import Image
from shapefile import Shape

Expand Down Expand Up @@ -479,7 +478,7 @@ def load_nightlight_nasa(bounds, req_files, year):
continue
extent = np.int64(np.clip(extent, 0, tile_size[None] - 1))
# pylint: disable=unsubscriptable-object
im_nl, _ = read_bm_file(SYSTEM_DIR, fname % (year))
im_nl = read_bm_file(SYSTEM_DIR, fname % (year))
im_nl = np.flipud(im_nl)
im_nl = sparse.csc.csc_matrix(im_nl)
im_nl = im_nl[extent[0, 0] : extent[1, 0] + 1, extent[0, 1] : extent[1, 1] + 1]
Expand Down Expand Up @@ -512,18 +511,15 @@ def read_bm_file(bm_path, filename):
-------
arr1 : array
Raw BM data
curr_file : gdal GeoTiff File
Additional info from which coordinates can be calculated.
"""
path = Path(bm_path, filename)
LOGGER.debug("Importing%s.", path)
if not path.exists():
raise FileNotFoundError(
"Invalid path: check that the path to BlackMarble file is correct."
)
curr_file = gdal.Open(str(path))
arr1 = curr_file.GetRasterBand(1).ReadAsArray()
return arr1, curr_file
curr_file = rasterio.open(path)
return curr_file.read(1)


def unzip_tif_to_py(file_gz):
Expand Down
4 changes: 2 additions & 2 deletions climada/hazard/centroids/centr.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ def from_meta(cls, meta):

@classmethod
def from_vector_file(cls, file_name, dst_crs=None):
"""Create Centroids object from vector file (any format supported by fiona).
"""Create Centroids object from a vector file supported by GeoPandas.

Parameters
----------
file_name : str
vector file with format supported by fiona and 'geometry' field.
vector file in a format supported by GeoPandas, with a 'geometry' field.
dst_crs : crs, optional
reproject to given crs
If no crs is given in the file, simply sets the crs.
Expand Down
Loading
Loading