diff --git a/@tsg_nc/tsg_platform_info.mat b/@tsg_nc/tsg_platform_info.mat index 5a747398c5b22dccf2faa18cc587c3c494b1849b..5940258864c04157f815330703822359841df452 100644 Binary files a/@tsg_nc/tsg_platform_info.mat and b/@tsg_nc/tsg_platform_info.mat differ diff --git a/tsg_util/headerForm.m b/tsg_util/headerForm.m index f6b54f2224ad3951647413dddc519d4287e59bfb..286316589e76c8eeb3c868202d7184a4d115b21b 100644 --- a/tsg_util/headerForm.m +++ b/tsg_util/headerForm.m @@ -58,6 +58,7 @@ hHeaderFig = figure(... 'Toolbar', 'none', ... 'Tag', 'GLOBAL_ATTRIBUTES', ... 'Visible','on',... + 'WindowStyle', 'modal', ... 'Units', 'normalized',... 'Position',get(hTsgGUI,'Position'), ... 'Color', get( 0, 'DefaultUIControlBackgroundColor' )); diff --git a/tsg_util/resetAxes.m b/tsg_util/resetAxes.m new file mode 100644 index 0000000000000000000000000000000000000000..edfc6da3143678b1bf31c22e2ab7b86acf0a5858 --- /dev/null +++ b/tsg_util/resetAxes.m @@ -0,0 +1,10 @@ +function resetAxes( hPlotAxes ) + +% Initialise axis limits +% ---------------------- +for i = 1 : length( hPlotAxes ) + xlim( hPlotAxes(i), 'auto' ); + ylim( hPlotAxes(i), 'auto' ); +end + +end \ No newline at end of file diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m index 77fa1b3a00cffe4ac9a11e62276778d164191c67..cd782eee23880d29035da106c5625bbc3b331f14 100644 --- a/tsg_util/updateTsgStruct.m +++ b/tsg_util/updateTsgStruct.m @@ -1,17 +1,17 @@ -function updateTsgStruct(hTsgGUI) +function updateTsgStruct(hMainFig) % % This function is called after reading data and update tsg structure % with common values % % Input % ----- -% hTsgGUI ............ Handel to the main user interface +% hMainFig ............ Handel to the main user interface % % $Id$ % Get the data from the application GUI % ------------------------------------- -tsg = getappdata( hTsgGUI, 'tsg_data'); +tsg = getappdata( hMainFig, 'tsg_data'); % get min and max values for position and set to globals attributes % ----------------------------------------------------------------- @@ -80,8 +80,8 @@ tsg.CNDC_LINCOEF(1) = 1; tsg.CNDC_LINCOEF(2) = 0; tsg.SSTP_LINCOEF(1) = 1; tsg.SSTP_LINCOEF(2) = 0; - + % Save tsg structure % ------------------ -setappdata( hTsgGUI, 'tsg_data', tsg); +setappdata( hMainFig, 'tsg_data', tsg); \ No newline at end of file diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m index 67d8b45c5c019685084c921e646849090ff2ef9a..3cea42750167d228805d5baef05862b732511ef8 100644 --- a/tsgqc_GUI.m +++ b/tsgqc_GUI.m @@ -913,7 +913,7 @@ hrbInterpCancel = uicontrol( ... %% test if user preference autoload field is checked (on) % ------------------------------------------------------- if strcmp(root.preference.autoload, 'on') - + % this code need to be fatorized file/open menu % --------------------------------------------- @@ -941,7 +941,7 @@ if strcmp(root.preference.autoload, 'on') % update some fields in tsg structure % ----------------------------------- - updateTsgStruct(hMainFig); + updateTsgStruct( hMainFig ); % Running average of TSG time series % ---------------------------------- @@ -957,6 +957,7 @@ if strcmp(root.preference.autoload, 'on') % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ); plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -985,11 +986,22 @@ end %---------------------------------------------------------------------- function OpenMenuCallback(hObject, eventdata) - % Desactivate some toggle buttons - % ------------------------------- - set( hQCToggletool, 'state', 'off' ); - set( hPanToggletool, 'state', 'off' ); + % Activate or desactivate uipanels + % -------------------------------- + set( hpCalCoef, 'Visible', 'off' ); + set( hbgQc, 'Visible', 'on' ); + set( hpDateLimit, 'Visible', 'off' ); + set( hpInterpPos, 'Visible', 'off' ); + + % Pushbutton + % ---------- set( hTimelimitToggletool, 'state', 'off' ); + set( hQCToggletool, 'state', 'off' ); + set( hClimToggletool, 'state', 'off' ); + set( hBottleToggletool, 'state', 'off' ); + set( hCalToggletool, 'state', 'off' ); + set( hInterpToggletool, 'state', 'off' ); + set( hHeaderPushtool, 'enable', 'off' ); % Pointer set to watch during reading and plotting % ------------------------------------------------ @@ -1015,42 +1027,39 @@ end % construct valid and full file path % ----------------------------------- fullFileName = strcat(pathname, fileName); - - % call default tsg_initialisation - % ------------------------------- - tsg_initialisation(hMainFig); % Read the data % ------------- switch filterIndex - case 1 + case 1 % read TSG text file *.txt + tsg_initialisation(hMainFig); error1 = readTsgDataTxt( hMainFig, fullFileName ); - - case 2 + + case 2 % read TSG XML file *.xml + tsg_initialisation(hMainFig); error1 = readTsgDataXML( hMainFig, fullFileName ); - - case 3 - error1 = readTsgDataNetCDF( hMainFig, fullFileName ); + + case 3 % read TSG netcdf file *.nc + tsg_initialisation(hMainFig); + error1 = readTsgDataNetCDF( hMainFig, fullFileName ); %# a modifier - if error1 == 1 - error2 = error1; - end - case 4 + case 4 % read TSG labview file *.lbv + tsg_initialisation(hMainFig); error1 = readTsgDataLabview( hMainFig, fullFileName ); if error1 ~= -1 automaticQC( hMainFig ); end - case 5 + case 5 % Read bucket file *.btl if ~isempty( tsg.SSPS ) error2 = readBucketData( hMainFig, fullFileName ); else msgbox( 'Load a TSG file before a Water sample file', 'Read Bucket'); end - case 6 + case 6 % Read Argo file *.arg (G. Reverdin format) if ~isempty( tsg.SSPS ) error2 = readCoriolisData( hMainFig, fullFileName ); else @@ -1059,8 +1068,11 @@ end otherwise return; - end + + % Get application data + % -------------------- + tsg = getappdata( hMainFig, 'tsg_data'); % A TSG file has been read. Plot the data. % ---------------------------------------- @@ -1070,10 +1082,6 @@ end % --------------------------------- set( hOpenMenu, 'UserData', 'on' ); - % Get application data - % -------------------- - tsg = getappdata( hMainFig, 'tsg_data'); - % enable toolbar menu pushtool % ---------------------------- hdl_pushtool = findobj('-regexp','Tag', 'PUSHTOOL_'); @@ -1089,14 +1097,13 @@ end % update some fields in tsg structure and restore tsg % --------------------------------------------------- - updateTsgStruct(hMainFig); + updateTsgStruct(hMainFig ); tsg = getappdata( hMainFig, 'tsg_data'); % Running average of TSG time series % ---------------------------------- tsg_moveaverage(hMainFig); - % The callback to detect the mouse motion can be set to on % -------------------------------------------------------- set( hMainFig, 'UserData', 'ButtonMotionOn'); @@ -1104,7 +1111,14 @@ end % Update QC statistics % -------------------- display_QC( hMainFig, hPlotAxes); - + + else + + % Problem to read the file of reading canceled by the user + % TSG structure has been reinitialize, so the plots must be + % reinitialized + % --------------------------------------------------------- + resetAxes( hPlotAxes ) end end @@ -1113,11 +1127,11 @@ end % --------------------------------- if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT ) tsg_mergesample( hMainFig ); - tsg = getappdata( hMainFig, 'tsg_data'); end % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ) plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -1152,6 +1166,7 @@ end % Draw the 3 plots of the interpolation figure % -------------------------------------------- + resetAxes( hPlotAxes ) plot_Interpolation( hMainFig, hPlotAxes, 1 ); plot_Interpolation( hMainFig, hPlotAxes, 2 ); plot_Interpolation( hMainFig, hPlotAxes, 3 ); @@ -1182,6 +1197,7 @@ end % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ) plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -1297,6 +1313,7 @@ end % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ) plot_Calibration( hMainFig, hPlotAxes, 1, 'SSPS' ); plot_Calibration( hMainFig, hPlotAxes, 2, 'SSJT' ); plot_Calibration( hMainFig, hPlotAxes, 3, 'SSTP' ); @@ -1353,6 +1370,7 @@ end % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ) plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -1370,11 +1388,11 @@ end % Get the calibration coefficients. % They will be used in the function calibration % --------------------------------------------- - tsg.CNDC_LINCOEF(1) = str2num(get( hetCalCNDCSlope, 'String')); + tsg.CNDC_LINCOEF(1) = str2num(get( hetCalCNDCSlope, 'String')); tsg.CNDC_LINCOEF(2) = str2num(get( hetCalCNDCOffset, 'String')); - tsg.SSJT_LINCOEF(1) = str2num(get( hetCalSSJTSlope, 'String')); + tsg.SSJT_LINCOEF(1) = str2num(get( hetCalSSJTSlope, 'String')); tsg.SSJT_LINCOEF(2) = str2num(get( hetCalSSJTOffset, 'String')); - tsg.SSTP_LINCOEF(1) = str2num(get( hetCalSSTPSlope, 'String')); + tsg.SSTP_LINCOEF(1) = str2num(get( hetCalSSTPSlope, 'String')); tsg.SSTP_LINCOEF(2) = str2num(get( hetCalSSTPOffset, 'String')); % Save tsg application data @@ -1413,14 +1431,14 @@ end tsg.SSJT_CAL = []; tsg.SSTP_CAL = []; - % Update the Adjusted variables (SSPS - SSJT) with calibrated records - % ------------------------------------------------------------------- - updateAdjustedVariable( hMainFig ); - % Save tsg application data % -------------------------- setappdata( hMainFig, 'tsg_data', tsg ); + % Update the Adjusted variables (SSPS - SSJT) with calibrated records + % ------------------------------------------------------------------- + updateAdjustedVariable( hMainFig ); + % Refresh plot #1 % --------------- plot_Calibration( hMainFig, hPlotAxes, 1, 'SSPS' ); @@ -1995,9 +2013,9 @@ end % Switch somme buttons % -------------------- - set( hZoomToggletool, 'state', 'off' ); - set( hQCToggletool, 'state', 'off' ); - set( hPanToggletool, 'state', 'off' ); + set( hZoomToggletool, 'state', 'off' ); + set( hQCToggletool, 'state', 'off' ); + set( hPanToggletool, 'state', 'off' ); set( hMapToggletool, 'state', 'off' ); set( hClimToggletool, 'Enable', 'off'); set( hCalToggletool, 'enable', 'off' ); @@ -2019,6 +2037,7 @@ end % Plot in the 3 axes % ------------------ + resetAxes( hPlotAxes ) plot_Correction( hMainFig, hPlotAxes ); % Get the information on time limits of the time series @@ -2071,6 +2090,7 @@ end % Draw the 3 plots of the validation figure % ----------------------------------------- + resetAxes( hPlotAxes ) plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -2092,18 +2112,30 @@ end set( hPanToggletool, 'state', 'off' ); set( hQCToggletool, 'state', 'off' ); set( hTimelimitToggletool, 'state', 'off' ); - - tsg = getappdata(hMainFig, 'tsg_data'); - tsg.SSPS_ADJUSTED = tsg.SSPS; - tsg.SSPS_ADJUSTED_ERROR = NaN*ones(size(tsg.SSPS)); - tsg.SSPS_ADJUSTED_QC = tsg.SSPS_QC; + % Get tsg application data + % ------------------------ + tsg = getappdata(hMainFig, 'tsg_data'); - setappdata(hMainFig, 'tsg_data', tsg); - - % Plot in the 3 axes - % ------------------ - plot_Correction( hMainFig, hPlotAxes ); + % To cancel the correction set the ERROR to NaN then + % call updateAdjustedVariable. + % -------------------------------------------------- + tsg.SSPS_ADJUSTED_ERROR = NaN * ones( size(tsg.SSPS_ADJUSTED_ERROR)); + + % Save tsg data + % ------------- + setappdata(hMainFig, 'tsg_data', tsg); + + % Set the ADJUSTED variable either to the raw variable or to + % the calibrated variable + % ---------------------------------------------------------- + updateAdjustedVariable( hMainFig ); + + % Plot in the 3 axes + % ------------------ + plot_Correction( hMainFig, hPlotAxes ); +% end +% end end