Hello community,

here is the log from the commit of package octave-forge-ncarray for 
openSUSE:Factory checked in at 2019-11-28 10:15:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-ncarray (Old)
 and      /work/SRC/openSUSE:Factory/.octave-forge-ncarray.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "octave-forge-ncarray"

Thu Nov 28 10:15:01 2019 rev:2 rq:751371 version:1.0.4

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/octave-forge-ncarray/octave-forge-ncarray.changes    
    2015-06-16 15:12:48.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.octave-forge-ncarray.new.26869/octave-forge-ncarray.changes
     2019-11-28 10:15:32.163638027 +0100
@@ -1,0 +2,7 @@
+Wed Nov 27 14:12:32 UTC 2019 - Stefan BrĂ¼ns <[email protected]>
+
+- Update to version 1.0.4:
+  * Avoid obsolete strmatch function
+  * Use a tolerance in test script (bug #49391)
+
+-------------------------------------------------------------------

Old:
----
  ncarray-1.0.3.tar.gz

New:
----
  ncarray-1.0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ octave-forge-ncarray.spec ++++++
--- /var/tmp/diff_new_pack.c9osH6/_old  2019-11-28 10:15:32.567638032 +0100
+++ /var/tmp/diff_new_pack.c9osH6/_new  2019-11-28 10:15:32.567638032 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package octave-forge-ncarray
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,19 +12,19 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %define octpkg  ncarray
 Name:           octave-forge-%{octpkg}
-Version:        1.0.3
+Version:        1.0.4
 Release:        0
 Summary:        Access to NetCDF files as a multi-dimensional array from Octave
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Scientific/Math
-Url:            http://octave.sourceforge.net
-Source0:        
http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
+URL:            https://octave.sourceforge.io
+Source0:        
https://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
 BuildArch:      noarch
 BuildRequires:  octave-devel
 Requires:       octave-cli >= 3.4.0

++++++ ncarray-1.0.3.tar.gz -> ncarray-1.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/DESCRIPTION new/ncarray/DESCRIPTION
--- old/ncarray/DESCRIPTION     2014-05-04 21:49:45.000000000 +0200
+++ new/ncarray/DESCRIPTION     2016-11-29 15:41:59.000000000 +0100
@@ -1,6 +1,6 @@
 Name: ncarray
-Version: 1.0.3
-Date: 2014-05-04
+Version: 1.0.4
+Date: 2016-11-29
 Author: Alexander Barth <[email protected]>
 Maintainer: Alexander Barth <[email protected]>
 Title: ncarray
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/NEWS new/ncarray/NEWS
--- old/ncarray/NEWS    2014-05-04 21:49:45.000000000 +0200
+++ new/ncarray/NEWS    2016-11-29 15:41:59.000000000 +0100
@@ -1,3 +1,9 @@
+Summary of important user-visible changes for ncarray 1.0.4:
+------------------------------------------------------------
+
+ ** Avoid obsolete strmatch function
+ ** Use a tolerance in test script (bug #49391)
+
 Summary of important user-visible changes for ncarray 1.0.3:
 ------------------------------------------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@BaseArray/nanvar.m 
new/ncarray/inst/@BaseArray/nanvar.m
--- old/ncarray/inst/@BaseArray/nanvar.m        2013-12-19 16:06:03.000000000 
+0100
+++ new/ncarray/inst/@BaseArray/nanvar.m        2016-11-29 15:41:59.000000000 
+0100
@@ -32,7 +32,7 @@
 function x = funelem(x,nm)
   % make sure x is not an ncArray
   x = full(x);
-  mask = isnan(x) || isnan(nm);
+  mask = isnan(x) | isnan(nm);
   diff = zeros(size(x));
   diff(mask) = x(mask) - nm(mask);
   x = {diff.^2, ~mask};  
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@CatArray/subsref.m 
new/ncarray/inst/@CatArray/subsref.m
--- old/ncarray/inst/@CatArray/subsref.m        2013-08-01 16:00:08.000000000 
+0200
+++ new/ncarray/inst/@CatArray/subsref.m        2016-11-29 15:41:59.000000000 
+0100
@@ -2,17 +2,20 @@
 
 % handle case with a single subscript
 % for example CA(234)
-
 if strcmp(idx.type,'()') && length(idx.subs) == 1
     % indices of elements in B
     ind = idx.subs{1};
-    
+
+    if strcmp(ind,':')
+        ind = [1:numel(self)]';
+    end
+
     % output array
     B = zeros(size(ind));
     B(:) = NaN;
     
     if self.overlap 
-        % transform index to subscript
+        % transform linear index ind to subscript subs
         subs = cell(1,self.nd);
         [subs{:}] = ind2sub(size(self),ind);
         
@@ -26,22 +29,7 @@
         
         for i=1:length(ind)
             idxe.subs = mat2cell(subs(i,:),1,ones(1,self.nd));
-            %B(i) = subsref_canonical(self,idxe);
-            
-            [idx_global,idx_local,sz] = idx_global_local_(self,idxe);
-            tmp = zeros(sz);
-            tmp(:) = NaN;
-            
-            
-            for j=1:self.na
-                % get subset from j-th array
-                subset = subsref(self.arrays{j},idx_local{j});
-                
-                % set subset in global array B
-                tmp = subsasgn(tmp,idx_global{j},subset);
-            end
-            B(i) = tmp;
-            
+            B(i) = subsref_canonical(self,idxe);
         end
     else
         % assume all arrays does not overlap
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncArray/display.m 
new/ncarray/inst/@ncArray/display.m
--- old/ncarray/inst/@ncArray/display.m 2013-07-29 15:50:13.000000000 +0200
+++ new/ncarray/inst/@ncArray/display.m 2016-11-29 15:41:59.000000000 +0100
@@ -10,8 +10,13 @@
 
 for i = 1:length(c)
   tmp = sprintf('%dx',size(c(i).val));
-  fprintf('  Name: "%s" standard name: "%s" size %s\n',...
-          c(i).name,c(i).standard_name,tmp(1:end-1));
+  stdname = c(i).standard_name;
+  if isempty(stdname)
+     stdname = '<unset>';
+  end
+
+  fprintf('  Name: %15s; standard name: %25s; size %10s\n',...
+          c(i).name,stdname,tmp(1:end-1));
 end
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncArray/load.m 
new/ncarray/inst/@ncArray/load.m
--- old/ncarray/inst/@ncArray/load.m    2013-07-29 15:50:32.000000000 +0200
+++ new/ncarray/inst/@ncArray/load.m    2016-11-29 15:41:59.000000000 +0100
@@ -2,6 +2,7 @@
 % Load a subset of a variable based on range of coordiante variables.
 % The names of the coordinates (coord_name1, coord_name2,...) coorespond to 
the standard_name attribute.
 % Only 1-dimensional coordinates are currently supported.
+% Time units are converted to "datenum".
 %
 %
 % Example
@@ -15,6 +16,18 @@
   c(i).v = full(c(i).val);  
   % per default take all data along a dimension
   c(i).index = ':';
+
+  % convert time units
+  if ~isempty(strfind(c(i).units,'since'))     
+    [t0,f] = nctimeunits(c(i).units);    
+    c(i).v = f*double(c(i).v) + t0;
+  end
+
+  % change vertical axis to positive up
+  if strcmp(c(i).positive,'down')
+    c(i).v = -double(c(i).v);
+  end
+
   c(i).sub = c(i).v;
 end
 
@@ -38,7 +51,11 @@
   if numel(range) == 1
     dist = abs(c(j).v - range);
     [mindist,i] = min(dist);
+
+    %i
     %mindist
+    %c(j).v(i)
+    %datevec(c(j).v(i))
   else    
     i = find(range(1) < c(j).v & c(j).v < range(end)); 
     i = min(i):max(i);
@@ -49,6 +66,7 @@
 end
 
 idx = substruct('()',{c.index});
+%idx
 data = subsref (self,idx);
 
 varargout = {data,c.sub};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncArray/ncArray.m 
new/ncarray/inst/@ncArray/ncArray.m
--- old/ncarray/inst/@ncArray/ncArray.m 2012-07-05 15:12:20.000000000 +0200
+++ new/ncarray/inst/@ncArray/ncArray.m 2016-11-29 15:41:59.000000000 +0100
@@ -38,7 +38,7 @@
 % Web: http://modb.oce.ulg.ac.be/mediawiki/index.php/ncArray
 
 % hidded constructor signature:
-% data = ncArray(filename,varname)
+% data = ncArray(var,dims,coord);
 % is used to create data with coordinate values by ncCatArray
 
 function retval = ncArray(varargin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncArray/subsref.m 
new/ncarray/inst/@ncArray/subsref.m
--- old/ncarray/inst/@ncArray/subsref.m 2013-08-01 11:08:07.000000000 +0200
+++ new/ncarray/inst/@ncArray/subsref.m 2016-11-29 15:41:59.000000000 +0100
@@ -33,7 +33,6 @@
         j = sort(j);
         idx_c.type = '()';
         idx_c.subs = idx(1).subs(j);
-        
         varargout{i} = subsref(self.coord(i).val,idx_c);
     end       
 else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncBaseArray/ncsub.m 
new/ncarray/inst/@ncBaseArray/ncsub.m
--- old/ncarray/inst/@ncBaseArray/ncsub.m       2012-07-03 15:38:39.000000000 
+0200
+++ new/ncarray/inst/@ncBaseArray/ncsub.m       2016-11-29 15:41:59.000000000 
+0100
@@ -37,14 +37,19 @@
             if length(tmp) == 1
                 start(i) = tmp;
             else
+                % check if indexes are at regular intervals
                 test = tmp(1):tmp(2)-tmp(1):tmp(end);
-                
+                if size(tmp,2) == 1
+                   % tmp is a row vector, make test also a row vector
+                   test = test';
+                end
+
                 if all(tmp == test)
                     start(i) = tmp(1);
                     stride(i) = tmp(2)-tmp(1);
                     count(i) = (tmp(end)-tmp(1))/stride(i) +1;
                 else
-                    error('indeces');
+                    error('indeces not at regular intervals');
                 end
             end
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/@ncBaseArray/subsref.m 
new/ncarray/inst/@ncBaseArray/subsref.m
--- old/ncarray/inst/@ncBaseArray/subsref.m     2012-11-12 20:26:49.000000000 
+0100
+++ new/ncarray/inst/@ncBaseArray/subsref.m     2016-11-29 15:41:59.000000000 
+0100
@@ -52,7 +52,10 @@
 elseif strcmp(idx.type,'.')
     % load attribute
     name = idx.subs;
-    index = strmatch(name,{self.vinfo.Attributes(:).Name});
+    % strmatch is obsolete
+    % index = strmatch(name,{self.vinfo.Attributes(:).Name});
+    index = find(strcmp(name,{self.vinfo.Attributes(:).Name}));
+
     
     if isempty(index)
         error('variable %s has no attribute called %s',self.varname,name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/cached_decompress.m 
new/ncarray/inst/cached_decompress.m
--- old/ncarray/inst/cached_decompress.m        2013-11-25 10:56:29.000000000 
+0100
+++ new/ncarray/inst/cached_decompress.m        2016-11-29 15:41:59.000000000 
+0100
@@ -1,6 +1,6 @@
 % Decompress a file using a cache.
 %
-% [fname,success]=cached_decompress(filename)
+% [fname,success] = cached_decompress(filename)
 %
 % Input:
 %  filename: name of the file which is possibly compressed
@@ -14,15 +14,21 @@
 % CACHED_DECOMPRESS_LOG_FID (default 1): file id for log message
 % CACHED_DECOMPRESS_MAX_SIZE (default 1e10): maximum size of cache in bytes.
 
-% Alexander Barth, 2012-06-13
-%
-function [fname]=cached_decompress(url)
-
+function fname = cached_decompress(url)
 
 global CACHED_DECOMPRESS_DIR
 global CACHED_DECOMPRESS_LOG_FID
 global CACHED_DECOMPRESS_MAX_SIZE
 
+
+if startswith(url,'http:') || ...
+        ~(endswith(url,'.gz') || endswith(url,'.bz2') || endswith(url,'.xz'))
+  % opendap url or not compressed file
+  fname = url;
+  return
+end
+
+
 cache_dir = CACHED_DECOMPRESS_DIR;
 
 if isempty(cache_dir)
@@ -32,13 +38,6 @@
     fprintf('creating directory %s for temporary files.\n',cache_dir);
 end
 
-if beginswith(url,'http:') || ...
-        ~(endswith(url,'.gz') || endswith(url,'.bz2') || endswith(url,'.xz'))
-  % opendap url or not compressed file
-  fname = url;
-  return
-end
-
 %if exist(cache_dir,'dir') ~= 7
 %  error(['cache directory for compressed files does not exist. '...
 %         'Please create the directory %s or change le value of the '...
@@ -47,10 +46,10 @@
     
 % where to print logs? default to screen
 
-fid=CACHED_DECOMPRESS_LOG_FID;
+fid = CACHED_DECOMPRESS_LOG_FID;
 
 if (isempty(fid))
-    fid=1;
+    fid = 1;
 end
 
 % form filename for cache
@@ -58,22 +57,35 @@
 fname = url;
 fname = strrep(fname,'/','_SLASH_');
 fname = strrep(fname,'*','_STAR_');
+fname = strrep(fname,'\','_BSLASH_');
+fname = strrep(fname,':','_COLON_');
+
 fname = fullfile(cache_dir,fname);
 
 % test if in cache
 
 if exist(fname,'file') ~= 2
     if endswith(url,'.gz')
-        syscmd('gunzip --stdout "%s" > "%s"',url,fname);
+      cmd = 'gunzip --stdout -';
     elseif endswith(url,'.bz2')
-        syscmd('bunzip2 --stdout "%s" > "%s"',url,fname);
+      cmd = 'bunzip2 --stdout -';
+    elseif endswith(url,'.xz')
+      cmd = 'unxz --stdout -';
     else
-        syscmd('unxz --stdout "%s" > "%s"',url,fname);
+      cmd = 'cat';
     end    
+
+    if startswith(url,'ftp://')
+      syscmd('curl --silent "%s" | %s > "%s"',url,cmd,fname);
+    else
+      syscmd('%s < "%s" > "%s"',cmd,url,fname);
+    end
 else
 %    fprintf(fid,'retrieve from cache %s\n',url);
 end
 
+
+
 % check cache size
 
 d=dir(cache_dir);
@@ -107,23 +119,23 @@
 end
 end
 
-function t = beginswith(s,pre)
 
-if length(pre) <= length(s)
-    t = strcmp(s(1:length(pre)),pre);
-else
+function t = startswith(s,ext)
+
+  if length(ext) <= length(s)
+    t = strcmp(s(1:length(ext)),ext);
+  else
     t = 0;
-end
+  end
 end
 
-
 function t = endswith(s,ext)
 
-if length(ext) <= length(s)
+  if length(ext) <= length(s)
     t = strcmp(s(end-length(ext)+1:end),ext);
-else
+  else
     t = 0;
-end
+  end
 end
 
 
@@ -141,7 +153,7 @@
 end
 
 
-% Copyright (C) 2012-2013 Alexander Barth <[email protected]>
+% Copyright (C) 2012-2013, 2015 Alexander Barth <[email protected]>
 %
 % This program is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/ncCatArray.m 
new/ncarray/inst/ncCatArray.m
--- old/ncarray/inst/ncCatArray.m       2013-11-25 10:56:29.000000000 +0100
+++ new/ncarray/inst/ncCatArray.m       2016-11-29 15:41:59.000000000 +0100
@@ -80,6 +80,11 @@
                 'http://www.mathworks.com/matlabcentral/fileexchange/19550']);
         end
     end
+    
+    if isempty(filenames)
+        error('ncArray:nomatch','no file found matching %s',pattern);
+    end
+    
 elseif isa(pattern, 'function_handle')
     filenames = cell(1,length(range));
     
@@ -120,12 +125,24 @@
     dims{dim} = catdimname;
     coord(dim).dims = {catdimname};
     coord(dim).val = range;
+    coord(dim).name = catdimname;
 end
 
 
 for i=1:length(coord)
+
+    %test if value is already defined, if yes do nothing
+    if isfield(coord(i),'val')
+      if ~isempty(coord(i).val) 
+        continue
+      end
+    end
+
     % the number of the dimension might be different
     % find in coord(i).dims the index of the dimension called  dims{dim}
+    % for example we concatenate over time, then two situations can arrise
+    % the coordinate variable lon can dependent on time (dimc is not empty)
+    % or it does not depdent on time (dimc is empty)
     dimc = find(strcmp(coord(i).dims,dims{dim}));
     
     if isempty(dimc)      
@@ -133,12 +150,13 @@
       coord(i).val = ncBaseArray(filenames{1},coord(i).name,'vinfo',vinfo);
     else    
       % coordinates do also depend on the dimension over which we concatenate
+      %i,coord(i).name,dimc,dims{dim}
       coord(i).val = arr(dimc,filenames,coord(i).name,finfos);
     end
     
-    if dim > length(coord(i).dims)
-        coord(i).dims{dim} = catdimname;
-    end
+    %if dim > length(coord(i).dims)
+    %    coord(i).dims{dim} = catdimname;
+    %end
 end
 
 data = ncArray(var,dims,coord);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/ncarray_example.m 
new/ncarray/inst/ncarray_example.m
--- old/ncarray/inst/ncarray_example.m  1970-01-01 01:00:00.000000000 +0100
+++ new/ncarray/inst/ncarray_example.m  2016-11-29 15:41:59.000000000 +0100
@@ -0,0 +1,52 @@
+
+% Tutorial for using ncArray
+
+% It is advised to run this script in an empty directory.
+% It will delete and overwrite files named file1.nc, file2.nc and file3.nc.
+
+% size of the example data (2x3)
+
+n = 3;
+m = 2;
+
+% create 3 files (file1.nc, file2.nc,...) with a 2x3 variable called SST
+data = zeros(n,m);
+
+disp('create example files: file1.nc, file2.nc, file3.nc')
+
+for i = 1:3  
+    data(:) = i;
+    files{i} = sprintf('file%d.nc',i);
+    delete(files{i});
+    ncarray_example_file(files{i},data);
+end
+
+
+% Using ncArray
+
+SST = ncArray('file1.nc','SST');
+
+disp('load the entire file')
+data = SST(:,:,:);
+
+disp('get the attribute units')
+units = SST.units;
+
+
+disp('load a particular value');
+data = SST(3,2,1);
+
+% Using ncCatArray
+
+disp('concatenate the files over the 3rd dimension (here time)')
+
+SST = ncCatArray(3,{'file1.nc','file2.nc','file3.nc'},'SST');
+
+% or just 
+% SST = ncCatArray(3,'file*.nc','SST');
+
+disp('load all 3 files');
+data = SST(:,:,:);
+
+disp('load a particular value (1,2,1) of the 3rd file');
+data = SST(1,2,3);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/ncarray_example_file.m 
new/ncarray/inst/ncarray_example_file.m
--- old/ncarray/inst/ncarray_example_file.m     1970-01-01 01:00:00.000000000 
+0100
+++ new/ncarray/inst/ncarray_example_file.m     2016-11-29 15:41:59.000000000 
+0100
@@ -0,0 +1,46 @@
+% create an example NetCDF file with the name filename and given data
+
+function ncarray_example_file(filename,data)
+
+  dtype = 'double';
+  sz = size(data);
+
+  % Variables
+  nccreate(filename,'lon','Format','classic','Datatype',dtype,...
+           'Dimensions',{'x',sz(1), 'y',sz(2)});
+  ncwriteatt(filename,'lon','long_name','Longitude')
+  ncwriteatt(filename,'lon','units','degrees_east')
+  
+  nccreate(filename,'lat','Datatype',dtype,'Dimensions',{'x',sz(1), 
'y',sz(2)});
+  ncwriteatt(filename,'lat','long_name','Latitude')
+  ncwriteatt(filename,'lat','units','degrees_north')
+  
+  nccreate(filename,'time','Datatype',dtype,'Dimensions',{'time',1});
+  ncwriteatt(filename,'time','long_name','Time')
+  ncwriteatt(filename,'time','units','days since 1858-11-17 00:00:00 GMT')
+  
+  nccreate(filename,'SST','Datatype',dtype,'Dimensions',...
+           {'x',sz(1), 'y',sz(2), 'time',1});
+  ncwriteatt(filename,'SST','missing_value',single(9999))
+  ncwriteatt(filename,'SST','_FillValue',single(9999))
+  ncwriteatt(filename,'SST','units','degC')
+  ncwriteatt(filename,'SST','long_name','Sea Surface Temperature')
+  ncwriteatt(filename,'SST','coordinates','lat lon')
+
+  ncwrite(filename,'SST',data);  
+
+  % Copyright (C) 2012,2013,2015 Alexander Barth <[email protected]>
+  %
+  % This program is free software; you can redistribute it and/or modify
+  % it under the terms of the GNU General Public License as published by
+  % the Free Software Foundation; either version 2 of the License, or
+  % (at your option) any later version.
+  %
+  % This program is distributed in the hope that it will be useful,
+  % but WITHOUT ANY WARRANTY; without even the implied warranty of
+  % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  % GNU General Public License for more details.
+  %
+  % You should have received a copy of the GNU General Public License
+  % along with this program; If not, see <http://www.gnu.org/licenses/>.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/nccoord.m new/ncarray/inst/nccoord.m
--- old/ncarray/inst/nccoord.m  2013-08-01 11:08:07.000000000 +0200
+++ new/ncarray/inst/nccoord.m  2016-11-29 15:41:59.000000000 +0100
@@ -12,6 +12,9 @@
 % coord is an empty structure if no coordinate information have been
 % found.
 
+% TODO: use a predictable order for coord:
+% lon, lat, depth, time, ensemble,...
+
 % Author: Alexander Barth ([email protected])
 
 function [dims,coord] = nccoord(filename,varname)
@@ -32,7 +35,8 @@
 dims = {vinfo.Dimensions(:).Name};
 
 % create empty coord array with the fields name and dims
-coord = struct('name',{},'dims',{},'standard_name',{},'units',{});
+coord = struct('name',{},'dims',{},'standard_name',{},...
+               'units',{},'positive',{});
 
 % check the coordinate attribute
 if ~isempty(vinfo.Attributes)
@@ -73,6 +77,7 @@
         c.dims = {d(:).Name};
         c.standard_name = [];
         c.units = [];
+        c.positive = [];
         
         % get standard_name attribute if present
         i = find(strcmp('standard_name',{vinfo.Attributes(:).Name}));
@@ -86,6 +91,12 @@
           c.units = vinfo.Attributes(i).Value;
         end
         
+        % get positive attribute if present
+        i = find(strcmp('positive',{vinfo.Attributes(:).Name}));
+        if ~isempty(i)
+          c.positive = vinfo.Attributes(i).Value;
+        end
+
         coord(end+1) = c;
     end
 end
@@ -93,7 +104,7 @@
 end
 
 
-% Copyright (C) 2012, 2013 Alexander Barth <[email protected]>
+% Copyright (C) 2012, 2013, 2015 Alexander Barth <[email protected]>
 %
 % This program is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/ncreadtime.m 
new/ncarray/inst/ncreadtime.m
--- old/ncarray/inst/ncreadtime.m       2014-05-04 21:35:56.000000000 +0200
+++ new/ncarray/inst/ncreadtime.m       2016-11-29 15:41:59.000000000 +0100
@@ -7,7 +7,7 @@
 
 function t = ncreadtime(filename,varname)
 
-t = ncread(filename,varname);
+t = double(ncread(filename,varname));
 units = ncreadatt(filename,varname,'units');
 
 [t0,f] = nctimeunits(units);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/nctimeunits.m 
new/ncarray/inst/nctimeunits.m
--- old/ncarray/inst/nctimeunits.m      2014-05-04 21:35:56.000000000 +0200
+++ new/ncarray/inst/nctimeunits.m      2016-11-29 15:41:59.000000000 +0100
@@ -5,31 +5,65 @@
 % Parse the netCDF time unit u and returns the time offset (days since 31 
 % December 1 BC, as datenum) and scaling factor f (in days).
 % See the netCDF CF convention for the structure of the time units.
+% 
http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#time-coordinate
+% Also: 
http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/CDM/CalendarDateTime.html
 
 function [t0,f] = nctimeunits(u)
 
-if strfind(u,'seconds')
+% years in days for udunits
+% 
http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#time-coordinate
+year_in_days =  365.242198781;
+
+
+l = strfind(u,'since');
+
+if length(l) ~= 1
+  error(['time units sould expect one "since": "' u '"']);
+end
+
+period = strtrim(lower(u(1:l-1)));
+reference_date = strtrim(u(l+6:end));
+
+if strcmp(period,'millisec') || strcmp(period,'msec')
+  f = 1/(24*60*60*1000);
+elseif strcmp(period,'second') || strcmp(period,'seconds') ...
+      || strcmp(period,'s') || strcmp(period,'sec')
   f = 1/(24*60*60);
-elseif strfind(u,'hours')
+elseif strcmp(period,'minute') || strcmp(period,'minutes') ...
+      || strcmp(period,'min')
+  f = 1/(24*60);
+elseif strcmp(period,'hour') || strcmp(period,'hours') ...
+      || strcmp(period,'hr')
   f = 1/24;
-elseif strfind(u,'days')
+elseif strcmp(period,'day') || strcmp(period,'days')
   f = 1;
+elseif strcmp(period,'week') || strcmp(period,'weeks')
+  f = 1/(24*60*60*7);
+elseif strcmp(period,'year') || strcmp(period,'years') ...
+      strcmp(period,'yr')
+  f = year_in_days;
+elseif strcmp(period,'month') || strcmp(period,'months') ...
+      strcmp(period,'mon')
+  f = year_in_days/12;
 else
-  error(['unknown units "' u '"']);
+  error(['unknown units "' period '"']);
 end
-  
-l = strfind(u,'since')+6;
 
-try
-  t0 = datenum(u(l:end),'yyyy-mm-dd HH:MM:SS');
-catch
+
+if strcmp(reference_date,'1900-01-01 00:00:0.0')
+  t0 = datenum(1900,1,1);
+else
   try
-    t0 = datenum(u(l:end),'yyyy-mm-ddTHH:MM:SS');
-  catch    
+    t0 = datenum(reference_date,'yyyy-mm-dd HH:MM:SS');
+  catch
     try
-      t0 = datenum(u(l:end),'yyyy-mm-dd');
-    catch
-      error(['date format is not recogized ' u(l:end)])
+      t0 = datenum(reference_date,'yyyy-mm-ddTHH:MM:SS');
+    catch    
+      try
+        t0 = datenum(reference_date,'yyyy-mm-dd');
+      catch
+        error(['date format is not recogized ' reference_date])
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/private/assertAlmostEqual.m 
new/ncarray/inst/private/assertAlmostEqual.m
--- old/ncarray/inst/private/assertAlmostEqual.m        1970-01-01 
01:00:00.000000000 +0100
+++ new/ncarray/inst/private/assertAlmostEqual.m        2016-11-29 
15:41:59.000000000 +0100
@@ -0,0 +1,21 @@
+% this function is necessary because of the limitation of matlab
+
+function assertAlmostEqual(observed,expected)
+
+% tolerance for testing
+tol = 1e-10;
+
+% for compatibility with matlab which does not have
+% assert (OBSERVED, EXPECTED, TOL)
+
+assert(max(abs(observed(:) - expected(:))) < tol)
+
+% for octave prior to 3.8.0
+if isempty(which('isequaln'))
+  isequaln = @(x,y) isequalwithequalnans(x,y);
+end
+
+% check also NaNS
+assert(isequal(isnan(observed),isnan(expected)))
+
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/private/ncarray_example_file.m 
new/ncarray/inst/private/ncarray_example_file.m
--- old/ncarray/inst/private/ncarray_example_file.m     2013-12-19 
16:06:03.000000000 +0100
+++ new/ncarray/inst/private/ncarray_example_file.m     1970-01-01 
01:00:00.000000000 +0100
@@ -1,85 +0,0 @@
-function ncarray_example_file(filename,data)
-
-if ~isempty(which('nccreate')) && ~isempty(which('ncwriteatt')) && ...
-      ~isempty(which('ncwrite'))
-  % use matlab netcdf high level interface
-
-  %dtype = 'single';
-  dtype = 'double';
-
-  % Variables
-  nccreate(filename,'lon','Format','classic','Datatype',dtype,...
-           'Dimensions',{'x',220, 'y',144});
-  ncwriteatt(filename,'lon','long_name','Longitude')
-  ncwriteatt(filename,'lon','units','degrees_east')
-  
-  nccreate(filename,'lat','Datatype',dtype,'Dimensions',{'x',220, 'y',144});
-  ncwriteatt(filename,'lat','long_name','Latitude')
-  ncwriteatt(filename,'lat','units','degrees_north')
-  
-  nccreate(filename,'time','Datatype',dtype,'Dimensions',{'time',1});
-  ncwriteatt(filename,'time','long_name','Time')
-  ncwriteatt(filename,'time','units','days since 1858-11-17 00:00:00 GMT')
-  
-  nccreate(filename,'SST','Datatype',dtype,'Dimensions',...
-           {'x',220, 'y',144, 'time',1});
-  ncwriteatt(filename,'SST','missing_value',single(9999))
-  ncwriteatt(filename,'SST','_FillValue',single(9999))
-  ncwriteatt(filename,'SST','units','degC')
-  ncwriteatt(filename,'SST','long_name','Sea Surface Temperature')
-  ncwriteatt(filename,'SST','coordinates','lat lon')
-
-  ncwrite(filename,'SST',data);  
-else
-  % use octcdf interface
-
-  nc = netcdf(filename,'c');
-
-  % dimensions
-  
-  nc('x') = size(data,1);
-  nc('y') = size(data,2);
-  nc('time') = size(data,3);
-
-  % variables
-
-  nc{'lon'} = ncdouble('y','x');  % 31680 elements 
-  nc{'lon'}.long_name = ncchar('Longitude');
-  nc{'lon'}.units = ncchar('degrees_east');
-  
-  nc{'lat'} = ncdouble('y','x');  % 31680 elements 
-  nc{'lat'}.long_name = ncchar('Latitude');
-  nc{'lat'}.units = ncchar('degrees_north');
-
-  nc{'time'} = ncdouble('time');  % 1 elements 
-  nc{'time'}.long_name = ncchar('Time');
-  nc{'time'}.units = ncchar('days since 1858-11-17 00:00:00 GMT');
-  
-  nc{'SST'} = ncdouble('time','y','x');  % 31680 elements 
-  nc{'SST'}.missing_value = ncdouble(9999);
-  nc{'SST'}.FillValue_ = ncdouble(9999);
-  nc{'SST'}.units = ncchar('degC');
-  nc{'SST'}.long_name = ncchar('Sea Surface Temperature');
-  nc{'SST'}.coordinates = ncchar('lat lon');
-
-  % global attributes
-  
-  nc{'SST'}(:) = permute(data,[3 2 1]);
-  close(nc)
-end
-
-% Copyright (C) 2012,2013 Alexander Barth <[email protected]>
-%
-% This program is free software; you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation; either version 2 of the License, or
-% (at your option) any later version.
-%
-% This program is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program; If not, see <http://www.gnu.org/licenses/>.
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/test_ncarray.m 
new/ncarray/inst/test_ncarray.m
--- old/ncarray/inst/test_ncarray.m     2014-05-04 21:35:56.000000000 +0200
+++ new/ncarray/inst/test_ncarray.m     2016-11-29 15:41:59.000000000 +0100
@@ -1,26 +1,25 @@
 % Test ncBaseArray, ncCatArray and ncArray.
 function test_ncarray()
 
-% for octave prior to 3.8.0
-if isempty(which('isequaln'))
-  isequaln = @(x,y) isequalwithequalnans(x,y);
-end
-
 varname = 'SST';
 
 tmpdir = tempname;
 mkdir(tmpdir);
 
 tmpfname = tempname(tmpdir);
+refdata = {};
+
 for i = 1:3  
   files{i} = fullfile(tmpdir,sprintf('file%d.nc',i));
-  ncarray_example_file(files{i},randn(220,144));
+  refdata{i} = randn(220,144);                                      
+  ncarray_example_file(files{i},refdata{i});
 end
 
 
 filename = files{1};
 
 
+
 % test ncread/ncwrite
 
 copyfile(files{1},tmpfname);
@@ -32,7 +31,7 @@
 
 ncwrite(tmpfname,'SST',SST_ref);
 test = ncread(tmpfname,'SST');
-assert(isequaln(test,SST_ref))
+assertAlmostEqual(test,SST_ref)
 
 
 %%% test ncBaseArray
@@ -44,23 +43,23 @@
 test = SST(:,:,:);
 SST_ref = ncread(tmpfname,varname);
 
-assert(isequaln(test,SST_ref))
+assertAlmostEqual(test,SST_ref)
 assert(isempty(SST(:,:,:,[])));
-assert(isequaln(SST_ref, SST(:,:,:,1)))
+assertAlmostEqual(SST_ref, SST(:,:,:,1))
 
 ind = floor(numel(SST_ref) * rand(100,1))+1;
-assert(isequaln(SST(ind),SST_ref(ind)))
+assertAlmostEqual(SST(ind),SST_ref(ind))
 
 % writing
 
 r = round(randn(size(SST)));
 SST(:,:,:) = r;
 SST_ref = ncread(tmpfname,varname);
-assert(isequaln(r,SST_ref));
+assertAlmostEqual(r,SST_ref);
 
 SST(:,:,:) = 3 * r;
 SST_ref = ncread(tmpfname,varname);
-assert(isequaln(3 * r,SST_ref));
+assertAlmostEqual(3 * r,SST_ref);
 
 
 
@@ -73,86 +72,86 @@
 test = SST(:,:,:);
 SST_ref = ncread(tmpfname,varname);
 
-assert(isequaln(test,SST_ref))
+assertAlmostEqual(test,SST_ref)
 assert(isempty(SST(:,:,:,[])));
-assert(isequaln(SST_ref, SST(:,:,:,1)))
+assertAlmostEqual(SST_ref, SST(:,:,:,1))
 
 ind = floor(numel(SST_ref) * rand(100,1))+1;
-assert(isequaln(SST(ind),SST_ref(ind)))
+assertAlmostEqual(SST(ind),SST_ref(ind))
 
-assert(isequaln(SST_ref(1,:,:), SST(1,:,:)))
+assertAlmostEqual(SST_ref(1,:,:), SST(1,:,:))
 
 % sum
 
 nanmeanSST = nanmean(SST);
 nanmeanSSTref = nanmean(SST_ref);
-assert(isequaln(nanmeanSST, nanmeanSSTref))
+assertAlmostEqual(nanmeanSST, nanmeanSSTref)
 
 %momentSST = moment(SST,2,1);
 %momentSSTref = moment(SST_ref,2,1);
-%assert(isequaln(momentSST, momentSSTref))
+%assertAlmostEqual(momentSST, momentSSTref)
 
 
 sumSST = sum(SST,1);
 sumSSTref = sum(SST_ref,1);
-assert(isequaln(sumSST, sumSSTref))
+assertAlmostEqual(sumSST, sumSSTref)
 
 sumSST = sum(SST,2);
 sumSSTref = sum(SST_ref,2);
-assert(isequaln(sumSST, sumSSTref))
+assertAlmostEqual(sumSST, sumSSTref)
 
 sumSST = sum(SST,3);
 sumSSTref = sum(SST_ref,3);
-assert(isequaln(sumSST, sumSSTref))
+assertAlmostEqual(sumSST, sumSSTref)
 
 sumSST = sum(SST);
 sumSSTref = sum(SST_ref);
-assert(isequaln(sumSST, sumSSTref))
+assertAlmostEqual(sumSST, sumSSTref)
 
 prodSST = prod(SST);
 prodSSTref = prod(SST_ref);
-assert(isequaln(prodSST, prodSSTref))
+assertAlmostEqual(prodSST, prodSSTref)
 
 % only for octave
 %sumsqSST = sumsq(SST);
 %sumsqSSTref = sumsq(SST_ref); % does not work in matlab
-%assert(isequaln(sumsqSST, sumsqSSTref))
+%assertAlmostEqual(sumsqSST, sumsqSSTref)
 
 meanSST = mean(SST);
 meanSSTref = mean(SST_ref);
-assert(isequaln(meanSST, meanSSTref))
+assertAlmostEqual(meanSST, meanSSTref)
 
 varSST = var(SST);
 varSSTref = var(SST_ref);
-assert(isequaln(varSST, varSSTref))
+assertAlmostEqual(varSST, varSSTref)
 
 varSST = var(SST,1);
 varSSTref = var(SST_ref,1);
-assert(isequaln(varSST, varSSTref))
+assertAlmostEqual(varSST, varSSTref)
 
 varSST = var(SST,[],2);
 varSSTref = var(SST_ref,[],2);
-assert(isequaln(varSST, varSSTref))
+assertAlmostEqual(varSST, varSSTref)
 
 stdSST = std(SST);
 stdSSTref = std(SST_ref);
-assert(isequaln(stdSST, stdSSTref))
+assertAlmostEqual(stdSST, stdSSTref)
 
 stdSST = std(SST,1);
 stdSSTref = std(SST_ref,1);
-assert(isequaln(stdSST, stdSSTref))
+assertAlmostEqual(stdSST, stdSSTref)
 
 stdSST = std(SST,[],2);
 stdSSTref = std(SST_ref,[],2);
-assert(isequaln(stdSST, stdSSTref))
+assertAlmostEqual(stdSST, stdSSTref)
 
 maxSST = max(SST,[],2);
 maxSSTref = max(SST_ref,[],2);
-assert(isequaln(maxSST, maxSSTref))
+assertAlmostEqual(maxSST, maxSSTref)
 
 minSST = min(SST,[],2);
 minSSTref = min(SST_ref,[],2);
-assert(isequaln(minSST, minSSTref))
+assertAlmostEqual(minSST, minSSTref)
 
 
 
@@ -161,11 +160,11 @@
 r = round(randn(size(SST)));
 SST(:,:,:) = r;
 SST_ref = ncread(tmpfname,varname);
-assert(isequaln(r,SST_ref));
+assertAlmostEqual(r,SST_ref);
 
 SST(:,:,:) = 3 * r;
 SST_ref = ncread(tmpfname,varname);
-assert(isequaln(3 * r,SST_ref));
+assertAlmostEqual(3 * r,SST_ref);
 
 
 
@@ -183,7 +182,7 @@
 
 SST_ref = ncread(filename,'SST');
 tmp2 = CA(:,:,1);
-assert(isequaln(SST_ref,tmp2))
+assertAlmostEqual(SST_ref,tmp2)
 
 
 
@@ -192,7 +191,7 @@
 
 
 
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 CA2 = CatArray(4,{...
     ncArray(files{1},varname),...
@@ -202,7 +201,7 @@
 
 SST_test = CA2(:,:,:,2);
 
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 CA2 = ncCatArray(3,{...
     files{1},...
@@ -211,11 +210,11 @@
     varname);
 
 SST_test = CA2(:,:,2);
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 CA2 = ncCatArray(3,fullfile(tmpdir,'file*nc'),varname);
 SST_test = CA2(:,:,2);
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 
 CA2 = ncCatArray(3,...
@@ -224,7 +223,7 @@
     1:3);
 
 SST_test = CA2(:,:,2);
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 SST_ref = cat(3,...
     ncread(files{1},'SST'),...
@@ -232,23 +231,31 @@
     ncread(files{3},'SST'));
 
 
-assert(isequaln(CA2(:,:,:),SST_ref))
 
-assert(isequaln(CA2(:,:,1),SST_ref(:,:,1)))
-assert(isequaln(CA2(3:5:50,3:5:100,1),SST_ref(3:5:50,3:5:100,1)))
-assert(isequaln(CA2(3:5:50,3:5:100,2),SST_ref(3:5:50,3:5:100,2)))
-assert(isequaln(CA2(3:5:50,3:5:100,3),SST_ref(3:5:50,3:5:100,3)))
-assert(isequaln(CA2(3:5:50,3:5:100,end),SST_ref(3:5:50,3:5:100,end)))
-assert(isequaln(CA2(50,100,1:3),SST_ref(50,100,1:3)))
-assert(isequaln(CA2(3:5:50,3:5:100,1:2:3),SST_ref(3:5:50,3:5:100,1:2:3)))
-assert(isequaln(CA2(3:5:50,3:5:end,1:2:3),SST_ref(3:5:50,3:5:end,1:2:3)))
-assert(isequaln(CA2(3:5:50,3:5:end,:),SST_ref(3:5:50,3:5:end,:)))
+assertAlmostEqual(CA2(:,:,:),SST_ref)
+
+assertAlmostEqual(CA2(:,:,1),SST_ref(:,:,1))
+assertAlmostEqual(CA2(3:5:50,3:5:100,1),SST_ref(3:5:50,3:5:100,1))
+assertAlmostEqual(CA2(3:5:50,3:5:100,2),SST_ref(3:5:50,3:5:100,2))
+assertAlmostEqual(CA2(3:5:50,3:5:100,3),SST_ref(3:5:50,3:5:100,3))
+assertAlmostEqual(CA2(3:5:50,3:5:100,end),SST_ref(3:5:50,3:5:100,end))
+assertAlmostEqual(CA2(50,100,1:3),SST_ref(50,100,1:3))
+assertAlmostEqual(CA2(3:5:50,3:5:100,1:2:3),SST_ref(3:5:50,3:5:100,1:2:3))
+assertAlmostEqual(CA2(3:5:50,3:5:end,1:2:3),SST_ref(3:5:50,3:5:end,1:2:3))
+assertAlmostEqual(CA2(3:5:50,3:5:end,:),SST_ref(3:5:50,3:5:end,:))
+
+% access with linear index
+assertAlmostEqual(CA2(:),SST_ref(:))
+assertAlmostEqual(CA2(1:10),SST_ref(1:10))
+assertAlmostEqual(CA2(1:2:10),SST_ref(1:2:10))
+
+
 ind = floor(numel(SST_ref) * rand(100,1))+1;
-assert(isequaln(CA2(ind),SST_ref(ind)))
+assertAlmostEqual(CA2(ind),SST_ref(ind))
 
 meanSST = mean(CA2,3);
 meanSSTref = mean(SST_ref,3);
-%assert(isequaln(meanSST, meanSSTref))
+%assertAlmostEqual(meanSST, meanSSTref)
 
 diff = meanSST -meanSSTref;
 assert(max(diff(:)) < 1e-6)
@@ -265,16 +272,16 @@
 CA2(:,:,:) = r;
 
 check = ncread(list{2},varname);
-assert(isequaln(check,r(:,:,2)))
+assertAlmostEqual(check,r(:,:,2))
 
 r2 = round(randn(size(CA2)));
 r(3:5:50,3:5:end,:) = r2(3:5:50,3:5:end,:);
 CA2(3:5:50,3:5:end,:) = r2(3:5:50,3:5:end,:);
-assert(isequaln(CA2(:,:,:),r))
+assertAlmostEqual(CA2(:,:,:),r)
 
 r(end-1,3:5:end,1:2:3) = 2*r2(end-1,3:5:end,1:2:3);
 CA2(end-1,3:5:end,1:2:3) = 2*r2(end-1,3:5:end,1:2:3);
-assert(isequaln(CA2(:,:,:),r))
+assertAlmostEqual(CA2(:,:,:),r)
 
 
 
@@ -299,31 +306,31 @@
     
     [x,y,t] = data(:,:,:).coord;
     
-    assert(isequaln(data(:,:,:),SST_ref))
-    assert(isequaln(x,lon_ref))
+    assertAlmostEqual(data(:,:,:),SST_ref)
+    assertAlmostEqual(x,lon_ref)
     
-    assert(isequaln(data(),SST_ref))
+    assertAlmostEqual(data(),SST_ref)
     [x,y,t] = data().coord;
-    assert(isequaln(x,lon_ref))
+    assertAlmostEqual(x,lon_ref)
     
-    assert(isequaln(data(1:3:end,:,:),SST_ref(1:3:end,:,:)))
+    assertAlmostEqual(data(1:3:end,:,:),SST_ref(1:3:end,:,:))
     [x,y,t] = data(1:3:end,:,:).coord;
-    assert(isequaln(x,lon_ref(1:3:end,:)))
+    assertAlmostEqual(x,lon_ref(1:3:end,:))
     
     % test ncArray (constructor: ncData(filename,varname)
     SST = ncArray(filename,varname);
     [x,y,t] = data(:,:,:).coord;
     
-    assert(isequaln(data(:,:,:),SST_ref))
-    assert(isequaln(x,lon_ref))
+    assertAlmostEqual(data(:,:,:),SST_ref)
+    assertAlmostEqual(x,lon_ref)
     
-    assert(isequaln(data(),SST_ref))
+    assertAlmostEqual(data(),SST_ref)
     [x,y,t] = data().coord;
-    assert(isequaln(x,lon_ref))
+    assertAlmostEqual(x,lon_ref)
     
-    assert(isequaln(data(1:3:end,:,:),SST_ref(1:3:end,:,:)))
+    assertAlmostEqual(data(1:3:end,:,:),SST_ref(1:3:end,:,:))
     [x,y,t] = data(1:3:end,:,:).coord;
-    assert(isequaln(x,lon_ref(1:3:end,:)))
+    assertAlmostEqual(x,lon_ref(1:3:end,:))
     
     
     %assert(strcmp(SST.units,'degC'))
@@ -341,34 +348,41 @@
 
 SST = ncArray(zname,'SST');
 SST_ref = ncread(tmpfname,'SST');
-assert(isequaln(SST(),SST_ref))
+assertAlmostEqual(SST(),SST_ref)
 
 
 CA2 = ncCatArray(3,fullfile(tmpdir,'file*nc'),varname);
 SST_test = CA2(:,:,2);
 SST_ref = ncread(files{2},'SST');
-assert(isequaln(SST_test,SST_ref))
+assertAlmostEqual(SST_test,SST_ref)
 
 assert(strcmp(CA2.('units'),'degC'));
 
+
+
 test_ncarray_nan
 
 % clean-up
-for i = 1:3  
-  delete(files{i});
+d = dir(tmpdir);
+for i = 1:length(d)
+    if ~strcmp(d(i).name,'.')  && ~strcmp(d(i).name,'..')
+        delete(fullfile(tmpdir,d(i).name));
+    end
 end
+
 rmdir(tmpdir);
 
 
 [t0,f] = nctimeunits('days since 1770-01-01 00:00:00');
-assert(t0,datenum(1770,01,01));
-assert(f,1);
+assert(t0 == datenum(1770,01,01));
+assert(f == 1);
 
 disp('All tests passed.')
 
+end
 
 
-% Copyright (C) 2012 Alexander Barth <[email protected]>
+% Copyright (C) 2012, 2015 Alexander Barth <[email protected]>
 %
 % This program is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ncarray/inst/test_ncarray_nan.m 
new/ncarray/inst/test_ncarray_nan.m
--- old/ncarray/inst/test_ncarray_nan.m 2014-02-17 11:02:10.000000000 +0100
+++ new/ncarray/inst/test_ncarray_nan.m 2016-11-29 15:41:59.000000000 +0100
@@ -24,11 +24,11 @@
 data = ncCatArray(3,files,varname);
 reddata = nanmean(data,3);
 reddataref = nanmean(dataref,3);
-assert(isequaln(reddata, reddataref))
+assertAlmostEqual(reddata, reddataref)
 
 reddata = nansum(data,3);
 reddataref = nansum(dataref,3);
-assert(isequaln(reddata, reddataref))
+assertAlmostEqual(reddata, reddataref)
 
 reddata = nanvar(data,[],3);
 reddataref = nanvar(dataref,[],3);


Reply via email to