OPENDAP Overview



OPeNDAP is a data connection tool that can be used within your favorite software program (MATLAB/PYTHON/R/IDL/EXCEL) to download the subsets of the MACA datasets. Some important steps in getting OPeNDAP to work for you are provided here:
  • Identifying the OPENDAP url for your files
  • Checking your software compatibility with OPENDAP
  • Example code for accessing data through OPENDAP
  • Identifying OPeNDAP URL

    In your software program, you will need to identify the OPeNDAP URL as a path to your files. The OPeNDAP URL is different than the URL you would use to download the file.


    STEP 1: navigate to the THREDDS catalog for your data

    See data catalogs. For OPeNDAP, you should use the 'Aggregated' files in this table, as they have longer year ranges(i.e.1950-2005 or 2006-2099) than the individual files (which only have year ranges of 5-10 years)

    STEP 2: find a desired file and view the record for it

    For example, here is a page from a data catalog for a file:


    STEP 3: find the path for the THREDDS server name



    STEP 4: find the THREDDS file name and directory

    The OPeNDAP directory and filename is listed under 'OPeNDAP':

    STEP 5: Form the OPeNDAP URL

    Concatenate the server name and file directory and name together to form the OPeNDAP URL.
    For example, from the screenshot it would be:

    myFile='http://thredds.northwestknowledge.net:8080//thredds/dodsC/macav2livneh_huss_BNU-ESM_r1i1p1_historical_1950-2005_CONUS_daily_aggregated.nc'

    Note: these filenames have since changed slightly so that the current correct filename is actually myFile='http://thredds.northwestknowledge.net:8080//thredds/dodsC/macav2livneh_huss_BNU-ESM_r1i1p1_historical_1950_2005_CONUS_daily_aggregated.nc'

    STEP 6: Double Check URL

    If you want to double check the URL you have formed, you can click on the link under OPeNDAP URL and look at the OPeDAP Dataset Access Form. There you will find the OPeNDAP URL in the box labeled 'DATA URL':

    OPeNDAP: check software setup

    • Check that you have an internet connection on your computer
    • Open your software program(MATLAB,python,R,IDL,Excel,etc)
    • Check that your software program has OPeNDAP support.
      • MATLAB (v2012a and later) has built-in OPeNDAP support
      • R includes support through the netCDF interface. However, the netcdf packages for Windows are not yet opendap-enabled. If using R, the ncdf4 package must be installed.The ncdf4 package can be downloaded at http://cirrus.ucsd.edu/~pierce/ncdf/
      • Python includes support through the netCDF/pydap libraries.
      • IDL(8-4 and later) include OPeNDAP support.
    • Find the OPeNDAP URL for one of our files and test that you can view some of the metadata for this file through OPeNDAP. For example,
      • myFile='http://thredds.northwestknowledge.net:8080/thredds/dodsC/agg_macav2metdata_huss_BNU-ESM_r1i1p1_historical_1950_2005_CONUS_daily.nc';
      • Matlab: ncdisp(myFile);
      • Python: from netCDF4 import Dataset; filehandle=Dataset(myFile,'r',format="NETCDF4");filehandle.variables
      • R: 1) library(ncdf4) 2) nc <- nc_open(myFile) 3) nc
    • If your OPeNDAP connection is successful, you should see metadata for the filename displayed in your software program.

    OPeNDAP Examples in R

    OPeNDAP Examples in IDL