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

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

  ViewVC Help
Powered by ViewVC 1.1.22