-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
bugSomething isn't workingSomething isn't working
Description
MWE:
using Rasters, NCDatasets
filename = tempname() * ".nc"
rs = Rasters.create(
filename, (;a = Float64), (X(1:10),);
fill = NaN, missingval = NaN
)
rs2 = RasterStack(filename; lazy = true, raw = true)
ras = Raster(filename; lazy = true, raw = true)
open(first, rs) # works
open(first, rs2) # errors
open(first, ras) # works
Calling open
on a RasterStack wraps in a CFVariable, which when encountering missingval
will return missing
. But since the eltype of the Raster doesn't have missing, this errors.
(this is on #968 so the openstack thing works)
Full error message:
ERROR: MethodError: Cannot `convert` an object of type Missing to an object of type Float64
The function `convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:
convert(::Type{T}, ::T) where T<:Number
@ Base number.jl:6
convert(::Type{T}, ::ColorTypes.Colorant{T, 1} where T) where T<:Real
@ ColorTypes C:\Users\tsh371\.julia\packages\ColorTypes\L7biZ\src\conversions.jl:110
convert(::Type{T}, ::Number) where T<:Number
@ Base number.jl:7
...
Stacktrace:
[1] setindex!(A::Vector{Float64}, x::Missing, i::Int64)
@ Base .\array.jl:987
[2] copyto_unaliased!(deststyle::IndexLinear, dest::Vector{…}, srcstyle::IndexCartesian, src::CommonDataModel.SubVariable{…})
@ Base .\abstractarray.jl:1087
[3] copyto!(dest::Vector{…}, src::CommonDataModel.SubVariable{…})
@ Base .\abstractarray.jl:1061
[4] copyto!
@ .\broadcast.jl:966 [inlined]
[5] copyto!
@ .\broadcast.jl:925 [inlined]
[6] materialize!
@ .\broadcast.jl:883 [inlined]
[7] materialize!
@ .\broadcast.jl:880 [inlined]
[8] readblock!(A::Rasters.ModifiedDiskArray{…}, out_block::Vector{…}, I::UnitRange{…})
@ Rasters C:\Users\tsh371\.julia\dev\Rasters\src\modifieddiskarray.jl:101
[9] getindex_disk(a::Rasters.ModifiedDiskArray{Float64, 1, CommonDataModel.CFVariable{…}, Rasters.NoMod{…}}, i::Int64)
@ DiskArrays C:\Users\tsh371\.julia\dev\DiskArrays\src\indexing.jl:54
[10] getindex
@ C:\Users\tsh371\.julia\dev\DiskArrays\src\indexing.jl:308 [inlined]
[11] #447
@ C:\Users\tsh371\.julia\dev\DimensionalData\src\stack\indexing.jl:45 [inlined]
[12] map
@ .\tuple.jl:355 [inlined]
[13] map
@ .\namedtuple.jl:266 [inlined]
[14] getindex
@ C:\Users\tsh371\.julia\dev\DimensionalData\src\stack\indexing.jl:45 [inlined]
[15] first(s::RasterStack{…})
@ DimensionalData C:\Users\tsh371\.julia\dev\DimensionalData\src\stack\stack.jl:171
[16] open(f::typeof(first), st::RasterStack{…}; kw::@Kwargs{})
@ Rasters C:\Users\tsh371\.julia\dev\Rasters\src\stack.jl:536
[17] open(f::Function, st::RasterStack{…})
@ Rasters C:\Users\tsh371\.julia\dev\Rasters\src\stack.jl:530
[18] top-level scope
@ c:\Users\tsh371\.julia\dev\Rasters\test\runtests.jl:13
Some type information was truncated. Use `show(err)` to see complete types.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working