You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Rasters
r1 =Raster(rand(X(1:10), Y(1:10)))
r2 =Raster(rand(dims(r1)...))
rs =RasterStack(r1, r2)
bool_cond_raster = r1 .>0.5
mask_inds =view(Rasters.DD.DimIndices(bool_cond_raster), bool_cond_raster)
masked_stack = rs[mask_inds] # fine so far
Operations on a directly masked stack
masked_stack[1] # also finecollect(masked_stack) # errorsidentity.(masked_stack) # errorssum(masked_stack) # somehow fine and correct?# errors for anything that calls `collect
Operations on a viewed stack
# If I try to view,
viewed_stack =view(rs, mask_inds)
viewed_stack[1] # also finecollect(viewed_stack) # also errorssum(viewed_stack) # also fine and correct
The error:
ERROR: Use iterate(layers(s)) rather than `iterate(s)`
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] iterate(::RasterStack{…})
@ DimensionalData ~/.julia/dev/DimensionalData/src/stack/stack.jl:169
[3] copyto!(dest::Vector{…}, src::RasterStack{…})
@ Base ./abstractarray.jl:943
[4] _collect(cont::UnitRange{…}, itr::RasterStack{…}, ::Base.HasEltype, isz::Base.HasLength)
@ Base ./array.jl:765
[5] collect(itr::RasterStack{…})
@ Base ./array.jl:759
[6] broadcastable(x::RasterStack{…})
@ Base.Broadcast ./broadcast.jl:743
[7] broadcasted(::typeof(identity), ::RasterStack{…})
@ Base.Broadcast ./broadcast.jl:1339
[8] top-level scope
@ REPL[99]:1
Some type information was truncated. Use `show(err)` to see complete types.
```1
The text was updated successfully, but these errors were encountered:
Yeah, we need to define what iterate on a stack does and I never settled. It's like base with broadcast over a Dict. The fact that stack layers can have mixed sizes complicates things a little.
Edit: I already made the old version error, we can fix it now.
Here's a running example (from my mapzonal code):
Setup:
Operations on a directly masked stack
Operations on a
view
ed stackThe error:
The text was updated successfully, but these errors were encountered: