Newer
Older
Yves Gouriou
committed
minSSPSQC(hMainFig)
case 'SSPSmax'
maxSSPSQC(hMainFig)
case 'SSJTmin'
minSSJTQC(hMainFig)
case 'SSJTmax'
maxSSJTQC(hMainFig)
Yves Gouriou
committed
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
case 'SSTPmin'
minSSTPQC(hMainFig)
case 'SSTPmax'
maxSSTPQC(hMainFig)
otherwise
msgbox('QCMenuCallback : erreur', 'QCMenuCallback','error', 'modal');
end
% --------------------------
% refresh QC statistic panel
% --------------------------
display_QC( hMainFig );
% ------------------
% Refresh the plots
%-------------------
% Get the parameter displayed on plot number 1 : figure at the top
% -----------------------------------------------------------------
PARA = getParaCorModule( hMainFig );
% Draw plot 1
% -----------
plot_Validation( hMainFig, hPlotAxes, 1, PARA{1} );
% Update the map if already displayed
% -----------------------------------
if strcmp( get(hMapFig,'visible'), 'on') == 1
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes);
end
end
%% QC_OnMenuCallback ............................... Quality Control Module
%----------------------------------------------------------------------
% Callback function run when the QC toggle tool is pressed
%----------------------------------------------------------------------
function QC_OnMenuCallback(gcbo, eventdata)
% Make the QC code uipanel visible
% --------------------------------
set( hbgQc, 'Visible' ,'on');
set( hbgParameter, 'Visible', 'off');
% Desactivate toggletools.
% ------------------------
set( hZoomInToggletool, 'state', 'off', 'enable', 'on' );
set( hZoomOutToggletool, 'state', 'off', 'enable', 'on' );
set( hPanToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
set( hCalToggletool, 'state', 'off', 'enable', 'off' );
set( hInterpToggletool, 'state', 'off', 'enable', 'off' );
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
PARA = getParaCorModule( hMainFig );
% refresh QC statistic panel
% --------------------------
display_QC( hMainFig );
% Activate right clic context menu on first axes (salinity)
% ---------------------------------------------------------
set(hPlotAxes(1),'UIContextMenu', hQcCmenu);
% Activate clic mouse menu on first axes (salinity) for next rbbox
% ----------------------------------------------------------------
set(hPlotAxes(1),'ButtonDownFcn', @QC_SelectCallback);
% change cursor to crosshair aspect
% ---------------------------------
set( hMainFig, 'Pointer', 'crosshair');
% -------------------------------------------------------------
% nested function on mouse clic when QC toggle tool is selected
% -------------------------------------------------------------
function QC_SelectCallback(gcbo, eventdata)
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
% disable ButtonMotion on main fig during select
% prevent drawing to map
% ----------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Selection of the data within the figure
% ---------------------------------------
point1 = get(gca,'CurrentPoint'); % button down detected
finalRect = rbbox; % return figure units
point2 = get(gca,'CurrentPoint'); % button up detected
point1 = point1(1,1:2); % extract x and y
point2 = point2(1,1:2);
p1 = min(point1,point2);
p2 = max(point1,point2); % calculate locations
% The following code is only executed if the left mouse button is clicked.
% If the right mouse button is clicked, this code must not be
% executed as the variable 'ind' will be emptied. And this variable
% is used when the context menu (callback 'Qc') is called
% -----------------------------------------------------------------
if ~strcmp( get(gcf, 'SelectionType'), 'alt')
% The QC is applied either on TSG data either on Sample data.
% it depends if the Botte Toggle button has been cliked on
% -----------------------------------------------------------
if strcmp( get(hBottleToggletool, 'state'), 'on')
% get index on selected zone
% --------------------------
if ~isempty(tsg.DAYD_EXT)
ind = find(tsg.DAYD_EXT > p1(1) & tsg.DAYD_EXT < p2(1) & ...
tsg.EXT_DIF > p1(2) & tsg.EXT_DIF < p2(2));
Yves Gouriou
committed
% Keep the information on the indices of the selected zone
% --------------------------------------------------------
tsg.rbboxind = ind .* ones(size(ind));
% Modifiy the QC
% --------------
tsg.([SAMPLE '_EXT_QC'])(ind) = tsg.qc.active.Code;
Yves Gouriou
committed
% Save the modifications
% ----------------------
setappdata( hMainFig, 'tsg_data', tsg);
% plot selected data with selected code
% --------------------------------------
plot_Correction( hMainFig, hPlotAxes, PARA);
Yves Gouriou
committed
end
else
% get index on selected zone
% ---------------------------
ind = find(tsg.DAYD > p1(1,1) & tsg.DAYD < p2(1,1) & ...
tsg.(PARA{1}) > p1(1,2) & tsg.(PARA{1}) < p2(1,2));
% Keep the information on the indices of the selected zone
% --------------------------------------------------------
tsg.rbboxind = ind .* ones(size(ind));
% Modifiy the QC
% --------------
tsg.([PARA{1} '_QC'])(ind) = tsg.qc.active.Code;
% put last SSPS_QC in queue (Undo/Redo)
% -------------------------------------
%tsg.queue = push( tsg.queue, tsg.([PARA '_QC']));
% store QC in queue object, for undo
% ----------------------------------
%tsg.queue = push(tsg.queue, tsg.([PARA '_QC']));
% Save the modifications
% ----------------------
setappdata( hMainFig, 'tsg_data', tsg);
% ------------------------------------
plot_Validation( hMainFig, hPlotAxes, 1, PARA{1} );
% refresh QC statistic panel
% --------------------------
display_QC( hMainFig );
% Update the map if already displayed
% -----------------------------------
if strcmp( get(hMapFig,'visible'), 'on') == 1
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes);
% enable undo menu
% ----------------
set(findobj('tag','UIMENU_UNDO'),'enable','on');
end
% As soon as a modification took place the data should be saved
% -------------------------------------------------------------
set( hSaveMenu, 'UserData', 'on' );
end
% enable ButtonMotion on main fig after select QC area
% ----------------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
end
end
%% QC_OffMenuCallback .............................. Quality Control Module
%----------------------------------------------------------------------
% Callback function run when the QC toggle tool is released
%----------------------------------------------------------------------
function QC_OffMenuCallback(gcbo, eventdata)
% Desactive right clic menu on first axes (salinity)
% ---------------------------------------------------
set(hPlotAxes(1),'UIContextMenu', []);
% Desactive clic mouse menu (zoom) on first axes (salinity)
% ----------------------------------------------------------
set(hPlotAxes(1),'ButtonDownFcn', []);
% Uipanel visible or not
% -----------------------
set( hbgQc, 'Visible', 'off' );
if strcmp( get(hBottleToggletool, 'state'), 'off' )
set( hCalToggletool, 'state', 'off', 'enable', 'on' );
set( hInterpToggletool, 'state', 'off', 'enable', 'on' );
end
% uibuttongroup uipanel used to choose a parameter is set to
% on only if the Correction screen (bottle toggletool) is off
% -----------------------------------------------------------
if strcmp( get( hBottleToggletool, 'state'), 'off')
set( hbgParameter, 'Visible', 'on');
end
% cursor back to normal
% ---------------------
set(hMainFig,'Pointer','arrow');
end
%% Qc context menu selected ........................ Quality Control Module
%-----------------------------------------------------------
% Callback function run when the QC context menu is selected
%
% Context menu used to attribute a QC to the TSG time series
%
%-----------------------------------------------------------
function Qc(hObject, eventdata, key)
% Retrieve Default Quality Code and Color
% ---------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Get the parameter (SSPS, SSJT or SSTP)
% --------------------------------------
PARA = getParaCorModule( hMainFig );
% get key and some values in hashtable
% ------------------------------------

