changeset 12369:c054e66b0d32 octave-forge

Remove ncinfo, ncread and ncwrite
author abarth93
date Mon, 17 Feb 2014 09:33:01 +0000
parents e2e72af49f3d
children 59effd0cf1b6
files main/octcdf/DESCRIPTION main/octcdf/NEWS main/octcdf/inst/ncinfo.m main/octcdf/inst/ncread.m main/octcdf/inst/ncwrite.m
diffstat 5 files changed, 9 insertions(+), 334 deletions(-) [+]
line wrap: on
line diff
--- a/main/octcdf/DESCRIPTION	Sat Feb 15 13:38:14 2014 +0000
+++ b/main/octcdf/DESCRIPTION	Mon Feb 17 09:33:01 2014 +0000
@@ -1,6 +1,6 @@
 Name: octcdf
-Version: 1.1.6
-Date: 2013-05-04
+Version: 1.1.7
+Date: 2014-02-17
 Author: Alexander Barth <barth.alexander@gmail.com>
 Maintainer: Alexander Barth <barth.alexander@gmail.com>
 Title: octcdf
--- a/main/octcdf/NEWS	Sat Feb 15 13:38:14 2014 +0000
+++ b/main/octcdf/NEWS	Mon Feb 17 09:33:01 2014 +0000
@@ -1,6 +1,13 @@
 Summary of important user-visible changes for releases of the octcdf package
 
 ===============================================================================
+octcdf-1.1.7   Release Date: 2014-02-17   Release Manager: Alexander Barth
+===============================================================================
+
+ ** Remove ncinfo, ncread and ncwrite which are now fully implemented in the 
+    package netcdf.
+
+===============================================================================
 octcdf-1.1.6   Release Date: 2013-04-30   Release Manager: Alexander Barth
 ===============================================================================
 
