diff --git a/tsg_io/read_file_woa01.m b/tsg_io/read_file_woa01.m new file mode 100644 index 0000000000000000000000000000000000000000..aeaa694e9ad09650cd39169957e178fb1a49393c --- /dev/null +++ b/tsg_io/read_file_woa01.m @@ -0,0 +1,60 @@ +function levitus = read_file_woa01(file) +% a mettre dans la classe de base oceano puisque commun a tous +% +% read WOA01 Levitus T-S-O2, Stddev & nb_obs Netcdf file in memory + +% $Id$ + +filesfound = checkforfiles( file ); +if filesfound == 0; + warning(['Couldn''t find ', file]); + levitus = -1; + return; +end + +% a commenter en production +% t = cputime; + +% il existe un "bug" dans netcdf ligne 409, ncitem retourne une +% erreur dans la variable result +nc = netcdf(which(file),'nowrite'); + +%recupere les variables et les mets de le workspace +variables = var(nc); + +% list les variables du fichier et sort +% if strcmp( variable, 'list' ) +% disp(char(ncnames(var(nc)))); +% return +% end + +% Initialise la waitbar de chargement du fichier netCDF +wb = waitbar(0,['Loading file: ' file ' Please wait...']); + +for i = 1:length(variables) + value = variables{i}(:); + % je n'ai pas reussi a utiliser autonan avec l'attribue FillValue_ + value(value == fillval(variables{i})) = NaN; + % Assign dynamiquely variable in struct levitus. + levitus.(name(variables{i})) = value; + % set(wb, 'Title', name(variables{i})); + waitbar( i/length(variables), wb); +end + +close(wb); +close(nc); + +% a commenter en production +% e = cputime-t +% +% builtin( 'set', findobj( 'Tag', 'main' ), 'UserData', self ); + +%---------------------------------------------------------------------- +%---------------------------------------------------------------------- +function filesfound = checkforfiles( file ) + +if exist(file,'file'); + filesfound = 1; +else + filesfound = 0; +end