jacques.grelet_ird.fr
committed
code = tsg.qc.hash.(key).code;
color = tsg.qc.hash.(key).color;
% set active code and color from selected context menu
% ----------------------------------------------------
tsg.qc.active.Code = code;
tsg.qc.active.Color = color;
% Modify and plot the last selected tsg data
% ------------------------------------------
if isfield(tsg, 'rbboxind') && ~isempty( tsg.rbboxind )
if strcmp( get(hBottleToggletool, 'state'), 'on')
tsg.([SAMPLE '_EXT_QC'])(tsg.rbboxind) = tsg.qc.active.Code;
% in the application data
% ----------------------------------------
setappdata( hMainFig, 'tsg_data', tsg );
% Draw the 3 plots of the Correction figure
% -----------------------------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
else
tsg.([PARA{1} '_QC'])(tsg.rbboxind) = tsg.qc.active.Code;
% Save tsg.SSPS_QC in the application data before use
% inside plot_Validation
% ---------------------------------------------------
setappdata( hMainFig, 'tsg_data', tsg );
% Draw plot 1 of the validation figure
% ------------------------------------
plot_Validation( hMainFig, hPlotAxes, 1, PARA{1} );
end
end
% Update the radio button corresponding to the selected
% QC context menu (rbg : RadioButtonGroup)
% -----------------------------------------------------
% radioTag = ['TAG_QC_RADIO_' key]; % Build the TAG of the CODE
% hbgChildren = get(hbgQc,'Children'); % Get the handles of the rbg
% hbgTagCell = get(hbgChildren, 'tag'); % get the TAG of the rbg
% ind = strcmp(radioTag, hbgTagCell); % Compare the TAG
% hRadioButton = hbgChildren( ind == 1 ); % Get the handle of the button
% set(hbgQc, 'SelectedObject', hRadioButton); % Make this button active
display_QC( hMainFig);
setappdata( hMainFig, 'tsg_data', tsg );
end
%% Radiobutton Quality Control ..................... Quality Control Module
% ---------------------------------------------------------------
% Callback to select CODE and COLOR QC from the RadioButton Group
% ---------------------------------------------------------------
function RadiobuttonQc(source, eventdata)
% Retrieve Default Quality Code and Color
% ---------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Retrieve the key from the active RadioButton
% --------------------------------------------
rbTag = get(eventdata.NewValue,'Tag');
key = strrep(rbTag, 'TAG_QC_RADIO_', '');
% store his handle to uibuttongroup userdata
% ------------------------------------------
set(hbgQc,'Userdata', eventdata.NewValue);
% set active code and color from selected context menu
% ----------------------------------------------------

jacques.grelet_ird.fr
committed
tsg.qc.active.Code = tsg.qc.hash.(key).code;
tsg.qc.active.Color = tsg.qc.hash.(key).color;

jacques.grelet_ird.fr
committed
% save tsg struct
% ----------------
end
%% preQcPanCallback .................................Quality Control Module
% ---------------------------------------------------------------
% Callback function ... to be completed
% ---------------------------------------------------------------
function preQcPanCallback(obj, evd)
set(hQCToggletool, 'state', 'off' );
end
%% postQcPanCallback ............................... Quality Control Module
% ---------------------------------------------------------------
% Callback function ... to be completed
% ---------------------------------------------------------------
% Set the right limit and interval to the 3 axes
% ----------------------------------------------
for iaxe = 1:3
set(hPlotAxes(iaxe),'XTickMode','auto')
datetick(hPlotAxes(iaxe),'x','keeplimits')
end
% Re-draw the map once the pan is off - only valide in QC mode
% -------------------------------------------------------------
if strcmp( get(hMapFig, 'visible'), 'on') == 1
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes);
end
% restacks the figure to the top of the screen
% --------------------------------------------
figure( hMainFig);
set(hQCToggletool, 'state', 'on' );
%---------------------------------------------------------------------
% Callback function run when mouse pointer is moving on temperature plot
% draw corresponding measurement position on map
%---------------------------------------------------------------------
function MouseMotion(hObject, eventdata)
% Test if the callback can be activated
% -------------------------------------
if strcmp( get( hMainFig, 'UserData'), 'ButtonMotionOn')
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Get current position of cusor and return its coordinates in
% axes with handle h_axes
% -----------------------------------------------------------
a = get(hPlotAxes(1), 'CurrentPoint');
x = a(2,1);
y = a(2,2);
% Get the Limits of axes 1
% ------------------------
limx = get(hPlotAxes(1), 'XLim');
limy = get(hPlotAxes(1), 'YLim');
% Code to Activate the PAN function when QC mode is active
% A PAN zone is defined in the bottom (10%) of PlotAxes(1)
% 1 - one to desactivate QC when Pan is set to on.
% 2 - one to reactivate QC once the pan has been used.
% ---------------------------------------------------------
% if we are in QC mode
% ---------------------
if strcmp( get(hQCToggletool, 'state' ), 'on' );
% Suppose that Y axes is increasing from the bottom to the top
% ------------------------------------------------------------
limy2 = limy(1) + (limy(2)-limy(1)) * 0.10;
if x > limx(1) && x < limx(2) && y <= limy2 && y >= limy(1)
hPan = pan(hMainFig);
set(hPan,'ActionPreCallback', @preQcPanCallback);
set(hPan,'ActionPostCallback', @postQcPanCallback);
set(hPan,'Enable','on');
else

