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

Annotation of /MITgcm_contrib/mlosch/interp_llc/drop_thinwalls.m

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


Revision 1.1 - (hide annotations) (download)
Thu May 3 21:07:20 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 mlosch 1.1 function [H]=drop_thinwalls(h,hx,hy,periodic)
2     %
3     % Returns the depths at T points based on T, U and V points.
4     %
5     % e.g.
6     % H=drop_thinwalls(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     [nx,ny]=size(h);
13    
14     % Fill-up cell-centers where all sides are higher
15     Hsides=min( hx, hx([2:end 1],:,:) );
16     Hsides=min( Hsides, hy );
17     Hsides=min( Hsides, hy(:,[2:end end],:) );
18     H=max( h, Hsides );
19    
20     %H=h;
21     for jj=1:ny;
22     jp=min(ny,jj+1);
23     jm=max(1,jj-1);
24     for ii=1:nx;
25     if periodic==1
26     ip=mod(ii,nx)+1;
27     im=mod(ii-2+nx,nx)+1;
28     else
29     ip=min(nx,ii+1);
30     im=max(1,ii-1);
31     end
32    
33     hp=H(ii,jj);
34     hm=H(im,jj);
35     ho=hx(ii,jj);
36     if ho>max(hm,hp)
37     if hm<hp
38     H(ii,jj)=ho;
39     else
40     H(im,jj)=ho;
41     end
42     end
43    
44     hp=H(ii,jj);
45     hm=H(ii,jm);
46     ho=hy(ii,jj);
47     if ho>max(hm,hp)
48     if hm<hp
49     H(ii,jj)=ho;
50     else
51     H(ii,jm)=ho;
52     end
53     end
54    
55     end
56     end

  ViewVC Help
Powered by ViewVC 1.1.22