Skip to content
Snippets Groups Projects
maxSSJTQC.m 1.25 KiB
Newer Older
function maxSSJTQC(hMainFig)
%
% This function is called after option/preferences menu has been activated
% and flag salinity data where SSTP > max as BAD if test is on
%
% Input
% -----
% hMainFig ............ Handle to the main user interface
%
% $Id$

% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');

% Get BAD code value
% ----------------------
badCode = tsg.qc.hash.BAD.code;

ssjt_max = tsg.preference.ssjt_max_string;

% If necessary replace a comma by a point
% ---------------------------------------
ssjt_max = regexprep(ssjt_max, ',', '.');

% If bias not a numeric, str2double return a NaN
% ----------------------------------------------
ssjt_max = str2double( ssjt_max );

if isnumeric( ssjt_max ) && ~isnan( ssjt_max )

  % Set salinity QC to BAD for ssps < ssps_max
  % -----------------------------------------------------
  ind = find(tsg.SSJT > ssjt_max);
  if ~isempty( ind )
    tsg.SSJT_QC(ind) = castByteQC( badCode, ind );
  end

  % Save tsg structure
  % ------------------
  setappdata( hMainFig, 'tsg_data', tsg);
  
else
  
  msgbox('Enter a numeric value in the REFERENCE menu', 'ssjt QC',...
         'error', 'modal');

end

end