Skip to content

Commit

Permalink
Merge branch 'main' into crs
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbuntemeyer committed Feb 1, 2025
2 parents 45bfdf0 + 33e1648 commit 5a27076
Show file tree
Hide file tree
Showing 40 changed files with 3,392 additions and 2,619 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
os: ["ubuntu-latest"]
# python versions
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -36,7 +36,7 @@ jobs:
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Create conda environment
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
cache-downloads: true
cache-downloads-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}"
Expand All @@ -61,7 +61,7 @@ jobs:
--junitxml=test-results/${{ runner.os }}-${{ matrix.python-version }}.xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
flags: unittests
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/publish-pypi.yaml

This file was deleted.

117 changes: 117 additions & 0 deletions .github/workflows/release-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build and Upload py-cordex to PyPI
on:
release:
types:
- published
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build-artifacts:
runs-on: ubuntu-latest
if: github.repository == 'euro-cordex/py-cordex'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build tarball and wheels
run: |
git clean -xdf
git restore -SW .
python -m build
- name: Check built artifacts
run: |
python -m twine check --strict dist/*
pwd
if [ -f dist/py-cordex-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist

test-built-dist:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
- name: Verify the built dist/wheel is valid
if: github.event_name == 'push'
run: |
python -m pip install --upgrade pip
python -m pip install dist/py-cordex*.whl
python -c "import cordex; print(cordex.__version__)"
upload-to-test-pypi:
needs: test-built-dist
if: github.event_name == 'push'
runs-on: ubuntu-latest

environment:
name: pypi
url: https://test.pypi.org/p/py-cordex
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to TestPyPI
if: github.event_name == 'push'
uses: pypa/[email protected]
with:
repository-url: https://test.pypi.org/legacy/
verbose: true


upload-to-pypi:
needs: test-built-dist
if: github.event_name == 'release'
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/py-cordex
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
verbose: true
88 changes: 0 additions & 88 deletions .github/workflows/testpypi-release.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-json
Expand All @@ -10,18 +10,18 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.2'
rev: 'v0.9.3'
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.9.1
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
Expand Down
29 changes: 22 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,36 @@ This package offers python tools for the `CORDEX <https://cordex.org/>`_ communi
Most of the tools leverage the ``xarray`` API to create grid and coordinate informations and data of CORDEX domains in the
form of an ``xarray.Dataset`` directly from the official `CORDEX archive specifications <https://cordex.org/experiment-guidelines/experiment-protocol-rcms/>`_.

Please have a look at the `introduction noteboook <https://py-cordex.readthedocs.io/en/latest/notebooks/introduction.html>`_!

Features
--------

* Tools to manage CORDEX grids as xarray datasets.
* Includes coordinate transformations, bounds and vertices for CORDEX datasets.
* Utitlities for cmorization to make the CORDEX ensembles more consistent.
* Preprocessing for easy access to a homogenized CORDEX ensemble dataset.

For planned features, please have a look at the `issues <https://github.com/euro-cordex/py-cordex/issues>`_, grab one, and `contribute <https://py-cordex.readthedocs.io/en/latest/contributing.html>`_!
You can use this package, e.g., to easily access CORDEX grid definitions:

.. code-block:: python
import cordex as cx
cx.domain("EUR-11")
to create an xarray Dataset:

.. image:: https://raw.githubusercontent.com/euro-cordex/py-cordex/main/docs/eur-11_xarray.png

Meta data
^^^^^^^^^
Access to meta data should be automatic and machine readable to avoid humans to do boring, repetitiv tasks that are error prone.
For that purpose, easy access to meta information should be guaranteed by tables collected `here <https://github.com/euro-cordex/tables>`_.
and make a quick plot using the accessor:

.. code-block:: python
cx.domain("EUR-11").cx.map()
.. image:: https://raw.githubusercontent.com/euro-cordex/py-cordex/main/docs/eur-11.png

For planned features, please have a look at the `issues <https://github.com/euro-cordex/py-cordex/issues>`_, grab one, and `contribute <https://py-cordex.readthedocs.io/en/latest/contributing.html>`_!

Installation
------------
Expand All @@ -58,7 +74,6 @@ For instructions to install py-cordex from source, please have a look at the
If you want to contribute, please get in contact as early as possible, e.g.,
using `draft pull requests <https://github.blog/2019-02-14-introducing-draft-pull-requests>`_.


Credits
-------

Expand Down
6 changes: 2 additions & 4 deletions ci/requirements/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.10
- docutils
- pint-xarray
- matplotlib-base
- xarray
Expand All @@ -12,7 +13,6 @@ dependencies:
- pillow
- pip
- nbsphinx
- nbsphinx-link
- ipython
- cftime
- pooch
Expand All @@ -26,6 +26,4 @@ dependencies:
- pydata-sphinx-theme
- sphinx-book-theme>=0.3.3
- sphinx-autosummary-accessors
- pip:
- sphinxcontrib-mockautodoc
- myst_nb
- myst-nb
1 change: 1 addition & 0 deletions ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- python-cdo
- cmor
- pint-xarray
- pint!=0.24 # see https://github.com/euro-cordex/py-cordex/issues/249
- flox
# for testing
- pytest
Expand Down
Loading

0 comments on commit 5a27076

Please sign in to comment.