Newer
Older
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} );
% reset map border
% ----------------
tsg.preference.map_border = ...
str2double(tsg.preference.map_border_string(tsg.preference.map_border_value));
setappdata( hMainFig, 'tsg_data', tsg );
% Set the pointer
% ---------------
set( hMainFig, 'Pointer', 'arrow');
%% cancelCorrectionCallback .................................... Correction Module
function cancelCorrectionCallback(src, evnt, 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.
% 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
% --------------------------------
% 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 );
%% gradientCorrectionCallback .................................... Correction Module
function gradientCorrectionCallback(src, evnt)
gael.alory_legos.obs-mip.fr
committed
% Callback function run when
gael.alory_legos.obs-mip.fr
committed
% 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');
gael.alory_legos.obs-mip.fr
committed
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
gael.alory_legos.obs-mip.fr
committed
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
SAMPLE = tsg.plot.sample;
gael.alory_legos.obs-mip.fr
committed
if ~isempty( tsg.([SAMPLE '_EXT']) )
gael.alory_legos.obs-mip.fr
committed
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig, PARA );
gael.alory_legos.obs-mip.fr
committed
% Correction
% ----------
error = corTsgGradient(hMainFig, PARA, dateMin, dateMax);
gael.alory_legos.obs-mip.fr
committed
switch error
gael.alory_legos.obs-mip.fr
committed
case 1
gael.alory_legos.obs-mip.fr
committed
% Plot in the 3 axes
% ------------------
plot_Correction( hMainFig, hPlotAxes, PARA );
if DateMax <= DateMin
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
end
gael.alory_legos.obs-mip.fr
committed
end
gael.alory_legos.obs-mip.fr
committed
end
gael.alory_legos.obs-mip.fr
committed
end
%% biasCorrectionCallback .................................... Correction Module
function biasCorrectionCallback(src, evnt)
Yves Gouriou
committed
% Callback function run when
Yves Gouriou
committed
% Desactivate somme Toggle button
% -------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hTimelimitToggletool, 'state', 'off' );
Yves Gouriou
committed
% 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');
Yves Gouriou
committed
% Get tsg application data
% ------------------------
tsg = getappdata(hMainFig, 'tsg_data');
Yves Gouriou
committed
% Get parameter we are working on (SSPS, SSJT, SSTP)
% or SSPS_CAL, SSJT_CAL, SSTP_CAL
% -------------------------------------------------
PARA = getParaCorModule( hMainFig );
SAMPLE = tsg.plot.sample;
Yves Gouriou
committed
if ~isempty( tsg.([SAMPLE '_EXT']) )
Yves Gouriou
committed
% Compute the sample-TSG differences
% ----------------------------------
diffTsgSample( hMainFig, PARA );
Yves Gouriou
committed
end
% Correction
% ----------
error = corTsgBias(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 );
Yves Gouriou
committed
case -1
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(src, evnt)
% 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 );
Yves Gouriou
committed
case -1
msgbox( 'Date limits are not correct',...
'Correction module', 'warn', 'modal');
end
%% medianCorrectionCallback .................................... Correction Module
function medianCorrectionCallback(src, evnt)
% 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 = corTsgMedian(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 );
% Nothing is done - Error msg within the corTsgMedian function
Yves Gouriou
committed
end
%% PopupMenu Select Parameter
% POP_UP filled in with the function "initParameterChoice"
% ---------------------------
function SelectParameter(src, evnt, nplot)
% Callback function run when the ....
% Get application data
% --------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Get the active string of the selected box
% -----------------------------------------
val = get( src, 'Value' );
string_list = get( src, 'String' );
selected_string = string_list{val};
% Get the default parameter
% -------------------------
tsg.plot.sample = selected_string;
if strcmp( tsg.plot.sample, 'SSJT' )
tsg.plot.sample = 'SSTP';
% Save application data
% --------------------
setappdata( hMainFig, 'tsg_data', tsg);
% Disable the climatology
% -----------------------
plotClim = 0;
if strcmp( get(hClimToggletool, 'state'), 'on' )
set( hClimToggletool, 'state', 'off' );
plotClim = 1;
end
% Disable the climatology
% -----------------------
set( hClimToggletool, 'state', 'off' );
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} );
% Plot the climatology if it was already plotted
% ----------------------------------------------
if plotClim
set( hClimToggletool, 'state', 'on' );
plot_Climatology(hMainFig, hPlotAxes);
%% SelectTime_OnMenuCallback
%---------------------------
function SelectTime_OnMenuCallback(src, evnt)
% Callback function run when the ....
% Desactivate Zoom and Pan functions.
% ----------------------------------
set( hZoomInToggletool, 'state', 'off' );
set( hZoomOutToggletool, 'state', 'off' );
set( hQCToggletool, 'state', 'off' );
set( hPanToggletool, 'state', 'off' );
% Create a pointer to select the time limits
% ------------------------------------------
selTimePointer = ones(16)+1;
selTimePointer(1,:) = 1; selTimePointer(16,:) = 1;
selTimePointer(:,1) = 1; selTimePointer(:,16) = 1;
selTimePointer(1:4,8:9) = 1; selTimePointer(13:16,8:9) = 1;
selTimePointer(8:9,1:4) = 1; selTimePointer(8:9,13:16) = 1;
selTimePointer(5:12,5:12) = NaN; % Create a transparent region in the center
% Activate clic mouse menu on second axes (salinity) for next rbbox
% ----------------------------------------------------------------
set(hMainFig,'WindowButtonDownFcn', @Time_SelectCallback);
% change cursor
% ---------------
set( hMainFig, 'Pointer', 'custom',...
'PointerShapeCData', selTimePointer, 'PointerShapeHotSpot',[9 9]);
% ----------------------------------------------------------------------
% nested function on mouse clic when Select Time toggle tool is selected
% ----------------------------------------------------------------------
function Time_SelectCallback(src, evnt)
% disable ButtonMotion on main fig during select
% prevent drawing to map
% ----------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% 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
% get index on selected zone - Only on X axes (time)
% --------------------------------------------------
ind = find(tsg.DAYD >= p1(1,1) & tsg.DAYD <= p2(1,1));
% Write the date in the Editable uicontrol
% ----------------------------------------
set( hetDateMin, 'String', datestr(tsg.DAYD(ind(1)), 31));
set( hetDateMax, 'String', datestr(tsg.DAYD(ind(end)), 31));
% enable ButtonMotion on main fig after select QC area
% ----------------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
end
end
%% SelectTime_OffMenuCallback
%----------------------------
function SelectTime_OffMenuCallback(src, evnt)
% Desactivate time limit buttons
% ------------------------------
set( hTimelimitToggletool, 'state', 'off');
end
%% Clim_OffMenuCallback
%------------------------------------------------------------------------
% Callback function run when the Levitus climatology toolbar is unselected
%------------------------------------------------------------------------
function Clim_OffMenuCallback(src, evnt)
% Get lines handles from tag
% --------------------------
hLines = findobj('-regexp', 'Tag', 'TAG_LINE_CLIMATO_');
% Delete climatology lines on axes
% ---------------------------------
delete(hLines);
% Update the map (if visible)
% ----------------------------
if strcmp( get(hMapFig,'visible'), 'on') == 1
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes);
end
%------------------------------------------------------------------------
% Callback function run when the Levitus climatology toolbar is unselected
%------------------------------------------------------------------------
function Clim_OnMenuCallback(src, evnt)
% Test if the TSG and bucket files have been read
% -----------------------------------------------
if strcmp( get(hOpenMenu, 'UserData'), 'on' )
% Read surface climatology (annual, seasonal or monthly)
% ------------------------------------------------------
read_Climatology(hMainFig);
% plot climatology
% ----------------
plot_Climatology(hMainFig, hPlotAxes);
end
end
%% ClimatoSelectMenuCallback
% -------------------------------------------------------------------
% Callback function run when climato submenu is selected
% -------------------------------------------------------------------
function ClimatoSelectMenuCallback(src, evnt, climato, time)
% find all climato submenu and set 'checked' property to 'off'
% ------------------------------------------------------------
hdl = findobj( '-regexp', 'tag', 'TAG_UIMENU_CLIMATO');
set(hdl, 'checked', 'off');
% set current climato submenu checked
% -----------------------------------
% memorize action on climatology menu for next use
% ------------------------------------------------
s.type = climato;
s.time = time;
set(hClimatoMenu, 'userdata', s);
% check if climatology toggle button is set
% -----------------------------------------
if strcmp(get(hClimToggletool, 'state'), 'on')
% clear last plotted climatology
% ------------------------------
Clim_OffMenuCallback;
% Read surface climatology (annual, seasonal or monthly)
% ------------------------------------------------------
read_Climatology(hMainFig);
% plot and read (eventually) new climatology
% ------------------------------------------
plot_Climatology(hMainFig, hPlotAxes);
end
%% PreferencesMenuCallback
% -------------------------------------------------------------------
% Callback function run when Option/Preference is selected
% -------------------------------------------------------------------
function PreferencesMenuCallback(src, evnt)
oldmapres=tsg.preference.map_resolution;
% call preferences form function
% ------------------------------
if( preferencesForm(hMainFig) )
% if form is validate, update plots only if plot exist
% ----------------------------------------------------
if ~isempty(findobj( '-regexp', 'Tag', ('TAG_PLOT\d_LINE_')))
SelectParameter(pmhPara(1),[],1);
end
% Update the map (if visible) if ship speed QC has been applied
% or map resolution has been changed
% -------------------------------------------------------------
if (strcmp( get(hMapFig,'visible'), 'on') == 1 & ...
tsg.preference.map_resolution ~= oldmapres)
erase_Line( hPlotAxes, 4 );
plot_map( hMainFig, hPlotAxes);
%% HelpMenuCallback
% -------------------------------------------------------------------
% Callback function run when Help/Help is selected
% -------------------------------------------------------------------
function HelpMenuCallback(src, evnt)
msgbox( 'Function Help not yet implemented', 'warn', 'modal');
end
%% AboutMenuCallback
% -------------------------------------------------------------------
% Callback function run when Help/About is selected
% -------------------------------------------------------------------
function AboutMenuCallback(src, evnt)
aboutDialog(hMainFig, DEFAULT_PATH_FILE);

