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

Annotation of /MITgcm_contrib/gael/matlab_class/@gcmfaces/nanmin.m

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


Revision 1.4 - (hide annotations) (download)
Mon Feb 8 13:19:21 2016 UTC (9 years, 5 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.3: +13 -4 lines
- add DIM=0 option to operate on dimensions 1 and 2 jointly

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

  ViewVC Help
Powered by ViewVC 1.1.22