% 1. load data
load 4900093

% 2. plot oxygen data in the top 200 m (levels 1 - 21)
% 2.1 restrict variables to layers of interest only
pres = pres(:,1:21);
doxy = doxy(:,1:21);

% 2.2 quality control pressure and oxygen data (replace 99999 with NaNs)
bad = find(pres==99999);
pres(bad) = nan;
doxy(bad) = nan;

% 2.3 test min and max of both variables; replace unrealistic values with 
% NaNs if necessary
min(doxy(:))
max(doxy(:))
% remove negative oxygen values
bad = find(doxy<0);
doxy(bad) = nan;

% 2.4 plot and label axis
figure
pcolor(time*ones(1,21),-pres,doxy); shading interp
colorbar
title('Dissolved oxygen (mmol/kg) at ARGO float #4900093')
ylabel('Depth (m)')
xlabel('Days since 1950/1/1')

% Note that our time axis is not very useful.
% Use the commands datevec, datenum and datestr to create tick-labels
% with dates:

% first: covert the days after 1950-1-1 to absolute days since Jan-1-0000
N0 = datenum([1950 1 1]);
Ntimes = time+N0;

% When does our time series begin and end?
date_beg = datevec(Ntimes(1));
date_end = datevec(Ntimes(end));

% suppose you want tick-marks at Jan-1 and July-1 of 2003 to 2005
% create vector of N values for those dates
tick_dates = [2003 1 1;
              2003 7 1;
              2004 1 1;
              2004 7 1;
              2005 1 1;
              2005 7 1];
Nticks = datenum(tick_dates);
Nticklabels = datestr(Nticks,12);

% plot again:
figure
pcolor(Ntimes*ones(1,21),-pres,doxy); shading interp
colorbar
title('Dissolved oxygen (mmol/kg) at ARGO float #4900093')
ylabel('Depth (m)')
set(gca,'XTick',Nticks,'XTickLabel',Nticklabels)

