diff --git a/tsg_util/corTsgLinear.m b/tsg_util/corTsgLinear.m index c93a303269e6774db39a6a83348eaf6422c1507d..4d4f3a58de33288254234b055b00d0b433471749 100644 --- a/tsg_util/corTsgLinear.m +++ b/tsg_util/corTsgLinear.m @@ -14,7 +14,6 @@ function [error] = corTsgLinear(hMainFig, dateMin, dateMax) % Get application data % -------------------- tsg = getappdata( hMainFig, 'tsg_data'); -sample = getappdata( hMainFig, 'sample'); % Get PROBABLY_GOOD, PROBABLY_BAD and VALUE_CHANGED codes % ------------------------------------------------------- @@ -34,24 +33,24 @@ if dateMax > dateMin % Find samples within TIME_WINDOWS with Good and probably Good QC % --------------------------------------------------------------- - ind = find( sample.DAYD >= dateMin & sample.DAYD <= dateMax &... - sample.SSPS_QC <= PROBABLY_GOOD); + ind = find( tsg.DAYD_SPL >= dateMin & tsg.DAYD_SPL <= dateMax &... + tsg.SSPS_SPL_QC <= PROBABLY_GOOD); if ~isempty(ind) % detect NaN in sample.SSPS_DIF due to bad QC code for tsg.SSPS % ------------------------------------------------------------- - ind2 = find(~isnan(sample.SSPS_DIF(ind))); + ind2 = find(~isnan(tsg.SSPS_SPL_DIF(ind))); % Compute linear fit of the TSG/SAMPLE difference % ----------------------------------------------- if ~isempty(ind2) - if ~isempty(sample.SSPS_DIF(ind(ind2))) + if ~isempty(tsg.SSPS_SPL_DIF(ind(ind2))) % Linear fit applied to the difference tsg-sample % ----------------------------------------------- - X = sample.DAYD(ind(ind2)); - Y = sample.SSPS_DIF(ind(ind2)); + X = tsg.DAYD_SPL(ind(ind2)); + Y = tsg.SSPS_SPL_DIF(ind(ind2)); [p, S, mu] = polyfit( X, Y, 1); @@ -76,7 +75,6 @@ if dateMax > dateMin % Update tsg application data % --------------------------- setappdata( hMainFig, 'tsg_data', tsg); - setappdata( hMainFig, 'sample', sample); % everything OK % ------------- diff --git a/tsg_util/corTsgMedian.m b/tsg_util/corTsgMedian.m index 853af40f2cc78bba70a5db5e02ef5cc5341bfab3..e16e115e420f97fd5ad396db0c97b5ccbbabdda2 100644 --- a/tsg_util/corTsgMedian.m +++ b/tsg_util/corTsgMedian.m @@ -22,7 +22,6 @@ function [error] = corTsgMedian(hMainFig, dateMin, dateMax) % Get application data % -------------------- tsg = getappdata( hMainFig, 'tsg_data'); -sample = getappdata( hMainFig, 'sample'); % Shorten the variable name % ------------------------- @@ -51,7 +50,7 @@ if dateMax > dateMin % Find the indices of samples within the time limits. % -------------------------------------------------- - indSample = find(sample.DAYD >= dateMin & sample.DAYD <= dateMax); + indSample = find(tsg.DAYD_SPL >= dateMin & tsg.DAYD_SPL <= dateMax); indCor = 0; for i = 1:length(indSample) @@ -59,22 +58,22 @@ if dateMax > dateMin % Find samples within TIME_WINDOWS with Good and probably Good QC % --------------------------------------------------------------- - ind = find( sample.DAYD >= (sample.DAYD(indSample(i)) - TIME_WINDOWS/2) &... - sample.DAYD <= (sample.DAYD(indSample(i)) + TIME_WINDOWS/2) &... - sample.SSPS_QC <= PROBABLY_GOOD); + ind = find( tsg.DAYD_SPL >= (tsg.DAYD_SPL(indSample(i)) - TIME_WINDOWS/2) &... + tsg.DAYD_SPL <= (tsg.DAYD_SPL(indSample(i)) + TIME_WINDOWS/2) &... + tsg.SSPS_SPL_QC <= PROBABLY_GOOD); if ~isempty(ind) % detect NaN in sample.SSPS_DIF due to bad QC code in tsg.SSPS % ------------------------------------------------------------ - ind2 = find(~isnan(sample.SSPS_DIF(ind))); + ind2 = find(~isnan(tsg.SSPS_SPL_DIF(ind))); % Compute the median difference and error within TIME_WINDOWS % ----------------------------------------------------------- if ~isempty(ind2) - if ~isempty(sample.SSPS_DIF(ind(ind2))) + if ~isempty(tsg.SSPS_SPL_DIF(ind(ind2))) - A = sample.SSPS_DIF(ind(ind2)); + A = tsg.SSPS_SPL_DIF(ind(ind2)); meanA = mean(A); stdA = std(A); @@ -82,10 +81,10 @@ if dateMax > dateMin % ------------------------------------------ ind3 = find( A >= meanA-3*stdA & A <= meanA+3*stdA); - B = sample.SSPS_DIF(ind(ind2(ind3))); + B = tsg.SSPS_SPL_DIF(ind(ind2(ind3))); if ~isempty( B ) indCor = indCor + 1; - cor.DAYD(indCor) = sample.DAYD((indSample(i))); + cor.DAYD(indCor) = tsg.DAYD_SPL((indSample(i))); cor.DIFF(indCor) = median(B); cor.ERROR(indCor) = nanstd(B)/sqrt(length(B)); cor.NVALUE(indCor) = length(B); @@ -96,7 +95,7 @@ if dateMax > dateMin % ------------------------------------------------------ ind4 = find( A < meanA-3*stdA | A > meanA+3*stdA); if ~isempty( ind4 ) - sample.SSPS_QC(ind(ind2(ind4))) = PROBABLY_BAD; + tsg.SSPS_SPL_QC(ind(ind2(ind4))) = PROBABLY_BAD; end end end @@ -160,7 +159,6 @@ if dateMax > dateMin % Update tsg application data % --------------------------- setappdata( hMainFig, 'tsg_data', tsg); - setappdata( hMainFig, 'sample', sample); % everything OK % ------------- diff --git a/tsg_util/diffTsgSample.m b/tsg_util/diffTsgSample.m index d45d9780c7e4f8526801794580d26b7a3717fc96..624a16bd62b078001d63706775348912d82b20de 100644 --- a/tsg_util/diffTsgSample.m +++ b/tsg_util/diffTsgSample.m @@ -7,7 +7,6 @@ function diffTsgSample(hTsgGUI) % Get the tsg and sample structures from the application % ------------------------------------------------------ tsg = getappdata( hTsgGUI, 'tsg_data'); -sample = getappdata( hTsgGUI, 'sample' ); % Get PROBABLY_GOOD code % ---------------------- @@ -17,7 +16,7 @@ probablyGoodCode = get(tsg.qc.hash, 'PROBABLY_GOOD', 'code'); % ------------------------------------------------------------------- indTsg = find( tsg.SSPS_QC <= probablyGoodCode ); -[m, n] = size(sample.SSPS); +[m, n] = size(tsg.SSPS_SPL); % time difference between 2 successive TSG measurements % Not use anymore. Now use a constant tsg.cst.TSG_WS_TIMEDIFF in the test @@ -28,11 +27,11 @@ indTsg = find( tsg.SSPS_QC <= probablyGoodCode ); % ---------------------------------------------------------------- for i= 1 : m - if sample.SSPS_QC(i) <= probablyGoodCode + if tsg.SSPS_SPL_QC(i) <= probablyGoodCode % Compute the differences between the sample and the time serie % ------------------------------------------------------------- - timeDiff = abs(tsg.DAYD - sample.DAYD(i)); + timeDiff = abs(tsg.DAYD - tsg.DAYD_SPL(i)); % Compute the indice of the TSG measurement the closest to the sample % taking into account the TSG quality code @@ -45,7 +44,7 @@ for i= 1 : m if timeDiff(indMin) < tsg.cst.TSG_WS_TIMEDIFF && ... ~isnan(tsg.ssps_smooth(indMin)) - sample.SSPS_SMOOTH(i) = tsg.ssps_smooth(indMin); + tsg.SSPS_SPL_SMOOTH(i) = tsg.ssps_smooth(indMin); end end @@ -53,8 +52,8 @@ end % Salinity difference : Sample minus smoothed TSG % ----------------------------------------------- -sample.SSPS_DIF = sample.SSPS - sample.SSPS_SMOOTH; +tsg.SSPS_SPL_DIF = tsg.SSPS_SPL - tsg.SSPS_SPL_SMOOTH; % update the sample structures in the application % ------------------------------------------------ -setappdata( hTsgGUI, 'sample', sample ); \ No newline at end of file +setappdata( hTsgGUI, 'tsg_data', tsg ); \ No newline at end of file diff --git a/tsg_util/plot_Correction.m b/tsg_util/plot_Correction.m index c5f40e409a77d5c3744db3e8e2d1159509a24b31..233b52603a8472b63e062aad1d9a99e2a6aa8240 100644 --- a/tsg_util/plot_Correction.m +++ b/tsg_util/plot_Correction.m @@ -10,9 +10,23 @@ erase_Line( hPlotAxes, 3 ); % Get tsg application data % ------------------------ tsg = getappdata( hMainFig, 'tsg_data'); -sample = getappdata( hMainFig, 'sample'); -plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] ); +% Plot the samples +% ---------------- +if ~isempty( tsg.SSPS_SPL ) + ind = find( tsg.SSPS_SPL_TYPE == 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(ind),... + tsg.SSPS_SPL_DIF(ind), tsg.SSPS_SPL_QC(ind),... + 'SSPS_SPL_1','','none','square',5); + end + ind = find( tsg.SSPS_SPL_TYPE > 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(ind),... + tsg.SSPS_SPL_DIF(ind), tsg.SSPS_SPL_QC(ind),... + 'SSPS_SPL_2','','none','o',5); + end +end % Get the code for VALUE_CHANGED % ------------------------------ @@ -20,38 +34,52 @@ VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code'); % Select the record with VALUE_CHANGED code % ----------------------------------------- -ind = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED); +indVC = find( tsg.SSPS_ADJUSTED_QC == VALUE_CHANGED); % Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 1 % ------------------------------------------------------- plot_Tsg( hMainFig, hPlotAxes, 1,... - tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind)-tsg.SSPS(ind),... - [], 'SSPS_ADJUSTED','b','none','.',1); + tsg.DAYD(indVC), tsg.SSPS_ADJUSTED(indVC)-tsg.SSPS(indVC),... + [], 'SSPS_ADJUSTED','b','none','.',1); % Plot SSPS and SAMPLE, with code color, on axe 2 % ------------------------------------------------ plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','*',2); -plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] ); + 'SSPS','','none','*',2); + +if ~isempty( tsg.SSPS_SPL ) + ind = find( tsg.SSPS_SPL_TYPE == 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD_SPL(ind),... + tsg.SSPS_SPL(ind), tsg.SSPS_SPL_QC(ind),... + 'SSPS_SPL_1','','none','square',5); + end + ind = find( tsg.SSPS_SPL_TYPE > 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD_SPL(ind),... + tsg.SSPS_SPL(ind), tsg.SSPS_SPL_QC(ind),... + 'SSPS_SPL_2','','none','o',5); + end +end % Plot SSPS, with no code, on axe3 % -------------------------------- plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS,... - [],'SSPS','k','none','.',1); + [],'SSPS','k','none','.',1); % Plot TSG_ADJUSTED + ERROR on axe 3 % ----------------------------------- -plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(ind),... - tsg.SSPS_ADJUSTED(ind) + tsg.SSPS_ADJUSTED_ERROR(ind),... - [], 'SSPS_ADJUSTED','g','none','.',1); -plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(ind),... - tsg.SSPS_ADJUSTED(ind) - tsg.SSPS_ADJUSTED_ERROR(ind),... - [], 'SSPS_ADJUSTED','g','none','.',1); +plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(indVC),... + tsg.SSPS_ADJUSTED(indVC) + tsg.SSPS_ADJUSTED_ERROR(indVC),... + [], 'SSPS_ADJUSTED','g','none','.',1); +plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD(indVC),... + tsg.SSPS_ADJUSTED(indVC) - tsg.SSPS_ADJUSTED_ERROR(indVC),... + [], 'SSPS_ADJUSTED','g','none','.',1); % Plot SSPS_ADJUSTED on axe 3 % --------------------------- plot_Tsg( hMainFig, hPlotAxes, 3,... - tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind), [],... - 'SSPS_ADJUSTED','r','none','.',3); + tsg.DAYD(indVC), tsg.SSPS_ADJUSTED(indVC), [],... + 'SSPS_ADJUSTED','r','none','.',3); end diff --git a/tsg_util/plot_Validation.m b/tsg_util/plot_Validation.m new file mode 100644 index 0000000000000000000000000000000000000000..2bf0fb016fa95afbd0892cdc7ea98dd9f425d675 --- /dev/null +++ b/tsg_util/plot_Validation.m @@ -0,0 +1,58 @@ +function plot_Validation( hMainFig, hPlotAxes, nPlot ) + +% Get tsg application data +% ------------------------ +tsg = getappdata( hMainFig, 'tsg_data'); + +switch nPlot + + % --------------------------------------------------------------------- + case 1 + + erase_Line( hPlotAxes, 1 ); + if ~isempty( tsg.ssps_smooth ) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],... + 'SSPS_SMOOTH','k','-','*',2); + end + + if ~isempty( tsg.SSPS ) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... + 'SSPS','','none','*',2); + end + + % Plot Salinity bucket + % -------------------- + if ~isempty( tsg.SSPS_SPL ) + ind = find( tsg.SSPS_SPL_TYPE == 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(ind), tsg.SSPS_SPL(ind),... + tsg.SSPS_SPL_QC(ind),'SSPS_SPL_1','','none','square',5); + end + ind = find( tsg.SSPS_SPL_TYPE > 1 ); + if ~isempty(ind) + plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD_SPL(ind), tsg.SSPS_SPL(ind),... + tsg.SSPS_SPL_QC(ind),'SSPS_SPL_2','','none','o',5); + end + end + + % --------------------------------------------------------------------- + case 2 + + erase_Line( hPlotAxes, 2 ); + if ~isempty( tsg.SSJT ) + plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],... + 'SSJT','k','none','*',2); + end + + % --------------------------------------------------------------------- + case 3 + erase_Line( hPlotAxes, 3 ); + if ~isempty( tsg.SPDC ) + plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],... + 'SPDC','k','none','*',2); + end +end + +axesCommonProp( hPlotAxes ); + +end diff --git a/tsg_util/tsg_initialisation.m b/tsg_util/tsg_initialisation.m index c067b5362ee5a92426783ec79b686897051f3744..ce4e233c38eaf51caa04f8d172f055bf9304f394 100644 --- a/tsg_util/tsg_initialisation.m +++ b/tsg_util/tsg_initialisation.m @@ -48,8 +48,15 @@ tsg.file.type = []; % ------------------------------------------------------------------------- %% Smooth TSG time serie field % ------------------------------------------------------------------------- -tsg.ssps.smooth.val = []; -tsg.ssps.smooth.nval = []; +tsg.ssps_smooth = []; +tsg.ssps_smooth.nval = []; + +% ------------------------------------------------------------------------- +%% Structure used to merge WS and EXT sample +% need to be intialise (isempty test performed on tsg.SSPS_SPL +% ------------------------------------------------------------------------- +tsg.DAYD_SPL = []; +tsg.SSPS_SPL = []; % ------------------------------------------------------------------------- %% Constants for the quality control procedure diff --git a/tsg_util/tsg_mergesample.m b/tsg_util/tsg_mergesample.m index ea309d43ef89812938d9367ddb04f520bd97a013..a4616e8f2f10269d53fceebbedcd23e42c5a31c0 100644 --- a/tsg_util/tsg_mergesample.m +++ b/tsg_util/tsg_mergesample.m @@ -95,8 +95,20 @@ if ~isempty(sample) sample.SSPS_DIF = sample.SSPS_DIF(iOrder); sample.SSPS_SMOOTH = sample.SSPS_SMOOTH(iOrder); sample.SSPS_TYPE = sample.SSPS_TYPE(iOrder); + + % put the structure smaple in the tsg structure + % --------------------------------------------- + tsg.DAYD_SPL = sample.DAYD; + tsg.LATX_SPL = sample.LATX; + tsg.LONX_SPL = sample.LONX; + tsg.SSPS_SPL = sample.SSPS; + tsg.SSPS_SPL_QC = sample.SSPS_QC; + tsg.SSPS_SPL_DIF = sample.SSPS_DIF; + tsg.SSPS_SPL_SMOOTH = sample.SSPS_SMOOTH; + tsg.SSPS_SPL_TYPE = sample.SSPS_TYPE; + end -% Update application data sample -% ------------------------------ -setappdata( hTsgGUI, 'sample', sample ); +% Update application data +% ----------------------- +setappdata( hTsgGUI, 'tsg_data', tsg ); diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m index 322fe1b49b006d8ebe8ec4f7c893f10bef6ebe1a..3ccd8b9e2c6b13246e50378bc3f2bf965f225adb 100644 --- a/tsgqc_GUI.m +++ b/tsgqc_GUI.m @@ -782,28 +782,22 @@ if strcmp(root.preference.autoload, 'on') % ---------------------------------- tsg_moveaverage(hMainFig); - % Get application data before drawing - % ----------------------------------- + % Get application data for the test + % --------------------------------- tsg = getappdata( hMainFig, 'tsg_data'); - % yes, plot the Salinity, temperature and velocity - % ------------------------------------------------ - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],... - 'SSPS','k','none','.',1); - - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','.',1); - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],... - 'SSJT','k','none','.',1); - plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],... - 'SPDC','k','none','.',1); - axesCommonProp( hPlotAxes ); - if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT ) tsg_mergesample( hMainFig ); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] ); end - + + % Draw the 3 plots of the validation figure + % ----------------------------------------- + plot_Validation( hMainFig, hPlotAxes, 1 ); + plot_Validation( hMainFig, hPlotAxes, 2 ); + plot_Validation( hMainFig, hPlotAxes, 3 ); + + % Draw the map with the ship track + % -------------------------------- plot_map( hMainFig, hPlotAxes); % The callback to detect the mouse motion can be set to on @@ -908,26 +902,9 @@ end % ---------------------------------- tsg_moveaverage(hMainFig); - % Get application data - % -------------------- - tsg = getappdata( hMainFig, 'tsg_data'); - % The callback to detect the mouse motion can be set to on % -------------------------------------------------------- set( hMainFig, 'UserData', 'ButtonMotionOn'); - - % Make the Salinity, temperature and velocity plot - % ------------------------------------------------ - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],... - 'SSPS','k','-','*',2); - - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','*',2); - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],... - 'SSJT','k','none','*',2); - plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],... - 'SPDC','k','none','*',2); - axesCommonProp( hPlotAxes ); % Update QC statistics % -------------------- @@ -935,19 +912,24 @@ end end end + + % Get application data + % -------------------- + tsg = getappdata( hMainFig, 'tsg_data'); % Merge bucket and external samples % --------------------------------- if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT ) tsg_mergesample( hMainFig ); + tsg = getappdata( hMainFig, 'tsg_data'); end - % Plot Salinity bucket - % -------------------- - if error2 ~= -1 - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] ); - end - + % Draw the 3 plots of the validation figure + % ----------------------------------------- + plot_Validation( hMainFig, hPlotAxes, 1 ); + plot_Validation( hMainFig, hPlotAxes, 2 ); + plot_Validation( hMainFig, hPlotAxes, 3 ); + % Pointer reset to arrow % ---------------------- set( hMainFig, 'Pointer', 'arrow' ); @@ -1134,8 +1116,7 @@ end % Retrieve named application data % ------------------------------- - sample = getappdata( hMainFig, 'sample'); - tsg = getappdata( hMainFig, 'tsg_data'); + tsg = getappdata( hMainFig, 'tsg_data'); % Selection of the data within the figure % --------------------------------------- @@ -1163,8 +1144,8 @@ end % get index on selected zone % -------------------------- - ind = find(sample.DAYD > p1(1,1) & sample.DAYD < p2(1,1) & ... - sample.SSPS_DIF > p1(1,2) & sample.SSPS_DIF < p2(1,2)); + ind = find(tsg.DAYD_SPL > p1(1,1) & tsg.DAYD_SPL < p2(1,1) & ... + tsg.SSPS_SPL_DIF > p1(1,2) & tsg.SSPS_SPL_DIF < p2(1,2)); % Keep the information on the indices of the selected zone % -------------------------------------------------------- @@ -1172,21 +1153,15 @@ end % Modifiy the QC % -------------- - sample.SSPS_QC(ind) = tsg.qc.active.Code; + tsg.SSPS_SPL_QC(ind) = tsg.qc.active.Code; % Save the modifications % ---------------------- setappdata( hMainFig, 'tsg_data', tsg); - setappdata( hMainFig, 'sample', sample); % plot selected data with selected code % -------------------------------------- - erase_Line( hPlotAxes, 1 ); - erase_Line( hPlotAxes, 2 ); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] ); - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','.',1); - plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] ); + plot_Correction( hMainFig, hPlotAxes); else @@ -1215,12 +1190,9 @@ end % ---------------------- setappdata( hMainFig, 'tsg_data', tsg); - % plot selected data with selected code - % -------------------------------------- - erase_Line( hPlotAxes, 1 ); - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','.',1); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] ); + % Draw plot 1 of the validation figure + % ------------------------------------ + plot_Validation( hMainFig, hPlotAxes, 1 ); % refresh QC statistic panel % -------------------------- @@ -1256,7 +1228,6 @@ end % Retrieve Default Quality Code and Color % --------------------------------------- tsg = getappdata( hMainFig, 'tsg_data'); - sample = getappdata( hMainFig, 'sample'); % get key and some values in hashtable % ------------------------------------ @@ -1274,22 +1245,16 @@ end if strcmp( get(hBottleToggletool, 'state'), 'on') - sample.SSPS_QC(tsg.rbboxind) = tsg.qc.active.Code; + tsg.SSPS_SPL_QC(tsg.rbboxind) = tsg.qc.active.Code; % Save tsg.SSPS_QC and tsg.qc.active.Code % in the application data % ---------------------------------------- - setappdata( hMainFig, 'sample', sample); setappdata( hMainFig, 'tsg_data', tsg ); - % Plot selected data with the new codes - % -------------------------------------- - erase_Line( hPlotAxes, 1 ); - erase_Line( hPlotAxes, 2 ); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] ); - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','.',1); - plot_Sample( hMainFig, hPlotAxes, 2, 'SSPS', [] ); + % Draw the 3 plots of the Correction figure + % ----------------------------------------- + plot_Correction( hMainFig, hPlotAxes ); else tsg.SSPS_QC(tsg.rbboxind) = tsg.qc.active.Code; @@ -1297,13 +1262,11 @@ end % Save tsg.SSPS_QC in the application data % ---------------------------------------- setappdata( hMainFig, 'tsg_data', tsg ); + + % Draw plot 1 of the validation figure + % ------------------------------------ + plot_Validation( hMainFig, hPlotAxes, 1 ); - % Plot the TSG data with new codes - % -------------------------------- - erase_Line( hPlotAxes, 1 ); - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','.',1); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] ); end end @@ -1428,8 +1391,8 @@ end % Dynamically display data in uicontrol % ------------------------------------- - %if x > tsg.DAYD(1) && x < tsg.DAYD(end) - if x > limx(1) && x < limx(2) + if x > tsg.DAYD(1) && x < tsg.DAYD(end) + %if x > limx(1) && x < limx(2) indCursor = find( tsg.DAYD > x); set( hInfoDateText, 'String',... @@ -1533,7 +1496,7 @@ end set( hZoomToggletool, 'state', 'off' ); set( hQCToggletool, 'state', 'off' ); set( hPanToggletool, 'state', 'off' ); - + % Activate some toolbar buttons % ----------------------------- hdl_Toggletool = findobj('-regexp','Tag', 'CORRECT_'); @@ -1541,7 +1504,7 @@ end % Test if tsg and sample data have been loaded % -------------------------------------------- - if ~isempty( tsg.SSPS_WS ) || ~isempty( tsg.SSPS_EXT ) + if ~isempty( tsg.SSPS_SPL ) % Compute the sample-TSG differences % ---------------------------------- @@ -1574,10 +1537,6 @@ end % Callback function run when the bootle push tool is selected %--------------------------------------------------------------------- function Bottle_OffMenuCallback(hObject, eventdata) - - % Transfert de la structure Sample à la structure - % RESTE A ECRIRE - % ----------------------------------------------- % Activate the Climatology button % ------------------------------- @@ -1600,26 +1559,18 @@ end % Desactivate Click Mouse on figure % --------------------------------- set( hMainFig, 'WindowButtonDownFcn', []); + + % Drawing only necessary if the Correction moduel has been activated + % ------------------------------------------------------------------ + if ~isempty( tsg.SSPS_SPL ) + + % Draw the 3 plots of the validation figure + % ----------------------------------------- + plot_Validation( hMainFig, hPlotAxes, 1 ); + plot_Validation( hMainFig, hPlotAxes, 2 ); + plot_Validation( hMainFig, hPlotAxes, 3 ); + end - % Plot the SSS, SST and Velocity - % ------------------------------ - erase_Line( hPlotAxes, 1 ); - erase_Line( hPlotAxes, 2 ); - erase_Line( hPlotAxes, 3 ); - - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.ssps_smooth, [],... - 'SSPS','k','-','*',2); - - plot_Tsg( hMainFig, hPlotAxes, 1, tsg.DAYD, tsg.SSPS, tsg.SSPS_QC,... - 'SSPS','','none','*',2); - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS', [] ); - plot_Tsg( hMainFig, hPlotAxes, 2, tsg.DAYD, tsg.SSJT,[],... - 'SSJT','k','none','*',2); - plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SPDC,[],... - 'SPDC','k','none','*',2); - - axesCommonProp( hPlotAxes ); - end %% SelectTime_OnMenuCallback ............................ Correction module @@ -1745,13 +1696,10 @@ end tsg.SSPS_ADJUSTED_QC = tsg.SSPS_QC; setappdata(hMainFig, 'tsg_data', tsg); - - % Reinitialise plot 1 and 3 - % ------------------------- - erase_Line( hPlotAxes, 1 ) - plot_Sample( hMainFig, hPlotAxes, 1, 'SSPS_DIF', [] ); - erase_Line( hPlotAxes, 3 ) - plot_Tsg( hMainFig, hPlotAxes, 3, tsg.DAYD, tsg.SSPS, [], 'SSPS','k','none','.',1); + + % Plot in the 3 axes + % ------------------ + plot_Correction( hMainFig, hPlotAxes ); end