`chunks` needs to be passed to `to_multiscale` otherwise it's ignored
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start by tracing to_multiscale() and its calls from Image2DModel and Image3DModel when scale_factors is a list. Check the Dask-array and xarray.DataArray paths, then verify that existing chunks are passed through instead of replaced by defaults. Done means explicitly chunked input retains its chunks without requiring chunks on Image2DModel.parse().
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 394
- Forks
- 95
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from scverse/spatialdata
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
scverse/spatialdata#1256 ·
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
scverse/spatialdata#1249 ·
-
bug 🚨 element: images 🌌 element: labels 🏷️ needs: triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scverse/spatialdata#1239 ·
-
bug 🚨 element: shapes ▲ models needs: triage priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scverse/spatialdata#1234 ·
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scverse/spatialdata#1230 ·
All issues in scverse/spatialdata
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·