--- a/main/octcdf/inst/ncinfo.m	Sat Feb 15 13:38:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-% Information about complete NetCDF file or variable.
-%
-% finfo = ncinfo(filename)
-% vinfo = ncinfo(filename,varname)
-% return information about complete NetCDF file (filename) or about
-% the specific variable varname.
-%
-% vinfo.Size: the size of the netcdf variable. For vectors the Size field
-%   has only one element.
-%
-%
-function info = ncinfo(filename,varname)
-
-nc = netcdf(filename,'r');
-if nargin == 1    
-    info.Filename = filename;
-    
-    variables = var(nc);
-    for i=1:length(variables)
-        info.Variables(i) = ncinfo_var(nc,filename,name(variables{i}));
-    end
-elseif nargin == 2
-    info = ncinfo_var(nc,filename,varname);
-end
-
-close(nc);
-end
-
-function vinfo = ncinfo_var(nc,filename,varname)
-
-
-nv = nc{varname};
-
-% dimensions
-dims = fliplr(dim(nv));
-
-if length(dims) == 1
-  vinfo.Size = size(nv,1); % works in octave
-else
-  vinfo.Size = fliplr(size(nv));
-end
-
-vinfo.Filename = filename;
-vinfo.Dimensions = [];
-vinfo.Name = varname;
-
-
-for i=1:length(dims)
-    tmp = struct();
-    tmp.Name = name(dims{i});
-    tmp.Length = dims{i}(:);
-    % requires octcdf 1.1.6
-    %tmp.Unlimited = isrecdim(dims{i});
-    
-    if isempty(vinfo.Dimensions)
-      vinfo.Dimensions = [tmp];
-    else
-      vinfo.Dimensions(i) = tmp;
-    end
-end
-
-
-na = att(nv);
-
-vinfo.Attributes = [];
-
-for j=1:length(na)
-    tmp = struct();
-    nm = name(na{j});
-    
-    tmp.Name = nm;
-    tmp.Value = na{j}(:);
-    
-    if isempty(vinfo.Attributes)      
-      vinfo.Attributes = [tmp];
-    else
-      vinfo.Attributes(j) = tmp;
-    end
-end
-
-vinfo.FillValue = fillval(nv);
-
-
-end
-
-
-
-%% Copyright (C) 2012 Alexander Barth
-%%
-%% 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/>.
--- a/main/octcdf/inst/ncread.m	Sat Feb 15 13:38:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-% Read a NetCDF variable.
-%
-% x = ncread(filename,varname)
-% x = ncread(filename,varname,start,count,stride)
-% read the variable varname from file filename.
-% The parameter start contains the starting indices, count
-% is the number of elements and stride the increment between
-% two successive elements (default 1).
-%
-% Note: the order of dimension is reversed compared to 
-% the shell command ncdump
-
-function x = ncread(filename,varname,start,count,stride)
-
-nc = netcdf(filename,'r');
-nv = nc{varname};
-sz = size(nv); sz = sz(end:-1:1);
-
-% number of dimenions
-%nd = length(sz);
-nd = length(dim(nv));
-
-if nargin == 2
-  start = ones(1,nd);
-  count = inf*ones(1,nd);
-end
-
-if nargin < 5
-  stride = ones(1,nd);
-end
-
-% ndmat number of dimension for matlab/octave
-
-if nd == 0
-  ndmat = 2;
-  start = [1 1];
-  count = [1 1];
-  stride = [1 1];  
-elseif nd == 1
-  ndmat = 2;
-  start = [1 start];
-  count = [1 count];
-  stride = [1 stride];
-else
-  ndmat = nd;
-end 
-
-% replace inf in count
-i = count == inf;
-count(i) = (sz(i)-start(i))./stride(i) + 1;
-
-% end index
-
-endi = start + (count-1).*stride;
-
-% replace inf in count
-
-%i = endi == inf;
-%endi(i) = sz(i);
-
-
-% load data
-
-% subsref structure
-subsr.type = '()';
-subsr.subs = cell(1,ndmat);
-for i=1:ndmat
-  subsr.subs{ndmat-i+1} = start(i):stride(i):endi(i);
-end
-
-x = subsref(nv,subsr);
-
-%keyboard
-
-% apply attributes
-
-factor = nv.scale_factor(:);
-offset = nv.add_offset(:);
-fv = nv.FillValue_;
-
-if ~isempty(fv)
-  x(x == fv) = NaN;
-else
-  fv = nv.missing_value;
-  
-  if ~isempty(fv)
-    x(x == fv) = NaN;
-  end  
-end
-
-if ~isempty(factor)
-  x = x * factor;
-end
-
-if ~isempty(offset)
-  x = x + offset;
-end
-
-if nd ~= 1
-  x = permute(x,[ndims(x):-1:1]);
-
-  if length(count) < 2
-    count(2) = 1; 
-  end
-
-  x = reshape(x,count);
-end
-
-close(nc)
-
-
-%% Copyright (C) 2012,2013 Alexander Barth
-%%
-%% 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/>.
--- a/main/octcdf/inst/ncwrite.m	Sat Feb 15 13:38:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-% Write a NetCDF variable.
-%
-% ncwrite(filename,varname,x)
-% ncwrite(filename,varname,x,start,stride)
-% write the variable varname to file filename.
-% The parameter start contains the starting indices 
-% and stride the increment between
-% two successive elements (default 1).
-
-function ncwrite(filename,varname,x,start,stride)
-
-nc = netcdf(filename,'w');
-nv = nc{varname};
-
-% number of dimenions
-nd = length(dim(nv));
-
-% sz size (padded with ones)
-sz = ones(1,nd);
-tmp = size(x);
-sz(1:length(tmp)) = tmp;
-
-if nargin == 3
-  start = ones(1,nd);
-end
-
-if nargin < 5
-  stride = ones(1,nd);
-end
-
-% ndmat number of dimension for matlab/octave
-
-if nd == 0
-  ndmat = 2;
-  start = [1 1];
-  count = [1 1];
-  stride = [1 1];  
-elseif nd == 1
-  ndmat = 2;
-  start = [1 start];
-  count = [1 count];
-  stride = [1 stride];
-else
-  ndmat = nd;
-end 
-
-% end index
-
-endi = start + (sz-1).*stride;
-
-
-% save data
-
-% subsref structure
-subsr.type = '()';
-subsr.subs = cell(1,nd);
-for i=1:nd
-  subsr.subs{nd-i+1} = start(i):stride(i):endi(i);
-end
-%start,endi
-
-
-% apply attributes
-
-factor = nv.scale_factor(:);
-offset = nv.add_offset(:);
-fv = nv.FillValue_(:);
-
-if ~isempty(offset)
-  x = x - offset;
-end
-
-if ~isempty(factor)
-  x = x / factor;
-end
-
-if ~isempty(fv)
-  x(isnan(x)) = fv;
-else
-  fv = nv.missing_value;
-  
-  if ~isempty(fv)
-    x(isnan(x)) = fv;
-  end  
-end
-
-x = permute(x,[ndims(x):-1:1]);
-
-nv = subsasgn(nv,subsr,x);
-close(nc)
-
-
-%% Copyright (C) 2012 Alexander Barth
-%%
-%% 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/>.