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

Contents of /MITgcm_contrib/mlosch/interp_llc/xyrecur_max.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 [H2,x2,y2]=xyrecur_max(He,xe,ye,niter)
2 %
3 % Returns the gridded data on a grid of half the size
4 % with the maximum (highest) data moved to the cell-centers.
5 %
6 % e.g.
7 % [H2,x2,y2]=xyrecur_max(He,xe,ye);
8
9 H2=He;
10 x2=xe;
11 y2=ye;
12
13 % Recursively iterate
14 for nit=1:niter,
15 disp(sprintf(' Recursion level %i (%i,%i) -> (%i,%i) ... ',nit,nx,ny,nx/2,ny/2));
16
17 [nx,ny]=size(H2);
18
19 ii=1:2:nx-1;
20 jj=1:2:ny-1;
21
22 H2=max( max(H2(ii,jj),H2(ii+1,jj)) , max(H2(ii,jj+1),H2(ii+1,jj+1)) );
23 x2=(x2(ii)+x2(ii+1))/2;
24 y2=(y2(jj)+y2(jj+1))/2;
25
26 disp('done.');
27
28 end

  ViewVC Help
Powered by ViewVC 1.1.22