From bbe922379af5e76f044431bd60da731414756e0b Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Tue, 1 Jun 2010 15:12:37 +0000
Subject: [PATCH] utilise POSITION_QC au lieu de POSITION_ADJUSTED_QC mis par
 erreur utilise uniquement les types natifs netcdf, soit double, float, int,
 short, byte et char

---
 @netcdf_native/write.m     | 24 ++++++++++--------------
 tsg_util/castByteQC.m      |  2 +-
 tsg_util/updateTsgStruct.m |  2 +-
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/@netcdf_native/write.m b/@netcdf_native/write.m
index 53fd7ef..fe1bc12 100644
--- a/@netcdf_native/write.m
+++ b/@netcdf_native/write.m
@@ -262,18 +262,16 @@ for i=1:numel(ncv_keys)
     % ------------------------------------------------------
     if isnumeric(value)
       switch s.type__
-        case {'double', 'real'}
+        case 'double'
           value = double(value);
-        case {'float', 'single'}
+        case 'float'
           value = single(value);
-        case {'int', 'integer', 'int32'}
+        case 'int'
           value = int32(value);
-        case {'short', 'int16'}
+        case 'short'
           value = int16(value);
-        case {'int8'}
+        case 'byte'
           value = int8(value);
-        case {'byte', 'uint8'}
-          value = uint8(value);
         case 'char'
           value = char(value);
       end
@@ -352,18 +350,16 @@ for i=1:numel(ncv_keys)
   % cast variable with the right netcdf nctype
   % ------------------------------------------
   switch s.type__
-    case {'double', 'real'}
+    case 'double'
       value = double(s.data__);
-    case {'float', 'single'}
+    case 'float'
       value = single(s.data__);
-    case {'int', 'integer', 'int32'}
+    case 'int'
       value = int32(s.data__);
-    case {'short', 'int16'}
+    case 'short'
       value = int16(s.data__);
-    case {'int8'}
+    case 'byte'
       value = int8(s.data__);
-    case {'byte', 'uint8'}
-      value = uint8(s.data__);
     case 'char'
       value = char(s.data__);
   end
diff --git a/tsg_util/castByteQC.m b/tsg_util/castByteQC.m
index a08ce7d..2389d32 100644
--- a/tsg_util/castByteQC.m
+++ b/tsg_util/castByteQC.m
@@ -8,6 +8,6 @@ function [tabOut] = castByteQC( code, tabIn )
 % $Id$
 
 
- tabOut = uint8(code) * uint8( ones(size(tabIn) ));
+ tabOut = int8(code) * int8( ones(size(tabIn) ));
  
 end
diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m
index 6dbb73e..384a39f 100644
--- a/tsg_util/updateTsgStruct.m
+++ b/tsg_util/updateTsgStruct.m
@@ -92,7 +92,7 @@ end
 
 % initialize POSITION_QC
 % ----------------------
-tsg.('POSITION_ADJUSTED_QC') = castByteQC( NO_CONTROL, tsg.DAYD );
+tsg.('POSITION_QC') = castByteQC( NO_CONTROL, tsg.DAYD );
 
 % Empty variables filled with NaN
 % -------------------------------
-- 
GitLab