/[MITgcm]/MITgcm_contrib/gmaze_pv/subfct/subfct_getisoS.m
ViewVC logotype

Contents of /MITgcm_contrib/gmaze_pv/subfct/subfct_getisoS.m

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


Revision 1.2 - (show annotations) (download)
Wed Sep 19 15:24:41 2007 UTC (17 years, 10 months ago) by gmaze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
General Update

1 %
2 % [Iiso MASK] = SUBFCT_GETISOS(TRACER,ISO)
3 %
4 % This function determines the iso-surface ISO of the
5 % 3D field TRACER(Z,Y,X)
6 % Iiso(Y,X) contains indices of axis Z of the iso-surface.
7 % MASK(Y,X) contains 1 where the iso-surface is defined
8 % and 0 elsewhere. Useful to plot other fields.
9 %
10 % 06/19/06
11 % gmaze@mit.edu
12
13 function varargout = subfct_getisoS(CHP,ISO)
14
15
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17 % PRE-PROCESS and ERROR CHECK %
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 pv_checkpath
20
21 if nargin ~= 2
22 help subfct_getisoS.m
23 error('subfct_getisoS.m : Wrong number of parameters')
24 return
25 end
26
27 [nz ny nx] = size(CHP);
28 if nz ==1 | nx == 1 | ny == 1
29 help subfct_getisoS.m
30 error('subfct_getisoS.m : 3DFIELD must be a 3D field')
31 return
32 end
33
34
35
36 %%%%%%%%%%%%%%%%%%%%%%%%%
37 % DETERMINE ISO-SURFACE %
38 %%%%%%%%%%%%%%%%%%%%%%%%%
39
40 mask = ones(ny,nx).*NaN;
41 %isoS = ones(ny,nx).*NaN;
42 Iiso = ones(ny,nx).*NaN;
43
44 for ix = 1 : nx
45 for iy = 1 : ny
46 p = squeeze(CHP(:,iy,ix));
47 p = find(p<=ISO);
48 if isempty(p)
49 % isoS(iy,ix) = NaN;
50 Iiso(iy,ix) = NaN;
51 else
52 % isoS(iy,ix) = CHP(max(p),iy,ix);
53 Iiso(iy,ix) = max(p);
54 mask(iy,ix) = 1;
55 end %if
56 end %for ix
57 end %for iy
58
59
60
61 %%%%%%%%%%%
62 % OUTPUTS %
63 %%%%%%%%%%%
64 switch nargout
65 case {0,1}
66 varargout(1) = {Iiso};
67 case 2
68 varargout(1) = {Iiso};
69 varargout(2) = {mask};
70 end %switch nargout
71
72

  ViewVC Help
Powered by ViewVC 1.1.22