Skip to content
Snippets Groups Projects
tsg_plot_SalTsgSample.m 3.18 KiB
Newer Older
function tsg_plot_SalTsgSample( hGUI, hAxes )
%
% Function to plot the Salinity from TSG and smaple meausrements
%
% Input
% -----
% hGUI ............... Handel to the user interface
% hPlotAxes .......... Handels to the graphic axes
%
% Output
% ------

% Retrieve named application data
% -------------------------------
tsg    = getappdata( hGUI, 'tsg_data');
sample = getappdata( hGUI, 'sample' );
qc     = getappdata( hGUI, 'qcColor');


% Plot the Salinity with the right color code
% -------------------------------------------
axes( hAxes(1));

ind = find(tsg.PSAL_QC <= qc.Code.NO_CONTROL );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
               strcat('.',qc.Color.NO_CONTROL));

hold on;

ind = find(tsg.PSAL_QC == qc.Code.GOOD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
               strcat('.',qc.Color.GOOD));
           
ind = find(tsg.PSAL_QC == qc.Code.PROBABLY_GOOD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
               strcat('.',qc.Color.PROBABLY_GOOD));
           
ind = find(tsg.PSAL_QC == qc.Code.PROBABLY_BAD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
               strcat('.',qc.Color.PROBABLY_BAD));
           
ind = find(tsg.PSAL_QC == qc.Code.BAD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
               strcat('.',qc.Color.BAD));
           
% Plot salinity sample on TSG plot
% --------------------------------
if ~isempty(sample)
    plot(hAxes(1), sample.TIME, sample.PSAL, 'r*');
end
   

% Plot sample measurements
% ------------------------
axes( hAxes(2));

ind = find(sample.PSAL_QC <= qc.Code.NO_CONTROL );
plot(hAxes(2), sample.TIME(ind), sample.PSAL_DIF(ind), ...
               strcat('o',qc.Color.NO_CONTROL));

hold on;

ind = find(sample.PSAL_QC == qc.Code.GOOD );
plot(hAxes(2), sample.TIME(ind), sample.PSAL_DIF(ind), ...
               strcat('o',qc.Color.GOOD));
           
ind = find(sample.PSAL_QC == qc.Code.PROBABLY_GOOD );
plot(hAxes(2), sample.TIME(ind), sample.PSAL_DIF(ind), ...
               strcat('o',qc.Color.PROBABLY_GOOD));
           
ind = find(sample.PSAL_QC == qc.Code.PROBABLY_BAD );
plot(hAxes(2), sample.TIME(ind), sample.PSAL_DIF(ind), ...
               strcat('o',qc.Color.PROBABLY_BAD));
           
ind = find(sample.PSAL_QC == qc.Code.BAD );
plot(hAxes(2), sample.TIME(ind), sample.PSAL_DIF(ind), ...
               strcat('o',qc.Color.BAD));

%plot(hAxes(3), tsg.TIME, tsg.TEMP_TSG, '.');

% Formatted x-TIME axes
% ---------------------
datetick(hAxes(1), 'x');
datetick(hAxes(2), 'x');
%datetick(hAxes(3), 'x');

% Write some 'Y' label
% ------------------
set(get(hAxes(1), 'Ylabel'), 'String', 'Salinity');
set(get(hAxes(2), 'Ylabel'), 'String', 'Salinity Difference');
%set(get(hAxes(3), 'Ylabel'), 'String', 'Ship Velocity');

% Make the axes visible
% ---------------------
set(hAxes(1), 'Visible', 'on' );
set(hAxes(2), 'Visible', 'on' );
%set(hAxes(3), 'Visible', 'on' );

% The 3 axes will behave identically when zoomed and panned
% ---------------------------------------------------------