/[MITgcm]/MITgcm_contrib/gael/matlab_class/sample_processing/example_interp.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/sample_processing/example_interp.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (hide annotations) (download)
Fri Apr 30 06:19:35 2010 UTC (15 years, 3 months ago) by gforget
Branch: MAIN
Changes since 1.4: +3 -3 lines
changing the sample input data directory name from
matlab_class_material to sample_input

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

  ViewVC Help
Powered by ViewVC 1.1.22