From 36f97667a013d97404c343f0887f84c9b9ff0a0c Mon Sep 17 00:00:00 2001
From: Yves Gouriou <yves.gouriou@ird.fr>
Date: Thu, 29 Nov 2007 10:36:56 +0000
Subject: [PATCH] =?UTF-8?q?Test=20de=20l'integration=20du=20moudle=20de=20?=
 =?UTF-8?q?correction=20-=20Pas=20encore=20implement=C3=A9.=20Ajoute=20dan?=
 =?UTF-8?q?s=20tsg=5Fintialisation=20une=20structure=20contenant=20les=20c?=
 =?UTF-8?q?onstantes=20du=20programme?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dev_tsgcor_GUI.m              | 31 +++++++++++++++----------------
 tsg_util/tsg_initialisation.m | 35 +++++++++++++++++++++++++++++++++--
 tsgqc_GUI.m                   |  3 ++-
 3 files changed, 50 insertions(+), 19 deletions(-)

diff --git a/dev_tsgcor_GUI.m b/dev_tsgcor_GUI.m
index 5d974ca..6294586 100644
--- a/dev_tsgcor_GUI.m
+++ b/dev_tsgcor_GUI.m
@@ -1,4 +1,4 @@
-function dev_tsgcor_GUI
+function dev_tsgcor_GUI( hMainFig )
 % dev_tsgcor_GUI 
 %
 % GUI for correction of TSG data by comparison to samples
@@ -265,13 +265,16 @@ function dev_tsgcor_GUI
 
 % Lecture fichier TSG
 % -------------------
-filename = 'F:\work\M_TsgQc\tsg_data\past0601.txt';
-[tsg, error] = dev_readTsg( filename);
+% filename = 'F:\work\M_TsgQc\tsg_data\past0601.txt';
+% [tsg, error] = dev_readTsg( filename);
 
 % Lecture fichier bucket
 % -----------------------
-filename = 'F:\work\M_TsgQc\tsg_data\past0601.btl';
-[bucketASCII, error] = dev_readBucket( filename);
+% filename = 'F:\work\M_TsgQc\tsg_data\past0601.btl';
+% [bucketASCII, error] = dev_readBucket( filename);
+
+tsg    = getappdata( hMainFig, 'tsg_data' );
+sample = getappdata( hMainFig, 'sample' );
 
 % Salinity, in one 1 hour interval, should not depart the average for more
 % than SAL_STD_MAX standard deviation
@@ -291,12 +294,12 @@ COR_TIME_WINDOWS = 10;
       dev_moveaverage(tsg.TIME, tsg.PSAL, TSG_DT_SMOOTH, TSG_STDMAX);
 
 % Merge the 2 types of 'bucket' records, if they exists
-bucketNETCDF      = bucketASCII;
-bucketNETCDF.TIME = bucketNETCDF.TIME + 1;
-bucketNETCDF.PSAL = bucketNETCDF.PSAL + 1;
-bucketNETCDF = struct([]);
-sample = dev_mergesample( bucketNETCDF, bucketASCII);
-  
+%bucketNETCDF      = bucketASCII;
+%bucketNETCDF.TIME = bucketNETCDF.TIME + 1;
+%bucketNETCDF.PSAL = bucketNETCDF.PSAL + 1;
+%bucketNETCDF = struct([]);
+%sample = dev_mergesample( bucketNETCDF, bucketASCII);
+
 % Compute the sample-TSG differences
 sample = dev_diffTsgSample(tsg, psal_smooth, sample, TSG_SAMPLING_TIME);
 
@@ -645,11 +648,7 @@ axes(hPlotAxes(1));
   function QuitProgram(hObject, eventdata)
 
     delete(hChild1Fig);
-    % reset Matlab search path to default
-    rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
-    rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
-    rehash;
+
   end
       
-
 end
diff --git a/tsg_util/tsg_initialisation.m b/tsg_util/tsg_initialisation.m
index c0e1ec9..6d3019f 100644
--- a/tsg_util/tsg_initialisation.m
+++ b/tsg_util/tsg_initialisation.m
@@ -8,6 +8,10 @@ function tsg_initialisation(hTsgGUI, hQcCmenu)
 % ------
 % $Id$
 
+
+% *************************************************************************
+%              Constants for the quality control procedure
+
 % Quality Code and color
 
 qc.Color.NO_CONTROL    = 'k';
@@ -22,12 +26,39 @@ qc.Code.PROBABLY_GOOD  = 3;
 qc.Code.PROBABLY_BAD   = 4;
 qc.Code.BAD            = 5;
 
+% Store default value 'quality' a application data
+% ------------------------------------------------
 quality.Code  = qc.Code.GOOD;
 quality.Color = qc.Color.GOOD;
 set( hQcCmenu, 'UserData', quality );
 
-% Set named application data
-% -------------------------------
+% Store the 'qc' structure as application data
+% --------------------------------------------
 setappdata( hTsgGUI, 'qcColor', qc);
 
+
+% *************************************************************************
+%              Constants for the Correction procedure
+
+% Smoothing of tsg time series over 1 hour interval
+% 1 hour interval expressed in MATLAB serial Number
+% -------------------------------------------------
+const.TSG_DT_SMOOTH = datenum(0, 0, 0, 1, 0 , 0);
+
+% Smoothing of tsg time series :
+% Salinity, in one 1 hour interval, should not depart the average for more
+% than SAL_STD_MAX standard deviation
+% -----------------------------------------------------------------------
+const.TSG_STDMAX = 0.1;
+
+% Correction is estimated by computing the median value of X tsg-sample
+% differences
+% Amount of days used to compute the correction
+% ---------------------------------------------------------------------
+const.COR_TIME_WINDOWS = 10;
+
+% store the 'const' structure as an application data
+% --------------------------------------------------
+setappdata( hTsgGUI, 'constante', const);
+
 end
diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m
index 43953d4..8fa9b23 100644
--- a/tsgqc_GUI.m
+++ b/tsgqc_GUI.m
@@ -669,12 +669,13 @@ function tsgqc_GUI
 
             % Test if tsg and sample data have been loaded
             % --------------------------------------------
-            if ~isempty( getappdata( hMainFig, 'sample') ) && ...
+            if ~isempty( getappdata( hMainFig, 'tsg_data') ) && ...
                ~isempty( getappdata( hMainFig, 'sample') )
            
                 % Call the GUI for tsg correction
                 % -------------------------------
                 msgbox('The correction module has not been implemented');
+                %dev_tsgcor_GUI( hMainFig );
                 
             else
                 
-- 
GitLab