OPeNDAP is a way for you to load netcdf data into your matlab session with a single command line, and the data can reside at JISAO or at another OPeNDAP institution, for example, the NOAA Earth System Research Laboratory . The good part of OPeNDAP is that, in theory, a single command line can be used to input an entire data set, similar to "load data.mat" . The bad side of OPeNDAP is that the speed that the data loads will be constrained by the ftp file transfer speed. All of the data sets on the JISAO WWW climate data archive can be accessed through OPeNDAP. Unfortunately figuring out the OPeNDAP data sets at other institutions is a tedious task. All NOAA ESRL data sets are available through OPeNDAP. The URL to use for JISAO data sets is
OPeNDAP provides an easy way to read the attributes of a file. For an
append .das to the URL to read the attributes
append .dds to the URL to read the data type and dimensions
append .help to the URL to see a list of other options
Outside of JISAO, the OPeNDAP software can be downloaded from the OPeNDAP home page. You may have to send email to someone there to actually find the library.
At JISAO, you need to connect the OPeNDAP library. Put
path( path,'/usr/local/DODS-3.2.1/bin' );
into your "startup.m" file or execute it in your matlab session.
A good example to try is:
This example, if it runs in a finite amount of time, downloads all of the variables in the netcdf file, and uses the variable names used in the netCDF file. DODS is pulling a data set over the ftp connection so for a large data set this could be very slow.
If you wanted only
the first map of the SST data, type:
In this example, the [0:0][0:179][0:359] specifies that you want the first month of data, all of the latitudes and all of the longitudes, respectively. NetCDF counts from 0 instead of from 1. This is done to confuse you. In the case of this data set there are 180 latitudes and 360 longitudes.
To see the variable names and dimensions of a data set, click on http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/reynolds_sst/sst.mnmean.nc.dds, where the suffix .dds is appended to the URL for the data set. Other information can be obtained with other suffixes, as described in http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/reynolds_sst/sst.mnmean.nc.help
Most data sets have values that have been scaled so that they can be
written more compactly. For example, it is common that sea-level pressure
values are stored minus 1000 mb, so that 1023.5mb is stored as 23.5.
Also, you will have to check to see if there is a missing value flag
for the variable. The packing and missing value flag information is one of the "attributes" of the netCDF file. To read
the attributes, type
xxx = loaddods( '-A', 'http://www.cdc.noaa.gov/cgi-bin/nph-nc/Datasets/reynolds_sst/sst.mnmean.nc' )
which, for this file, yields:
xxx = sst: [1x1 struct] mask: [1x1 struct] global: [1x1 struct]To see the scaling information and missing value flag for the SST data:
>> xxx.sst ans = long_name: 'Monthly Means of Sea Surface Temperature' valid_range: [2x1 double] actual_range: [2x1 double] units: 'degC' add_offset: 0 scale_factor: 0.0100 missing_value: 32767 precision: 2 least_significant_digit: 2 var_desc: [1x25 char] dataset: [1x14 char] level_desc: [1x9 char] statistic: [1x6 char] parent_stat: [1x6 char] DODS_ML_Real_Name: 'sst' sst: [1x1 struct] time: [1x1 struct] lat: [1x1 struct] lon: [1x1 struct]So for sst, you would process as follows:
sst = xxx.sst;
sst(sst==xxx.sst.missing_value) = NaN;
sst = ( sst * xxx.sst.scale_factor ) + xxx.sst.add_offset;
Type "help loaddods" in your matlab session to get more information. Some of their examples don't work, I suspect because the files they are pointing to have been moved.