rafaqz / Rasters.jl

Raster manipulation for the Julia language
MIT License
209 stars 36 forks source link

Add .nc4 as NCDatasets extension #683

Closed haakon-e closed 3 months ago

haakon-e commented 3 months ago

This PR makes files with .nc4 extensions use NCDatasets as the default backend.

I'm working with some climate data files with .nc4 extension (more info here).

Currently, I get this error message:

julia> Raster(paths[1], lazy=true)
ERROR: `Rasters.jl` requires backends to be loaded externally as of version 0.8. Run `import ArchGDAL` to fix this error.
Stacktrace:
 [1] _open(f::Function, s::Rasters.GDALsource, filename::String; kw::@Kwargs{})
   @ Rasters ~/.julia/packages/Rasters/1JI3p/src/sources/sources.jl:81
 [2] _open(f::Function, s::Rasters.GDALsource, filename::String)
   @ Rasters ~/.julia/packages/Rasters/1JI3p/src/sources/sources.jl:79
 [3] _open(f::Function, filename::String; source::Rasters.GDALsource, kw::@Kwargs{})
   @ Rasters ~/.julia/packages/Rasters/1JI3p/src/sources/sources.jl:77
 [4] Raster(filename::String; source::Rasters.NoKW, kw::@Kwargs{lazy::Bool})
   @ Rasters ~/.julia/packages/Rasters/1JI3p/src/array.jl:292
 [5] top-level scope
   @ REPL[9]:1

Additionally, perhaps this error message could be made somewhat more useful?

I tried to trace down where the error message comes from, but was not successful. In any case, something like:

If you want to specify a different backend, set the keyword source to one of :gdal, :netcdf, :grd, or :grib. E.g. Raster(file; source=:netcdf).

could be useful.

rafaqz commented 3 months ago

Thanks. You can also manually use source=:netcdf

rafaqz commented 3 months ago

These bugs are not related to the PR