jacques.grelet_ird.fr
committed
try
pan(hMainFig, 'off');
catch
end
end % end of cursor test location
end % end of QC mode test
% Dynamically display data in uicontrol for valid data
% ----------------------------------------------------
if x > tsg.DAYD(1) && x < tsg.DAYD(end)
% get index of cursor location
% ----------------------------
indCursor = find( tsg.DAYD > x, 1, 'first');
% display informations of cursor location in text uicontrol
% ---------------------------------------------------------
datestr(tsg.DAYD(indCursor),'dd/mm/yyyy HH:MM'));
set( hInfoLatText, 'String', dd2dm(tsg.LATX(indCursor), 0) );
set( hInfoLongText, 'String', ...
dd2dm(mod(tsg.LONX(indCursor) + 180, 360) - 180, 1) );
set( hInfoSSPSText, 'String', tsg.SSPS(indCursor) );
end
if ~isempty(tsg.SSJT)
set( hInfoSSJTText, 'String', tsg.SSJT(indCursor) );
set( hInfoSSTPText, 'String', tsg.SSTP(indCursor) );
end
% Plot the position on the map if this one is active
% --------------------------------------------------
if strcmp( get(hMapFig, 'Visible'), 'on')
% Select the map axes
% -------------------
axes( hPlotAxes(4));
% Look for a MARKER (Red point) on the ship track
% -----------------------------------------------
h = findobj( hPlotAxes(4), '-regexp','Tag', 'TAG_PLOT4_LINE_MARKER');
if isempty( h ) % if no Marker
if ~isnan( tsg.LONX(indCursor) )
% Plot a Marker (Red point) on the ship track
% -------------------------------------------
hMarker = m_line( mod(tsg.LONX(indCursor(1)) + ...
tsg.lonplus, tsg.lonmod) - tsg.lonplus,...
tsg.LATX(indCursor(1)),...
'Marker', 'o', 'MarkerSize', 5, ...
'Color', 'r', 'MarkerFaceColor', 'r');
% Put a tag on the Marker - This tag allows to get the handle
% of the Marker
% -----------------------------------------------------------
set( hMarker, 'TAG', 'TAG_PLOT4_LINE_MARKER' );
if ~isnan( tsg.LONX(indCursor) )
% Delete the Marker and redraw it
% -------------------------------
delete( h);
tsg.LONX(indCursor), tsg.LATX(indCursor),...
'Marker', 'o', 'MarkerSize', 5, ...
'Color', 'r', 'MarkerFaceColor', 'r');
% Put a tag on the Marker - This tag allows to get the handle
% of the Marker
% -----------------------------------------------------------
set( hMarker, 'TAG', 'TAG_PLOT4_LINE_MARKER' );
end % end of map visible
else
% if cursor is out of valid data, display blank
% ---------------------------------------------
set( hInfoDateText, 'String', '' );
set( hInfoLatText, 'String', '' );
set( hInfoLongText, 'String', '' );
set( hInfoSSPSText, 'String', '' );
set( hInfoSSTPText, 'String', '' );
set( hInfoSSJTText, 'String', '' );
end % end of BuntonMotionOn
end % end of mouseMotion function
%---------------------------------------------------------------------
% Callback function run when the Map tool bar item is selected
%---------------------------------------------------------------------
function Map_OnMenuCallback(hObject, eventdata)
% Desactivate Zoom and Pan toggle buttons
% ---------------------------------------
set(hZoomInToggletool, 'state', 'off' );
set(hZoomOutToggletool, 'state', 'off' );
set(hPanToggletool, 'state', 'off' );
% Make the earth map visible
% --------------------------
set(hMapFig, 'Visible', 'on' );
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes)

jacques.grelet_ird.fr
committed
% De-activate keyPressFcn callback on main fig
% --------------------------------------------
set(hMainFig, 'KeyPressFcn', []);
%---------------------------------------------------------------------
% Callback function run when the Map tool bar item is unselected
%---------------------------------------------------------------------
function Map_OffMenuCallback(hObject, eventdata)
% ----------------------------

