55 |
iters=arg; |
iters=arg; |
56 |
else |
else |
57 |
error(['The only allowed numeric argument is iterations',... |
error(['The only allowed numeric argument is iterations',... |
58 |
' to read in as a vector for the last arguement']); |
' to read in as a vector for the last argument']); |
59 |
end |
end |
60 |
end |
end |
61 |
end |
end |
62 |
|
if isempty(file) |
63 |
|
if isempty(varlist), |
64 |
|
fprintf( 'No file name in argument list\n'); |
65 |
|
else |
66 |
|
fprintf(['No file in argument list:\n ==> ',char(varlist(1))]); |
67 |
|
for i=2:size(varlist,2), fprintf([' , ',char(varlist(i))]); end |
68 |
|
fprintf(' <==\n'); |
69 |
|
end |
70 |
|
error(' check argument list !!!'); |
71 |
|
end |
72 |
|
|
73 |
% Create list of filenames |
% Create list of filenames |
74 |
for eachfile=file |
for eachfile=file |
163 |
if isempty(varlist), varlist=ncnames(var(nc)); end |
if isempty(varlist), varlist=ncnames(var(nc)); end |
164 |
|
|
165 |
% Attributes for structure |
% Attributes for structure |
166 |
if iters>0; S.iters_read_from_file=iters; end |
if iters>0; S.iters_from_file=iters; end |
167 |
S.attributes.global=read_att(nc); |
S.attributes.global=read_att(nc); |
168 |
|
|
169 |
% Read variable data |
% Read variable data |
176 |
end |
end |
177 |
|
|
178 |
dims = ncnames(dim(nc{cvar})); % Dimensions |
dims = ncnames(dim(nc{cvar})); % Dimensions |
179 |
|
sizVar = size(nc{cvar}); nDims=length(sizVar); |
180 |
if dims{1} == 'T' |
if dims{1} == 'T' |
181 |
|
if isempty(find(fii)), error('Iters not found'); end |
|
if isempty(find(fii)), disp('Iters not found'); return, end |
|
|
|
|
|
tmpdata = nc{cvar}(fii,:); |
|
182 |
it = length(dims); |
it = length(dims); |
183 |
%- if only 1 time record, 1rst dim get lost; add it back: |
tmpdata = nc{cvar}(fii,:); |
184 |
% if size(nc{cvar},1) == 1, |
%- leading unity dimensions get lost; add them back: |
185 |
if length(fii) == 1, |
tmpdata=reshape(tmpdata,[length(fii) sizVar(2:end)]); |
|
tmpdata=reshape(tmpdata,[1 size(tmpdata)]); |
|
|
end |
|
186 |
else |
else |
|
tmpdata = nc{cvar}(:); |
|
187 |
it = 0; |
it = 0; |
188 |
|
tmpdata = nc{cvar}(:); |
189 |
|
%- leading unity dimensions get lost; add them back: |
190 |
|
tmpdata=reshape(tmpdata,sizVar); |
191 |
end |
end |
192 |
|
|
|
nDims=length(size(nc{cvar})); |
|
193 |
if dBug > 1, |
if dBug > 1, |
194 |
fprintf([' var:',cvar,': nDims=%i ('],nDims);fprintf(' %i',size(nc{cvar})); |
fprintf([' var:',cvar,': nDims=%i ('],nDims);fprintf(' %i',size(nc{cvar})); |
195 |
fprintf('):%i,nD=%i,it=%i ;',length(size(tmpdata)),length(dims),it); |
fprintf('):%i,nD=%i,it=%i ;',length(size(tmpdata)),length(dims),it); |