JuliaDataCubes / JuliaDataCubes/PyramidScheme.jl

Broadcast engines does not work on tif based pyramids

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
18
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The following errors:

using YAXArrays, DiskArrayEngine
using PyramidScheme: PyramidScheme as PS

pyrtif = PS.Pyramid("test/data/bremen_sea_ice_conc_2022_9_9.tif")
pyrtifeng = engine(pyrtif)
pyrtifengcalc = pyrtifeng .+ pyrtifeng .- pyrtifeng
ERROR: ArgumentError: Windows must contain Ints or UnitRanges as elements
Stacktrace:
  [1] to_window(r::Base.OneTo{Int32})
    @ DiskArrayEngine ~/Documents/PyramidScheme/dev/DiskArrayEngine/src/windows.jl:96
  [2] _broadcast_getindex_evalf
    @ ./broadcast.jl:709 [inlined]
  [3] _broadcast_getindex
    @ ./broadcast.jl:682 [inlined]
  [4] (::Base.Broadcast.var"#31#32"{Base.Broadcast.Broadcasted{…}})(k::Int64)
    @ Base.Broadcast ./broadcast.jl:1118
  [5] ntuple
    @ ./ntuple.jl:49 [inlined]
  [6] copy
    @ ./broadcast.jl:1118 [inlined]
  [7] materialize
    @ ./broadcast.jl:903 [inlined]
  [8] InputArray(a::ArchGDAL.IRasterBand{Float32}; dimsmap::Tuple{Int64, Int64}, windows::Tuple{Base.OneTo{…}, Base.OneTo{…}})
    @ DiskArrayEngine ~/Documents/PyramidScheme/dev/DiskArrayEngine/src/mwops.jl:34
  [9] (::DiskArrayEngine.var"#182#186"{Tuple{}, Tuple{…}})(ii::Int64)
    @ DiskArrayEngine ~/Documents/PyramidScheme/dev/DiskArrayEngine/src/enginearrays.jl:115
 [10] ntuple
    @ ./ntuple.jl:19 [inlined]
 [11] mapslices_engine(::Function, ::DiskArrayEngine.EngineArray{…}, ::Vararg{…}; dims::Tuple{}, outchunks::Nothing)
    @ DiskArrayEngine ~/Documents/PyramidScheme/dev/DiskArrayEngine/src/enginearrays.jl:105
 [12] copy(bc::Base.Broadcast.Broadcasted{DiskArrayEngine.EngineStyle{…}, Tuple{…}, Base.Broadcast.var"#12#14"{…}, Tuple{…}})
    @ DiskArrayEngine ~/Documents/PyramidScheme/dev/DiskArrayEngine/src/enginearrays.jl:169
 [13] materialize(bc::Base.Broadcast.Broadcasted{…})
    @ Base.Broadcast ./broadcast.jl:903
 [14] (::PyramidScheme.var"#53#54"{Base.Broadcast.var"#12#14"{…}, Tuple{…}})(l::Int64)
    @ PyramidScheme ~/Documents/PyramidScheme/src/broadcast.jl:15
 [15] iterate
    @ ./generator.jl:47 [inlined]
 [16] collect_to!(dest::Vector{…}, itr::Base.Generator{…}, offs::Int64, st::Int64)
    @ Base ./array.jl:892
 [17] collect_to_with_first!(dest::Vector{…}, v1::YAXArray{…}, itr::Base.Generator{…}, st::Int64)
    @ Base ./array.jl:870
 [18] _collect(c::UnitRange{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:864
 [19] collect_similar(cont::UnitRange{Int64}, itr::Base.Generator{UnitRange{…}, PyramidScheme.var"#53#54"{…}})
    @ Base ./array.jl:763
 [20] map(f::Function, A::UnitRange{Int64})
    @ Base ./abstractarray.jl:3285
 [21] copy(bc::Base.Broadcast.Broadcasted{PyramidScheme.PyramidStyle, Tuple{…}, typeof(-), Tuple{…}})
    @ PyramidScheme ~/Documents/PyramidScheme/src/broadcast.jl:12
 [22] materialize(bc::Base.Broadcast.Broadcasted{PyramidScheme.PyramidStyle, Nothing, typeof(-), Tuple{…}})
    @ Base.Broadcast ./broadcast.jl:903
 [23] macro expansion
    @ ./timing.jl:279 [inlined]
 [24] top-level scope
    @ ./REPL[69]:1
Some type information was truncated. Use `show(err)` to see complete types.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Julia example with the TIFF pyramid first. Read DiskArrayEngine/src/windows.jl:96 and src/mwops.jl:34, then trace the broadcast path through DiskArrayEngine/src/enginearrays.jl:105 and PyramidScheme/src/broadcast.jl:12-15. Done means the shown broadcast expression no longer raises the reported ArgumentError.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.