/[MITgcm]/MITgcm_contrib/mlosch/interp_llc/remove_inlets.m
ViewVC logotype

Contents of /MITgcm_contrib/mlosch/interp_llc/remove_inlets.m

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


Revision 1.1 - (show annotations) (download)
Thu May 3 21:07:21 2007 UTC (18 years, 2 months ago) by mlosch
Branch: MAIN
CVS Tags: HEAD
initial checkin of topography and hydrography interpolation scripts for
the llc-grid, based on old matlab scripts by Alistair Adcroft
Let's hope, they are useful.

1 function [h,hx,hy]=remove_inlets(h,hx,hy)
2 %
3 % Remove simple inlets
4 %
5 % e.g.
6 % [H2,Hx2,Hy2]=remove_inlets(H2,Hx2,Hy2);
7
8 if size(h)~=size(hx) | size(h)~=size(hy)
9 error('Arguments must all be the same size!\n');
10 end
11
12 oh=h+1;
13
14 while ( sum(oh(:)-h(:)) )
15 oh=h;
16
17 % Find second deepest side
18 hh(1,:,:,:)=hx;
19 hh(2,:,:,:)=hx([2:end 1],:,:);
20 hh(3,:,:,:)=hy;
21 hh(4,:,:,:)=hy(:,[2:end end],:);
22 hh=sort(hh);
23
24 % Remove inlets
25 h=squeeze(hh(2,:,:,:));
26
27 % Regenerate side walls
28 hX=max(h,h([end 1:end-1],:,:)); hx=max(hx,hX);
29 hY=max(h,h(:,[1 1:end-1],:)); hy=max(hy,hY);
30
31 end

  ViewVC Help
Powered by ViewVC 1.1.22