The script to read the netcdf file
%
% Read netcdf file sst05d19900108.nc. This netcdf file contains the
sea-surface temperature
% field from the 8th January 1990 the begiining of the WOCE observation
period. This data set is an
% arbitrary example taken from the
% WOCE Global Data V2 data set to illustrate the power of the netcdf command
% developed by Chuck Denham
%
%
% Load the data.
sst1=netcdf('/u/bindoff/sst05d19900108.nc')
%
% display the contents of the variables
%
for i=1:8
sst1{i}
end
%
% Do a test plot of the data using the pcolor function
%
latitude=sst1{'latitude'}(1:end);
longitude=sst1{'longitude'}(1:end);
sst=sst1{'sea_surface_temperature'}(1:end,1:end); pause
%
pcolor(sst(1:10:end,1:10:end)/100)
caxis([-2 32])
shading flat
%
Output from the script above from Matlab
>> sst_data
sst1 =
NetCDF_File: '/u/bindoff/sst05d19900108.nc'
nDimensions: 4
nVariables: 8
nGlobalAttributes: 6
RecordDimension: ''
nRecords: 0
Permission: 'nowrite'
DefineMode: 'data'
FillMode: 'fill'
MaxNameLen: 0
ans =
NetCDF_Variable: 'woce_date'
itsType: 'long'
itsDimensions: 'time'
itsLengths: 1
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 6
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'woce_time_of_day'
itsType: 'float'
itsDimensions: 'time'
itsLengths: 1
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 5
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'julian_day_1990'
itsType: 'short'
itsDimensions: 'time'
itsLengths: 1
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 6
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'depth'
itsType: 'float'
itsDimensions: 'time'
itsLengths: 1
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 5
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'latitude'
itsType: 'float'
itsDimensions: 'latitude'
itsLengths: 360
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 6
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'longitude'
itsType: 'float'
itsDimensions: 'longitude'
itsLengths: 720
itsOrientation: 1
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 6
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'sea_surface_temperature'
itsType: 'short'
itsDimensions: 'latitude, longitude'
itsLengths: [360 720]
itsOrientation: [1 2]
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 8
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
ans =
NetCDF_Variable: 'bin_count'
itsType: 'byte'
itsDimensions: 'latitude, longitude'
itsLengths: [360 720]
itsOrientation: [1 2]
itsVars: {}
itsSrcsubs: {}
itsDstsubs: {}
nAttributes: 4
itIsAutoscaling: 0
itIsAutoNaNing: 0
itIsUnsigned: 0
itIsQuick: 0
>> whos
Name Size Bytes Class
ans 360x720 3058 ncvar object
i 1x1 8 double array
latitude 360x1 2880 double array
longitude 720x1 5760 double array
sst 360x720 2073600 double array
sst1 4-D 2290 netcdf object
Grand total is 260398 elements using 2087596 bytes
>>
>> diary off
And the figure created by the script