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

Annotation of /MITgcm_contrib/mlosch/interp_llc/mdsiocompact.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:21 2007 UTC (18 years, 2 months ago) by mlosch
Branch: MAIN
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 b=mdsiocompact(a);
2     % hack to convert to mdsio compact format
3    
4     [nx,ny,nz,nt]=size(a);
5     if nx/4~=round(nx/4);
6     error('not a llc field');
7     end
8    
9     n4=nx/4;
10     m=(ny-n4)/n4;
11     m4=m*n4;
12     for kt = 1:nt
13     for kz = 1:nz
14     for k=1:4
15     sides{k} = a([1:n4]+(k-1)*n4,1:m4,kz,kt);
16     end
17     cap = a([1:n4]+1*n4,m4+1:end,kz,kt);
18     % reformat
19     btmp = [sides{1} ...
20     sides{2} ...
21     cap ...
22     reshape(rot90(sides{3},1),[n4 m4]) ...
23     reshape(rot90(sides{4},1),[n4 m4]) ...
24     cap*0];
25     b(:,:,kz,kt)=btmp;
26     end
27     end
28    
29     return

  ViewVC Help
Powered by ViewVC 1.1.22