- 积分
- 3107
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-9-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2017-6-23 09:25:22
|
显示全部楼层
%-----------------------------------------------
%Data explanation:
%Data for all over the world:73*144;
%No year and level request;
%Data for monthly mean from NCEP/NCAR;
%Data format:.nc;
%Put your data file in folder ..\data\.
%-------EOF for model 1-------------------------
clear all;close all;clc
f=netcdf('C:\Documents and Settings\All Users\桌面','nowrite');%You can change the data file if you wish.
lon=f{'lon'}(:);
lat=f{'lat'}(:);
%level=f{'level'}(:);
PP=f{'air'}(:);%If you change the data file, you should change the value('uwnd') too.
close(f);
clear f;
%-------You can choose the area and year!------
lon1=70;%longitude of the west boundry.
lon2=140;%longitude of the east boundry.
lat1=0;%latitude of the south boundry.
lat2=60;%latitude of the north boundry.
year1=1979;%year begin.
year2=2007;%year end.
levelnumber=1;%No.'N' level;From the lowest;
%-------------------------------
lonw=lon1/2.5+1;
lone=lon2/2.5+1;
lats=(90-lat1)/2.5+1;
latn=(90-lat2)/2.5+1;
clear lon1 lon2 lat1 lat2;
%--------------------------------
y=[ ];
for m=1:12:(year2-year1+1)*12;
x=[ ];
for n=lonw:1:lone;
%a=(squeeze(PP(m,levelnumber,[latn:lats],n)));
a=(squeeze(PP(m,[latn:lats],n)))';
x=[x;a];
end
y=[y,x];
clear x;
end
clear m n;
clear PP;
clear a;
%y=0.00999999977648258*y+202.649993896484;
z=y*y';
[V,D]=eig(z);
clear z;
r=[ ];
rr=size(D);
for l=1:1:rr;
r=[r,D(l,l)];
end
clear l D;
%----------Mode----------------------
figure(1)
[m,i]=max(r);
A=V(:,i);
clear i;%maxmum number position.
G=m/(r*ones(rr,1))% accumulation variance
clear m;%maximum number.
AA=[ ];
for n=1:(lats-latn+1):rr;
AA=[AA,A([n:n+lats-latn],1)];
end
%clear A;
clear n rr;
[C,H]=contourf(lon([lonw:lone],1),lat([latn:lats],1),AA);
clabel(C,H,'LabelSpacing',72,'Rotation',0,'FontSize',8);
clear C H;
grid on;
xlabel('longitude');ylabel('latitude');
%caxis([-0.6,0.6]);
colorbar;
clear lone lonw lats latn;
%-----------Time serial---------------------
figure(2)
Y=V'*y;
clear y;
YY=Y(1,[1:(year2-year1+1)]);
X=year1:1:year2;
hold on;
plot(X,YY);
clear YY;
Z=zeros(1,(year2-year1+1));
plot(X,Z,'r');
axis tight;
xlabel('year');
clear X Z year1 year2;
hold off;
%-----------------------------------
clear A AA V Y lat level levelnumber lon r;
上面是所有程序,希望帮我解决一下,非常感谢 |
|