jacques.grelet_ird.fr
committed
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
%% Map menus
% -----------
function mapResolutionCallback(src, evnt, resolution)
% set map resolution
% ------------------
tsg.preference.map_resolution = resolution;
% Save the modifications for use new setting
% -----------------------------------------
setappdata( hMainFig, 'tsg_data', tsg);
% redraw map
% ------------------------------------------
erase_Line( hPlotAxes, 4 );
plot_map(hMainFig, hPlotAxes);
end
function mapPatchMenuCallback(src, evnt, patch)
if patch
% find map with patch submenu and set 'checked' property to 'off'
% ------------------------------------------------------------
hdl = findobj( '-regexp', 'tag', 'TAG_UIMENU_MAP_WITHOUT_PATCH');
set(hdl, 'checked', 'off');
% set current climato submenu checked
% -----------------------------------
set(src, 'checked', 'on');
% set tsg.preference for next use
% ------------------------------------------------
tsg.preference.map_patch_value = 2;
else
hdl = findobj( '-regexp', 'tag', 'TAG_UIMENU_MAP_WITH_PATCH');
set(hdl, 'checked', 'off');
% set current climato submenu checked
% -----------------------------------
set(src, 'checked', 'on');
% set tsg.preference for next use
% ------------------------------------------------
tsg.preference.map_patch_value = 1;
end
% Save the modifications for use new setting
% -----------------------------------------
setappdata( hMainFig, 'tsg_data', tsg);
% redraw map
% ------------------------------------------
erase_Line( hPlotAxes, 4 );
plot_map(hMainFig, hPlotAxes);
end
%% function mapDynaBorderCallback
% --------------------------------
function mapDynaBorderCallback(src, evnt, border)
hdl = findobj( '-regexp', 'tag', 'TAG_UIMENU_MAP_BORDER_');
set(hdl, 'Checked', 'off');
set(src, 'Checked', 'on');
% change the map border from menu on map
% --------------------------------------
tsg.preference.map_border = border;
setappdata( hMainFig, 'tsg_data', tsg);
% redraw map
% ------------------------------------------
erase_Line( hPlotAxes, 4 );
plot_map(hMainFig, hPlotAxes);
end
%% HeaderMenuCallback
% -------------------------------------------------------------------
% Callback function run when the headerForm tool bar item is selected
% -------------------------------------------------------------------
function HeaderMenuCallback(src, evnt)
% call header form function
% -------------------------
headerForm(hMainFig);
end
%% PrintFigMenuCallback
% -------------------------------------------------------------------
% Callback function run when the Report tool bar item is selected
% -------------------------------------------------------------------
function PrintFigMenuCallback(src, evnt)
% disable ButtonMotion on main fig during select
% ----------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Get the tsg structure
% ---------------------
tsg = getappdata( hMainFig, 'tsg_data');
hPrintFig = figure( 'Name', 'Print','NumberTitle', 'off','Resize', 'on');
hPlot(1) = subplot(3,1,1);
hPlot(2) = subplot(3,1,2);
hPlot(3) = subplot(3,1,3);
title( hPlot(1), tsg.file.name, 'interpreter', 'none');
if strcmp(get(hBottleToggletool,'state'), 'on')
% Default parameter
% -----------------------------------------------------
PARA = getParaCorModule( hMainFig );
plot_Correction( hMainFig, hPlot, PARA );
elseif strcmp(get(hCalToggletool,'state'), 'on')
plot_Calibration( hMainFig, hPlot, 1, 'SSPS' );
plot_Calibration( hMainFig, hPlot, 2, 'SSJT' );
plot_Calibration( hMainFig, hPlot, 3, 'SSTP' );
% elseif strcmp(get(hMapToggletool,'state'), 'on')
% plot_map( hMainFig, hPlot)
elseif strcmp(get(hInterpToggletool,'state'), 'on')
plot_Interpolation( hMainFig, hPlot, 1 );
plot_Interpolation( hMainFig, hPlot, 2 );
plot_Interpolation( hMainFig, hPlot, 3 );
plot_Validation( hMainFig, hPlot, 1, tsg.plot.parameter{1} );
plot_Validation( hMainFig, hPlot, 2, tsg.plot.parameter{2} );
plot_Validation( hMainFig, hPlot, 3, tsg.plot.parameter{3} );
% I = getframe(hPlotAxes(1));
% imwrite(I.cdata, 'myplot.png');
linkaxes([hPlot(1),hPlot(2),hPlot(3)], 'x');
% set(hPlot(i), 'box', 'on','XTickMode','auto');
set(hPlot(i), 'box', 'on','XTickMode','auto');
datetick(hPlot(i),'x','mm/dd','keepticks' );
% enable ButtonMotion on main fig after select QC area
% ----------------------------------------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
end
%% ReportMenuCallback
% -------------------------------------------------------------------
% Callback function run when the Report tool bar item is selected
% -------------------------------------------------------------------
function ReportMenuCallback(src, evnt)
% call report function
% --------------------
saveReport(hMainFig);
%% GoogleEarthMenuCallback
% -------------------------------------------------------------------
% Callback function run when the Google Earth tool bar item is selected
% -------------------------------------------------------------------
function GoogleEarthMenuCallback(src, evnt)
% Get tsg application data
% ------------------------
tsg = getappdata( hMainFig, 'tsg_data' );
% call KML Toolbox functions
% --------------------------
k = kml(tsg.CYCLE_MESURE);
% get indice from the selected area
if verLessThan('matlab','8.4')
XLim = get(hPlotAxes(1), 'XLim');

