Rasters.jl
Rasters.jl copied to clipboard
Using `~` for homedir does not work on MacOS
⊼ ⊽
julia> r1 = Raster("~/Downloads/N320_weights.nc")
ERROR: ArgumentError: file "~/Downloads/N320_weights.nc" not found
Stacktrace:
[1] _filenotfound_error(filename::String)
@ Rasters ~/.julia/dev/geo/Rasters.jl/src/utils.jl:531
[2] checkfilename(::Rasters.NCDsource, filename::String)
@ RastersNCDatasetsExt ~/.julia/dev/geo/Rasters.jl/ext/RastersNCDatasetsExt/ncdatasets_source.jl:4
[3] #_open#1
@ ~/.julia/dev/geo/Rasters.jl/ext/RastersNCDatasetsExt/ncdatasets_source.jl:10 [inlined]
[4] _open
@ ~/.julia/dev/geo/Rasters.jl/ext/RastersNCDatasetsExt/ncdatasets_source.jl:9 [inlined]
[5] #_open#26
@ ~/.julia/dev/geo/Rasters.jl/src/sources/sources.jl:110 [inlined]
[6] Raster(filename::String; source::Rasters.NoKW, kw::@Kwargs{})
@ Rasters ~/.julia/dev/geo/Rasters.jl/src/array.jl:327
[7] Raster(filename::String)
@ Rasters ~/.julia/dev/geo/Rasters.jl/src/array.jl:325
[8] top-level scope
@ REPL[3]:1
julia> r1 = Raster("/Users/anshul/Downloads/N320_weights.nc")
# runs
I think we need a abspath(expanduser(path)) somewhere, at least for local files...
Is this the same also for other file types?
Same for GDALsource on that file
julia> Raster("~/Downloads/N320_weights.nc"; source = Rasters.GDALsource())
ERROR: ArgumentError: file "~/Downloads/N320_weights.nc" not found
Stacktrace:
[1] _filenotfound_error(filename::String)
@ Rasters ~/.julia/dev/geo/Rasters.jl/src/utils.jl:531
[2] _open(f::Rasters.var"#78#79"{Rasters.GDALsource, @Kwargs{}, String}, ::Rasters.GDALsource, filename::String; write::Bool, mod::Nothing, kw::@Kwargs{})
@ RastersArchGDALExt ~/.julia/dev/geo/Rasters.jl/ext/RastersArchGDALExt/gdal_source.jl:114
[3] _open
@ ~/.julia/dev/geo/Rasters.jl/ext/RastersArchGDALExt/gdal_source.jl:98 [inlined]
[4] #_open#26
@ ~/.julia/dev/geo/Rasters.jl/src/sources/sources.jl:110 [inlined]
[5] _open
@ ~/.julia/dev/geo/Rasters.jl/src/sources/sources.jl:109 [inlined]
[6] #Raster#77
@ ~/.julia/dev/geo/Rasters.jl/src/array.jl:327 [inlined]
[7] top-level scope
@ REPL[10]:1
If I call expanduser on the string first, it works in both cases.
Lets add abspath(expanduser(path)) then. Probably we need a better path handler function
Well we have to handle urls, http, etc too
Yeah, probably why it doesn't work yet!