Skip to content
Snippets Groups Projects
Commit 96eecec5 authored by Yves Gouriou's avatar Yves Gouriou
Browse files

Now one unique plot function plot_Tsg

parent dc787bde
No related branches found
No related tags found
No related merge requests found
% tsg_quality.csv: definition ( id + 6 members + endl & 16 separators ; actually)
% $Id$
%
% tsg_quality.csv: definition ( id + 6 members + endl & 16 separators ; actually);;;;;
% $Id$;;;;;;
%;;;;;;
id;type;label;code;color;state;endl
char;char;char;integer;char;char;char
#;NO_CONTROL;No control;0;k;on;#
......@@ -8,7 +8,7 @@ char;char;char;integer;char;char;char
#;PROBABLY_GOOD;Probably Good;2;g;on;#
#;PROBABLY_BAD;Probably bad;3;m;on;#
#;BAD;Bad;4;r;on;#
#;VALUE_CHANGED;Value changed;5;r;off;#
#;VALUE_CHANGED;Value changed;5;c;off;#
#;HARBOUR;Harbour;6;c;on;#
#;NOT_USED;Not used;7;w;off;#
#;INTERPOLATED_VALUE;Interpolated value;8;k;off;#
......
......@@ -10,6 +10,8 @@ set(hPlotAxes(1), 'Visible', 'on' );
set(hPlotAxes(2), 'Visible', 'on' );
set(hPlotAxes(3), 'Visible', 'on' );
drawnow
% The 3 axes will behave identically when zoomed and panned
% ---------------------------------------------------------
linkaxes([hPlotAxes(1),hPlotAxes(2),hPlotAxes(3)], 'x');
......
......@@ -43,9 +43,9 @@ for i= 1 : m
% Keep the smooth TSG value
% -------------------------
if timeDiff(indMin) < tsg.cst.TSG_WS_TIMEDIFF && ...
~isnan(tsg.ssps.smooth.val(indMin))
~isnan(tsg.ssps_smooth(indMin))
sample.SSPS_SMOOTH(i) = tsg.ssps.smooth.val(indMin);
sample.SSPS_SMOOTH(i) = tsg.ssps_smooth(indMin);
end
end
......
function plot_Correction( hMainFig, hPlotAxes )
% Reinitialise plot 1 and 3
% -------------------------
erase_Line( hPlotAxes, 1 );
erase_Line( hPlotAxes, 2 );
erase_Line( hPlotAxes, 3 );
% Get tsg application data
% ------------------------
tsg = getappdata( hMainFig, 'tsg_data');
sample = getappdata( hMainFig, 'sample');
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
% Get the code for VALUE_CHANGED
% ------------------------------
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
% Select the record with VALUE_CHANGED code
% -----------------------------------------
ind = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED);
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1
% -------------------------------------------------------
plot_Tsg( hMainFig, hPlotAxes, 1,...
tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind)-tsg.SSPS(ind),...
[], 'SSPS_ADJUSTED','b','none','.',1);
% Plot SSPS and SAMPLE, with code color, on axe 2
% ------------------------------------------------
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','*',2);
plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] );
% Plot SSPS, with no code, on axe3
% --------------------------------
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS,...
[],'SSPS','k','none','.',1);
% Plot TSG_ADJUSTED + ERROR on axe 3
% -----------------------------------
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(ind),...
tsg.SSPS_ADJUSTED(ind) + tsg.SSPS_ADJUSTED_ERROR(ind),...
[], 'SSPS_ADJUSTED','g','none','.',1);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(ind),...
tsg.SSPS_ADJUSTED(ind) - tsg.SSPS_ADJUSTED_ERROR(ind),...
[], 'SSPS_ADJUSTED','g','none','.',1);
% Plot SSPS_ADJUSTED on axe 3
% ---------------------------
plot_Tsg( hMainFig, hPlotAxes, 3,...
tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind), [],...
'SSPS_ADJUSTED','r','none','.',3);
end
function plot_Tsg( hTsgGUI, hAxes, PlotNum, Para, Linestyle, MyColor )
function plot_Tsg( hTsgGUI, hAxes, PlotNum, X, Y, QC, para, colVal, lineType, markType, markSize )
%
% Function to plot TSG parameters
% The program can plot parameter of style SSPS or SSPS_ADJUSTED
......@@ -9,40 +9,30 @@ function plot_Tsg( hTsgGUI, hAxes, PlotNum, Para, Linestyle, MyColor )
% hTsgGUI ........ Handle to the user interface
% hAxes ........ Handle to the graphic axes
% PlotNum ........ Plot Number (used for the TAG)
% Para ........... Parametre whose difference with TSG data is plot
% Linestyle ...... 1 - plot the line with markers
% 0 - only plot a continous line
% MyColor ........ [] - Draw Para taking into account color QC code
% X
% Y
% QC ............. QC array - If empty plot using Color specification
% para
% colVal .......... [] - Draw Para taking into account color QC code
% 'k''b'... - Draw Para using Color code
% lineType ...... Matlab type : 'none', '-', '--', ':', '.-'
% markType ......... Matlab type
% markSize ...... Integer
% Para ........... Parametre whose difference with TSG data is plot
% Retrieve named application data
% -------------------------------
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');
if ~isempty( tsg.(Para) )
if ~isempty( X ) && ~isempty( Y )
axes( hAxes(PlotNum) );
set( hAxes(PlotNum), 'Box', 'on' );
hold on
if Linestyle
Style = 'none';
Mark = '.';
else
Style = '-';
Mark = 'none';
end
% Extract the name of the parameter
% ---------------------------------
pos = regexp( Para, '_', 'ONCE');
if isempty( pos )
parameter = Para;
else
parameter = Para(1:pos-1);
end
if isempty(MyColor)
% Plot using QC
% -------------
if ~isempty(QC)
% get list of keys from hashtable tsg.qc.hash, defined inside
% tsg_initialisation.m
......@@ -57,40 +47,40 @@ if ~isempty( tsg.(Para) )
% get key and some values in hashtable
% ------------------------------------
key = qc_list{i};
state = get(tsg.qc.hash, key, 'state');
code = get(tsg.qc.hash, key, 'code');
color = get(tsg.qc.hash, key, 'color');
qcState = get(tsg.qc.hash, key, 'state');
qcCode = get(tsg.qc.hash, key, 'code');
qcColor = get(tsg.qc.hash, key, 'color');
% plot only for valid context menu (set to 'on')
% ----------------------------------------------
if strcmp( state, 'on')
% if strcmp( qcState, 'on')
% plot tsg salinity sample with right code/color
% ----------------------------------------------
ind = find(tsg.([Para '_QC']) == code );
ind = find( QC == qcCode );
if ~isempty( ind )
line( tsg.DAYD(ind), tsg.(Para)(ind), ...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para '_' key],...
'LineStyle', Style, ...
'Marker', Mark, 'MarkerSize', 5, 'Color', color);
line( X(ind), Y(ind), ...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' para '_' key],...
'LineStyle', lineType, ...
'Marker', markType, 'MarkerSize', markSize, 'Color', qcColor);
end
end
%end
end
else
line(tsg.DAYD, tsg.(Para),...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para], ...
'LineStyle', Style,'Marker', Mark, 'MarkerSize', 5, 'Color', MyColor);
line( X, Y, 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' para], ...
'LineStyle', lineType, ...
'Marker', markType, 'MarkerSize', markSize, 'Color', colVal);
end
hold off;
% Write some 'Y' label
% ------------------
set(get(hAxes(PlotNum), 'Ylabel'), 'Interpreter', 'none', 'String', Para);
set(get(hAxes(PlotNum), 'Ylabel'), 'Interpreter', 'none', 'String', para);
end
......@@ -63,8 +63,8 @@ for i = 1:length(tsg.SSPS)
nval( i ) = length( ind2 );
end
tsg.ssps.smooth.val = smooth;
tsg.ssps.smooth.nval = nval;
tsg.ssps_smooth = smooth;
tsg.ssps_smooth_nval = nval;
% Update the tsg structure in the application
% --------------------------------------------
......
......@@ -782,15 +782,21 @@ if strcmp(root.preference.autoload, 'on')
% ----------------------------------
tsg_moveaverage(hMainFig);
% The callback to detect the mouse motion can be set to on
% --------------------------------------------------------
set( hMainFig, 'UserData', 'ButtonMotionOn');
% Get application data before drawing
% -----------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% yes, plot the Salinity, temperature and velocity
% ------------------------------------------------
plot_Tsg( hMainFig, hPlotAxes, 1, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSJT', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SPDC', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],...
'SSPS','k','none','.',1);
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','.',1);
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],...
'SSJT','k','none','.',1);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],...
'SPDC','k','none','.',1);
axesCommonProp( hPlotAxes );
if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT )
......@@ -800,6 +806,10 @@ if strcmp(root.preference.autoload, 'on')
plot_map( hMainFig, hPlotAxes);
% The callback to detect the mouse motion can be set to on
% --------------------------------------------------------
set( hMainFig, 'UserData', 'ButtonMotionOn');
% Hide handles marked as hidden with HandleVisibility property set to
% callback or off
% -------------------------------------------------------------------
......@@ -898,21 +908,26 @@ end
% ----------------------------------
tsg_moveaverage(hMainFig);
% Get application data
% --------------------
tsg = getappdata( hMainFig, 'tsg_data');
% The callback to detect the mouse motion can be set to on
% --------------------------------------------------------
set( hMainFig, 'UserData', 'ButtonMotionOn');
% Make the Salinity, temperature and velocity plot
% ------------------------------------------------
%plot_SalTempVel( hMainFig, hPlotAxes );
plot_Tsg( hMainFig, hPlotAxes, 1, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSJT', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SPDC', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],...
'SSPS','k','-','*',2);
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','*',2);
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],...
'SSJT','k','none','*',2);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],...
'SPDC','k','none','*',2);
axesCommonProp( hPlotAxes );
% Plot the Map with the ship trackline
% ------------------------------------
% plot_map( hMainFig, hPlotAxes)
% Update QC statistics
% --------------------
......@@ -923,7 +938,6 @@ end
% Merge bucket and external samples
% ---------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT )
tsg_mergesample( hMainFig );
end
......@@ -1170,7 +1184,8 @@ end
erase_Line( hPlotAxes, 1 );
erase_Line( hPlotAxes, 2 );
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','.',1);
plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] );
else
......@@ -1203,7 +1218,8 @@ end
% plot selected data with selected code
% --------------------------------------
erase_Line( hPlotAxes, 1 );
plot_Tsg( hMainFig, hPlotAxes, 1, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','.',1);
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] );
% refresh QC statistic panel
......@@ -1271,7 +1287,8 @@ end
erase_Line( hPlotAxes, 1 );
erase_Line( hPlotAxes, 2 );
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','.',1);
plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] );
else
......@@ -1284,7 +1301,8 @@ end
% Plot the TSG data with new codes
% --------------------------------
erase_Line( hPlotAxes, 1 );
plot_Tsg( hMainFig, hPlotAxes, 1, 'SSPS', 1, [] );
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','.',1);
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] );
end
......@@ -1528,23 +1546,10 @@ end
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig );
% plot Salinity Difference
% ------------------------
%plot_Sample( hMainFig, hPlotAxes );
erase_Line( hPlotAxes, 1 )
erase_Line( hPlotAxes, 2 )
erase_Line( hPlotAxes, 3 )
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSPS', 1, [] );
plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS', 0, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS_ADJUSTED', 0, 'r' );
axesCommonProp( hPlotAxes );
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes );
% Get the information on time limits of the time series
% Write them in the uipanel
......@@ -1602,11 +1607,17 @@ end
erase_Line( hPlotAxes, 2 );
erase_Line( hPlotAxes, 3 );
plot_Tsg( hMainFig, hPlotAxes, 1, 'SSPS', 1, [] );
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] );
plot_Tsg( hMainFig, hPlotAxes, 2, 'SSJT', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SPDC', 1, 'k' );
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],...
'SSPS','k','-','*',2);
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,...
'SSPS','','none','*',2);
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] );
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],...
'SSJT','k','none','*',2);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],...
'SPDC','k','none','*',2);
axesCommonProp( hPlotAxes );
end
......@@ -1739,8 +1750,8 @@ end
% -------------------------
erase_Line( hPlotAxes, 1 )
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
erase_Line( hPlotAxes, 3 )
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS', 0, 'k' );
erase_Line( hPlotAxes, 3 )
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS, [], 'SSPS','k','none','.',1);
end
......@@ -1773,43 +1784,9 @@ end
case 1
% Reinitialise plot 1 and 3
% -------------------------
erase_Line( hPlotAxes, 1 )
erase_Line( hPlotAxes, 3 )
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
% The order of ploting is important : RED before BLACK
% For the time series section where no correction has been
% made the black curve must be over the red one.
% ----------------------------------------------------
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS_ADJUSTED', 0, 'r' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS', 0, 'k' );
tsg = getappdata( hMainFig, 'tsg_data');
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1
% Only for VALUE_CHANGED
% -------------------------------------------------------
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
ind = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED);
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1
% -------------------------------------------------------
axes( hPlotAxes(1) );
line( tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind)-tsg.SSPS(ind),...
'Tag', 'TAG_PLOT1_LINE_TSGDIF', 'Color', 'b');
% Plot TSG + ERROR on axe 3
% -------------------------
errorPlus = tsg.SSPS_ADJUSTED(ind) + tsg.SSPS_ADJUSTED_ERROR(ind);
errorMinus = tsg.SSPS_ADJUSTED(ind) - tsg.SSPS_ADJUSTED_ERROR(ind);
axes( hPlotAxes(3) );
line( tsg.DAYD(ind), errorPlus(ind),...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_PLUS', 'Color', 'g');
line( tsg.DAYD(ind), errorMinus(ind),...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_MINUS', 'Color', 'g');
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes );
case -1
msgbox( 'Date limits are not correct',...
......@@ -1847,41 +1824,9 @@ end
case 1
% Reinitialise plot 1 and 3
% -------------------------
erase_Line( hPlotAxes, 1 )
erase_Line( hPlotAxes, 3 )
plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] );
% The order of ploting is important : RED before BLACK
% For the time series section where no correction has been
% made the black curve must be over the red one.
% ----------------------------------------------------
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS_ADJUSTED', 0, 'r' );
plot_Tsg( hMainFig, hPlotAxes, 3, 'SSPS', 0, 'k' );
tsg = getappdata( hMainFig, 'tsg_data');
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1
% Only for VALUE_CHANGED
% -------------------------------------------------------
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
ind = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED);
axes( hPlotAxes(1) );
line( tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind)-tsg.SSPS(ind),...
'Tag', 'TAG_PLOT1_LINE_TSGDIF', 'LineStyle', 'none', 'Marker', '.', 'MarkerSize', 1, 'Color', 'b');
% Plot TSG + ERROR on axe 3
% -------------------------
errorPlus = tsg.SSPS_ADJUSTED(ind) + tsg.SSPS_ADJUSTED_ERROR(ind);
errorMinus = tsg.SSPS_ADJUSTED(ind) - tsg.SSPS_ADJUSTED_ERROR(ind);
axes( hPlotAxes(3) );
line( tsg.DAYD(ind), errorPlus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_PLUS', 'Color', 'g');
line( tsg.DAYD(ind), errorMinus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_MINUS', 'Color', 'g');
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes );
case -1
msgbox( 'Date limits are not correct',...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment