From 07caa0be30ce7058aefc2d09cbe1709486abc2f9 Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Mon, 14 Jan 2013 14:58:13 +0000
Subject: [PATCH] this file was moved to tsg_tools directory

---
 tsg_util/netcdfTOtsgqc.m | 211 ---------------------------------------
 1 file changed, 211 deletions(-)
 delete mode 100644 tsg_util/netcdfTOtsgqc.m

diff --git a/tsg_util/netcdfTOtsgqc.m b/tsg_util/netcdfTOtsgqc.m
deleted file mode 100644
index 8af9c0e..0000000
--- a/tsg_util/netcdfTOtsgqc.m
+++ /dev/null
@@ -1,211 +0,0 @@
-% Conversion d'une liste de fichier NetCDF TSG en fichier ASCCI
-%
-% La liste des fichiers netCDF doit être placé dans un dichier ASCII.
-% un nom de fichier par ligne
-%
-clear all;
-clc;
-
-% Repertoire des fichiers NetCdf en lecture
-% -----------------------------------------
-dirIn = 'D:\temp\';
-
-% Repertoire des fichiers ASCII en écriture
-% -----------------------------------------
-dirOut = dirIn;
-
-% Nom du fichier qui liste les fichiers netCdf
-% --------------------------------------------
-fichierListe = 'list_nc.txt';
-
-% Liste des paramètres à écrire - Create empty structure array
-% ------------------------------------------------------------
-PARA = { 'CNDC'; 'CNDC_CAL'; ...
-  'SSPS'; 'SSPS_QC'; 'SSPS_CAL';...
-  'SSPS_ADJUSTED'; 'SSPS_ADJUSTED_QC'; 'SSPS_ADJUSTED_ERROR'; ...
-  'SSJT'; 'SSJT_QC'; 'SSJT_CAL';...
-  'SSJT_ADJUSTED'; 'SSJT_ADJUSTED_QC'; 'SSJT_ADJUSTED_ERROR'; ...
-  'SSTP'; 'SSTP_QC'; 'SSTP_CAL';...
-  'SSTP_ADJUSTED'; 'SSTP_ADJUSTED_QC'; 'SSTP_ADJUSTED_ERROR'};
-nPara = size( PARA, 1 );
-
-% Lecture du nom des fichiers à convertir. Ceux-ci se trouvent dans
-% le fichier liste_nc.txt
-% -----------------------------------------------------------------
-list_nc = textread([dirIn fichierListe],'%s');
-
-% Conversion du nom des fichiers en caracteres
-% --------------------------------------------
-list_nc = char(list_nc);
-
-% Boucle sur les fichiers à convertir
-% ----------------------------------
-nfiles  = size(list_nc,1);
-for i = 1 : nfiles
-
-  % Create structure array
-  % ----------------------
-  tsg = struct;
-
-  fileName = deblank(list_nc(i,:));
-  display( ['Traitement du fichier : ' fileName]);
-
-  % Ouverture d'un fichier NetCdf en lecture
-  % ----------------------------------------
-  nc = netcdf([dirIn fileName],'read');
-
-  if ~isempty(nc)
-
-    % Creation et ouverture du fichier en écriture .tsgqc
-    % ---------------------------------------------------
-    ind         = find(fileName == '.');
-    fileNameOut = fileName(1 : ind-1);
-    fid         = fopen([dirOut fileNameOut '.tsgqc'],'wt');
-    display( ['          Ecriture du fichier : ' fileNameOut]);
-
-    % --------------------------------
-    % Get global attributes: meta data
-    % --------------------------------
-    global_att = att(nc);
-    for iatt = 1:length(global_att)
-
-      % extract name and value from netcdf globals attributes
-      % -----------------------------------------------------
-      attribute = name(global_att{iatt});
-      value     = global_att{iatt}(:);
-
-      % assign globals attributes in base workspace
-      % -------------------------------------------
-      assignin('base', attribute, value);
-
-      % populate tsg structure with globals attributes
-      % ----------------------------------------------
-      tsg.(attribute) = value;
-
-    end % end of attributes loop
-
-    % ----------------------------
-    % Get variables describing TSG
-    % ----------------------------
-    variables = var(nc);
-    for ivar = 1:length(variables)
-
-      % extract name and value from netcdf variables
-      % --------------------------------------------
-      variable = name(variables{ivar});
-      nv       = nc{ivar};
-
-      % use autonan mode, remplace fillValue with NaN
-      % ---------------------------------------------
-      nv = autonan(nv, true);
-
-      % populate tsg structure with netcdf variables
-      % --------------------------------------------
-      tsg.(variable) = nv(:);
-
-      % assign netcdf variables in base workspace
-      % -----------------------------------------
-      assignin('base', variable, nv(:));
-
-    end % end of variables loop
-
-    % Initialise le tableau des variables à écrire
-    % --------------------------------------------
-    nbRecords = length( tsg.DAYD );
-    tsg_data = NaN * ones(nPara+8, nbRecords);
-
-    % Selectionne les paramètres et crée le tableau en écriture
-    % --------------------------------------------------------
-    if nbRecords ~= 0
-
-      % Met en forme les dates et positions
-      % ------------------------------------
-       year  = str2num(tsg.DATE(:,1:4));
-       month = str2num(tsg.DATE(:,5:6));
-       day   = str2num(tsg.DATE(:,7:8));
-       hour  = str2num(tsg.DATE(:,10:11));
-       min   = str2num(tsg.DATE(:,12:13));
-       sec   = str2num(tsg.DATE(:,14:15));
-
-      %[year, month, day, hour, min, sec] = datevec( julianToDatenum(tsg.DAYD) );
-      tsg_data = [year month day hour min fix(sec) tsg.LATX mod(tsg.LONX+180,360)-180 ];
-      header = 'YEAR MNTH DAYX hh mi ss LATX LONX';
-      format = '%04d %02d %02d %02d %02d %02d %12.7f %12.7f';
-
-      % Boucle sur les paramètres à sauvegarder
-      % ---------------------------------------
-      for iPara = 1 : nPara
-
-        % Sélectionne le nom du paramètre
-        % -------------------------------
-        para = PARA{iPara};
-
-        if isempty(tsg.(para))
-          tsg.(para) = NaN * ones( size( tsg.DAYD ) );
-        end
-
-        if findstr( '_QC', para)
-          
-          % Test pour contourner un bug de TSGQC. Les QC devaient être castés
-          % en byte sinon la valeur 0 devenait égale à -127
-          ind = 0;
-          ind = find( tsg.(para) == -127 );
-          if ~isempty(ind)
-            tsg.(para)(ind) = 0;
-          end
-          tsg_data = [tsg_data double(tsg.(para))];
-          format   = [format ' %1d'];
-        else
-          tsg_data = [tsg_data tsg.(para)];
-          format   = [format ' %6.3f'];
-        end
-        header   = [header ' ' para];
-
-      end % Fin de boucle sur les paramètres à sauvegarder
-
-      % Write some information
-      % ----------------------
-      if ~isempty( tsg.DATE_CREATION )
-        fprintf( fid, '%%DATE_CREATION %s\n', tsg.DATE_CREATION );
-      end
-      if ~isempty( tsg.CYCLE_MESURE )
-        fprintf( fid, '%%CYCLE_MESURE %s\n', tsg.CYCLE_MESURE);
-      end
-      if ~isempty( tsg.PLATFORM_NAME )
-        fprintf( fid, '%%PLATFORM_NAME %s\n', tsg.PLATFORM_NAME);
-      end
-      if ~isempty( tsg.SHIP_CALL_SIGN )
-        fprintf( fid, '%%SHIP_CALL_SIGN %s\n', tsg.SHIP_CALL_SIGN);
-      end
-      if ~isempty( tsg.PI_NAME )
-        fprintf( fid, '%%PI_NAME %s\n', tsg.PI_NAME);
-      end
-      if ~isempty( tsg.DATA_ACQUISITION )
-        fprintf( fid, '%%DATA_ACQUISITION %s\n', tsg.DATA_ACQUISITION);
-      end
-
-      % Write the file
-      % --------------
-      fprintf( fid, '%%HEADER %s\n', header);
-      fprintf( fid, [format '\n'], tsg_data');
-
-      % Everything OK
-      % -------------
-      error = 1;
-    end   % Selectionne les paramètres et crée le tableau en écriture
-
-    fclose( fid );
-
-    % Clear the Workspace
-    % -------------------
-    clear tsg tsg_data;
-
-  else
-
-    msg_error = 'ok';
-    if isempty(nc)
-      msg_error = ['Problem  opening file : ' fileName];
-    end
-    
-  end
-end   % Find Boucle sur les fichiers à convertir
-- 
GitLab