1 |
gforget |
1.6 |
clear all; |
2 |
gforget |
1.1 |
|
3 |
|
|
%%%%%%%%%%%%%%%%% |
4 |
|
|
%load parameters: |
5 |
|
|
%%%%%%%%%%%%%%%%% |
6 |
|
|
choiceV3orV4='v4' |
7 |
|
|
|
8 |
gforget |
1.2 |
if ~isempty(choiceV3orV4)&isempty(whos('mygrid')); |
9 |
gforget |
1.1 |
gcmfaces_path; |
10 |
gforget |
1.5 |
dir0=[mydir '/sample_input/']; |
11 |
gforget |
1.4 |
dirGrid=[dir0 '/GRID' choiceV3orV4 '/']; |
12 |
|
|
dirIn=[dir0 '/SAMPLE' choiceV3orV4 '/']; |
13 |
gforget |
1.2 |
if strcmp(choiceV3orV4,'v4'); nF=5; else; nF=1; end; |
14 |
|
|
global mygrid; mygrid=[]; grid_load(dirGrid,nF); |
15 |
gforget |
1.1 |
end; |
16 |
|
|
|
17 |
|
|
%%%%%%%%%%%%%%%%%%%%%%% |
18 |
gforget |
1.2 |
%get sample data: V3 SSH |
19 |
gforget |
1.5 |
dirV3=[mydir '/sample_input/SAMPLEv3/']; |
20 |
gforget |
1.2 |
etan=rdmds([dirV3 'DDetan'],0); etan(etan==0)=NaN; |
21 |
gforget |
1.5 |
dirV3=[mydir '/sample_input/GRIDv3/']; |
22 |
gforget |
1.2 |
lon=rdmds([dirV3 'XC']); lat=rdmds([dirV3 'YC']); |
23 |
gforget |
1.1 |
|
24 |
|
|
%%%%%%%%%%%%%%%%%%%%%%% |
25 |
|
|
%do the interpolation: |
26 |
|
|
x=[lon-360;lon]; y=[lat;lat]; z=[etan;etan]; |
27 |
|
|
|
28 |
|
|
z_interp=gcmfaces(5); |
29 |
|
|
for ii=1:5; |
30 |
|
|
xi=mygrid.XC{ii}; yi=mygrid.YC{ii}; |
31 |
|
|
zi = interp2(x',y',z',xi,yi); |
32 |
|
|
z_interp{ii}=zi; |
33 |
|
|
end; |
34 |
|
|
|
35 |
|
|
%%%%%%%%%%%%%%%%%%%%%%% |
36 |
|
|
%illustrate the result: |
37 |
|
|
|
38 |
|
|
figure; set(gcf,'Units','Normalized','Position',[0.1 0.3 0.4 0.6]); |
39 |
|
|
x=[lon-360;lon]; y=[lat;lat]; z=[etan;etan]; |
40 |
|
|
pcolor(x,y,z); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar; |
41 |
|
|
|
42 |
|
|
figure; set(gcf,'Units','Normalized','Position',[0.5 0.3 0.4 0.6]); |
43 |
|
|
[X,Y,FLD]=convert2pcol(mygrid.XC,mygrid.YC,z_interp); |
44 |
|
|
pcolor(X,Y,FLD); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar; |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|