diff --git a/tsg_io/readTsgDataTxt.m b/tsg_io/readTsgDataTxt.m index aba15c230ccd0a55a60933d865d2ef40b50b1a02..14b19faddb6cd6e5cdcc747138f5c9a5d59d476a 100644 --- a/tsg_io/readTsgDataTxt.m +++ b/tsg_io/readTsgDataTxt.m @@ -44,8 +44,7 @@ fprintf('...reading %s : ', filename); % Read the file % ------------- -tsgData = fscanf(fid, '%d/%d/%d %d:%d:%d %f %f %f %f %d %f %f', ... - [13 Inf])'; +tsgData = fscanf(fid, '%d/%d/%d %d:%d:%d %f %f %f %f %d %f %f', [13 Inf])'; % Every variable are put in a structure % ------------------------------------- @@ -54,19 +53,19 @@ tsg.DAYD = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ... % save original date % ------------------ -tsg.DATE = datestr( tsg.DAYD, 'yyyymmddHHMMSS' ); -tsg.LATX = tsgData(:,7); -tsg.LONX = tsgData(:,8); -tsg.SSJT = tsgData(:,9); -tsg.SSPS = tsgData(:,10); -tsg.SSPS_QC = tsgData(:,11); -tsg.SSPS_ADJ = tsgData(:,12); -tsg.SSPS_ERR = tsgData(:,13); +tsg.DATE = datestr( tsg.DAYD, 'yyyymmddHHMMSS' ); +tsg.LATX = tsgData(:,7); +tsg.LONX = tsgData(:,8); +tsg.SSJT = tsgData(:,9); +tsg.SSPS = tsgData(:,10); +tsg.SSPS_QC = tsgData(:,11); +tsg.SSPS_ADJUSTED = tsgData(:,12); +tsg.SSPS_ADJUSTED_ERROR = tsgData(:,13); % populate tsg.file structure % --------------------------- [tsg.file.pathstr, tsg.file.name, tsg.file.ext, tsg.file.versn] = ... - fileparts(filename); + fileparts(filename); %tsg.file.name = filename; tsg.file.type = 'ASCII'; diff --git a/tsg_util/plot_Interpolation.m b/tsg_util/plot_Interpolation.m index af8e917fe5af1b08cec516dee65bd7ca5f15b3bc..ac44765e96ca247f596356b28cbbbb2df6dcbe10 100644 --- a/tsg_util/plot_Interpolation.m +++ b/tsg_util/plot_Interpolation.m @@ -31,15 +31,13 @@ switch nPlot 'SSPS','k','none','*',2); end end + +% set( hPlotAxes(1) ,'xlim', [tsg.DAYD(1) tsg.DAYD(end)] ); % --------------------------------------------------------------------- case 2 erase_Line( hPlotAxes, 2 ); - if ~isempty( tsg.LATX ) - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.LATX,[],... - 'LATX','k','none','*',2); - end if ~isempty(tsg.POSITION_QC) ind = find( tsg.POSITION_QC == INTERPOLATED_VALUE ); if ~isempty( ind ) @@ -48,13 +46,17 @@ switch nPlot end end + if ~isempty( tsg.LATX ) + plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.LATX,[],... + 'LATX','k','none','*',2); + end + +% set( hPlotAxes(2) ,'xlim', [tsg.DAYD(1) tsg.DAYD(end)] ); + + % --------------------------------------------------------------------- case 3 erase_Line( hPlotAxes, 3 ); - if ~isempty( tsg.LONX ) - plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.LONX,[],... - 'LONX','k','none','*',2); - end if ~isempty(tsg.POSITION_QC) ind = find( tsg.POSITION_QC == INTERPOLATED_VALUE ); if ~isempty( ind ) @@ -62,7 +64,13 @@ switch nPlot 'LONX_INTERP','r','none','*',2); end end - + + if ~isempty( tsg.LONX ) + plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.LONX,[],... + 'LONX','k','none','*',2); + end + +% set( hPlotAxes(3) ,'xlim', [tsg.DAYD(1) tsg.DAYD(end)] ); end axesCommonProp( hPlotAxes ); diff --git a/tsg_util/plot_Tsg.m b/tsg_util/plot_Tsg.m index b22306a8127b10b5a1bfdf3de810a1176cd25981..512dbaf661d9cabb68ab58e01e94d4568001589d 100644 --- a/tsg_util/plot_Tsg.m +++ b/tsg_util/plot_Tsg.m @@ -27,8 +27,7 @@ tsg = getappdata( hTsgGUI, 'tsg_data'); if ~isempty( X ) && ~isempty( Y ) axes( hAxes(PlotNum) ); - set( hAxes(PlotNum), 'Box', 'on' ); - hold on +% hold on % Plot using QC % ------------- @@ -51,22 +50,17 @@ if ~isempty( X ) && ~isempty( Y ) qcCode = get(tsg.qc.hash, key, 'code'); qcColor = get(tsg.qc.hash, key, 'color'); - % plot only for valid context menu (set to 'on') + % plot tsg salinity sample with right code/color % ---------------------------------------------- - % if strcmp( qcState, 'on') + ind = find( QC == qcCode ); + if ~isempty( ind ) - % plot tsg salinity sample with right code/color - % ---------------------------------------------- - ind = find( QC == qcCode ); - if ~isempty( ind ) + line( X(ind), Y(ind), ... + 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' para '_' key],... + 'LineStyle', lineType, ... + 'Marker', markType, 'MarkerSize', markSize, 'Color', qcColor); - line( X(ind), Y(ind), ... - 'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' para '_' key],... - 'LineStyle', lineType, ... - 'Marker', markType, 'MarkerSize', markSize, 'Color', qcColor); - - end - %end + end end else @@ -75,8 +69,8 @@ if ~isempty( X ) && ~isempty( Y ) 'LineStyle', lineType, ... 'Marker', markType, 'MarkerSize', markSize, 'Color', colVal); end - - hold off; + +% hold off; % Write some 'Y' label % ------------------ diff --git a/tsg_util/resetAxes.m b/tsg_util/resetAxes.m index edfc6da3143678b1bf31c22e2ab7b86acf0a5858..e0f3116d6606b69d7dc49d1f075d2ee268f469f5 100644 --- a/tsg_util/resetAxes.m +++ b/tsg_util/resetAxes.m @@ -1,10 +1,14 @@ -function resetAxes( hPlotAxes ) +function resetAxes( hMainFig, hPlotAxes ) + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); % Initialise axis limits % ---------------------- for i = 1 : length( hPlotAxes ) - xlim( hPlotAxes(i), 'auto' ); - ylim( hPlotAxes(i), 'auto' ); + set( hPlotAxes(i),... + 'Visible', 'off', 'box', 'on', 'XLimMode', 'auto', 'YLimMode', 'auto'); end end \ No newline at end of file diff --git a/tsg_util/tsg_initialisation.m b/tsg_util/tsg_initialisation.m index 25805e4e69a640821461545fea8f919b755f8333..7ae16d766a28dceb6312f5ef6363fd5cbc5d2ea5 100644 --- a/tsg_util/tsg_initialisation.m +++ b/tsg_util/tsg_initialisation.m @@ -10,6 +10,9 @@ function tsg_initialisation(hMainFig) % % $Id$ % +% disable ButtonMotion on main fig +% --------------------------------- +%set( hMainFig, 'WindowButtonMotionFcn', []); % init empty tsg structure % ------------------------ diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m index cd782eee23880d29035da106c5625bbc3b331f14..43565e6274008464e3782c2260ff5e5164860212 100644 --- a/tsg_util/updateTsgStruct.m +++ b/tsg_util/updateTsgStruct.m @@ -13,6 +13,9 @@ function updateTsgStruct(hMainFig) % ------------------------------------- tsg = getappdata( hMainFig, 'tsg_data'); +nPARA = 3; +PARA = ['SSPS'; 'SSJT'; 'SSPS']; + % get min and max values for position and set to globals attributes % ----------------------------------------------------------------- tsg.SOUTH_LATX = min(tsg.LATX); @@ -42,44 +45,41 @@ end % Initialise ADJUSTED variables if empty % -------------------------------------- -if isempty( tsg.SSPS_ADJUSTED ) && ~isempty( tsg.SSPS ) - tsg.SSPS_ADJUSTED = tsg.SSPS; - tsg.SSPS_ADJUSTED_QC = tsg.SSPS_QC; - tsg.SSPS_ADJUSTED_ERROR = NaN * ones( size( tsg.SSPS )); - -elseif isempty( tsg.SSPS ) +for i = 1: nPARA - msgbox('You must initialise the tsg.SSPS variable',... - 'function ''updateTsgStruct''', .... - 'warn', 'modal'); -end + para1 = PARA(i,:); + para2 = [PARA(i,:) '_QC']; + para3 = [PARA(i,:) '_ADJUSTED']; + para4 = [PARA(i,:) '_ADJUSTED_QC']; + para5 = [PARA(i,:) '_ADJUSTED_ERROR']; -if isempty( tsg.SSJT_ADJUSTED ) && ~isempty( tsg.SSJT ) - tsg.SSJT_ADJUSTED = tsg.SSJT; - tsg.SSJT_ADJUSTED_QC = tsg.SSJT_QC; - tsg.SSJT_ADJUSTED_ERROR = NaN * ones( size( tsg.SSJT )); + if isempty( tsg.(para3) ) && ~isempty( tsg.(para1) ) + tsg.(para3) = tsg.(para1); + tsg.(para4) = tsg.(para2); + tsg.(para5) = NaN * ones( size( tsg.(para1) )); -elseif isempty( tsg.SSJT ) - - msgbox('You must initialise the tsg.SSJT variable',... - 'function ''updateTsgStruct''', .... - 'warn', 'modal'); -end + elseif isempty( tsg.(para1) ) -if isempty( tsg.SSTP_ADJUSTED ) && ~isempty( tsg.SSTP ) - tsg.SSTP_ADJUSTED = tsg.SSTP; - tsg.SSTP_ADJUSTED_QC = tsg.SSTP_QC; - tsg.SSTP_ADJUSTED_ERROR = NaN * ones( size( tsg.SSTP )); + msgbox(['You must initialise the tsg.' PARA(i) ' variable'],... + 'function ''updateTsgStruct''', .... + 'warn', 'modal'); + end end % Initialise 'variables_LINCOEF' % ------------------------------- -tsg.SSJT_LINCOEF(1) = 1; -tsg.SSJT_LINCOEF(2) = 0; -tsg.CNDC_LINCOEF(1) = 1; -tsg.CNDC_LINCOEF(2) = 0; -tsg.SSTP_LINCOEF(1) = 1; -tsg.SSTP_LINCOEF(2) = 0; +if isempty(tsg.SSJT_LINCOEF) + tsg.SSJT_LINCOEF(1) = 1; + tsg.SSJT_LINCOEF(2) = 0; +end +if isempty(tsg.CNDC_LINCOEF) + tsg.CNDC_LINCOEF(1) = 1; + tsg.CNDC_LINCOEF(2) = 0; +end +if isempty(tsg.SSTP_LINCOEF) + tsg.SSTP_LINCOEF(1) = 1; + tsg.SSTP_LINCOEF(2) = 0; +end % Save tsg structure % ------------------ diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m index 3cea42750167d228805d5baef05862b732511ef8..287798a6a872d1cb7dd6d224c2d3321db929bb91 100644 --- a/tsgqc_GUI.m +++ b/tsgqc_GUI.m @@ -37,7 +37,7 @@ clc; % ------------------------------------- global VERSION -VERSION = '0.2b'; +VERSION = '0.2c'; % reset userdata property of root Matlab object if it is not empty % ---------------------------------------------------------------- @@ -535,26 +535,26 @@ hPlotsPanel = uipanel( ... 'Parent', hMainFig, ... 'Units', 'normalized', ... 'BorderType', 'etchedin',... - 'Visible', 'on', ... + 'Visible', 'on',... 'Position',[0.15, 0.0, .85, .95]); hPlotAxes(1) = axes(... % the axes for plotting Salinity 'Parent', hPlotsPanel, ... 'Units', 'normalized', ... - 'Visible', 'off', ... + 'Visible', 'off','box', 'on', 'XLimMode', 'auto', 'YLimMode', 'auto', ... 'Tag', 'TAG_AXES_1', ... 'HandleVisibility','on', ... % set to callback after first plot 'Position',[.05, .64, .93, .35]); hPlotAxes(2) = axes(... % the axes for plotting temperature 'Parent', hPlotsPanel, ... 'Units', 'normalized', ... - 'Visible', 'off', ... + 'Visible', 'off', 'box', 'on',... 'Tag', 'TAG_AXES_2', ... 'HandleVisibility','on', ... 'Position',[.05, .33, .93, .27]); hPlotAxes(3) = axes(... % the axes for plotting ship velocity 'Parent', hPlotsPanel, ... 'Units', 'normalized', ... - 'Visible', 'off', ... + 'Visible', 'off', 'box', 'on',... 'Tag', 'TAG_AXES_3', ... 'HandleVisibility','on', ... 'Position',[.05, .02, .93, .27]); @@ -957,7 +957,7 @@ if strcmp(root.preference.autoload, 'on') % Draw the 3 plots of the validation figure % ----------------------------------------- - resetAxes( hPlotAxes ); + resetAxes( hMainFig, hPlotAxes ); plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -993,14 +993,17 @@ end set( hpDateLimit, 'Visible', 'off' ); set( hpInterpPos, 'Visible', 'off' ); - % Pushbutton - % ---------- - set( hTimelimitToggletool, 'state', 'off' ); - set( hQCToggletool, 'state', 'off' ); - set( hClimToggletool, 'state', 'off' ); + % Toggle button + % ------------- set( hBottleToggletool, 'state', 'off' ); set( hCalToggletool, 'state', 'off' ); + set( hClimToggletool, 'state', 'off' ); set( hInterpToggletool, 'state', 'off' ); + set( hPanToggletool, 'state', 'off' ); + set( hQCToggletool, 'state', 'off' ); + set( hTimelimitToggletool, 'state', 'off' ); + set( hZoomToggletool, 'state', 'off' ); + set( hHeaderPushtool, 'enable', 'off' ); % Pointer set to watch during reading and plotting @@ -1118,7 +1121,7 @@ end % TSG structure has been reinitialize, so the plots must be % reinitialized % --------------------------------------------------------- - resetAxes( hPlotAxes ) + resetAxes( hMainFig, hPlotAxes ) end end @@ -1131,7 +1134,7 @@ end % Draw the 3 plots of the validation figure % ----------------------------------------- - resetAxes( hPlotAxes ) + resetAxes( hMainFig, hPlotAxes ) plot_Validation( hMainFig, hPlotAxes, 1 ); plot_Validation( hMainFig, hPlotAxes, 2 ); plot_Validation( hMainFig, hPlotAxes, 3 ); @@ -1155,21 +1158,23 @@ end set( hpDateLimit, 'Visible', 'on' ); set( hpInterpPos, 'Visible', 'on' ); - % Pushbutton - % ---------- - set( hTimelimitToggletool, 'enable', 'on' ); - set( hQCToggletool, 'enable', 'off' ); - set( hClimToggletool, 'enable', 'off' ); - set( hBottleToggletool, 'enable', 'off' ); - set( hCalToggletool, 'enable', 'off' ); + % Toggle button + % ------------- + set( hBottleToggletool, 'state', 'off', 'enable', 'off' ); + set( hCalToggletool, 'state', 'off', 'enable', 'off' ); + set( hClimToggletool, 'state', 'off', 'enable', 'off' ); + set( hPanToggletool, 'state', 'off', 'enable', 'on' ); + set( hQCToggletool, 'state', 'off', 'enable', 'off' ); + set( hTimelimitToggletool, 'state', 'off', 'enable', 'on' ); + set( hZoomToggletool, 'state', 'off', 'enable', 'on' ); + set( hHeaderPushtool, 'enable', 'off' ); % 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 ); + plot_Interpolation( hMainFig, hPlotAxes, 1 ); + plot_Interpolation( hMainFig, hPlotAxes, 2 ); + plot_Interpolation( hMainFig, hPlotAxes, 3 ); end @@ -1184,20 +1189,22 @@ end set( hpCalCoef, 'Visible', 'off' ); set( hbgQc, 'Visible', 'on'); set( hpDateLimit, 'Visible', 'off' ); - set( hpInterpPos, 'Visible', 'off' ); + set( hpInterpPos, 'Visible', 'off' ); % Enable Pushbuttons % ------------------ - set( hQCToggletool, 'enable', 'on' ); - set( hTimelimitToggletool, 'enable', 'off' ); - set( hClimToggletool, 'enable', 'on' ); - set( hBottleToggletool, 'enable', 'on' ); - set( hCalToggletool, 'enable', 'on' ); + set( hBottleToggletool, 'state', 'off', 'enable', 'on' ); + set( hCalToggletool, 'state', 'off', 'enable', 'on' ); + set( hClimToggletool, 'state', 'off', 'enable', 'on' ); + set( hPanToggletool, 'state', 'off', 'enable', 'on' ); + set( hQCToggletool, 'state', 'off', 'enable', 'on' ); + set( hTimelimitToggletool, 'state', 'off', 'enable', 'off' ); + set( hZoomToggletool, 'state', 'off', 'enable', 'on' ); + set( hHeaderPushtool, 'enable', '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 ); @@ -1313,7 +1320,6 @@ 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' ); @@ -1370,7 +1376,6 @@ 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 ); @@ -1504,8 +1509,8 @@ end % Desactivate some toggle buttons % ------------------------------- - set( hQCToggletool, 'state', 'off' ); - set( hPanToggletool, 'state', 'off' ); + set( hQCToggletool, 'state', 'off' ); + set( hPanToggletool, 'state', 'off' ); set( hTimelimitToggletool, 'state', 'off' ); end @@ -2037,7 +2042,6 @@ end % Plot in the 3 axes % ------------------ - resetAxes( hPlotAxes ) plot_Correction( hMainFig, hPlotAxes ); % Get the information on time limits of the time series @@ -2090,7 +2094,6 @@ 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 );