jacques.grelet_ird.fr
committed
% Re-activate keyPressFcn callback on main fig
% ---------------------------------------------
set(hMainFig, 'KeyPressFcn', @keyPressFcnCallback);
%% Bottle_OnMenuCallback ................................ Correction Module
%---------------------------------------------------------------------
% Callback function run when the bootle push tool is selected
%---------------------------------------------------------------------
function Bottle_OnMenuCallback(hObject, eventdata)
% Callback function run when the Bottle tool bar item is selected
% Get the tsg structure
% ---------------------
tsg = getappdata(hMainFig, 'tsg_data');
% Get the parameter we are working on (SSPS, SSJT, SSTP)
% ------------------------------------------------------
PARA = getParaCorModule( hMainFig );
% Switch somme buttons
% --------------------
set( hQCToggletool, 'state', 'off' );
set( hZoomInToggletool, 'state', 'off', 'enable', 'on' );
set( hZoomOutToggletool, 'state', 'off', 'enable', 'on' );
set( hPanToggletool, 'state', 'off' );
set( hClimToggletool, 'state', 'off', 'enable', 'off');
set( hCalToggletool, 'enable', 'off' );
set( hInterpToggletool, 'enable', 'off' );
set( hTimelimitToggletool, 'enable', 'on' );
% Activate or desactivate uipanels
% ---------------------------------
set( hpDateLimit, 'Visible', 'on' );
set( hbgCorMethod, 'Visible', 'on' );
set( hCorPanel, 'Visible', 'on' );
set( hbgParameter, 'Visible', 'off');
set( hbgQc, 'Visible', 'off');
if ~isempty( tsg.([SAMPLE '_EXT']) )
% Compute the sample-TSG differences
% ----------------------------------
errDif = diffTsgSample( hMainFig, PARA );
msgbox('No sample data file has been read', 'modal');
Yves Gouriou
committed
end
Yves Gouriou
committed
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
% Necessary to unzoom as the new plot keep in memory the preceding zoom
% ---------------------------------------------------------------------
zoom out;
Yves Gouriou
committed
% Get the information on time limits of the time series
% Write them in the uipanel
% -----------------------------------------------------
noNaN = tsg.DAYD(~isnan( tsg.DAYD ));
set( hetDateMin, 'String', datestr(noNaN(1), 31));
set( hetDateMax, 'String', datestr(noNaN(end), 31));
%% Bottle_OffMenuCallback ............................... Correction module
%---------------------------------------------------------------------
% Callback function run when the bootle push tool is selected
%---------------------------------------------------------------------
function Bottle_OffMenuCallback(hObject, eventdata)
% If necessary toggle off some buttons
% ------------------------------------
set( hQCToggletool, 'state', 'off' );
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hClimToggletool, 'enable', 'on');
set( hCalToggletool, 'enable', 'on' );
set( hInterpToggletool, 'enable', 'on' );
set( hTimelimitToggletool, 'enable', 'off' );
% Activate or Desactivate uipanel
% --------------------------------
set( hpDateLimit, 'Visible', 'off' );
set( hCorPanel, 'Visible', 'off' );
set( hbgCorMethod, 'Visible', 'off' );
set( hbgParameter, 'Visible', 'on');
% Desactivate Click Mouse on figure
% ---------------------------------
set( hMainFig, 'WindowButtonDownFcn', []);
% Get tsg structure
% -----------------
tsg = getappdata( hMainFig, 'tsg_data' );
Yves Gouriou
committed
% Draw the 3 plots of the validation figure
% -----------------------------------------
plot_Validation( hMainFig, hPlotAxes, 1, tsg.plot.parameter{1} );
plot_Validation( hMainFig, hPlotAxes, 2, tsg.plot.parameter{2} );
plot_Validation( hMainFig, hPlotAxes, 3, tsg.plot.parameter{3} );
% Necessary to unzoom as the new plot keep in memory the preceding zoom
% ---------------------------------------------------------------------
zoom out;
% Set the pointer
% ---------------
set( hMainFig, 'Pointer', 'arrow');
end
%% OldCorCancelCallback .................................... Correction Module
function OldCorCancelCallback(hObject, eventdata)
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
% --------------------------------------------------
tsg.([PARA{1} '_ADJUSTED']) = [];
tsg.([PARA{1} '_ADJUSTED_QC']) = [];
tsg.([PARA{1} '_ADJUSTED_ERROR']) = [];
% Save tsg data
% -------------
setappdata(hMainFig, 'tsg_data', tsg);
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
end
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
%% cancelCorrectionCallback .................................... Correction Module
function cancelCorrectionCallback(hObject, eventdata, Limits)
% Callback function run when the user want to cancel the
% corrections made from comparison with bottles or ARGO data.
% The deletion can be made for th whole time series or
% between 2 dates.
% $Id$
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
% The correction will be cancelled either for the entire
% time series or within date limits
% ------------------------------------------------------
ind = 0;
switch Limits
% Get the indices of the whole time series
% ----------------------------------------
case 'total'
ind = find( tsg.DAYD >= tsg.DAYD(1) & tsg.DAYD <= tsg.DAYD(end) );
% ind = size(tsg.([PARA{1} '_ADJUSTED']));
% Get the indices between 2 dates
% --------------------------------
case 'part'
% Get the date limits used for the correction
% -------------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Find indices within date limits
% --------------------------------
if dateMax > dateMin
ind = find( tsg.DAYD >= dateMin & tsg.DAYD <= dateMax );
end
otherwise
msgbox( 'CorCancelCallback : error', 'CorCancelCallback', 'error', modal);
end
if ~isempty(ind) && ~isempty( tsg.([PARA{1} '_ADJUSTED']) )
% Cancel the correction : set the ADJUSTED variable to NaN
% and ADJUSTED_QC to 0 (Bytes)
% --------------------------------------------------------
tsg.([PARA{1} '_ADJUSTED'])(ind) = ...
NaN*ones(size(tsg.([PARA{1} '_ADJUSTED'])(ind))) ;
tsg.([PARA{1} '_ADJUSTED_QC'])(ind) = ...
zeros*ones(size(tsg.([PARA{1} '_ADJUSTED_QC'])(ind))) ;
tsg.([PARA{1} '_ADJUSTED_ERROR'])(ind) = ...
NaN*ones(size(tsg.([PARA{1} '_ADJUSTED_ERROR'])(ind))) ;
end
% Save tsg data
% -------------
setappdata(hMainFig, 'tsg_data', tsg);
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
end
%% gradientCorrectionCallback .................................... Correction Module
function gradientCorrectionCallback(hObject, eventdata)
gael.alory_legos.obs-mip.fr
committed
% Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get the time limits for the correction
% --------------------------------------
gael.alory_legos.obs-mip.fr
committed
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
gael.alory_legos.obs-mip.fr
committed
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
SAMPLE = tsg.plot.sample;
if ~isempty( tsg.([SAMPLE '_EXT']) )
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig, PARA );
% Correction
% ----------
error = corTsgGradient(hMainFig, PARA, dateMin, dateMax);
switch error
case 1
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
gael.alory_legos.obs-mip.fr
committed
if DateMax <= DateMin
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
end
gael.alory_legos.obs-mip.fr
committed
end
end
end
%% biasCorrectionCallback .................................... Correction Module
function biasCorrectionCallback(hObject, eventdata)
Yves Gouriou
committed
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
% Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get the time limits for the correction A TESTER
% -----------------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
SAMPLE = tsg.plot.sample;
if ~isempty( tsg.([SAMPLE '_EXT']) )
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig, PARA );
Yves Gouriou
committed
end
% Correction
% ----------
error = corTsgBias(hMainFig, PARA, dateMin, dateMax);
Yves Gouriou
committed
Yves Gouriou
committed
switch error
Yves Gouriou
committed
Yves Gouriou
committed
case 1
Yves Gouriou
committed
Yves Gouriou
committed
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
Yves Gouriou
committed
Yves Gouriou
committed
case -1
Yves Gouriou
committed
Yves Gouriou
committed
if DateMax <= DateMin
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
end
otherwise
msgbox( 'CorBiasCallback : Error different or -1',' ', 'error');
Yves Gouriou
committed
end
end
%% linearCorrectionCallback .................................... Correction Module
function linearCorrectionCallback(hObject, eventdata)
% Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get the time limits for the correction A TESTER
% -----------------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
if ~isempty( tsg.([SAMPLE '_EXT']) )
Yves Gouriou
committed
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig, PARA );
Yves Gouriou
committed
% Correction
% ----------
error = corTsgLinear(hMainFig, PARA, dateMin, dateMax);
Yves Gouriou
committed
switch error
Yves Gouriou
committed
case 1
Yves Gouriou
committed
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
case -1
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
end
%% medianCorrectionCallback .................................... Correction Module
function medianCorrectionCallback(hObject, eventdata)
% Callback function run when
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
% Get the time limits for the correction A TESTER
% --------------------------------------
dateMin = datenum(get( hetDateMin, 'String'), 'yyyy-mm-dd HH:MM:SS');
dateMax = datenum(get( hetDateMax, 'String'), 'yyyy-mm-dd HH:MM:SS');
% Get tsg application data
% ------------------------