Skip to content
Snippets Groups Projects
minSpeedQC.m 1.26 KiB
Newer Older
function minSpeedQC(hMainFig)
%
% This function is called after option/preferences menu has been activated
% and flag salinity data where ship speed < min as HARBOUR if test is on
%
% Input
% -----
% hMainFig ............ Handle to the main user interface
%
% problem: the QC flag counter in 'Validation Codes' window
% is not updated after the test is applied 
% 


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

% Get HARBOUR code value
% ----------------------
harbourCode = tsg.qc.hash.HARBOUR.code;

% get preference choice for ship speed test
% -----------------------------------------
test = tsg.preference.ship_speed_test;

if (test==2)

    speed_min_string = tsg.preference.ship_speed_min_string;
    speed_min_choice = tsg.preference.ship_speed_min;
    speed_min=str2double(speed_min_string(speed_min_choice));

    % Set salinity QC to HARBOUR for ship speed < speed_min
    % -----------------------------------------------------
    ind = find(tsg.SPDC < speed_min);
    if ~isempty( ind )
        tsg.SSPS_QC(ind) = castByteQC( harbourCode, ind );
    end

end

% Save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg);

end