Parent Directory
|
Revision Log
|
Revision Graph
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 [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 |