% doNORTEKoptic - translate optic sensor voltage from nortek profiler % (whether AWAC or Aquadopp) to scientific units % function [optic = doAWACoptic(extmeta, extvolts) % borrowed from dohydraoptic to convert the external voltages of a % extmeta is the structure of metadata for a Hydra external optical sensor % % for TRANS % extmeta.serial = 'TRANS290'; % OBS### | TRANS### | XXX#### % extmeta.height = 0; % m % extmeta.cals.pre = [0 0]; % for trans: [air blocked] % extmeta.cals.post = [0 0]; % for trans: [air blocked] % extmeta.cals.focallen = 25; % folcal length of the trans, 0.5 | 0.25 | 1 m % extmeta.cals.M = 0; % for trans % extmeta.cals.B = 0; % for trans % optic returns the attenuation suitable for: % 55:ATTN:ATTENUATION :attn:m-1:f7.5:added for r2d2 ctd data % % extmeta for OBS % extmeta.serial = 'OBS1711'; % OBS### | TRANS### | XXX#### % extmeta.height = 0.23; % m % if coef is present, dohydraoptic will apply them to OBS data % extmeta.coef = [0 1 0]; % or [] coefficients to a quadratic calibration eqation % extmeta.units = 'kg/m-3'; % extmeta.equation = 'Conc [kg/m-3] = coef(1)+coef(2)*V+coef(3)*V@2'; % optic returns nephylometer output, simply the volts it received % 56:NEP:BACKSCATTER INTENSITY :nephylometer:v:f10.6: added for Dave Pashinski % % If neither of these, then optic = extvolts % 29 Mar 2005 % -- add OBS calibration handling % 27 Jan 2009 % translated for AWAC, and include OBS3+ % Written by Marinna Martini for the U.S. Geological Survey % Coastal & Marine Program Woods Hole Field Center, Woods Hole, MA % http://woodshole.er.usgs.gov/ Please report bugs to mmartini@usgs.gov function optic = doNORTEKoptic(extmeta, extvolts) % for transmissometers if ~isempty(findstr('TRANS',extmeta.sensor_type)), % bail myself out.... if isfield(extmeta.cals,'focallen'), extmeta.cals.path_length = extmeta.cals.focallen; %disp('Warning: path length attribute will be called focallen') end % first make sure the required fields are there if ~isfield(extmeta.cals,'pre') || ~isfield(extmeta.cals,'post') || ... ~isfield(extmeta.cals,'path_length'), disp('dohydraoptic: Incorrect metadata for the transmissometer') disp(extmeta.cals) optic = []; return end if extmeta.cals.pre(1) >= extmeta.cals.post(1), Vair = extmeta.cals.pre(1); else Vair = extmeta.cals.post(1); end len = extmeta.cals.path_length; optic = -(1/len) .* log(extvolts./(.95*Vair)); elseif ~isempty(strmatch('OBS',extmeta.sensor_type,'exact')), if isfield(extmeta.cals,'SEDcoef') && ~isempty(extmeta.cals.SEDcoef), % user has supplied coefficients optic = extmeta.cals.SEDcoef(1).*ones(size(extvolts)); for n = 2:length(extmeta.cals.SEDcoef), optic = optic + extmeta.cals.SEDcoef(n).*(extvolts.^(n-1)); end else % No coefficients, no conversion %disp('dohydraoptic: No coefficients supplied for the OBS') optic = []; end %for OBS3+ on the AWAC elseif ~isempty(strmatch('OBS3+',extmeta.sensor_type,'exact')), if isfield(extmeta.cals,'NTUcoef') && ~isempty(extmeta.cals.NTUcoef), % user has supplied coefficients for NTU's optic1 = extmeta.cals.NTUcoef(1);%.*ones(size(extvolts)); for n = 2:length(extmeta.cals.NTUcoef), optic1 = optic1 + extmeta.cals.NTUcoef(n).*(extvolts.^(n-1)); end optic = optic1; if isfield(extmeta.cals,'SEDcoef') && ~isempty(extmeta.cals.SEDcoef), % user has supplied coefficients for sediment concentration optic2 = extmeta.cals.SEDcoef(1).*ones(size(extvolts)); for n = 2:length(extmeta.cals.SEDcoef), optic2 = optic2 + extmeta.cals.SEDcoef(n).*(extvolts.^(n-1)); end optic = [optic1 optic2]; end else % No coefficients, no conversion %disp('dohydraoptic: No coefficients supplied for the OBS') optic = [extvolts]; end else optic = extvolts; end