%% O2_calibration.m : to get calibration data for SeaBird O2 sensors
%% inputs is sensor serial number 
%%  Choose calibration nearest in time to mission by uncommenting/commenting out
%% SOc and BOc are the only coefficients that change with time; all others differ between sensors
function [m,b,k,c,SOc,BOc] = O2_calibration(O2serial);

if O2serial==368;
 disp('Oxygen sensor SN 368');
 %% O2 current slope and intercept
 m = 2.4522e-07; b = -4.4139e-10;
 %% oxygen membrane temperature coefficients
 k = 8.9412; c=-6.9756;
 %% For oxygen calculation, need coefficients oxygen current bias and slope
 disp(['Using post cruise (new) SOc and BOc, Cal date 6 March 2000']);
 SOc = 2.9279; BOc = -.0317;
 % disp(['Using pre-cruise (old) SOc and BOc, Cal date 30 Dec. 1998']);
 % SOc = 2.2910; BOc = -.0097;

elseif O2serial==493;
 disp('Oxygen sensor SN 493');
 %% O2 current slope and intercept
 m = 2.4294e-07; b = 4.8587e-11;
 %% oxygen membrane temperature coefficients
 k = 8.9156; c=-7.0174;
 %% For oxygen calculation, need coefficients oxygen current bias and slope
 disp(['Using post cruise (new) SOc and BOc, Cal date 7 March 2000']);
  SOc = 3.0936; BOc = -.0332;
 % disp(['Using pre-cruise (old) SOc and BOc, Cal date 25 Nov. 1998']);
 % SOc = 2.8668; BOc = -.0201;

elseif O2serial==544;
 disp('Oxygen sensor SN 544');
 %% O2 current slope and intercept
 m = 2.4444e-07; b = -2.7378e-10;
 %% oxygen membrane temperature coefficients
 k = 8.9902; c=-6.8669;
 %% For oxygen calculation, need coefficients oxygen current bias and slope
 disp(['Using calibration from 7 February 2000']);
  SOc = 2.6024; BOc = -.0103;
else
 disp(['Error: Unknown Oxygen Sensor Serial Number']); return
end
