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

Amélioration des modules de correction.

Modification du tracé de la carte pour s'adapter aux limites de la série temporelle visible à l'écran

Desactivation du module PREFERENCE qui bugue
parent f880bc8e
No related branches found
No related tags found
No related merge requests found
function [error] = corTsgLinear(hMainFig, dateMin, dateMax) function [error] = corTsgLinear(hMainFig, dateMin, dateMax)
%
% Correct the TSG salinity time series with the Water sample. % Correct the TSG salinity time series with the Water sample.
% Use the median value of TIME_WINDOWS water sample to compute the % Use a linear fit to the water sample/tsg difference
% correction. see the documentation
% %
% Input % Input
% hMainFig ..... Handle to the main GUI % hMainFig ..... Handle to the main GUI
...@@ -12,119 +10,73 @@ function [error] = corTsgLinear(hMainFig, dateMin, dateMax) ...@@ -12,119 +10,73 @@ function [error] = corTsgLinear(hMainFig, dateMin, dateMax)
% Output % Output
% Error ........ 1 everything OK % Error ........ 1 everything OK
% ........ -1 dateMax <= date Min % ........ -1 dateMax <= date Min
%
% TO DO
% corTsgMethod1.m
% 1) Test if there are NaN values in 'sample':
% We could get some problem with the computation of the median and std
% 2) Initialisation de la structure 'cor'
% 3) Test for anormal sample-tsg difference - Suppress bad points
% 4) Test on the validation code. do we apply the correction whatever the
% is the code ?
% 5) Return an Error code ?
% 6) Test Date_Min < Date_Max
% Get application data % Get application data
% -------------------- % --------------------
tsg = getappdata( hMainFig, 'tsg_data'); tsg = getappdata( hMainFig, 'tsg_data');
sample = getappdata( hMainFig, 'sample'); sample = getappdata( hMainFig, 'sample');
% Shorten the variable name % Get PROBABLY_GOOD, PROBABLY_BAD and VALUE_CHANGED codes
% ------------------------- % -------------------------------------------------------
TIME_WINDOWS = tsg.cst.COR_TIME_WINDOWS;
% Get PROBABLY_GOOD and VALUE_CHANGED code
% ----------------------------------------
PROBABLY_GOOD = get(tsg.qc.hash, 'PROBABLY_GOOD', 'code'); PROBABLY_GOOD = get(tsg.qc.hash, 'PROBABLY_GOOD', 'code');
PROBABLY_BAD = get(tsg.qc.hash, 'PROBABLY_BAD', 'code');
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code'); VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
% The correction is computed between dateMin and dateMax
% ------------------------------------------------------
dt = find(sample.DAYD >= dateMin & sample.DAYD <= dateMax);
if dateMax > dateMin if dateMax > dateMin
% Create a structure with an NaN
% No other solution as I can't add a structure to an empty one
% ------------------------------------------------------------
cor = struct('DAYD', NaN, 'DIFF', NaN, 'ERROR', NaN, 'NVALUE', NaN);
% --------------------
for i = 1 : length(dt)
% Find the sample within TIME_WINDOWS with Good and probably Good QC
% ------------------------------------------------------------------
ind = find( sample.DAYD(dt) >= sample.DAYD(dt(i)) - TIME_WINDOWS/2 &...
sample.DAYD(dt) <= sample.DAYD(dt(i)) + TIME_WINDOWS/2 &...
sample.SSPS_QC(dt) <= PROBABLY_GOOD);
end
% Eliminate the first element if NaN % Find samples within TIME_WINDOWS with Good and probably Good QC
% ---------------------------------- % ---------------------------------------------------------------
if isnan(cor.DAYD(1)) ind = find( sample.DAYD >= dateMin & sample.DAYD <= dateMax &...
cor.DAYD(1) = []; sample.SSPS_QC <= PROBABLY_GOOD);
cor.DIFF(1) = [];
cor.ERROR(1) = []; if ~isempty(ind)
cor.NVALUE(1) = [];
end % detect NaN in sample.SSPS_DIF due to bad QC code for tsg.SSPS
% -------------------------------------------------------------
if ~isempty( cor.DAYD ) ind2 = find(~isnan(sample.SSPS_DIF(ind)));
% The error is maximum if the median is computed with less than 4 samples % Compute linear fit of the TSG/SAMPLE difference
% ----------------------------------------------------------------------- % -----------------------------------------------
cor.ERROR( cor.NVALUE < 4 ) = 1; if ~isempty(sample.SSPS_DIF(ind(ind2)))
% The correction is applied between dateMin and dateMax X = sample.DAYD(ind(ind2));
% We attribute to dateMin the first correction computed Y = sample.SSPS_DIF(ind(ind2));
% and to dateMax the last one
% [p, S, mu] = polyfit( X, Y, 1);
% Find the tsg date in the interval dateMin-dateMax
% ------------------------------------------------- % The correction is applied to the TSG between dateMin and dateMax using
dtTsg = find(tsg.DAYD >= dateMin & tsg.DAYD <= dateMax); % a linear interpolation only on measurements with GOOD and
% PROBABLY_GOOD QC
if cor.DAYD(1) ~= dateMin % ----------------------------------------------------------------------
cor.DAYD = [tsg.DAYD(dtTsg(1)) cor.DAYD]; dtTsg = find( tsg.DAYD >= dateMin & tsg.DAYD <= dateMax &...
cor.DIFF = [cor.DIFF(1) cor.DIFF]; tsg.SSPS_QC <= PROBABLY_GOOD);
cor.ERROR = [cor.ERROR(1) cor.ERROR];
cor.NVALUE = [cor.NVALUE(1) cor.NVALUE]; [tsg.SSPS_ADJUSTED(dtTsg), tsg.SSPS_ADJUSTED_ERROR(dtTsg)] =...
end polyval( p, tsg.DAYD(dtTsg), S, mu);
if cor.DAYD(end) ~= dateMax tsg.SSPS_ADJUSTED(dtTsg) = tsg.SSPS(dtTsg) + tsg.SSPS_ADJUSTED(dtTsg);
cor.DAYD = [cor.DAYD tsg.DAYD(dtTsg(end))];
cor.DIFF = [cor.DIFF cor.DIFF(end)]; % VALUE_CHANGED code
cor.ERROR = [cor.ERROR cor.ERROR(end)]; % ------------------
cor.NVALUE = [cor.NVALUE cor.NVALUE(end)]; tsg.SSPS_ADJUSTED_QC(dtTsg) = VALUE_CHANGED;
end end
p = polyfit( x, y, 1);
y = polyval(p,x);
% The correction is applied to the TSG between dateMin and dateMax using
% a linear interpolation
% ----------------------------------------------------------------------
tsg.SSPS_ADJUSTED(dtTsg) = tsg.SSPS(dtTsg) + ...
interp1(cor.DAYD, cor.DIFF, tsg.DAYD(dtTsg));
tsg.SSPS_ADJUSTED_ERROR(dtTsg) = ...
interp1(cor.DAYD, cor.ERROR, tsg.DAYD(dtTsg));
tsg.SSPS_ADJUSTED_QC(dtTsg) = VALUE_CHANGED;
else else
% RAZ if no correction % RAZ if no correction
% -------------------- % --------------------
dt = find(tsg.DAYD >= dateMin & tsg.DAYD <= dateMax); dtTsg = find(tsg.DAYD >= dateMin & tsg.DAYD <= dateMax);
tsg.SSPS_ADJUSTED(dtTsg) = NaN*ones(size(tsg.SSPS(dt)));
tsg.SSPS_ADJUSTED_ERROR(dtTsg) = NaN*ones(size(tsg.SSPS(dt)));
tsg.SSPS_ADJUSTED_QC(dtTsg) = zeros(size(tsg.SSPS(dt)));
tsg.SSPS_ADJUSTED(dt) = NaN*ones(size(tsg.SSPS(dt)));
tsg.SSPS_ADJUSTED_ERROR(dt) = NaN*ones(size(tsg.SSPS(dt)));
tsg.SSPS_ADJUSTED_QC(dt) = zeros(size(tsg.SSPS(dt)));
end end
% Update tsg application data % Update tsg application data
% --------------------------- % ---------------------------
setappdata( hMainFig, 'tsg_data', tsg); setappdata( hMainFig, 'tsg_data', tsg);
setappdata( hMainFig, 'sample', sample);
% everything OK % everything OK
% ------------- % -------------
error = 1; error = 1;
...@@ -134,6 +86,7 @@ else ...@@ -134,6 +86,7 @@ else
% DateMax <= DateMin % DateMax <= DateMin
% ------------------ % ------------------
error = -1; error = -1;
end end
...@@ -15,16 +15,9 @@ function [error] = corTsgMedian(hMainFig, dateMin, dateMax) ...@@ -15,16 +15,9 @@ function [error] = corTsgMedian(hMainFig, dateMin, dateMax)
% %
% TO DO % TO DO
% corTsgMethod1.m % corTsgMethod1.m
% 1) Test if there are NaN values in 'sample':
% We could get some problem with the computation of the median and std
% 2) Initialisation de la structure 'cor'
% 3) Test for anormal sample-tsg difference - Suppress bad points % 3) Test for anormal sample-tsg difference - Suppress bad points
% 4) Test on the validation code. do we apply the correction whatever the % 4) Test on the validation code. do we apply the correction whatever the
% is the code ? % is the code ?
% 5) Return an Error code ?
% 6) Test Date_Min < Date_Max
% 7) BUG : Le nombre d'elements est faux si il y a des NaN
% Get application data % Get application data
% -------------------- % --------------------
...@@ -35,41 +28,69 @@ sample = getappdata( hMainFig, 'sample'); ...@@ -35,41 +28,69 @@ sample = getappdata( hMainFig, 'sample');
% ------------------------- % -------------------------
TIME_WINDOWS = tsg.cst.COR_TIME_WINDOWS; TIME_WINDOWS = tsg.cst.COR_TIME_WINDOWS;
% Get PROBABLY_GOOD code % Get PROBABLY_GOOD, PROBABLY_BAD and VALUE_CHANGED codes
% ---------------------- % -------------------------------------------------------
PROBABLY_GOOD = get(tsg.qc.hash, 'PROBABLY_GOOD', 'code'); PROBABLY_GOOD = get(tsg.qc.hash, 'PROBABLY_GOOD', 'code');
PROBABLY_BAD = get(tsg.qc.hash, 'PROBABLY_BAD', 'code');
VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code'); VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code');
% Create a structure with an NaN % Create a structure with an NaN
% No other solution as I can't add a structure to an empty one % No other solution, as I can't add a structure to an empty one
% ------------------------------------------------------------ % -------------------------------------------------------------
cor = struct('DAYD', NaN, 'DIFF', NaN, 'ERROR', NaN, 'NVALUE', NaN); cor = struct('DAYD', NaN, 'DIFF', NaN, 'ERROR', NaN, 'NVALUE', NaN);
if dateMax > dateMin if dateMax > dateMin
% Find the number of samples within the time limits.
% --------------------------------------------------
indSample = find(sample.DAYD >= dateMin & sample.DAYD <= dateMax); indSample = find(sample.DAYD >= dateMin & sample.DAYD <= dateMax);
indCor = 0; indCor = 0;
for i=1:length(indSample) for i=1:length(indSample)
% Find the sample within TIME_WINDOWS with Good and probably Good QC % Find samples within TIME_WINDOWS with Good and probably Good QC
% ------------------------------------------------------------------ % ---------------------------------------------------------------
ind = find( sample.DAYD >= (sample.DAYD(i) - TIME_WINDOWS/2) &... ind = find( sample.DAYD >= (sample.DAYD(i) - TIME_WINDOWS/2) &...
sample.DAYD <= (sample.DAYD(i) + TIME_WINDOWS/2) &... sample.DAYD <= (sample.DAYD(i) + TIME_WINDOWS/2) &...
sample.SSPS_QC <= PROBABLY_GOOD); sample.SSPS_QC <= PROBABLY_GOOD);
% Compute the median difference and error within TIME_WINDOWS
% -----------------------------------------------------------
if ~isempty(ind) if ~isempty(ind)
indCor = indCor + 1;
cor.DAYD(indCor) = sample.DAYD(i);
cor.DIFF(indCor) = nanmedian(sample.SSPS_DIF(ind));
cor.ERROR(indCor) = nanstd(sample.SSPS_DIF(ind))/sqrt(length(ind));
% BUG : Le nombre d'element est faux si il y a des NaN % detect NaN in sample.SSPS_DIF due to bad QC code in tsg.SSPS
cor.NVALUE(indCor) = length(ind); % ------------------------------------------------------------
ind2 = find(~isnan(sample.SSPS_DIF(ind)));
% Compute the median difference and error within TIME_WINDOWS
% -----------------------------------------------------------
if ~isempty(sample.SSPS_DIF(ind(ind2)))
A = sample.SSPS_DIF(ind(ind2));
meanA = mean(A);
stdA = std(A);
% Standard deviation test: keep these values
% ------------------------------------------
ind3 = find( A >= meanA-3*stdA & A <= meanA+3*stdA);
B = sample.SSPS_DIF(ind(ind2(ind3)));
if ~isempty( B )
indCor = indCor + 1;
cor.DAYD(indCor) = sample.DAYD(i);
cor.DIFF(indCor) = median(B);
cor.ERROR(indCor) = nanstd(B)/sqrt(length(B));
cor.NVALUE(indCor) = length(B);
end
% Standard deviation test: don't keep these values
% QC PROBABLY_BAD
% ------------------------------------------------------
ind4 = find( A < meanA-3*stdA | A > meanA+3*stdA);
if ~isempty( ind4 )
sample.SSPS_QC(ind(ind2(ind4))) = PROBABLY_BAD;
end
end
end end
end end
% Eliminate the first element if NaN % Eliminate the first element if NaN
...@@ -93,7 +114,7 @@ if dateMax > dateMin ...@@ -93,7 +114,7 @@ if dateMax > dateMin
% %
% Find the tsg date in the interval dateMin-dateMax % Find the tsg date in the interval dateMin-dateMax
% ------------------------------------------------- % -------------------------------------------------
dtTsg = find(tsg.DAYD >= dateMin & tsg.DAYD <= dateMax); dtTsg = find(tsg.DAYD >= dateMin & tsg.DAYD <= dateMax);
if cor.DAYD(1) ~= dateMin if cor.DAYD(1) ~= dateMin
cor.DAYD = [tsg.DAYD(dtTsg(1)) cor.DAYD]; cor.DAYD = [tsg.DAYD(dtTsg(1)) cor.DAYD];
...@@ -109,15 +130,19 @@ if dateMax > dateMin ...@@ -109,15 +130,19 @@ if dateMax > dateMin
end end
% The correction is applied to the TSG between dateMin and dateMax using % The correction is applied to the TSG between dateMin and dateMax using
% a linear interpolation % a linear interpolation only on measurements with GOOD and
% PROBABLY_GOOD QC
% ---------------------------------------------------------------------- % ----------------------------------------------------------------------
dtTsg = find( tsg.DAYD >= dateMin & tsg.DAYD <= dateMax &...
tsg.SSPS_QC <= PROBABLY_GOOD);
tsg.SSPS_ADJUSTED(dtTsg) = tsg.SSPS(dtTsg) + ... tsg.SSPS_ADJUSTED(dtTsg) = tsg.SSPS(dtTsg) + ...
interp1(cor.DAYD, cor.DIFF, tsg.DAYD(dtTsg)); interp1(cor.DAYD, cor.DIFF, tsg.DAYD(dtTsg));
tsg.SSPS_ADJUSTED_ERROR(dtTsg) = ... tsg.SSPS_ADJUSTED_ERROR(dtTsg) = ...
interp1(cor.DAYD, cor.ERROR, tsg.DAYD(dtTsg)); interp1(cor.DAYD, cor.ERROR, tsg.DAYD(dtTsg));
% Get PROBABLY_GOOD code % VALUE_CHANGED code
% ---------------------- % ------------------
tsg.SSPS_ADJUSTED_QC(dtTsg) = VALUE_CHANGED; tsg.SSPS_ADJUSTED_QC(dtTsg) = VALUE_CHANGED;
else else
...@@ -135,6 +160,7 @@ if dateMax > dateMin ...@@ -135,6 +160,7 @@ if dateMax > dateMin
% Update tsg application data % Update tsg application data
% --------------------------- % ---------------------------
setappdata( hMainFig, 'tsg_data', tsg); setappdata( hMainFig, 'tsg_data', tsg);
setappdata( hMainFig, 'sample', sample);
% everything OK % everything OK
% ------------- % -------------
......
...@@ -62,7 +62,7 @@ if isempty(MyColor) ...@@ -62,7 +62,7 @@ if isempty(MyColor)
line( sample.DAYD(ind), sample.(Para)(ind), ... line( sample.DAYD(ind), sample.(Para)(ind), ...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para '_' key],... 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para '_' key],...
'LineStyle', 'none',... 'LineStyle', 'none',...
'Marker', 'square', 'MarkerSize', 3,... 'Marker', 'square', 'MarkerSize', 5,...
'MarkerEdgeColor', 'k', 'MarkerFaceColor', color); 'MarkerEdgeColor', 'k', 'MarkerFaceColor', color);
end end
...@@ -73,10 +73,8 @@ else ...@@ -73,10 +73,8 @@ else
line( sample.DAYD, sample.(Para),... line( sample.DAYD, sample.(Para),...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para],... 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para],...
'LineStyle', 'none',... 'LineStyle', 'none', 'Marker', 'square', 'MarkerSize', 5,...
'Marker', 'square', 'MarkerSize', 3,...
'MarkerEdgeColor', MyColor, 'MarkerFaceColor', MyColor); 'MarkerEdgeColor', MyColor, 'MarkerFaceColor', MyColor);
end end
hold off; hold off;
......
...@@ -80,9 +80,10 @@ if ~isempty( tsg.(Para) ) ...@@ -80,9 +80,10 @@ if ~isempty( tsg.(Para) )
end end
else else
line( tsg.DAYD, tsg.(Para),'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para], ...
'LineStyle', Style, ... line(tsg.DAYD, tsg.(Para),...
'Marker', Mark, 'MarkerSize', 5, 'Color', MyColor); 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para], ...
'LineStyle', Style,'Marker', Mark, 'MarkerSize', 5, 'Color', MyColor);
end end
hold off; hold off;
......
function plot_map(hTsgGUI, hAxes) function plot_map(hTsgGUI, hPlotAxes)
% Function to plot the earth map and ship trackline % Function to plot the earth map and ship trackline
% %
% Input % Input
...@@ -20,13 +20,28 @@ function plot_map(hTsgGUI, hAxes) ...@@ -20,13 +20,28 @@ function plot_map(hTsgGUI, hAxes)
% ------------------------------- % -------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data'); tsg = getappdata( hTsgGUI, 'tsg_data');
% Get the Geographic limit of the TSG time series
% -----------------------------------------------
dateLim = get(hPlotAxes(1), 'Xlim');
ind = find( tsg.DAYD >= dateLim(1) & tsg.DAYD <= dateLim(2));
latMin = min( tsg.LATX(ind) );
latMax = max( tsg.LATX(ind) );
lonMin = min( tsg.LONX(ind) );
lonMax = max( tsg.LONX(ind) );
% Positionning the right axes % Positionning the right axes
% ---------------------------- % ----------------------------
axes(hAxes(4)); axes(hPlotAxes(4));
%hLines = get( hPlotAxes(4), 'Children' );
%if ~isempty( hLines )
% delete(hLines);
%end
% Use of Mercator projection % Use of Mercator projection
% -------------------------- % --------------------------
m_proj('Mercator','lat',[-70 70],'long',[-180 180]); %m_proj('Mercator','lat',[-70 70],'long',[-180 180]);
m_proj('Mercator','lat',[latMin latMax],'long',[lonMin lonMax]);
% detailed coast lines % detailed coast lines
% m_gshhs_i('patch',[.7 .7 .7]); % m_gshhs_i('patch',[.7 .7 .7]);
...@@ -38,10 +53,11 @@ m_proj('Mercator','lat',[-70 70],'long',[-180 180]); ...@@ -38,10 +53,11 @@ m_proj('Mercator','lat',[-70 70],'long',[-180 180]);
% ---------------------------- % ----------------------------
m_coast('patch',[.7 .7 .7]); m_coast('patch',[.7 .7 .7]);
m_grid('box','fancy','tickdir','in', ... %m_grid('box','fancy','tickdir','in', ...
'ytick', [-70:20:70],... % 'ytick', [-70:20:70],...
'xtick', [-180:40:180],... % 'xtick', [-180:40:180],...
'Fontsize', [10]); % 'Fontsize', [10]);
m_grid('box','fancy','tickdir','in', 'Fontsize', [10]);
% Plot the ship track - Check if LAT-LON in deg-decimal % Plot the ship track - Check if LAT-LON in deg-decimal
% ----------------------------------------------------- % -----------------------------------------------------
......
...@@ -28,7 +28,8 @@ config_file = [prefdir, filesep, app_name, '.mat']; ...@@ -28,7 +28,8 @@ config_file = [prefdir, filesep, app_name, '.mat'];
% Open config file % Open config file
% ---------------- % ----------------
config = fopen( config_file, 'r' ); %config = fopen( config_file, 'r' );
config = -1;
% test fopen return value % test fopen return value
% ----------------------- % -----------------------
......
...@@ -662,7 +662,7 @@ hrbCorCancel = uicontrol( ... ...@@ -662,7 +662,7 @@ hrbCorCancel = uicontrol( ...
'FontSize',tsg.fontSize-1,... 'FontSize',tsg.fontSize-1,...
'Tag', 'CORRECT_CANCEL_PUSH', ... 'Tag', 'CORRECT_CANCEL_PUSH', ...
'Enable', 'off',... 'Enable', 'off',...
'pos',[.05 .68 .9 .25], ... 'pos',[.05 .08 .9 .25],...
'HandleVisibility','callback', ... 'HandleVisibility','callback', ...
'Callback', @CorCancelCallback); 'Callback', @CorCancelCallback);
hrbCorLinear = uicontrol( ... hrbCorLinear = uicontrol( ...
...@@ -684,7 +684,7 @@ hrbCorMedian = uicontrol( ... ...@@ -684,7 +684,7 @@ hrbCorMedian = uicontrol( ...
'FontSize',tsg.fontSize-1,... 'FontSize',tsg.fontSize-1,...
'Tag', 'CORRECT_MEDIAN_PUSH', ... 'Tag', 'CORRECT_MEDIAN_PUSH', ...
'Enable', 'off',... 'Enable', 'off',...
'pos',[.05 .08 .9 .25],... 'pos',[.05 .68 .9 .25], ...
'HandleVisibility','callback', ... 'HandleVisibility','callback', ...
'Callback', @CorMedianCallback); 'Callback', @CorMedianCallback);
...@@ -893,7 +893,11 @@ end ...@@ -893,7 +893,11 @@ end
% Plot the Map with the ship trackline % Plot the Map with the ship trackline
% ------------------------------------ % ------------------------------------
plot_map( hMainFig, hPlotAxes) % plot_map( hMainFig, hPlotAxes)
% Update QC statistics
% --------------------
display_QC( hMainFig, hPlotAxes)
end end
end end
...@@ -1291,7 +1295,7 @@ end ...@@ -1291,7 +1295,7 @@ end
y = a(2,2); y = a(2,2);
% Code to Activate the PAN function when QC mode is active % Code to Activate the PAN function when QC mode is active
% A PAN zone is defined in the bottom (5%) of PlotAxes(1) % A PAN zone is defined in the bottom (10%) of PlotAxes(1)
% 2 callback are needed : % 2 callback are needed :
% 1 - one to desactivate QC when Pan is set to on. % 1 - one to desactivate QC when Pan is set to on.
% 2 - one to reactivate QC once the pan has been used. % 2 - one to reactivate QC once the pan has been used.
...@@ -1304,9 +1308,9 @@ end ...@@ -1304,9 +1308,9 @@ end
% Suppose that Y axes is increasing from the bottom to the top % Suppose that Y axes is increasing from the bottom to the top
% ------------------------------------------------------------ % ------------------------------------------------------------
limy2 = limy(1) + (limy(2)-limy(1)) * 0.05; limy2 = limy(1) + (limy(2)-limy(1)) * 0.10;
if x > limx(1) && x < limx(2) && y <= limy2 if x > limx(1) && x < limx(2) && y <= limy2 && y >= limy(1)
hPan = pan(hMainFig); hPan = pan(hMainFig);
set(hPan,'ActionPreCallback', @preQcPanCallback); set(hPan,'ActionPreCallback', @preQcPanCallback);
set(hPan,'ActionPostCallback', @postQcPanCallback); set(hPan,'ActionPostCallback', @postQcPanCallback);
...@@ -1381,7 +1385,13 @@ end ...@@ -1381,7 +1385,13 @@ end
% --------------------------------------- % ---------------------------------------
set(hZoomToggletool, 'state', 'off' ); set(hZoomToggletool, 'state', 'off' );
set(hPanToggletool, 'state', 'off' ); set(hPanToggletool, 'state', 'off' );
if ~isempty( get(hMapPanel, 'UserData'))
delete(get(hMapPanel, 'UserData'));
end
plot_map( hMainFig, hPlotAxes)
% Make the earth map visible % Make the earth map visible
% -------------------------- % --------------------------
set(hMapPanel, 'Visible', 'on' ); set(hMapPanel, 'Visible', 'on' );
...@@ -1597,6 +1607,14 @@ end ...@@ -1597,6 +1607,14 @@ end
function CorCancelCallback(hObject, eventdata) function CorCancelCallback(hObject, eventdata)
% Callback function run when ... % Callback function run when ...
% Desactivate somme Toggle button
% -------------------------------
set( hZoomToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hStartlimitToggletool, 'State', 'off' );
set( hEndlimitToggletool, 'State', 'off' );
tsg = getappdata(hMainFig, 'tsg_data'); tsg = getappdata(hMainFig, 'tsg_data');
tsg.SSPS_ADJUSTED = NaN*ones(size(tsg.SSPS)); tsg.SSPS_ADJUSTED = NaN*ones(size(tsg.SSPS));
...@@ -1616,13 +1634,21 @@ end ...@@ -1616,13 +1634,21 @@ end
%% CorLinearCallback .................................... Correction Module %% CorLinearCallback .................................... Correction Module
function CorLinearCallback(hObject, eventdata) function CorLinearCallback(hObject, eventdata)
% Callback function run when % Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hStartlimitToggletool, 'State', 'off' );
set( hEndlimitToggletool, 'State', 'off' );
% Get the time limits for the correction A TESTER % Get the time limits for the correction A TESTER
% -------------------------------------- % --------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS'); dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS'); dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Compute the sample-TSG differences % Compute the sample-TSG differences
% ---------------------------------- % ----------------------------------
diffTsgSample( hMainFig ); diffTsgSample( hMainFig );
...@@ -1630,11 +1656,11 @@ end ...@@ -1630,11 +1656,11 @@ end
% Correction % Correction
% ---------- % ----------
error = corTsgLinear(hMainFig, dateMin, dateMax); error = corTsgLinear(hMainFig, dateMin, dateMax);
switch error switch error
case 1 case 1
% Reinitialise plot 2 and 3 % Reinitialise plot 2 and 3
% ------------------------- % -------------------------
erase_Line( hPlotAxes(2), 2 ) erase_Line( hPlotAxes(2), 2 )
...@@ -1646,19 +1672,28 @@ end ...@@ -1646,19 +1672,28 @@ end
% ---------------------------------------- % ----------------------------------------
plot_Tsg( hMainFig, hPlotAxes(3), 3, 'SSPS_ADJUSTED', 0, 'r' ); plot_Tsg( hMainFig, hPlotAxes(3), 3, 'SSPS_ADJUSTED', 0, 'r' );
tsg = getappdata( hMainFig, 'tsg_data');
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 2 % Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 2
% ------------------------------------------------------- % -------------------------------------------------------
axes( hPlotAxes(2) ); axes( hPlotAxes(2) );
tsg = getappdata( hMainFig, 'tsg_data');
line( tsg.DAYD, tsg.SSPS_ADJUSTED-tsg.SSPS,... line( tsg.DAYD, tsg.SSPS_ADJUSTED-tsg.SSPS,...
'Tag', 'TAG_PLOT2_LINE_TSGDIF', 'Color', 'b'); 'Tag', 'TAG_PLOT2_LINE_TSGDIF', 'Color', 'b');
% Plot TSG + ERROR on axe 3
% -------------------------
errorPlus = tsg.SSPS_ADJUSTED + tsg.SSPS_ADJUSTED_ERROR;
errorMinus = tsg.SSPS_ADJUSTED - tsg.SSPS_ADJUSTED_ERROR;
axes( hPlotAxes(3) );
line( tsg.DAYD, errorPlus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_PLUS', 'Color', 'g');
line( tsg.DAYD, errorMinus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_MINUS', 'Color', 'g');
case -1 case -1
msgbox( 'Date limits are not correct',... msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal'); 'Correction module', 'warn', 'modal');
end end
msgbox('Method not yet implemented', 'modal' );
end end
...@@ -1666,11 +1701,19 @@ end ...@@ -1666,11 +1701,19 @@ end
function CorMedianCallback(hObject, eventdata) function CorMedianCallback(hObject, eventdata)
% Callback function run when % Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hStartlimitToggletool, 'State', 'off' );
set( hEndlimitToggletool, 'State', 'off' );
% Get the time limits for the correction A TESTER % Get the time limits for the correction A TESTER
% -------------------------------------- % --------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS'); dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS'); dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Compute the sample-TSG differences % Compute the sample-TSG differences
% ---------------------------------- % ----------------------------------
diffTsgSample( hMainFig ); diffTsgSample( hMainFig );
...@@ -1678,11 +1721,11 @@ end ...@@ -1678,11 +1721,11 @@ end
% Correction % Correction
% ---------- % ----------
error = corTsgMedian(hMainFig, dateMin, dateMax); error = corTsgMedian(hMainFig, dateMin, dateMax);
switch error switch error
case 1 case 1
% Reinitialise plot 2 and 3 % Reinitialise plot 2 and 3
% ------------------------- % -------------------------
erase_Line( hPlotAxes(2), 2 ) erase_Line( hPlotAxes(2), 2 )
...@@ -1694,18 +1737,29 @@ end ...@@ -1694,18 +1737,29 @@ end
% ---------------------------------------- % ----------------------------------------
plot_Tsg( hMainFig, hPlotAxes(3), 3, 'SSPS_ADJUSTED', 0, 'r' ); plot_Tsg( hMainFig, hPlotAxes(3), 3, 'SSPS_ADJUSTED', 0, 'r' );
tsg = getappdata( hMainFig, 'tsg_data');
% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 2 % Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 2
% ------------------------------------------------------- % -------------------------------------------------------
axes( hPlotAxes(2) ); axes( hPlotAxes(2) );
tsg = getappdata( hMainFig, 'tsg_data');
line( tsg.DAYD, tsg.SSPS_ADJUSTED-tsg.SSPS,... line( tsg.DAYD, tsg.SSPS_ADJUSTED-tsg.SSPS,...
'Tag', 'TAG_PLOT2_LINE_TSGDIF', 'Color', 'b'); 'Tag', 'TAG_PLOT2_LINE_TSGDIF', 'Color', 'b');
% Plot TSG + ERROR on axe 3
% -------------------------
errorPlus = tsg.SSPS_ADJUSTED + tsg.SSPS_ADJUSTED_ERROR;
errorMinus = tsg.SSPS_ADJUSTED - tsg.SSPS_ADJUSTED_ERROR;
axes( hPlotAxes(3) );
line( tsg.DAYD, errorPlus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_PLUS', 'Color', 'g');
line( tsg.DAYD, errorMinus,...
'Tag', 'TAG_PLOT3_LINE_TSGERROR_MINUS', 'Color', 'g');
case -1 case -1
msgbox( 'Date limits are not correct',... msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal'); 'Correction module', 'warn', 'modal');
end end
end end
%% Clim_OffMenuCallback %% Clim_OffMenuCallback
......
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