Accessing netCDF/OPeNDAP data with Matlab
Since Matlab R2012a native OPeNDAP support has been added to the Matlab netcdf package that exists since R2008b+. (For older Matlab releases, get snctools which is shiiped with OpenEarthTools) From OpenEarthTools run the following set-up function to add all relevant paths:
- Go to an OPeNDAP server (e.g. http://opendap.deltares.nl) and pick a netCDF file by copying the contents of the Data URL box.
Define the associated url you just copied.
and select the variable you want to plot by looking at the file contents
Define the data subset to get. Not until you issue the nc_varget you will actually get the data. Even if when the underlying file would be a hundreds of GB, this step can be pretty fast provided the subset you chose is not too big. Only when you make too big a selection, Matlab will take long. This will happen for instance with the 100 + years of tidal elevation dataset at station DelftZijl Buitenhaven. This selection step is the essential difference with the approach of downloading a netCDF file and then using Matlab to view that local file from your harddisk. With OPeNDAP you do not have to download an entire file before you can view it, because you can request only a specific slice, or a subset of a matrix.
- et voila