%% temp_cal.m : get calibration coefficients for SeaBird Temperature sensors
%% input is temperature sensor serial number 

function [t_a, t_b, t_c, t_d, t_f0] = temp_cal(tempserial);

% use if mission run PRIOR to 24 July 2002
if tempserial==4123.1;
 fprintf('     Temperature sensor SN 4123 (PRIOR to 24 July 2002)\n');
 %% IPTS-68 coefficients
 t_a = 3.67988003e-03;
 t_b = 6.03911684e-04;
 t_c = 1.63056430e-05;
 t_d = 2.12888340e-06;
 t_f0 = 3171.158;

% use if mission run AFTER to 24 July 2002
elseif tempserial==4123;
 fprintf('     Temperature sensor SN 4123\n');
 %% IPTS-68 coefficients
t_a = 3.68120897e-03;
t_b = 6.03986959e-04;
t_c = 1.63121880e-05;
t_d = 2.11029408e-06;
t_f0 = 3164.161;


% this sensor's calibration coefficients PRIOR to July 2002  
elseif tempserial==4122.1;
 fprintf('     Temperature sensor SN 4122 (PRIOR to 24 July 2002)\n');
 %% IPTS-68 coefficients
 t_a = 3.67988033e-03;
 t_b = 6.06596377e-04;
 t_c = 1.66383558e-05;
 t_d = 2.13805613e-06;
 t_f0 = 3188.468;

% this sensor's calibration coefficients AFTER July 2002 
elseif tempserial==4122;
 fprintf('     Temperature sensor SN 4122\n');
 %% IPTS-68 coefficients
 t_a = 3.68120941e-03;
 t_b = 6.06682419e-04;
 t_c = 1.66858054e-05;
 t_d = 2.16802828e-06;
 t_f0 = 3181.509;

 elseif tempserial==2813;
 fprintf('     Temperature sensor SN 2813\n');
 %% IPTS-68 coefficients
 t_a = 3.67999722e-03;
 t_b = 6.02624547e-04;
 t_c = 1.59294960e-05;
 t_d = 2.06238399e-06;
 t_f0 = 2798.583;
  
elseif tempserial==2819;
 fprintf('     Temperature sensor SN 2819\n');
 %% IPTS-68 coefficients
 t_a = 3.67997127e-03;
 t_b = 6.01240767e-04;
 t_c = 1.58748231e-05;
 t_d = 2.03516651e-06;
 t_f0 = 3039.622;


else
 fprintf(' !!! Error: Unknown Temperature Sensor Serial Number\n'); return
end
