/[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.1 - (hide annotations) (download)
Wed Feb 10 14:52:05 2010 UTC (15 years, 5 months ago) by gforget
Branch: MAIN
matlab_class: example of data processing (to make llc model input using
		matlab_class/@gcmfaces)

1 gforget 1.1
2     %%%%%%%%%%%%%%%%%
3     %load parameters:
4     %%%%%%%%%%%%%%%%%
5     choiceV3orV4='v4'
6    
7     if strcmp(choiceV3orV4,'v3')&isempty(whos('mygrid'));
8     gcmfaces_path;
9     global mygrid; mygrid=[]; clear all;
10     dirGrid='/net/altix3700/raid4/gforget/mysetups/ecco_v3/RUNS/fwd3y_fg_as_v4_ncep/';
11     nF=1; grid_load(dirGrid,nF); global mygrid;
12     dirIn='/net/altix3700/raid4/gforget/mysetups/ecco_v3/RUNS/fwd3y_fg_as_v4_ncep/DIAGfiles/';
13     elseif strcmp(choiceV3orV4,'v4')&isempty(whos('mygrid'));
14     gcmfaces_path;
15     global mygrid; mygrid=[]; clear all;
16     dirGrid='/net/altix3700/raid5/gforget/mysetups/ecco_v4/RUNS/GRIDev4/';
17     nF=5; grid_load(dirGrid,nF); global mygrid;
18     dirIn='/net/altix3700/raid4/gforget/mysetups/ecco_v4/RUNS/runs3yVISC/fwd3y_ncep_evolution4/DIAGfiles/';
19     end;
20    
21    
22    
23     %%%%%%%%%%%%%%%%%%%%%%%
24     %get sample data: OCCA SSH
25    
26     ncload /net/altix3700/raid5/gforget/occa_r3/atlasannual_nc/DDetan.0406annclim.nc Longitude_t Latitude_t etan;
27     lon=Longitude_t*ones(1,160); lat=ones(360,1)*Latitude_t'; etan=etan'; etan(etan<-100)=NaN;
28    
29     %%%%%%%%%%%%%%%%%%%%%%%
30     %do the interpolation:
31     x=[lon-360;lon]; y=[lat;lat]; z=[etan;etan];
32    
33     z_interp=gcmfaces(5);
34     for ii=1:5;
35     xi=mygrid.XC{ii}; yi=mygrid.YC{ii};
36     zi = interp2(x',y',z',xi,yi);
37     z_interp{ii}=zi;
38     end;
39    
40     %%%%%%%%%%%%%%%%%%%%%%%
41     %illustrate the result:
42    
43     figure; set(gcf,'Units','Normalized','Position',[0.1 0.3 0.4 0.6]);
44     x=[lon-360;lon]; y=[lat;lat]; z=[etan;etan];
45     pcolor(x,y,z); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar;
46    
47     figure; set(gcf,'Units','Normalized','Position',[0.5 0.3 0.4 0.6]);
48     [X,Y,FLD]=convert2pcol(mygrid.XC,mygrid.YC,z_interp);
49     pcolor(X,Y,FLD); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar;
50    
51    
52    

  ViewVC Help
Powered by ViewVC 1.1.22