From cb81ee1294d27b48f9bc421c31b66219a5a2719d Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Fri, 11 Sep 2026 06:58:39 -0400 Subject: [PATCH 1/4] Fix bug in rechunking cftime arrays along a subset of dimensions (#11576) ### Description This PR proposes a fix for the issue that prevents rechunking multi-dimensional cftime arrays along a subset of its dimensions. It does so by preserving the chunks along dimensions that were not specified in the new target chunks, as is done for non-cftime arrays. ### Checklist - [x] Closes #11567 - [x] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` ### AI Disclosure This PR was created without AI. --- doc/whats-new.rst | 3 +++ xarray/namedarray/parallelcompat.py | 9 ++++++++- xarray/tests/test_dask.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 6d67d234020..da7259da069 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -117,6 +117,9 @@ Bug Fixes type error when applying reduction methods, due to the reduction methods being dynamically generated (:issue:`8136`). By `Andrew Scherer `_. +- Fixed a bug that caused rechunking a multi-dimensional cftime array along a + subset of its dimensions to raise an error (:issue:`11567`, :pull:`11576`). + By `Spencer Clark `_. .. _`pandas-dev/pandas#64793`: https://github.com/pandas-dev/pandas/pull/64793 diff --git a/xarray/namedarray/parallelcompat.py b/xarray/namedarray/parallelcompat.py index 8a68f5e9562..4ca5814580d 100644 --- a/xarray/namedarray/parallelcompat.py +++ b/xarray/namedarray/parallelcompat.py @@ -357,7 +357,14 @@ def rechunk( from xarray.namedarray.utils import _get_chunk if _contains_cftime_datetimes(data): - chunks2 = _get_chunk(data, chunks, self, preferred_chunks={}) # type: ignore[arg-type] + preferred_chunks = dict(enumerate(data.chunks)) + chunks2 = _get_chunk( + data, # type: ignore[arg-type] + chunks, + self, + preferred_chunks=preferred_chunks, + dims=preferred_chunks.keys(), + ) else: chunks2 = chunks # type: ignore[assignment] return data.rechunk(chunks2, **kwargs) diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index 3c0a4a19550..1b2b2effef3 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -1237,6 +1237,20 @@ def test_auto_chunk_da_cftime(): assert actual.chunks == expected.chunks +@pytest.mark.parametrize( + ("chunks", "expected"), + [({"x": 2, "y": 3}, ((2,), (3,))), ({"x": 2}, ((2,), (1, 1, 1)))], + ids=lambda x: f"{x}", +) +def test_rechunk_multi_dimensional_da_cftime(chunks, expected): + times = xr.date_range("2000", periods=6, use_cftime=True) + times = times.to_numpy().reshape((2, 3)) + da = xr.DataArray(times, dims=["x", "y"]) + da = da.chunk({"x": 1, "y": 1}) + result = da.chunk(chunks).chunks + assert result == expected + + def test_map_blocks_error(map_da, map_ds): def bad_func(darray): return (darray * darray.x + 5 * darray.y)[:1, :1] From 7819876ea740b774e62f49ac554a69706dbe83ff Mon Sep 17 00:00:00 2001 From: Charles Turner <52199577+charles-turner-1@users.noreply.github.com> Date: Sat, 12 Sep 2026 01:30:42 +1000 Subject: [PATCH 2/4] Fix property test (#11575) --- xarray/core/dataarray.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 0e4d186a944..dfcbb6e18cd 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -4,14 +4,7 @@ import datetime import json import warnings -from collections.abc import ( - Callable, - Collection, - Hashable, - Iterable, - Mapping, - Sequence, -) +from collections.abc import Callable, Collection, Hashable, Iterable, Mapping, Sequence from functools import partial from os import PathLike from types import EllipsisType @@ -4778,6 +4771,10 @@ def from_series(cls, series: pd.Series, sparse: bool = False) -> DataArray: Dataset.from_dataframe """ temp_name = "__temporary_name" + if temp_name == series.index.name: + # See properties/test_pandas_roundtrip.py: + # @reproduce_failure('6.155.2', b'AEEAQQBBAQFBAEEBAJBfX3RlbXBvcmFyeV9uYW1l') + temp_name = "__temporary_name_fallback" df = pd.DataFrame({temp_name: series}) ds = Dataset.from_dataframe(df, sparse=sparse) result = ds[temp_name] From a0e3b9ee302476f56a73b61550e3c98857d1c7c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2026 17:35:27 +0200 Subject: [PATCH 3/4] Bump the actions group with 2 updates (#11578) Bumps the actions group with 2 updates: [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) and [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action). Updates `prefix-dev/setup-pixi` from 0.10.1 to 0.10.2 - [Release notes](https://github.com/prefix-dev/setup-pixi/releases) - [Commits](https://github.com/prefix-dev/setup-pixi/compare/f00437f565399d418b0acc85936d12c1fb668347...d3f436a425481402e6a95a1d1fc10331c708cd9e) Updates `zizmorcore/zizmor-action` from 0.6.2 to 0.6.3 - [Release notes](https://github.com/zizmorcore/zizmor-action/releases) - [Commits](https://github.com/zizmorcore/zizmor-action/compare/3dc1ecc9bcb9e94e9b2c709687979e1298497054...70fb788f84895a7701f5643d103d587e460b5c99) --- updated-dependencies: - dependency-name: prefix-dev/setup-pixi dependency-version: 0.10.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: zizmorcore/zizmor-action dependency-version: 0.6.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci-additional.yaml | 14 +++++++------- .github/workflows/ci.yaml | 4 ++-- .github/workflows/hypothesis.yaml | 2 +- .github/workflows/upstream-dev-ci.yaml | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 1c5c8489df7..37aa24236c0 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -81,7 +81,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -120,7 +120,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -166,7 +166,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -216,7 +216,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -267,7 +267,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -317,7 +317,7 @@ jobs: with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -348,4 +348,4 @@ jobs: persist-credentials: false - name: Run zizmor - uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2 + uses: zizmorcore/zizmor-action@70fb788f84895a7701f5643d103d587e460b5c99 # v0.6.3 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3551e0712c9..32d2d0a7937 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -111,7 +111,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -220,7 +220,7 @@ jobs: with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 if: steps.filter.outputs.changed == 'true' with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} diff --git a/.github/workflows/hypothesis.yaml b/.github/workflows/hypothesis.yaml index 92e24a212c9..48f180fa9de 100644 --- a/.github/workflows/hypothesis.yaml +++ b/.github/workflows/hypothesis.yaml @@ -89,7 +89,7 @@ jobs: uses: xarray-contrib/pixi-lock/restore@1fab4c17af8243f6ca1321bc941cf2325f46c05d # v0.1.1 with: cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 295d20d36d8..7e4b0a1132c 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -117,7 +117,7 @@ jobs: with: manifest-path: ${{ env.MANIFEST_PATH }} cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true @@ -201,7 +201,7 @@ jobs: with: manifest-path: ${{ env.MANIFEST_PATH }} cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 + - uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e # v0.10.2 with: pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true From dcf716ac793e7aeb9e9ad41dfd250029e598648d Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Fri, 11 Sep 2026 17:36:17 +0200 Subject: [PATCH 4/4] use a maintained version of emscripten-forge (#11571) * use a maintained version of the emscripten-forge * docs-only changes [skip-ci] --- doc/environment_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/environment_template.yml b/doc/environment_template.yml index ca132a6b9ef..0f6c8264c04 100644 --- a/doc/environment_template.yml +++ b/doc/environment_template.yml @@ -1,6 +1,6 @@ name: xeus-python-kernel channels: - - https://prefix.dev/emscripten-forge-dev + - https://prefix.dev/emscripten-forge-4x - https://prefix.dev/conda-forge dependencies: - xeus-python