| 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 |
|
|
jj=find(~isnan(z)); x=x(jj); y=y(jj); z=z(jj); |
| 33 |
|
|
|
| 34 |
|
|
z_interp=gcmfaces(5); |
| 35 |
|
|
for ii=1:5; |
| 36 |
|
|
xi=mygrid.XC{ii}; yi=mygrid.YC{ii}; |
| 37 |
|
|
zi = griddata(x',y',z',xi,yi); |
| 38 |
|
|
z_interp{ii}=zi; |
| 39 |
|
|
end; |
| 40 |
|
|
|
| 41 |
|
|
fprintf('note that griddata puts values in remote places ... \n'); |
| 42 |
|
|
fprintf('so one should obviously be cautious when using this routine\n'); |
| 43 |
|
|
%msk=mygrid.hFacC(:,:,1); z_interp(find(msk==0))=NaN; |
| 44 |
|
|
|
| 45 |
|
|
%%%%%%%%%%%%%%%%%%%%%%% |
| 46 |
|
|
%illustrate the result: |
| 47 |
|
|
|
| 48 |
|
|
figure; set(gcf,'Units','Normalized','Position',[0.1 0.1 0.4 0.6]); |
| 49 |
|
|
x=[lon-360;lon]; y=[lat;lat]; z=[etan;etan]; |
| 50 |
|
|
pcolor(x,y,z); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar; |
| 51 |
|
|
|
| 52 |
|
|
figure; set(gcf,'Units','Normalized','Position',[0.5 0.1 0.4 0.6]); |
| 53 |
|
|
[X,Y,FLD]=convert2pcol(mygrid.XC,mygrid.YC,z_interp); |
| 54 |
|
|
pcolor(X,Y,FLD); axis([-180 180 -90 90]); shading flat; caxis([-2 1]); colorbar; |
| 55 |
|
|
|
| 56 |
|
|
pause; |
| 57 |
|
|
|