/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_IO/rdmds.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/rdmds.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by gforget, Wed Feb 10 14:46:49 2010 UTC revision 1.3 by gforget, Thu Sep 11 19:38:24 2014 UTC
# Line 118  for ind=1:size(varargin,2); Line 118  for ind=1:size(varargin,2);
118      error(sprintf('Argument %i > 9999999999',arg))      error(sprintf('Argument %i > 9999999999',arg))
119     end     end
120     itrs=arg;     itrs=arg;
121      elseif length(arg) == 1 & arg == -1
122       itrs=arg;
123    else    else
124     error(sprintf('Argument %i must be a positive integer',arg))     error(sprintf('Argument %i must be a positive integer',arg))
125    end    end
# Line 138  for iter=1:size(itrs,2); Line 140  for iter=1:size(itrs,2);
140   end   end
141    
142  % Figure out if there is a path in the filename  % Figure out if there is a path in the filename
143   NS=findstr('/',fname);   NS1=findstr('/',fname);
144   if size(NS)>0   NS2=findstr('\',fname);
145    Dir=fname(1:NS(end));   NS=max([NS1 NS2]);
146     if ~isempty(NS)
147      Dir=fname(1:NS);
148   else   else
149    Dir='./';    Dir=pwd;
150   end   end
151    
152  % Match name of all meta-files  % Match name of all meta-files
153   allfiles=dir( sprintf('%s*.meta',fname) );    %fprintf(' search for file "%s".*meta\n',fname);
154     allfiles=dir( sprintf('%s.*meta',fname) );
155    
156   if size(allfiles,1)==0   if size(allfiles,1)==0
157    disp(sprintf('No files match the search: %s*.meta',fname));    disp(sprintf('No files match the search: %s.*meta',fname));
158   %allow partial reads%  error('No files found.')   %allow partial reads%  error('No files found.')
159   end   end
160    
161  % Loop through allfiles  % Loop through allfiles
162   for j=1:size(allfiles,1);   for j=1:size(allfiles,1);
163      %fprintf(' file # %3i : %s\n',j,allfiles(j).name);
164    
165  % Read meta- and data-file  % Read meta- and data-file
166    [A,N,M,mG] = localrdmds([Dir allfiles(j).name],ieee,recnum);    [A,N,M,mG] = localrdmds([Dir allfiles(j).name],ieee,recnum);
# Line 168  for iter=1:size(itrs,2); Line 174  for iter=1:size(itrs,2);
174     if isempty(ii), jj1=0; jj2=0;     if isempty(ii), jj1=0; jj2=0;
175     else jj1=ii; jj2=ii+min(findstr(M(1+ii:end),'];')); end     else jj1=ii; jj2=ii+min(findstr(M(1+ii:end),'];')); end
176     if iter==1 & j==1,     if iter==1 & j==1,
177      MM=M; ind1=0; ind2=0; is1=ii1; js1=jj1; M3='';      MM=M; ind1=0; ind2=0; is1=ii1; js1=jj1; M3='';
178      if ii1*jj1 > 0,      if ii1*jj1 > 0,
179       %ind1=min(ii1,jj1); ind2=max(ii2,jj2);       %ind1=min(ii1,jj1); ind2=max(ii2,jj2);
180       %if ii1 < jj1, ii3=ii2+1; jj3=jj1-1;       %if ii1 < jj1, ii3=ii2+1; jj3=jj1-1;
181       %else  ii3=jj2+1; jj3=ii1-1; end       %else  ii3=jj2+1; jj3=ii1-1; end
182        order=sort([ii1 ii2 jj1 jj2]);        order=sort([ii1 ii2 jj1 jj2]);
183        ind1=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4);        ind1=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4);
184        M2=M(ii1:ii2); M4=M(jj1:jj2); M3=M(ii3:jj3);        M2=M(ii1:ii2); M4=M(jj1:jj2); M3=M(ii3:jj3);
185      elseif ii1 > 0,      elseif ii1 > 0,
186        ind1=ii1; ind2=ii2;        ind1=ii1; ind2=ii2;
187        M2=M(ii1:ii2); M4='';        M2=M(ii1:ii2); M4='';
188      elseif jj1 > 0,      elseif jj1 > 0,
189        ind1=jj1; ind2=jj2;        ind1=jj1; ind2=jj2;
190        M4=M(jj1:jj2); M2='';        M4=M(jj1:jj2); M2='';
191      end      end
# Line 192  for iter=1:size(itrs,2); Line 198  for iter=1:size(itrs,2);
198      %fprintf(' M4=%s<\n',M4);      %fprintf(' M4=%s<\n',M4);
199      %fprintf(' M5=%s<\n',M5);      %fprintf(' M5=%s<\n',M5);
200     else     else
201      if ii1*jj1 > 0,      if ii1*jj1 > 0,
202           order=sort([ii1 ii2 jj1 jj2]);           order=sort([ii1 ii2 jj1 jj2]);
203           ind=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4);           ind=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4);
204      else ind=max(ii1,jj1); ind2=ii2+jj2; end      else ind=max(ii1,jj1); ind2=ii2+jj2; end
# Line 220  for iter=1:size(itrs,2); Line 226  for iter=1:size(itrs,2);
226      end      end
227     end     end
228  %  save modifications:  %  save modifications:
229     if ind1>0 & j==size(allfiles,1) & iter==size(itrs,2),     if ind1>0 & j==size(allfiles,1) & iter==size(itrs,2),
230       if ii1 < jj1, MM=[MM(1:ind1-1),M2,M3,M4,M5];       if ii1 < jj1, MM=[MM(1:ind1-1),M2,M3,M4,M5];
231       else          MM=[MM(1:ind1-1),M4,M3,M2,M5]; end       else          MM=[MM(1:ind1-1),M4,M3,M2,M5]; end
232     end     end
233    end    end
234    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22