`coords.update()` converts CuPy arrays to NumPy for dimension coordinates
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先在 DataSet.coords.update() 入口点重现最小示例,并检查已赋值的坐标数据是如何处理的。跟踪 CuPy 数组转换为 NumPy 数组的位置,然后确定预期行为,并添加一个回归测试来显示最终的坐标类型。
由索引模型根据 Issue 内容生成。
描述
What is your issue?
When assigning CuPy arrays as coordinates to a dataset using DataSet.coords.update(), the resulting coordinate data is converted to a NumPy array.
As a result, GPU-native workflows that are dependent on coordinates (e.g. grid interpolation) become CPU-bound or require additional data transfers to the GPU.
Minimal example:
data_cp = cp.arange(6)
ds = xr.Dataset({
"var": (("x"), data_cp)
})
x_cp = cp.array([0,1,2,3,4,5])
print(type(x_cp)) # <class 'cupy.ndarray'>
ds.coords.update({"x": x_cp.copy()})
print(type(ds.coords["x"].data)) # <class 'numpy.ndarray'>
xarray: 2026.2.0
Question
Is this conversion intended, or should CuPy-backed coordinates be supported?
- 主要语言
- Python
- 星标
- 4.2k
- 派生
- 1.5k
- 平均合并
- 2 天 20 小时
- 30 天内合并 PR
- 70
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pydata/xarray 的其他 Issue
-
xarray removes axis grid from pcolormesh可能已有人在做 @Sealdot 于 1 天前认领。 未关闭bug needs triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
`DataTree.map_over_datasets` behavior can be obscure sometimes可能已有人在做 @mohansree14 于 24 天前认领。 未关闭needs triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Comparing attrs that contain a dict of NumPy arrays raises ValueError in identical / assert_identical可能已有人在做 @SohamXYZDev 于 30 天前认领。 未关闭bug needs triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
RangeIndex` with datetime64 bounds cannot be printed (`Unknown format code 'g'`)可能已有人在做 @d-chambers 于 61 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
DataTree constructor error message says dict even though dict is not accepted可能已有人在做 @aryansk 于 100 天前认领。 未关闭bug contrib-good-first-issue topic-DataTree topic-error reporting
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
documentation priority: low size: S status: needs triage
难度 2/5 1-3 小时 新手友好度 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
维护者通常 1 天内回复
-
documentation priority: low size: S status: needs triage
难度 2/5 1-3 小时 新手友好度 72/100
cubrid-lab/pycubrid#1307 ·
维护者通常 1 天内回复
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't work未关闭bug
难度 2/5 1-3 小时 新手友好度 80/100
ShaftHQ/chaosengine-harness#143 ·
维护者通常 1 天内回复
-
LLMContextNode tool builders fail on nested params like `params:retrieval.max_matches`可能已有人在做 @Shizoqua 今天认领。 未关闭Community
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
security
难度 2/5 1-3 小时 新手友好度 78/100
btclib-org/portanode#985 ·
维护者通常 1 天内回复