Skip to content
Snippets Groups Projects
automaticQC.m 1.1 KiB
Newer Older
Yves Gouriou's avatar
Yves Gouriou committed
function [] = automaticQC( hTsgGUI )
%
% function [] = automaticQC( hTsgGUI )
%
% Automatic controlon TSG time series
%
% Test for :
% No date or time
% SSS < 0 and SSS > 40
%

% Get application data : TSG structure
% --------------------------------------
tsg  = getappdata( hTsgGUI, 'tsg_data');

Yves Gouriou's avatar
Yves Gouriou committed
% ----------------------------------------
indNaN = find( isnan(tsg.DAYD) == 1 );

% Get BAD code value
% ------------------
badCode = get(tsg.qc.hash, 'BAD', 'code');

% Set salinity QC to BAD for SSS > 40
% -----------------------------------
ind = find(tsg.SSPS > 40);
%tsg.SSPS_QC(ind)    = badCode * ones(size(ind),1);
if ~isempty( ind )
  tsg.SSPS_QC(ind) = castByteQC( badCode, ind );
end
Yves Gouriou's avatar
Yves Gouriou committed

% Set salinity QC to BAD for SSS < 0
% -----------------------------------
ind = find(tsg.SSPS < 0);
%tsg.SSPS_QC(ind)    = badCode*ones(size(ind),1);
if ~isempty( ind )
  tsg.SSPS_QC(ind) = castByteQC( badCode, ind );
end
Yves Gouriou's avatar
Yves Gouriou committed

% Save the data in the application GUI
% ------------------------------------
setappdata( hTsgGUI, 'tsg_data', tsg );

end