JuliaDataCubes / JuliaDataCubes/YAXArrays.jl
Map of cubes with different chunkings can't be indexed by axis
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 132
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
When I apply a map over two cubes which have different internal chunkings which I make align by the setchunks function, I can do the computation but the subsetting into one of the axes fails with a ERROR: Chunks do not align in dimension 2
But the indexing into the underlying data works and it seems that the computation is correct.
I can't reproduce it yet with a toy example.
julia> wcorann_nan = map((x,y) -> isnan(x) ? NaN32 : y, setchunks(wcor, YAXArrays.Cubes.cubechunks(wcorann)), wcorann)
YAXArray with the following dimensions
Y Axis with 5820 Elements from 561609.15 to 736179.15
X Axis with 7500 Elements from 9.48724066e6 to 9.26227066e6
Polarisation Axis with 2 elements: VH VV
name: layer
Total size: 333.02 MB
julia> wcorann_nan[Y=(560000,570000)]
ERROR: Chunks do not align in dimension 2
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] (::DiskArrays.var"#73#77"{Int64, Int64})(i::Int64, ch::DiskArrays.GridChunks{3})
@ DiskArrays ~/.julia/packages/DiskArrays/bcti2/src/broadcast.jl:96
[3] #4
@ ./generator.jl:36 [inlined]
[4] iterate
@ ./generator.jl:47 [inlined]
[5] collect_to!
@ ./array.jl:845 [inlined]
[6] collect_to_with_first!
@ ./array.jl:823 [inlined]
[7] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Int64}, Vector{DiskArrays.GridChunks{3}}}}, Base.var"#4#5"{DiskArrays.var"#73#77"{Int64, Int64}}})
@ Base ./array.jl:797
[8] map
@ ./abstractarray.jl:3055 [inlined]
[9] merge_chunks(csnow::Vector{DiskArrays.GridChunks{3}}, n::Int64)
@ DiskArrays ~/.julia/packages/DiskArrays/bcti2/src/broadcast.jl:94
[10] #63
@ ~/.julia/packages/DiskArrays/bcti2/src/broadcast.jl:72 [inlined]
[11] ntuple
@ ./ntuple.jl:19 [inlined]
[12] common_chunks(::Tuple{Int64, Int64, Int64}, ::Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}, ::Vararg{Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}})
@ DiskArrays ~/.julia/packages/DiskArrays/bcti2/src/broadcast.jl:63
[13] eachchunk
@ ~/.julia/packages/DiskArrays/bcti2/src/broadcast.jl:51 [inlined]
[14] eachchunk_view(#unused#::DiskArrays.Chunked, vv::SubArray{Float32, 3, DiskArrays.BroadcastDiskArray{Float32, 3, Base.Broadcast.Broadcasted{DiskArrays.ChunkStyle{3}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}, var"#52#53", Tuple{Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}, Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}}}}, Tuple{UnitRange{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}, false})
@ DiskArrays ~/.julia/packages/DiskArrays/bcti2/src/subarray.jl:36
[15] eachchunk(a::DiskArrays.SubDiskArray{Float32, 3})
@ DiskArrays ~/.julia/packages/DiskArrays/bcti2/src/subarray.jl:32
[16] subsetcube(z::YAXArray{Float32, 3, DiskArrays.BroadcastDiskArray{Float32, 3, Base.Broadcast.Broadcasted{DiskArrays.ChunkStyle{3}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}, Base.OneTo{Int64}}, var"#52#53", Tuple{Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}, Zarr.ZArray{Float32, 3, Zarr.BloscCompressor, Zarr.DirectoryStore}}}}, Vector{CubeAxis}}; kwargs::Base.Pairs{Symbol, Tuple{Int64, Int64}, Tuple{Symbol}, NamedTuple{(:Y,), Tuple{Tuple{Int64, Int64}}}})
@ YAXArrays.Cubes ~/.julia/packages/YAXArrays/rQDCf/src/Cubes/Cubes.jl:260
[17] #getindex#22
@ ~/.julia/packages/YAXArrays/rQDCf/src/Cubes/Cubes.jl:316 [inlined]
[18] top-level scope
@ REPL[233]:1
Hereby the cubes are the following:
julia> wcor
YAXArray with the following dimensions
Y Axis with 5820 Elements from 561609.15 to 736179.15
X Axis with 7500 Elements from 9.48724066e6 to 9.26227066e6
Polarisation Axis with 2 elements: VH VV
name: layer
Total size: 333.02 MB
julia> wcorann
YAXArray with the following dimensions
Y Axis with 5820 Elements from 561609.15 to 736179.15
X Axis with 7500 Elements from 9.48724066e6 to 9.26227066e6
Polarisation Axis with 2 elements: VH VV
name: layer
Total size: 333.02 MB
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start by examining the provided Julia session and the stack trace through DiskArrays' broadcast.jl and subarray.jl, then YAXArrays.Cubes.subsetcube in Cubes.jl. Reproduce the map with setchunks on differently chunked cubes before investigating why Y=(560000,570000) indexing fails. Done means the mapped cube can be indexed successfully and still returns the correct computed data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100