Create a `Raster` from OPeNDAP (netCDF)

The netCDF library has a builtin capability of lazily reading data from an OPeNDAP server as the following code demonstrates. I was wondering how to tell Raster to do the same.

using NCDatasets: NCDataset
using Rasters

url = "http://apdrc.soest.hawaii.edu:80/dods/public_data/" *
  "WOA/WOA18/5_deg/monthly/temp"
varname = "tmn"

#-- works ---
NCDataset(url) do ds
  display(ds[varname])
end

#-- works if you have the file --
rs = Raster("tmp.nc"; name = "slp")
display(rs)

#-- fails ---
rs = Raster(url; name = varname)

The first problem is there is no way to tell this is a NetCDF and you should use the NCDatasets.jl backend, as there is no .nc extension. So you need to use source=Rasters.NCDfile.

But then there is a check for if the file exists, and of course that fails.

What we should do is skip file checks if the path starts with http and similar.

Can you make a github issue for this?

1 Like