/[MITgcm]/MITgcm_contrib/dgoldberg/depth_control_no_nsa/input/topbot.m
ViewVC logotype

Contents of /MITgcm_contrib/dgoldberg/depth_control_no_nsa/input/topbot.m

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


Revision 1.1 - (show annotations) (download)
Thu Dec 7 23:28:44 2017 UTC (7 years, 7 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
*** empty log message ***

1 function [tfld,bfld]=topbot(g,fld);
2 %function [tfld,bfld] = mit_bottomfield(g,fld); or
3 %function [tfld,bfld] = mit_bottomfield(cmask,fld);
4
5 if isstruct(g)
6 cm = change(g.cmask,'==',NaN,0);
7 else
8 cm = change(g,'==',NaN,0);
9 end
10 tfld = repmat(NaN,size(fld(:,:,1,:)));
11 bfld = repmat(NaN,size(fld(:,:,1,:)));
12 for kx=1:size(fld,1);
13 for ky=1:size(fld,2);
14 kt=min(find(cm(kx,ky,:)>0));
15 kb=max(find(cm(kx,ky,:)>0));
16 if kt > 0;
17 tfld(kx,ky,1,:) = fld(kx,ky,kt,:);
18 bfld(kx,ky,1,:) = fld(kx,ky,kb,:);
19 end
20 end
21 end
22 tfld = squeeze(tfld);
23 bfld = squeeze(bfld);
24
25 return
26

  ViewVC Help
Powered by ViewVC 1.1.22