jacques.grelet_ird.fr
committed
ind = find(tsg.DAYD > XLim(1) & tsg.DAYD < XLim(2));
else
ind = find(tsg.DAYD > hPlotAxes(1).XLim(1) & ...
tsg.DAYD < hPlotAxes(1).XLim(2) );
% Color value format must be passed as a character array according
% to the format string 'AABBGGRR', eg: red = 'FF0000FF'
k.plot(tsg.LONX(ind),tsg.LATX(ind), 'linewidth', 2, 'linecolor', 'FF0000FF');
k.run;
end
%% SaveMenuCallback
% -------------------------------------------------------------------
% Callback function run when the Save menu item is selected
% -------------------------------------------------------------------
function SaveMenuCallback(src, evnt)
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% fill or append header form
% -------------------------
error = headerForm(hMainFig);
% if user press continue button, ask for netcdf file
% ------------------------------------------------
if error ~= -1
[fileName, pathName, filterindex] = uiputfile('*.nc', ...
'Save file name', strcat(tsg.file.name, '.nc'));
% if user press cancel button, all var are set to zero
% ----------------------------------------------------
if filterindex == 0
return;
end
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
% flushes the evnt queue and updates the closed uiputfile window
% ---------------------------------------------------------------
drawnow;
% write netcdf file
% -----------------
error = writeTSGDataNetCDF(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% must to be rewriting
% ------------------------------
if error == -1
warning('tsgqc:SaveMenuCallback', ...
'NetCDF writing error: %s %s', pathName, fileName);
% update the display
% ------------------
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
end
% -------------------------------------------------------------------
% Callback function run when the Export menu item is selected
% -------------------------------------------------------------------
function ExportTsgCallback(src, evnt)
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Desactivate MouseMotion 'off'
% ----------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Open standard dialog box for saving files
% -----------------------------------------
[fileName, pathName, filterindex] = uiputfile('*.tsgqc', ...
'Save file name', strcat(tsg.file.name, '.tsgqc'));
% if user press cancel button, all var are set to zero
% ----------------------------------------------------
if filterindex == 0
return;
end
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
% Write a .TSG (ascii) file
% --------------------------
Yves Gouriou
committed
error = writeAsciiTsg(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
% Set MouseMotion 'on'
% --------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
% Check for .TSG writing error - must to be rewriting
% Because of the 'return' - These line must be at the end
% --------------------------------------------------------
warning('tsgqc:SaveMenuCallback', ...
'TSG no ouput: %s %s', pathName, fileName);
return;
end
end
%% ExportSampleCallback
% -------------------------------------------------------------------
% Callback function run when the Export menu item is selected
% -------------------------------------------------------------------
function ExportSampleCallback(src, evnt)
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Desactivate MouseMotion 'off'
% ----------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Open standard dialog box for saving files
% -----------------------------------------
gael.alory_legos.obs-mip.fr
committed
[fileName, pathName, filterindex] = uiputfile('*.spl', ...
'Save file name', strcat(tsg.file.name, '.spl'));
% if user press cancel button, all var are set to zero
% ----------------------------------------------------
if filterindex == 0
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
gael.alory_legos.obs-mip.fr
committed
% Write a .SPL (ascii) file
% --------------------------
error = writeAsciiSample(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
% Set MouseMotion 'on'
% --------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
% Check for .TSG writing error - must to be rewriting
% Because of the 'return' - These line must be at the end
% --------------------------------------------------------
if error == -1
warning('tsgqc:SaveMenuCallback', ...
'TSG no ouput: %s %s', pathName, fileName);
return;
end
% -----------------------------------------------------------------------
% Callback function run when the Edit/Undo menu item is selected (Ctrl+Z)
% -----------------------------------------------------------------------
function UndoMenuCallback(src, evnt)
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
if (tsg.qc_history_pointer > 0)
% Get the parameter (SSPS, SSJT or SSTP)
% --------------------------------------
PARA = getParaCorModule( hMainFig );
if (tsg.qc_history_pointer == tsg.qc_history_size)
tsg.qc_history_state = circshift(tsg.qc_history_state,[0 -1]);
tsg.qc_history_pointer = tsg.qc_history_pointer - 1;
end
% Back to previous QC flags
% -------------------------
tsg.qc_history_state(:,tsg.qc_history_pointer+1) = tsg.([PARA{1} '_QC']);
tsg.([PARA{1} '_QC']) = tsg.qc_history_state(:,tsg.qc_history_pointer);
tsg.qc_history_pointer = tsg.qc_history_pointer - 1;
% Allow redo
% ----------
tsg.qc_redo_possible = tsg.qc_redo_possible + 1;
% Save the modifications