From 31f706a821d922fcf73b7f844c6f2a300e491a6d Mon Sep 17 00:00:00 2001
From: Yves Gouriou <yves.gouriou@ird.fr>
Date: Tue, 4 Jun 2013 07:27:05 +0000
Subject: [PATCH] Permet d'entrer l'errezur que l'on associe au biais

---
 tsg_util/corTsgBias.m | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tsg_util/corTsgBias.m b/tsg_util/corTsgBias.m
index 9c09e69..5784423 100644
--- a/tsg_util/corTsgBias.m
+++ b/tsg_util/corTsgBias.m
@@ -70,9 +70,11 @@ end
 
 % Enter the bias that will be applied to PARA{1}
 % ----------------------------------------------
-prompt = ['Constant value to be applied to the ' PARA{1} ' time series'];
 defaultValue = {'0'};
+prompt = ['Constant value to be applied to the ' PARA{1} ' time series'];
 a = inputdlg(prompt,'Bias Correction',1,defaultValue);
+prompt = ['Error value to be applied to the ' PARA{1} ' time series'];
+b = inputdlg(prompt,'Bias Error',1,defaultValue);
 
 % everything OK
 % -------------
@@ -82,16 +84,18 @@ if ~isempty( a )
   % If necessary replace a comma by a point
   % ---------------------------------------
   bias = regexprep(a, ',', '.');
+  biasError = regexprep(b, ',', '.');
   
   % If bias not a numeric, str2doublereturn a NaN
   % ------------------------------------
   bias = str2double( bias );
+  biasError = str2double( biasError );
   
   if isnumeric( bias ) && ~isnan( bias)
 
     if dateMax > dateMin
 
-      if bias ~= 0
+%       if bias ~= 0
 
         % The correction is applied to the TSG between dateMin and dateMax
         % only to measurements with keptCode Quality Codes
@@ -109,9 +113,9 @@ if ~isempty( a )
             % --------------------------------------------------------
             tsg.([PARA{1} '_ADJUSTED'])(dtTsg) = tsg.(PARA{2})(dtTsg) + bias;
 
-            % The error is put to -2
-            % ----------------------
-            tsg.([PARA{1} '_ADJUSTED_ERROR'])(dtTsg) = -1;
+            % Attribute an error
+            % ------------------
+            tsg.([PARA{1} '_ADJUSTED_ERROR'])(dtTsg) = biasError;
 
             % Transfer the QC
             % ---------------
@@ -119,7 +123,7 @@ if ~isempty( a )
           end
 
         end
-      end
+%       end
 
       % Update tsg application data
       % ---------------------------
-- 
GitLab