/[MITgcm]/MITgcm_contrib/gael/matlab_class/@gcmfaces/nanmax.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/matlab_class/@gcmfaces/nanmax.m

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


Revision 1.3 - (show annotations) (download)
Thu Apr 10 16:06:03 2014 UTC (11 years, 3 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65p, checkpoint65q
Changes since 1.2: +12 -3 lines
- fix case of two gcmfaces arguments (issue reported by I. Fenty).

1 function r = nanmax(p,varargin)
2 %overloaded gcmfaces nanmax function :
3 % 1) if single gcmfaces argument, then returns the global nanmax over all faces
4 % 2) if two gcmfaces arguments, then returns the nanmax of the two at each point
5 % 3) otherwise calls double nanmax function for each face, passing over the other arguments
6
7 if nargin==1;
8 tmp1=[];
9 for iFace=1:p.nFaces;
10 iF=num2str(iFace);
11 eval(['tmp1=[tmp1;p.f' iF '(:)];']);
12 end;
13 r=nanmax(tmp1);
14 return;
15 end;
16
17 if isa(varargin{1},'gcmfaces');
18 r=p;
19 for iFace=1:r.nFaces;
20 iF=num2str(iFace);
21 eval(['r.f' iF '=nanmax(p.f' iF ',varargin{1}.f' iF ');']);
22 end;
23 return;
24 end;
25
26
27 r=p;
28 for iFace=1:r.nFaces;
29 iF=num2str(iFace);
30 eval(['r.f' iF '=nanmax(p.f' iF ',varargin{:});']);
31 end;
32
33

  ViewVC Help
Powered by ViewVC 1.1.22