/[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.2 - (hide annotations) (download)
Sat Feb 13 16:34:20 2010 UTC (15 years, 5 months ago) by gforget
Branch: MAIN
Changes since 1.1: +11 -17 lines
use sample input data that can be obtained online

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.2 dir0='/net/altix3700/raid4/gforget/mysetups/ecco_v4/RUNS/matlab_class_material/';
10     dirGrid=[dir0 'GRID' choiceV3orV4 '/'];
11     dirIn=[dir0 'SAMPLE' choiceV3orV4 '/'];
12     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     dirV3='/net/altix3700/raid4/gforget/mysetups/ecco_v4/RUNS/matlab_class_material/SAMPLEv3/';
19     etan=rdmds([dirV3 'DDetan'],0); etan(etan==0)=NaN;
20     dirV3='/net/altix3700/raid4/gforget/mysetups/ecco_v4/RUNS/matlab_class_material/GRIDv3/';
21     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