How do I access Cloud Data from my Local Machine with OPeNDAP?
OPeNDAP
OPeNDAP, or the Open-source Project for a Network Data Access Protocol, is a data server that allows for accessing scientific datasets through the public internet. OPeNDAP links can be acquired through dataset landing pages or the common metadata repository. Once you have the desired link(s), you can open them as follows:
#Import packages
import xarray as xr
= xr.open_dataset(https://opendap.earthdata.nasa.gov/collections/C2532426483-ORNL_CLOUD/granules/Daymet_Daily_V4R1.daymet_v4_daily_hi_tmax_2010.nc)
ds_https
# For datasets that contain dap4 specific datatypes, such as `int64`, replace `https` with `dap4` at the beginning to open with xarray. For example:
= https://opendap.earthdata.nasa.gov/collections/C2036881966-POCLOUD/granules/AQUA_MODIS.20220109_20220116.L3m.8D.SST4.sst4.4km
url = url.replace("https://", "dap4://")
dap4_url # dap4_url output: dap4://opendap.earthdata.nasa.gov/collections/C2036881966-POCLOUD/granules/AQUA_MODIS.20220109_20220116.L3m.8D.SST4.sst4.4km
= xr.open_dataset(dap4_url)
ds_dap4
# Note: Some datasets have their variables organized in groups, so within the open_dataset function, you may need to specify 'group=' to access the dataset.
For more information, see the OPeNDAP Data Access Client Tutorials.