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

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

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

revision 1.2 by gforget, Thu Oct 20 20:57:01 2011 UTC revision 1.4 by gforget, Mon Feb 8 13:19:21 2016 UTC
# Line 1  Line 1 
1  function r = nanmax(p,varargin)  function r = nanmax(p,varargin)
2    % NANMAX(p,varargin)
3    %
4  %overloaded gcmfaces nanmax function :  %overloaded gcmfaces nanmax function :
5  %  1) if single gcmfaces argument, then returns the global nanmax over all faces  %  1) if single gcmfaces argument, then returns the global nanmax over all faces
6  %  2) if more than one argument, then simply calls double nanmax function for  %  2) if two gcmfaces arguments, then returns the nanmax of the two at each point
7  %     each face data, passing over the other arguments  %  3) otherwise calls double nanmax function for each face, passing over the other arguments
8    
9  if nargin==1;  if nargin==1;
10     tmp1=[];     tmp1=[];
# Line 14  if nargin==1; Line 16  if nargin==1;
16     return;     return;
17  end;  end;
18    
19  r=p;  if isa(varargin{1},'gcmfaces');
20       r=p;
21       for iFace=1:r.nFaces;
22          iF=num2str(iFace);
23          eval(['r.f' iF '=nanmax(p.f' iF ',varargin{1}.f' iF ');']);
24       end;
25       return;
26    end;
27    
28  for iFace=1:r.nFaces;  if varargin{2}>0;
29     iF=num2str(iFace);    r=p;
30     eval(['r.f' iF '=nanmax(p.f' iF ',varargin{:});']);    for iFace=1:r.nFaces;
31         iF=num2str(iFace);
32         eval(['r.f' iF '=nanmax(p.f' iF ',varargin{:});']);
33      end;
34    else;
35      tmp1=convert2gcmfaces(p);
36      [n1,n2,n3,n4]=size(tmp1);
37      tmp1=reshape(tmp1,n1*n2,n3,n4);
38      r=nanmax(tmp1,[],1);
39  end;  end;
40    
41    

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

  ViewVC Help
Powered by ViewVC 1.1.22