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

Utilisation d'une variable tsg.preference.sample pour

determiner la donnée bouteille qui est utilisée (SSPS
ou SSTP)
parent 298a67ea
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -15,13 +15,7 @@ function [error] = corTsgLinear(hMainFig, PARA, dateMin, dateMax)
% Get application data
% --------------------
tsg = getappdata( hMainFig, 'tsg_data');
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
SAMPLE = tsg.preference.sample;
% -------------------------------------------------------------------------
% Get from the checkbox the QC code on which the correction will be applied
......
......@@ -18,13 +18,7 @@ function [error] = corTsgMedian(hMainFig, PARA, dateMin, dateMax)
% Get application data
% --------------------
tsg = getappdata( hMainFig, 'tsg_data');
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
SAMPLE = tsg.preference.sample;
% Shorten the variable name
% -------------------------
......@@ -172,6 +166,18 @@ if dateMax > dateMin
cor.ERROR = [cor.ERROR cor.ERROR(end)];
cor.NVALUE = [cor.NVALUE cor.NVALUE(end)];
end
% Test if the date are strictly increasing otherwise interp1
% cannot be used
% ----------------------------------------------------------
if ~isempty( find(diff(cor.DAYD) == 0) )
msgbox( {'Function corTsgMedian'; ' '; ...
'At least 2 samples have the same date';...
'The soft cannot make the interpolation'},...
'Correction Method', 'warn');
error = -1;
return
end
% The correction is applied to the TSG between dateMin and dateMax using
% a linear interpolation only on measurements with keptCode
......@@ -205,6 +211,10 @@ else
% DateMax <= DateMin
% ------------------
msgbox( {'Function corTsgMedian'; ' '; ...
'Date limits are not correct' },...
'Correction Method', 'warn', 'modal');
error = -1;
end
......
......@@ -72,6 +72,15 @@ else
tsg.preference.parameter{3} = 'NONE';
end
% Initialise tsg.preference.sample
% We need this variable because the validation of SSJT can only be
% made with SSTP sample.
% ----------------------------------------------------------------
tsg.preference.sample = pop1{1};
if strcmp( tsg.preference.sample, 'SSJT' )
tsg.preference.sample = 'SSTP';
end
% Save the tsg structure
% ---------------------
setappdata( hMainFig, 'tsg_data', tsg);
......
function plot_Correction( hMainFig, hPlotAxes, PARA )
% IF PARA = 'SSJT' use 'SSTP' to get the samples
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT')
SAMPLE = 'SSTP';
end
% Reinitialise plot 1 and 3
% -------------------------
erase_Line( hPlotAxes, 1 );
......@@ -15,7 +8,8 @@ erase_Line( hPlotAxes, 3 );
% Get tsg application data
% ------------------------
tsg = getappdata( hMainFig, 'tsg_data');
tsg = getappdata( hMainFig, 'tsg_data');
SAMPLE = tsg.preference.sample;
% Get the code for VALUE_CHANGED
% ------------------------------
......
......@@ -2,7 +2,8 @@ function plot_Validation( hMainFig, hPlotAxes, nPlot, PARA )
% Get tsg application data
% ------------------------
tsg = getappdata( hMainFig, 'tsg_data');
tsg = getappdata( hMainFig, 'tsg_data');
SAMPLE = tsg.preference.sample;
switch nPlot
......@@ -15,25 +16,18 @@ switch nPlot
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.(PARA), tsg.([PARA '_QC']),...
PARA,'','none','*',2);
end
% Plot PARA External data (WS, CTD, etc)
% there are only _EXT data for SSPS and SSTP variable
% ---------------------------------------------------
if strcmp( PARA, 'SSJT' )
PARA = 'SSTP';
end
if ~isempty( tsg.([PARA '_EXT']) )
if ~isempty( tsg.([SAMPLE '_EXT']) )
% Plot circle for WS data
% -----------------------
ind = 1: length( tsg.([PARA '_EXT_TYPE']));
indWS = strmatch( 'WS', tsg.([PARA '_EXT_TYPE']), 'exact');
ind = 1: length( tsg.([SAMPLE '_EXT_TYPE']));
indWS = strmatch( 'WS', tsg.([SAMPLE '_EXT_TYPE']), 'exact');
if ~isempty(ind)
plot_Tsg( hMainFig, hPlotAxes, 1,...
tsg.DAYD_EXT(indWS), tsg.([PARA '_EXT'])(indWS),...
tsg.([PARA '_EXT_QC'])(indWS), ...
[PARA '_EXT_1'],'','none','square',5);
tsg.DAYD_EXT(indWS), tsg.([SAMPLE '_EXT'])(indWS),...
tsg.([SAMPLE '_EXT_QC'])(indWS), ...
[SAMPLE '_EXT_1'],'','none','square',5);
end
% Plot squares for CTD, ARGO, etc. data
......@@ -41,9 +35,9 @@ switch nPlot
indEXT = setxor(ind, indWS);
if ~isempty(indEXT)
plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_EXT(indEXT),...
tsg.([PARA '_EXT'])(indEXT),...
tsg.([PARA '_EXT_QC'])(indEXT),...
[PARA '_EXT_2'],'','none','o',5);
tsg.([SAMPLE '_EXT'])(indEXT),...
tsg.([SAMPLE '_EXT_QC'])(indEXT),...
[SAMPLE '_EXT_2'],'','none','o',5);
end
end
......
......@@ -1313,37 +1313,40 @@ end
end %if errTsg > 0
% Draw the 3 plots of the validation figure
% The plots need to be re-initialize because of a bug with
% the zoom function. When you open a new TSG file and you
% have used the zoom funtion with the preceding file.
% The zoom function keep the X and Y limits of the preceding file
% ---------------------------------------------------------------
delete( hPlotAxes(1) );
delete( hPlotAxes(2) );
delete( hPlotAxes(3) );
hPlotAxes(1) = axes( 'Parent', hPlotsPanel, 'Visible', 'off', ...
'box', 'on', 'Units', 'normalized','Tag', 'TAG_AXES_1', ...
'HandleVisibility','on', 'Position',[.05, .64, .93, .35]);
hPlotAxes(2) = axes( 'Parent', hPlotsPanel, 'Visible', 'off',...
'box', 'on', 'Units', 'normalized', 'Tag', 'TAG_AXES_2', ...
'HandleVisibility','on', 'Position',[.05, .33, .93, .27]);
hPlotAxes(3) = axes('Parent', hPlotsPanel, 'Visible', 'off',...
'box', 'on', 'Units', 'normalized', 'Tag', 'TAG_AXES_3', ...
'HandleVisibility','on', 'Position',[.05, .02, .93, .27]);
resetAxes( hMainFig, hPlotAxes )
plot_Validation( hMainFig, hPlotAxes, 1, tsg.preference.parameter{1} );
plot_Validation( hMainFig, hPlotAxes, 2, tsg.preference.parameter{2} );
plot_Validation( hMainFig, hPlotAxes, 3, tsg.preference.parameter{3} );
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
if errTsg == 1 || errSpl == 1
% Draw the 3 plots of the validation figure
% The plots need to be re-initialize because of a bug with
% the zoom function. When you open a new TSG file and you
% have used the zoom funtion with the preceding file.
% The zoom function keep the X and Y limits of the preceding file
% ---------------------------------------------------------------
delete( hPlotAxes(1) );
delete( hPlotAxes(2) );
delete( hPlotAxes(3) );
hPlotAxes(1) = axes( 'Parent', hPlotsPanel, 'Visible', 'off', ...
'box', 'on', 'Units', 'normalized','Tag', 'TAG_AXES_1', ...
'HandleVisibility','on', 'Position',[.05, .64, .93, .35]);
hPlotAxes(2) = axes( 'Parent', hPlotsPanel, 'Visible', 'off',...
'box', 'on', 'Units', 'normalized', 'Tag', 'TAG_AXES_2', ...
'HandleVisibility','on', 'Position',[.05, .33, .93, .27]);
hPlotAxes(3) = axes('Parent', hPlotsPanel, 'Visible', 'off',...
'box', 'on', 'Units', 'normalized', 'Tag', 'TAG_AXES_3', ...
'HandleVisibility','on', 'Position',[.05, .02, .93, .27]);
resetAxes( hMainFig, hPlotAxes )
plot_Validation( hMainFig, hPlotAxes, 1, tsg.preference.parameter{1} );
plot_Validation( hMainFig, hPlotAxes, 2, tsg.preference.parameter{2} );
plot_Validation( hMainFig, hPlotAxes, 3, tsg.preference.parameter{3} );
end
end % if ~isequal(fileName, 0)
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
end
......@@ -1827,14 +1830,8 @@ end
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
PARA = tsg.preference.parameter{1};
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
PARA = tsg.preference.parameter{1};
SAMPLE = tsg.preference.sample;
% Activate right clic context menu on first axes (salinity)
% ---------------------------------------------------------
......@@ -2013,13 +2010,7 @@ end
% Get the parameter (SSPS, SSJT or SSTP)
% --------------------------------------
PARA = tsg.preference.parameter{1};
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
SAMPLE = tsg.preference.sample;
% get key and some values in hashtable
% ------------------------------------
......@@ -2309,8 +2300,9 @@ end
% Get the parameter we are working on (SSPS, SSJT, SSTP)
% ------------------------------------------------------
PARA = tsg.preference.parameter{1};
PARA = tsg.preference.parameter{1};
SAMPLE = tsg.preference.sample;
% Switch somme buttons
% --------------------
set( hQCToggletool, 'state', 'off' );
......@@ -2329,13 +2321,6 @@ end
set( hCorPanel, 'Visible', 'on' );
set( hbgParameter, 'Visible', 'off');
set( hbgQc, 'Visible', 'off');
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
if ~isempty( tsg.([SAMPLE '_EXT']) )
......@@ -2467,15 +2452,9 @@ end
% Get the parameter (SSPS, SSJT, or SSTP)
% ---------------------------------------
tsg = getappdata(hMainFig, 'tsg_data');
PARA = tsg.preference.parameter{1};
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
tsg = getappdata(hMainFig, 'tsg_data');
PARA = tsg.preference.parameter{1};
SAMPLE = tsg.preference.sample;
if ~isempty( tsg.([SAMPLE '_EXT']) )
......@@ -2522,15 +2501,9 @@ end
% Get the parameter (SSPS, SSJT, or SSTP)
% ---------------------------------------
tsg = getappdata(hMainFig, 'tsg_data');
PARA = tsg.preference.parameter{1};
% No sample for 'SSJT' only for 'SSPS' and 'SSPT'
% ----------------------------------------------
SAMPLE = PARA;
if strcmp( SAMPLE, 'SSJT' )
SAMPLE = 'SSTP';
end
tsg = getappdata(hMainFig, 'tsg_data');
PARA = tsg.preference.parameter{1};
SAMPLE = tsg.preference.sample;
if ~isempty( tsg.([SAMPLE '_EXT']) )
......@@ -2550,9 +2523,9 @@ end
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
case -1
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
otherwise
% Nothing is done - Error msg within the corTsgMedian function
end
end
......@@ -2576,6 +2549,12 @@ end
% Get the default parameter
% -------------------------
tsg.preference.parameter{nplot} = selected_string;
if nplot == 1
tsg.preference.sample = selected_string;
if strcmp( tsg.preference.sample, 'SSJT' )
tsg.preference.sample = 'SSTP';
end
end
% Save application data
% --------------------
......@@ -2601,7 +2580,7 @@ end
% ----------------------------------------------
if plotClim
set( hClimToggletool, 'state', 'on' );
plot_ClimatologyB(hMainFig, hPlotAxes);
plot_Climatology(hMainFig, hPlotAxes);
end
end
......@@ -2859,7 +2838,6 @@ end
end
%% ReportMenuCallback
% -------------------------------------------------------------------
% Callback function run when the Report tool bar item is selected
......
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