-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
Description
When I am trying to rasterize into a netcdf file I get the following error and this is not really clear why this is not working. For a .tif file I get a better error message and also for loading a NetCDF.
The same happens for Zarr files.
using Rasters
julia> pointvec = [
(-20.0, 30.0),
(-20.0, 10.0),
(0.0, 10.0),
(0.0, 30.0),
(-20.0, 30.0),
]
julia> rasterize(count, pointvec, filename="/tmp/rasterizetest.nc", size=10)
ERROR: ArgumentError: `sourceconstructor` is not defined for Rasters.NCDsource
Stacktrace:
[1] sourceconstructor(s::Type{Rasters.NCDsource})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/sources/sources.jl:77
[2] sourceconstructor(source::Rasters.NCDsource)
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/sources/sources.jl:76
[3] write(filename::String, source::Rasters.NCDsource, A::Raster{…}; append::Bool, force::Bool, kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/sources/commondatamodel.jl:475
[4] write(::Function, ::String, ::Vararg{…}; kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/write.jl:207
[5] write(::Function, ::Function, ::Vararg{…}; kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/write.jl:207
[6] create(filename::String, source::Rasters.NCDsource, ::Type{…}, dims::Tuple{…}; name::Symbol, missingval::Int64, fill::Int64, metadata::Metadata{…}, chunks::Rasters.NoKW, scale::Rasters.NoKW, offset::Rasters.NoKW, dropband::Bool, lazy::Bool, verbose::Bool, force::Bool, coerce::Rasters.NoKW, f::Rasters.var"#625#626"{…}, kw::@Kwargs{})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:301
[7] create(filename::String, T::Type{…}, dims::Tuple{…}; lazy::Bool, parent::Rasters.NoKW, suffix::String, source::Rasters.NCDsource, missingval::Int64, kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:182
[8] create(::Function, ::String, ::Vararg{Any}; kw::@Kwargs{fill::Int64, name::Symbol, missingval::Int64, metadata::Metadata{Nothing, Dict{Any, Any}}, suffix::String})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:129
[9] #alloc_rasterize#623
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:490 [inlined]
[10] alloc_rasterize
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:480 [inlined]
[11] create_rasterize_dest
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:474 [inlined]
[12] create_rasterize_dest(f::Function, r::Rasters.RasterCreator{DataType, Tuple{X{Sampled{…}}, Y{Sampled{…}}}, Metadata{Nothing, Dict{Any, Any}}, Int64, Rasters.NoKW, Rasters.NoKW})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:455
[13] rasterize(data::Vector{…}; to::Nothing, fill::Function, threaded::Bool, geometrycolumn::Nothing, kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:443
[14] rasterize
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:439 [inlined]
[15] #rasterize#614
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:430 [inlined]
[16] top-level scope
@ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.This is the error for a .tif file. There it is clear what I did wrong.
julia> rasterize(count, pointvec, filename="/tmp/rasterizetest.tif", size=10)
ERROR: Missing package extension for Rasters.GDALsource(). Run `using ArchGDAL` before using `write` for this file extension.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:44
[2] write(filename::String, source::Rasters.GDALsource, A::Raster{…}; kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/write.jl:75
[3] write(::Function, ::String, ::Vararg{…}; kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/write.jl:207
[4] write(::Function, ::Function, ::Vararg{…}; kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/write.jl:207
[5] create(filename::String, source::Rasters.GDALsource, ::Type{…}, dims::Tuple{…}; name::Symbol, missingval::Int64, fill::Int64, metadata::Metadata{…}, chunks::Rasters.NoKW, scale::Rasters.NoKW, offset::Rasters.NoKW, dropband::Bool, lazy::Bool, verbose::Bool, force::Bool, coerce::Rasters.NoKW, f::Rasters.var"#625#626"{…}, kw::@Kwargs{})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:301
[6] create(filename::String, T::Type{…}, dims::Tuple{…}; lazy::Bool, parent::Rasters.NoKW, suffix::String, source::Rasters.GDALsource, missingval::Int64, kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:182
[7] create(::Function, ::String, ::Vararg{Any}; kw::@Kwargs{fill::Int64, name::Symbol, missingval::Int64, metadata::Metadata{Nothing, Dict{Any, Any}}, suffix::String})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/create.jl:129
[8] #alloc_rasterize#623
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:490 [inlined]
[9] alloc_rasterize
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:480 [inlined]
[10] create_rasterize_dest
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:474 [inlined]
[11] create_rasterize_dest(f::Function, r::Rasters.RasterCreator{DataType, Tuple{X{Sampled{…}}, Y{Sampled{…}}}, Metadata{Nothing, Dict{Any, Any}}, Int64, Rasters.NoKW, Rasters.NoKW})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:455
[12] rasterize(data::Vector{…}; to::Nothing, fill::Function, threaded::Bool, geometrycolumn::Nothing, kw::@Kwargs{…})
@ Rasters ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:443
[13] rasterize
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:439 [inlined]
[14] #rasterize#614
@ ~/.julia/packages/Rasters/G6rYV/src/methods/rasterize.jl:430 [inlined]
[15] top-level scope
@ REPL[17]:1
Some type information was truncated. Use `show(err)` to see complete types.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels