Unable to run groupby, map after shuffle_to_chunks

Đang mở
#11,212 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
numpy, python
Lĩnh vực
data

Hướng nghiên cứu

Chạy MVCE được cung cấp và truy vết các entry point groupby("y").shuffle_to_chunks() và groupby("y").map(...) tiếp theo, tập trung vào nơi kích thước chunk trở nên không xác định. So sánh dữ liệu trước và sau compute_chunk_sizes(), sau đó xác minh rằng việc lặp qua các nhóm và áp dụng hàm đồng nhất hoàn tất mà không có ValueError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug needs triage
What happened?

ValueError: Array chunk size or shape is unknown. Possible solution with x.compute_chunk_sizes()

What did you expect to happen?

Able to successfully iterate over groups and apply a function

Minimal Complete Verifiable Example
# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "xarray[complete]@git+https://github.com/pydata/xarray.git@main",
# ]
# ///
#
# This script automatically imports the development branch of xarray to check for issues.
# Please delete this header if you have _not_ tested this script with `uv run`!

import xarray as xr
xr.show_versions()
import dask.array as da
import numpy as np
import xarray as xr

data = da.ones((583753, 184), chunks=(18243, 12))

y = np.random.choice(np.array([1, 2, 3, 4, 5]), size=data.shape[0], replace=True)
d = xr.DataArray(data=data, coords={"y": y}, dims=["y", "x"])
d = d.groupby("y").shuffle_to_chunks()
d.data = d.data.compute_chunk_sizes()
d.groupby("y").map(lambda x: x)[
    0, 0].compute()  # ValueError: Array chunk size or shape is unknown. Possible solution with x.compute_chunk_sizes()
Steps to reproduce

No response

MVCE confirmation
  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
  • Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None
python: 3.12.12 | packaged by conda-forge | (main, Jan 27 2026, 00:01:15) [Clang 19.1.7 ]
python-bits: 64
OS: Darwin
OS-release: 25.3.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('C', 'UTF-8')
libhdf5: 1.14.6
libnetcdf: None
xarray: 2026.2.0
pandas: 2.3.3
numpy: 1.26.4
scipy: 1.16.3
netCDF4: None
pydap: None
h5netcdf: 1.8.1
h5py: 3.15.1
zarr: 2.18.7
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: 2025.11.0
distributed: 2025.11.0
matplotlib: 3.10.8
cartopy: None
seaborn: 0.13.2
numbagg: None
fsspec: 2026.2.0
cupy: None
pint: 0.25.2
sparse: None
flox: 0.11.2
numpy_groupies: 0.11.3
setuptools: 82.0.0
pip: 26.0.1
conda: None
pytest: 9.0.2
mypy: None
IPython: 9.10.0
sphinx: None

Ngôn ngữ chính
Python
Star
4.2k
Fork
1.5k
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pydata/xarray

Tất cả issue của pydata/xarray

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.