`chunks` needs to be passed to `to_multiscale` otherwise it's ignored
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 394
- Forks
- 95
- Ø Merge
- 4 T. 3 Std.
- Gemergte PRs (30 T.)
- 7
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, to_multiscale() und seine Aufrufe aus Image2DModel und Image3DModel zu verfolgen, wenn scale_factors eine Liste ist. Überprüfe die Pfade für Dask-array und xarray.DataArray und stelle anschließend sicher, dass vorhandene Chunks durchgereicht werden, anstatt durch Standardwerte ersetzt zu werden. Als erledigt gilt die Aufgabe, wenn explizit gechunkte Eingaben ihre Chunks behalten, ohne dass chunks in Image2DModel.parse() erforderlich sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 72/100