Newer
Older
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');
% Get the code for VALUE_CHANGED
% ------------------------------
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
% **************************** AXE 1 ***********************************
% Plot the samples
% ----------------
if ~isempty( tsg.SSPS_SPL )
% Plot bucket samples
% -------------------
iWS = find( tsg.SSPS_SPL_TYPE == 1 );
if ~isempty(iWS)
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(iWS),...
tsg.SSPS_SPL_DIF(iWS), tsg.SSPS_SPL_QC(iWS),...
'SSPS_SPL_1','','none','square',5);
end
% Plot other (external) samples
% -----------------------------
iEXT = find( tsg.SSPS_SPL_TYPE > 1 );
if ~isempty(iEXT)
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(iEXT),...
tsg.SSPS_SPL_DIF(iEXT), tsg.SSPS_SPL_QC(iEXT),...
'SSPS_SPL_2','','none','o',5);
end
end
% Select the record with VALUE_CHANGED code
% -----------------------------------------
iVC = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED );
% Select only records corrected but not calibrated.
% Records corrected and calibrated have the same QC code.
% Records corrected have an error value
% ------------------------------------------------------
iERR = [];
if iVC ~= 0
iERR = find( isnan( tsg.SSPS_ADJUSTED_ERROR(iVC) ) == 0 );
end
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1
% but only for records that were corrected using Water Sample
% and but not corrected with the calibration coefficients.
% -----------------------------------------------------------
if iERR ~= 0
plot_Tsg( hMainFig, hPlotAxes, 1,...
tsg.DAYD(iVC(iERR)),...
tsg.SSPS_ADJUSTED(iVC(iERR))-tsg.SSPS(iVC(iERR)),...
[], 'SSPS_ADJUSTED','b','none','.',1);
end
% **************************** AXE 2 ***********************************
% 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);
if ~isempty( tsg.SSPS_SPL )
ind = find( tsg.SSPS_SPL_TYPE == 1 );
if ~isempty(ind)
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD_SPL(ind),...
tsg.SSPS_SPL(ind), tsg.SSPS_SPL_QC(ind),...
'SSPS_SPL_1','','none','square',5);
end
ind = find( tsg.SSPS_SPL_TYPE > 1 );
if ~isempty(ind)
plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD_SPL(ind),...
tsg.SSPS_SPL(ind), tsg.SSPS_SPL_QC(ind),...
'SSPS_SPL_2','','none','o',5);
end
end
% **************************** AXE 3 ***********************************
% Plot SSPS, with no code, on axe3
% --------------------------------
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS_ADJUSTED, [],...
'SSPS_ADJUSTED','r','none','*',1);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS,...
% Plot TSG_ADJUSTED + ERROR on axe 3
% -----------------------------------
if iERR ~= 0
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(iVC(iERR)),...
tsg.SSPS_ADJUSTED(iVC(iERR)) + tsg.SSPS_ADJUSTED_ERROR(iVC(iERR)),...
[], 'SSPS_ADJUSTED','g','none','*',1);
plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(iVC(iERR)),...
tsg.SSPS_ADJUSTED(iVC(iERR)) - tsg.SSPS_ADJUSTED_ERROR(iVC(iERR)),...
[], 'SSPS_ADJUSTED','g','none','*',1);
end