Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getindex with Extent hits non-lazy DimensionalData path #490

Open
felixcremer opened this issue Jan 13, 2025 · 2 comments
Open

getindex with Extent hits non-lazy DimensionalData path #490

felixcremer opened this issue Jan 13, 2025 · 2 comments

Comments

@felixcremer
Copy link
Member

indexing into an YAXArray with an Extent hits some non-lazy DD path.

lia> cube[ext]
^CERROR: InterruptException:
Stacktrace:
  [1] maybe_throw()
    @ GDAL ~/.julia/packages/GDAL/R5iZD/src/error.jl:40
  [2] aftercare
    @ ~/.julia/packages/GDAL/R5iZD/src/error.jl:59 [inlined]
  [3] gdalrasterioex(hRBand::ArchGDAL.IRasterBand{…}, eRWFlag::ArchGDAL.GDALRWFlag, nDSXOff::Int64, nDSYOff::Int64, nDSXSize::Int64, nDSYSize::Int64, pBuffer::Ptr{…}, nBXSize::Int64, nBYSize::Int64, eBDataType::ArchGDAL.GDALDataType, nPixelSpace::Int64, nLineSpace::Int64, psExtraArg::Ptr{…})
    @ GDAL ~/.julia/packages/GDAL/R5iZD/src/libgdal.jl:9847
  [4] rasterio!(rasterband::ArchGDAL.IRasterBand{…}, buffer::SubArray{…}, xoffset::Int64, yoffset::Int64, xsize::Int64, ysize::Int64, access::ArchGDAL.GDALRWFlag, pxspace::Int64, linespace::Int64, extraargs::Ptr{…})
    @ ArchGDAL /mnt/felix1/worldmap/dev/ArchGDAL/src/raster/rasterio.jl:239
  [5] rasterio!
    @ /mnt/felix1/worldmap/dev/ArchGDAL/src/raster/rasterio.jl:237 [inlined]
  [6] read!
    @ /mnt/felix1/worldmap/dev/ArchGDAL/src/raster/rasterio.jl:274 [inlined]
  [7] readblock!
    @ /mnt/felix1/worldmap/dev/ArchGDAL/src/raster/array.jl:171 [inlined]
  [8] readblock!(::RQADeforestation.BufferGDALBand{…}, ::SubArray{…}, ::UnitRange{…}, ::UnitRange{…})
    @ RQADeforestation /mnt/felix1/worldmap/dev/RQADeforestation/src/auxil.jl:32
  [9] #4
    @ ~/.julia/packages/DiskArrayTools/141OI/src/DiskArrayTools.jl:39 [inlined]
 [10] foreach
    @ ./abstractarray.jl:3187 [inlined]
 [11] readblock!(::DiskArrayTools.DiskArrayStack{…}, ::Array{…}, ::UnitRange{…}, ::UnitRange{…}, ::Base.Slice{…})
    @ DiskArrayTools ~/.julia/packages/DiskArrayTools/141OI/src/DiskArrayTools.jl:36
 [12] readblock_sizecheck!(::DiskArrayTools.DiskArrayStack{…}, ::Array{…}, ::UnitRange{…}, ::Vararg{…})
    @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:337
 [13] getindex_disk_nobatch!(out::Nothing, a::DiskArrayTools.DiskArrayStack{…}, i::Tuple{…})
    @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:244
 [14] getindex_disk!
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:260 [inlined]
 [15] getindex_disk
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:218 [inlined]
 [16] getindex
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:370 [inlined]
 [17] readblock!(::DiskArrayTools.CFDiskArray{…}, ::Array{…}, ::UnitRange{…}, ::UnitRange{…}, ::Base.Slice{…})
    @ DiskArrayTools ~/.julia/packages/DiskArrayTools/141OI/src/DiskArrayTools.jl:268
 [18] readblock_sizecheck!(::DiskArrayTools.CFDiskArray{…}, ::Array{…}, ::UnitRange{…}, ::Vararg{…})
    @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:337
 [19] getindex_disk_nobatch!(out::Nothing, a::DiskArrayTools.CFDiskArray{…}, i::Tuple{…})
    @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:244
 [20] getindex_disk!
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:260 [inlined]
 [21] getindex_disk
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:218 [inlined]
 [22] getindex
    @ ~/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:370 [inlined]
 [23] getindex
    @ ~/.julia/packages/DimensionalData/uMSYt/src/array/indexing.jl:130 [inlined]
 [24] getindex(A::YAXArray{Union{…}, 3, DiskArrayTools.CFDiskArray{…}, Tuple{…}, Dict{…}}, extent::Extent{(:X, :Y), Tuple{…}})
    @ DimensionalData ~/.julia/packages/DimensionalData/VxDQB/src/array/indexing.jl:12
 [25] top-level scope
    @ REPL[47]:1
Some type information was truncated. Use `show(err)` to see complete types.
@felixcremer
Copy link
Member Author

Most likely we should overload the getindex method ourselves.

@felixcremer
Copy link
Member Author

Maybe this is even fully broken:

If I wait it out I get the following error, this is on a GDALBand based data cube from RQADeforestation:

julia> scube = cube[ext];
ERROR: MethodError: no method matching _slicespan(::DimensionalData.Dimensions.Lookups.Points, ::DimensionalData.Dimensions.Lookups.Irregular{…}, ::DimensionalData.Dimensions.Lookups.Sampled{…}, ::Base.Slice{…})
The function `_slicespan` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  _slicespan(::DimensionalData.Dimensions.Lookups.Intervals, ::DimensionalData.Dimensions.Lookups.Irregular, ::DimensionalData.Dimensions.Lookups.Lookup, ::AbstractArray)
   @ DimensionalData ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:715
  _slicespan(::DimensionalData.Dimensions.Lookups.Irregular, ::DimensionalData.Dimensions.Lookups.Lookup, ::AbstractArray)
   @ DimensionalData ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:703
  _slicespan(::DimensionalData.Dimensions.Lookups.Explicit, ::DimensionalData.Dimensions.Lookups.Lookup, ::AbstractArray)
   @ DimensionalData ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:702
  ...

Stacktrace:
  [1] _slicespan(span::DimensionalData.Dimensions.Lookups.Irregular{…}, l::DimensionalData.Dimensions.Lookups.Sampled{…}, i::Base.Slice{…})
    @ DimensionalData.Dimensions.Lookups ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:703
  [2] slicespan(l::DimensionalData.Dimensions.Lookups.Sampled{…}, i::Base.Slice{…})
    @ DimensionalData.Dimensions.Lookups ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:698
  [3] getindex
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Lookups/lookup_arrays.jl:200 [inlined]
  [4] getindex
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/indexing.jl:11 [inlined]
  [5] _slicedims
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/primitives.jl:460 [inlined]
  [6] _slicedims
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/primitives.jl:444 [inlined]
  [7] _slicedims (repeats 2 times)
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/primitives.jl:445 [inlined]
  [8] _slicedims
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/primitives.jl:433 [inlined]
  [9] slicedims
    @ ~/.julia/packages/DimensionalData/uMSYt/src/Dimensions/primitives.jl:413 [inlined]
 [10] rebuildsliced
    @ ~/.julia/packages/DimensionalData/uMSYt/src/array/array.jl:100 [inlined]
 [11] rebuildsliced
    @ ~/.julia/packages/DimensionalData/uMSYt/src/array/array.jl:99 [inlined]
 [12] getindex
    @ ~/.julia/packages/DimensionalData/uMSYt/src/array/indexing.jl:131 [inlined]
 [13] getindex(A::YAXArray{Union{…}, 3, DiskArrayTools.CFDiskArray{…}, Tuple{…}, Dict{…}}, extent::Extent{(:X, :Y), Tuple{…}})
    @ DimensionalData ~/.julia/packages/DimensionalData/VxDQB/src/array/indexing.jl:12
 [14] top-level scope
    @ REPL[66]:1
Some type information was truncated. Use `show(err)` to see complete types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant