/[MITgcm]/MITgcm_contrib/mitgcm_tools/mitgcmhistory.m
ViewVC logotype

Diff of /MITgcm_contrib/mitgcm_tools/mitgcmhistory.m

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

revision 1.3 by dimitri, Mon Dec 10 05:28:50 2007 UTC revision 1.4 by dimitri, Wed Dec 12 23:42:46 2007 UTC
# Line 22  for k=1:nargin-1; Line 22  for k=1:nargin-1;
22    eval(['!grep ' varargin{k} ' ' file ' | sed s/.\*=// | sed s/NAN/1.23456789/ > ' tfile])    eval(['!grep ' varargin{k} ' ' file ' | sed s/.\*=// | sed s/NAN/1.23456789/ > ' tfile])
23    
24    % vals(:,k)=textread(tfile,'%f');    % vals(:,k)=textread(tfile,'%f');
   
25    % When output file is from an ongoing integration, one or more of    % When output file is from an ongoing integration, one or more of
26    % the diagnostics may be missing at the last available time step.    % the diagnostics may be missing at the last available time step.
27    % The code below accomodates this difference in length.    % The code below accomodates this difference in length.
# Line 32  for k=1:nargin-1; Line 31  for k=1:nargin-1;
31     lngt=length(vals(:,k));     lngt=length(vals(:,k));
32    else    else
33     tmp=textread(tfile,'%f');     tmp=textread(tfile,'%f');
34     % allow     if abs(length(tmp)-lngt)>1
35        % try to read one line at a time in order to deal with special case
36        % of values like, e.g.: "  -2.9248686233802-321"
37        fid=fopen(tfile);
38        n=0;
39        while(~feof(fid))
40         n=n+1;
41         tmp2=fgetl(fid);
42         val=sscanf(tmp2,'%f');
43         if length(val)>1
44          tmp(n)=0;
45         else
46          tmp(n)=val;
47         end
48        end
49        fid=fclose(fid);
50        tmp=tmp(1:n);
51       end
52     if abs(length(tmp)-lngt)>1     if abs(length(tmp)-lngt)>1
53      error(sprintf('An error occured while scanning for: %s',varargin{k}));      error(sprintf('An error occured while scanning for: %s',varargin{k}));
54     else     else

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

  ViewVC Help
Powered by ViewVC 1.1.22