# Create a \`Raster\` from OPeNDAP (netCDF)

**URL:** <https://discourse.julialang.org/t/create-a-raster-from-opendap-netcdf/96756>\
**Category:** Geo\
**Tags:** question, package, netcdf\
**Created:** [March 29, 2023, 7:47am UTC](https://discourse.julialang.org/t/create-a-raster-from-opendap-netcdf/96756 "2023-03-29T07:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [March 29, 2023, 7:47am UTC](https://discourse.julialang.org/t/create-a-raster-from-opendap-netcdf/96756/1 "2023-03-29T07:47:31Z")

</div>

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.

```julia
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)

```

---

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [March 29, 2023, 8:38am UTC](https://discourse.julialang.org/t/create-a-raster-from-opendap-netcdf/96756/2 "2023-03-29T08:38:43Z")

</div>

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?
