The default OPeNDAP installation provides one useful unix command line client and one useful matlab client.
loaddap is a matlab mex-file that
provides an alternative interface to opendap datasets than netcdf.
Example 4.1. Pathfinder with Loaddap
>> pathfinder_loaddap
url = 'http://data.nodc.noaa.gov/cgi-bin/nph-dods/pathfinder/Version5.0_Climatologies/Daily/Day/day001_day.hdf';
%
% Retrieve all the metadata using loaddap with the -A switch.
m = loaddap ( '-A', url )
m =
Clim_SST: [1x1 struct]
Clim_StandardDeviation: [1x1 struct]
Clim_Counts: [1x1 struct]
Longitude: [1x1 struct]
Latitude: [1x1 struct]
Clim_SST_Filled: [1x1 struct]
Global_Attributes: [1x1 struct]
% Hit return to continue...
%
% Now look at the metadata for the Clim_SST dataset.
m.Clim_SST.
ans =
solar_corr: '"N/A"'
limb_corr: '"N/A"'
nonlinear_corr: '"N/A"'
sst_equation: '"Pathfinder Version 5.0 NLSST"'
percent_good: '"N/A"'
scale_factor: 0.0750
scale_factor_err: 0
add_offset: -3
add_offset_err: 0
calibrated_nt: 23
long_name: '"Climatological Mean Sea Surface Temperature"'
units: '"Degrees C"'
format: '"F5.2"'
coordsys: '"geographic"'
ml__FillValue: 0
valid_range: [2x1 double]
C_format: '"%5.2f"'
missing_value: 0
DODS_ML_Real_Name: 'Clim_SST'
Clim_SST: [1x1 struct]
Latitude: [1x1 struct]
Longitude: [1x1 struct]
% Hit return to continue...
%
% Now look at the metadata for the Longitude dimension.
m.Clim_SST.Longitude
ans =
long_name: '"Longitude"'
units: '"Degrees East"'
DODS_ML_Size: 8192
DODS_ML_Real_Name: 'Longitude'
% Hit return to continue...
%
% Now look at the metadata for the Latitude dimension.
m.Clim_SST.Latitude
ans =
long_name: '"Latitude"'
units: '"Degrees North"'
DODS_ML_Size: 4096
DODS_ML_Real_Name: 'Latitude'
% Hit return to continue...
%
% And finally, retrieve the data by making a constraint.
% Because the image is 4096x8192, we'll grab every 10th pixel.
constraint = [url '?Clim_SST[0:10:4095][0:10:8191]'];
constraint
constraint =
http://data.nodc.noaa.gov/cgi-bin/nph-dods/pathfinder/Version5.0_Climatologies/Daily/Day/day001_day.hdf?Clim_SST[0:10:4095][0:10:8191]
% Hit return to continue...
%
% And load the actual data by dropping the '-A' switch to loaddap.
d = loaddap ( constraint );
d.Clim_SST
ans =
Clim_SST: [410x820 double]
Latitude: [410x1 double]
Longitude: [820x1 double]
pcolor ( d.Clim_SST.Longitude, d.Clim_SST.Latitude, d.Clim_SST.Clim_SST );
shading flat;
colorbar;
drawnow;
% Hit return to continue...
%
% Let's try again and scale the data this time.
% Also, let's take care of missing data (0) and the land mask (1).
% They didn't say the land mask was (1), but it is.
delete(gcf);
sst = d.Clim_SST.Clim_SST;
ind = find((sst==0) | (sst==1));
sst(ind) = NaN;
pcolor ( d.Clim_SST.Longitude, d.Clim_SST.Latitude, sst * 0.075 - 3 )
shading flat;
colorbar;
