load("full_timeseries.mat")
warmup = 79; % nsamples to warm up pH sensor
k0 = wwf.k0_timeseries(:,79:end);
dn = wwf.dn(79:end);
% k0means = mean(k0(5:20,:),'omitmissing'); % range with deep upwelled water. 
% % O2 sensor error highest at bottom due to time response
k0means = mean(k0,'omitmissing');
k0mean = mean(k0means,"all","omitmissing");
k0std = std(k0means,[],"all","omitmissing");
k0error = k0std *2;
lbound = k0mean - k0std;
hbound = k0mean + k0std;
pH_uncertainty = k0error * 16.66;

clf
plot(dn,k0means)


k0means = mean(k0,'omitmissing');
k0mean = mean(k0means,"all","omitmissing");
k0std = std(k0means,[],"all","omitmissing");
k0error = k0std *2;
lbound = k0mean - k0std;
hbound = k0mean + k0std;
pH_uncertainty = k0error * 16.66;