Closed tpoisot closed 3 years ago
Something like this works:
function Base.similar(layer::LT, ::Type{T}) where {LT <: SimpleSDMLayer, T<:Any}
newgrid = fill(nothing, size(layer))
newgrid = convert(Matrix{Union{T,Nothing}}, newgrid)
for i in eachindex(layer)
if !isnothing(layer[i])
newgrid[i] = zero(T)
end
end
return SimpleSDMPredictor(newgrid, layer.left, layer.right, layer.bottom, layer.top)
end
Something to create a similar layer but with a different type (e.g. same as a worldclime layer but with
Bool
values)or something to that effect.