Skip to content
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
14 changes: 7 additions & 7 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hypothesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/environment_template.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/andrew-s28>`_.
- 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 <https://github.com/spencerkclark>`_.

.. _`pandas-dev/pandas#64793`: https://github.com/pandas-dev/pandas/pull/64793

Expand Down
13 changes: 5 additions & 8 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
9 changes: 8 additions & 1 deletion xarray/namedarray/parallelcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading