% 1. load data
load 4900093

% 2. plot oxygen data at about 90 m depth (level 10)
% 2.1 restrict variables to layer of interest only
pres = pres(:,10);
doxy = doxy(:,10);
% 2.2 quality control pressure and oxygen data (replace 99999 with NaNs)
bad = find(pres==99999);
pres(bad) = nan;
doxy(bad) = nan;
% 2.3 remove negative oxygen values
bad = find(doxy<0);
doxy(bad) = nan;
% 2.4 plot
figure
plot(time,doxy,'.:')
% do fit from time = 19350 to 19645
hold on
plot([19350 19350],[195 220],'k:')
plot([19645 19645],[195 220],'k:')

% 3. determine linear fit for first summer
% 3.1 prepare x and y vectors by picking only elements within
% the desired timeframe
ind = find(time>=19350 & time<= 19645);
x = time(ind);
y = doxy(ind);
% 3.2 do unweighted fit
a = linfit(x,y,0);
% 3.3 plot result
figure
plot(x,y,'.:')
hold on
plot(x,a(1)+a(2)*x,'r-')
% Question: What is the unit on a(2)?



