CALIBRATEWLECOBBFL2 Calibrate WET Labs ECO Triplet Puck. Syntax: [CHLR, CDOM, SCAT] = CALIBRATEWLECOBBFL2(CHLR_CNTS, CDOM_CNTS, SCAT_CNTS, CHLR_COEFS, CDOM_COEFS, SCAT_COEFS) Description: [CHLR, CDOM, SCAT] = CALIBRATEWLECOBBFL2(CHLR_CNTS, CDOM_CNTS, SCAT_CNTS, CHLR_COEFS, CDOM_COEFS, SCAT_COEFS) applies the affine transformation (scale and offset) described in WET Labs calibration sheet to convert raw measurements (counts) of chlorophyll concentration, CDOM concetration and scattering in arrays CHLR_CNTS, CDOM_CNTS and SCAT_CNTS to engineering units (ug l-1, ppb and m-1 sr-1) in arrays CHLR, CDOM, SCAT, using the calibration coefficients in arrays or structs CHLR_COEFS, CDOM_COEFS and SCAT_COEFS. The calibration equation of each signal is a simple offset and scale: CHLR = CHLR_SF*(CHLR_CNTS - CHLR_DC) CDOM = CDOM_SF*(CDOM_CNTS - CDOM_DC) SCAT = SCAT_SF*(SCAT_CNTS - SCAT_DC) where CHLR_SF and CHLR_DC: chlorophyll scale factor and dark counts. These should be fields of struct CHLR_COEFS, shortened to SF and DC, or its elements if it is an array (in that order). CDOM_SF and CDOM_DC: CDOM scale factor and dark counts. These should be fields of struct CDOM_COEF, shortened to SF and DC, or its elements if it is an array (in that order). SCAT_SF and SCAT_DC: scattering scale factor and dark counts. These should be fields of struct SCAT_COEFS, shortened to SF and DC, or its elements if it is an array (in that order). Notes: The equations and coefficients are provided in the calibration sheets of the ECO Triplet Puck shipped with Seaglider gliders. They also appear in the basestation file 'sg_calib_constants.m'. Examples: chlr_cnts = [50 51 51 57 63 80 83 83 81 72 68 67 64 57 56 54 52 51 50] cdom_cnts = [45 49 50 50 51 56 57 59 57 60 57 61 58 58 58 57 57 60 56] scat_cnts = [81 79 78 78 81 83 86 83 76 73 75 71 71 72 73 73 81 71 70] chlr_coefs = [0.0118 38] cdom_coefs = [0.0878 40] scat_coefs = [3.51e-06 33] [chlr, cdom, scat] = ... calibrateWLECOBbFl2(chlr_cnts, cdom_cnts, scat_cnts, ... chlr_coefs, cdom_coefs, scat_coefs) Authors: Joan Pau Beltran <joanpau.beltran@socib.cat>
0001 function [chlr, cdom, scat] = calibrateWLECOBbFl2(chlr_cnts, cdom_cnts, scat_cnts, chlr_coefs, cdom_coefs, scat_coefs) 0002 %CALIBRATEWLECOBBFL2 Calibrate WET Labs ECO Triplet Puck. 0003 % 0004 % Syntax: 0005 % [CHLR, CDOM, SCAT] = CALIBRATEWLECOBBFL2(CHLR_CNTS, CDOM_CNTS, SCAT_CNTS, CHLR_COEFS, CDOM_COEFS, SCAT_COEFS) 0006 % 0007 % Description: 0008 % [CHLR, CDOM, SCAT] = CALIBRATEWLECOBBFL2(CHLR_CNTS, CDOM_CNTS, SCAT_CNTS, CHLR_COEFS, CDOM_COEFS, SCAT_COEFS) 0009 % applies the affine transformation (scale and offset) described in WET Labs 0010 % calibration sheet to convert raw measurements (counts) of chlorophyll 0011 % concentration, CDOM concetration and scattering in arrays CHLR_CNTS, 0012 % CDOM_CNTS and SCAT_CNTS to engineering units (ug l-1, ppb and m-1 sr-1) 0013 % in arrays CHLR, CDOM, SCAT, using the calibration coefficients in arrays 0014 % or structs CHLR_COEFS, CDOM_COEFS and SCAT_COEFS. 0015 % 0016 % The calibration equation of each signal is a simple offset and scale: 0017 % CHLR = CHLR_SF*(CHLR_CNTS - CHLR_DC) 0018 % CDOM = CDOM_SF*(CDOM_CNTS - CDOM_DC) 0019 % SCAT = SCAT_SF*(SCAT_CNTS - SCAT_DC) 0020 % where 0021 % CHLR_SF and CHLR_DC: chlorophyll scale factor and dark counts. 0022 % These should be fields of struct CHLR_COEFS, shortened to SF and DC, 0023 % or its elements if it is an array (in that order). 0024 % CDOM_SF and CDOM_DC: CDOM scale factor and dark counts. 0025 % These should be fields of struct CDOM_COEF, shortened to SF and DC, 0026 % or its elements if it is an array (in that order). 0027 % SCAT_SF and SCAT_DC: scattering scale factor and dark counts. 0028 % These should be fields of struct SCAT_COEFS, shortened to SF and DC, 0029 % or its elements if it is an array (in that order). 0030 % 0031 % Notes: 0032 % The equations and coefficients are provided in the calibration sheets of 0033 % the ECO Triplet Puck shipped with Seaglider gliders. They also appear in 0034 % the basestation file 'sg_calib_constants.m'. 0035 % 0036 % Examples: 0037 % chlr_cnts = [50 51 51 57 63 80 83 83 81 72 68 67 64 57 56 54 52 51 50] 0038 % cdom_cnts = [45 49 50 50 51 56 57 59 57 60 57 61 58 58 58 57 57 60 56] 0039 % scat_cnts = [81 79 78 78 81 83 86 83 76 73 75 71 71 72 73 73 81 71 70] 0040 % chlr_coefs = [0.0118 38] 0041 % cdom_coefs = [0.0878 40] 0042 % scat_coefs = [3.51e-06 33] 0043 % [chlr, cdom, scat] = ... 0044 % calibrateWLECOBbFl2(chlr_cnts, cdom_cnts, scat_cnts, ... 0045 % chlr_coefs, cdom_coefs, scat_coefs) 0046 % 0047 % Authors: 0048 % Joan Pau Beltran <joanpau.beltran@socib.cat> 0049 0050 % Copyright (C) 2014-2016 0051 % ICTS SOCIB - Servei d'observacio i prediccio costaner de les Illes Balears 0052 % <http://www.socib.es> 0053 % 0054 % This program is free software: you can redistribute it and/or modify 0055 % it under the terms of the GNU General Public License as published by 0056 % the Free Software Foundation, either version 3 of the License, or 0057 % (at your option) any later version. 0058 % 0059 % This program is distributed in the hope that it will be useful, 0060 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0061 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0062 % GNU General Public License for more details. 0063 % 0064 % You should have received a copy of the GNU General Public License 0065 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0066 0067 error(nargchk(nargin, 6, 6, 'struct')); 0068 0069 if isstruct(chlr_coefs) 0070 sd_chlr = [chlr_coefs.sf chlr_coefs.dc]; 0071 else 0072 sd_chlr = chlr_coefs([1 2]); 0073 end 0074 if isstruct(cdom_coefs) 0075 sd_cdom = [cdom_coefs.sf cdom_coefs.dc]; 0076 else 0077 sd_cdom = cdom_coefs([1 2]); 0078 end 0079 if isstruct(scat_coefs) 0080 sd_scat = [scat_coefs.sf scat_coefs.dc]; 0081 else 0082 sd_scat = scat_coefs([1 2]); 0083 end 0084 0085 chlr = sd_chlr(1)*(chlr_cnts - sd_chlr(2)); 0086 cdom = sd_cdom(1)*(cdom_cnts - sd_cdom(2)); 0087 scat = sd_scat(1)*(scat_cnts - sd_scat(2)); 0088 0089 end