Selection with extent of a single pixel fails with Chunk error
Opened this issue · 0 comments
felixcremer commented
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.