CALIBRATESBECT Calibrate Seabird Electronics CT sail. Syntax: [TEMP, COND] = CALIBRATESBECT(TEMP_FREQ, COND_FREQ, PRES, TEMP_COEFS, COND_COEFS) Description: [TEMP, COND] = CALIBRATESBECT(TEMP_FREQ, COND_FREQ, PRES, TEMP_COEFS, COND_COEFS) applies the equations described in Seabird Electronics calibration sheet to convert the temperature and conductivity raw measurements (Hz) in arrays TEMP_FREQ and COND_FREQ to engineering units (ITS90 ºC and Siemens/m) in arrays TEMP and COND, using the pressure readings in PRES (dbar) and the calibration coefficients in arrays or structs TEMP_COEFS and COND_COEFS. The calibration equations are: TEMP = 1/(T_G + T_H*ln(1/F_T) + T_I*ln(1/F_T)^2 + T_J*ln(1/F_T)^3) - 273.15 COND = 0.1*(C_G + C_H*F_C^2 + C_I*F_C^3 + C_J*F_C^4)/(1 + CTCOR*TEMP + CPCOR*PRES) where F_T: temperature signal frequency in kHz (TEMP_FREQ * 1e-3). F_C: conductivity signal frequency in kHz (COND_FREQ * 1e-3). T_G, T_H, T_I, T_J: temperature calibration coefficients. These should be fields of struct TEMP_COEFS or its elements if it is an array (in that order). C_G, C_H, C_I, C_J, CTCOR, CPCOR: conductivity calibration coefficients. These should be fields of struct COND_COEFS or its elements if it is an array (in that order). Notes: The equations and coefficients are provided in the calibration sheets of the CT sails shipped with Seaglider gliders. They also appear in the basestation file 'sg_calib_constants.m'. Examples: temp_true = [1.0 4.5 15.0 18.5 24.0 29.0 32.5 ] cond_true = [2.97836 3.28569 4.26827 4.61375 5.17227 5.69472 6.06756 ] pres = 0; temp_freq = [3387.875 3668.209 4609.999 4959.066 5544.757 6117.756 6542.459] cond_freq = [5987.16 6214.10 6888.93 7110.73 7455.09 7763.03 7975.39 ] temp_coefs = [ 4.38052489e-3 6.25478746e-4 2.34258763e-5 2.50671271e-6] cond_coefs = [-9.92304872 1.11163373 -2.02979731e-3 2.29265437e-4 -9.57e-8 3.25e-6] [temp, cond] = calibrateSBECT(temp_freq, cond_freq, pres, temp_coefs, cond_coefs) Authors: Joan Pau Beltran <joanpau.beltran@socib.cat>
0001 function [temp, cond] = calibrateSBECT(temp_freq, cond_freq, pres, temp_coefs, cond_coefs) 0002 %CALIBRATESBECT Calibrate Seabird Electronics CT sail. 0003 % 0004 % Syntax: 0005 % [TEMP, COND] = CALIBRATESBECT(TEMP_FREQ, COND_FREQ, PRES, TEMP_COEFS, COND_COEFS) 0006 % 0007 % Description: 0008 % [TEMP, COND] = CALIBRATESBECT(TEMP_FREQ, COND_FREQ, PRES, TEMP_COEFS, COND_COEFS) 0009 % applies the equations described in Seabird Electronics calibration sheet 0010 % to convert the temperature and conductivity raw measurements (Hz) in arrays 0011 % TEMP_FREQ and COND_FREQ to engineering units (ITS90 ºC and Siemens/m) 0012 % in arrays TEMP and COND, using the pressure readings in PRES (dbar) and the 0013 % calibration coefficients in arrays or structs TEMP_COEFS and COND_COEFS. 0014 % 0015 % The calibration equations are: 0016 % TEMP = 1/(T_G + T_H*ln(1/F_T) + T_I*ln(1/F_T)^2 + T_J*ln(1/F_T)^3) - 273.15 0017 % COND = 0.1*(C_G + C_H*F_C^2 + C_I*F_C^3 + C_J*F_C^4)/(1 + CTCOR*TEMP + CPCOR*PRES) 0018 % where 0019 % F_T: temperature signal frequency in kHz (TEMP_FREQ * 1e-3). 0020 % F_C: conductivity signal frequency in kHz (COND_FREQ * 1e-3). 0021 % T_G, T_H, T_I, T_J: temperature calibration coefficients. 0022 % These should be fields of struct TEMP_COEFS or its elements if it 0023 % is an array (in that order). 0024 % C_G, C_H, C_I, C_J, CTCOR, CPCOR: conductivity calibration coefficients. 0025 % These should be fields of struct COND_COEFS or its elements if it 0026 % is an array (in that order). 0027 % 0028 % Notes: 0029 % The equations and coefficients are provided in the calibration sheets of 0030 % the CT sails shipped with Seaglider gliders. They also appear in the 0031 % basestation file 'sg_calib_constants.m'. 0032 % 0033 % Examples: 0034 % temp_true = [1.0 4.5 15.0 18.5 24.0 29.0 32.5 ] 0035 % cond_true = [2.97836 3.28569 4.26827 4.61375 5.17227 5.69472 6.06756 ] 0036 % pres = 0; 0037 % temp_freq = [3387.875 3668.209 4609.999 4959.066 5544.757 6117.756 6542.459] 0038 % cond_freq = [5987.16 6214.10 6888.93 7110.73 7455.09 7763.03 7975.39 ] 0039 % temp_coefs = [ 4.38052489e-3 6.25478746e-4 2.34258763e-5 2.50671271e-6] 0040 % cond_coefs = [-9.92304872 1.11163373 -2.02979731e-3 2.29265437e-4 -9.57e-8 3.25e-6] 0041 % [temp, cond] = calibrateSBECT(temp_freq, cond_freq, pres, temp_coefs, cond_coefs) 0042 % 0043 % Authors: 0044 % Joan Pau Beltran <joanpau.beltran@socib.cat> 0045 0046 % Copyright (C) 2014-2016 0047 % ICTS SOCIB - Servei d'observacio i prediccio costaner de les Illes Balears 0048 % <http://www.socib.es> 0049 % 0050 % This program is free software: you can redistribute it and/or modify 0051 % it under the terms of the GNU General Public License as published by 0052 % the Free Software Foundation, either version 3 of the License, or 0053 % (at your option) any later version. 0054 % 0055 % This program is distributed in the hope that it will be useful, 0056 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0057 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0058 % GNU General Public License for more details. 0059 % 0060 % You should have received a copy of the GNU General Public License 0061 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0062 0063 error(nargchk(nargin, 5, 5, 'struct')); 0064 0065 if isstruct(temp_coefs) 0066 jihg_temp = [temp_coefs.t_j temp_coefs.t_i temp_coefs.t_h temp_coefs.t_g]; 0067 else 0068 jihg_temp = temp_coefs([4 3 2 1]); 0069 end 0070 0071 if isstruct(cond_coefs) 0072 jih0g_cond = [cond_coefs.c_j cond_coefs.c_i cond_coefs.c_h 0 cond_coefs.c_g]; 0073 ctcor = cond_coefs.ctcor; 0074 cpcor = cond_coefs.cpcor; 0075 else 0076 jih0g_cond = [cond_coefs([4 3 2]) 0 cond_coefs(1)]; 0077 ctcor = cond_coefs(5); 0078 cpcor = cond_coefs(6); 0079 end 0080 0081 temp = 1 ./ polyval(jihg_temp, log(1000 ./ temp_freq)) - 273.15; 0082 cond = 0.1 * ... 0083 polyval(jih0g_cond, cond_freq ./ 1000) ./ (1 + ctcor * temp + cpcor * pres); 0084 0085 end