`chunks` needs to be passed to `to_multiscale` otherwise it's ignored
还没有人认领这个 Issue。
评估
调研方向
首先跟踪当 scale_factors 为列表时,to_multiscale() 及其从 Image2DModel 和 Image3DModel 发起的调用。检查 Dask-array 和 xarray.DataArray 路径,然后验证现有 chunks 会被直接传递,而不是被默认值替换。完成的标准是:显式指定 chunks 的输入能够保留其 chunks,而无需在 Image2DModel.parse() 中要求提供 chunks。
由索引模型根据 Issue 内容生成。
描述
Super easy fix.
Problem
The function to_multiscale(), which is called by Image2DModel and Image3DModel when scale_factors is a list, calls this code:
# IPFS and visualization friendly default chunks
if "z" in image.dims:
default_chunks = 64
else:
default_chunks = 256
default_chunks = {d: default_chunks for d in image.dims}
if "t" in image.dims:
default_chunks["t"] = 1
out_chunks = chunks
if out_chunks is None:
out_chunks = default_chunks
This means that if some chunks were already set for the data passed to the model, as in this case
# data = da.ones((3, 32768, 32768), chunks=(1, 4096, 4096))
chunks= (1, 4096, 4096)
data = RNG.random((3, 32768, 32768), chunks=chunks)
xdata = DataArray(data, dims=("c", "y", "x"))
##
im = Image2DModel.parse(
xdata,
scale_factors=[2, 2, 2],
# chunks=chunks
)
They are rechunked, unless we pass chunk explicitly to Image2DModel.parse().
Solution
If the data has already chunks, pass them to to_multiscale(). This needs to be done when the data with a Dask array or an xarray DataArray.
- 主要语言
- Python
- 星标
- 394
- 派生
- 95
- 平均合并
- 3 天 9 小时
- 30 天内合并 PR
- 5
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scverse/spatialdata 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
scverse/spatialdata#1256 ·
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 68/100
scverse/spatialdata#1249 ·
-
bug 🚨 element: images 🌌 element: labels 🏷️ needs: triage
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1239 ·
-
bug 🚨 element: shapes ▲ models needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1234 ·
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1230 ·
查看 scverse/spatialdata 的全部 Issue
相似的 Issue
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 90/100