JuliaDataCubes / JuliaDataCubes/YAXArrays.jl
Selection with extent of a single pixel fails with Chunk error
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 132
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
When I am trying to select with an Extent that falls fully into one pixel I get the following error.
This appeared for me while working on PyramidScheme, where the first extent might be off, when the Makie axis is not yet on the right position.
using YAXArrays, ArchGDAL
julia> c = Cube("test/data/bremen_sea_ice_conc_2022_9_9.tif")
cs = 512
cs = 512
╭───────────────────────────────╮
│ 1264×1327 YAXArray{Float32,2} │
├───────────────────────────────┴──────────────────────────────────────── dims ┐
↓ X Sampled{Float64} -3.95e6:6250.0:3.94375e6 ForwardOrdered Regular Points,
→ Y Sampled{Float64} 4.35e6:-6250.0:-3.9375e6 ReverseOrdered Regular Points
├──────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────── metadata ┐
Dict{String, Any} with 2 entries:
"name" => "Gray"
"projection" => "PROJCS[\"WGS 84 / Antarctic Polar Stereographic\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",63781…
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── file size ┤
file size: 6.4 MB
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
julia> c[X=1..10]
cs = 512
cs = 0
ERROR: ArgumentError: Chunk sizes must be strictly positive
Stacktrace:
[1] DiskArrays.RegularChunks(cs::Int64, offset::Int64, s::Int64)
@ DiskArrays ~/Documents/PyramidScheme/dev/DiskArrays/src/chunks.jl:27
[2] subsetchunks(r::DiskArrays.RegularChunks, subs::UnitRange{Int64})
@ DiskArrays ~/Documents/PyramidScheme/dev/DiskArrays/src/chunks.jl:51
[3] #104
@ ./range.jl:0 [inlined]
[4] iterate
@ ./generator.jl:47 [inlined]
[5] grow_to!(dest::Vector{…}, itr::Base.Generator{…})
@ Base ./array.jl:907
[6] collect(itr::Base.Generator{Base.Iterators.Filter{…}, DiskArrays.var"#104#107"{…}})
@ Base ./array.jl:831
[7] eachchunk_view(::DiskArrays.Chunked{…}, vv::SubArray{…})
@ DiskArrays ~/Documents/PyramidScheme/dev/DiskArrays/src/subarray.jl:33
[8] eachchunk
@ ~/Documents/PyramidScheme/dev/DiskArrays/src/subarray.jl:25 [inlined]
[9] rebuild
@ ~/Documents/PyramidScheme/dev/YAXArrays/src/Cubes/Cubes.jl:200 [inlined]
[10] rebuild
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/array.jl:85 [inlined]
[11] rebuildsliced
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/array.jl:100 [inlined]
[12] rebuildsliced
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/array.jl:99 [inlined]
[13] view
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/indexing.jl:125 [inlined]
[14] _dim_view
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/indexing.jl:110 [inlined]
[15] #view#110
@ ~/Documents/PyramidScheme/dev/DimensionalData/src/array/indexing.jl:81 [inlined]
[16] getindex(::YAXArray{…}; kwargs::@Kwargs{…})
@ YAXArrays.Cubes ~/Documents/PyramidScheme/dev/YAXArrays/src/Cubes/Cubes.jl:487
[17] top-level scope
@ REPL[221]:1
Some type information was truncated. Use `show(err)` to see complete types.
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
Reproduce the failure with c[X=1..10] using the attached Bremen GeoTIFF. Start in DiskArrays/src/chunks.jl and DiskArrays/src/subarray.jl, then inspect the YAXArrays rebuild path at YAXArrays/src/Cubes/Cubes.jl:200. Done means selecting an extent contained within one pixel no longer raises the zero chunk-size error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100