Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with xr.core.ops renamed in versions of xarray>=2025.3.0 #2114

Merged
merged 7 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
"name": "Wong, Jack Kit-tai",
"affiliation": "University of Toronto, Toronto, Ontario, Canada",
"orcid": "0000-0003-1408-1502"
},
{
"name": "de Bruijn, Jens",
"affiliation": "Vrije Universiteit, Amsterdam, The Netherlands",
"orcid": "0000-0003-3961-6382"
}
],
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ Contributors
* Sebastian Lehner <[email protected]> `@seblehner <https://github.com/seblehner>`_
* Baptiste Hamon <[email protected]> `@baptistehamon <https://github.com/baptistehamon>`_
* Jack Kit-tai Wong <[email protected]> `@jack-ktw <https://github.com/jack-ktw>`_
* Jens de Bruijn <[email protected]> `@jensdebruijn <https://github.com/jensdebruijn>`_
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ Changelog

v0.56.0 (unreleased)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Hui-Min Wang (:user:`Hem-W`), Jack Kit-tai Wong(:user:`jack-ktw`), Adrien Lamarche (:user:`LamAdr`), Éric Dupuis (:user:`coxipi`).
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Hui-Min Wang (:user:`Hem-W`), Jack Kit-tai Wong(:user:`jack-ktw`), Adrien Lamarche (:user:`LamAdr`), Éric Dupuis (:user:`coxipi`), Jens de Bruijn (:user:`jensdebruijn`).

Bug fixes
^^^^^^^^^
* Fix installation instructions in the Contributing guide (:issue:`2088`, :pull:`2089`).
* Fixed parameter order in typing.cast() causing intermittent errors in solar_zenith_angle calculation. (:issue:`2097`, :pull:`2098`)
* `xclim` now uses directly `operator` instead of using `xarray`'s derived `get_op` function. A refactoring in `xarray` had changed the position of `get_op` which caused a bug. (:issue:`2113`, :pull:`2114`).
* Fixed an issue with star-annotated call signatures to maintain Python 3.10 compatibility. (:pull:`2116`).

Breaking changes
Expand Down
3 changes: 2 additions & 1 deletion src/xclim/indices/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from __future__ import annotations

import operator
import warnings
from collections.abc import Callable, Sequence

Expand Down Expand Up @@ -278,7 +279,7 @@ def get_op(op: str, constrain: Sequence[str] | None = None) -> Callable:
if op not in constraints:
raise ValueError(f"Operation `{op}` not permitted for indice.")

return xr.core.ops.get_op(binary_op) # noqa
return getattr(operator, f"__{binary_op}__")


def compare(
Expand Down