多变量EOF程序
;读取数据olre,olrs
ue=fbindirread("D:\cygwin\data\skx\shuju\lvbo\bfes1979-2008quyu\ubfe1979-2008quyu.grd",0,(/3944,17,33/),"float")ve=fbindirread("D:\cygwin\data\skx\shuju\lvbo\bfes1979-2008quyu\vbfe1979-2008quyu.grd",0,(/3944,17,33/),"float")
vorte=fbindirread("D:\cygwin\data\skx\shuju\lvbo\bfes1979-2008quyu\vortbfe1979-2008quyu.grd",0,(/3944,17,33/),"float")
u=ue(:,16:0,:)
v=ve(:,16:0,:)
vort=vorte(:,16:0,:)
f =addfile("D:\cygwin\data\skx\shuju\uwnd1979-2008.nc","r")
x=short2flt(f->uwnd(0:3943,{0:40},{90:170}))
copy_VarMeta(x, u)
;u=dim_standardize_n_Wrap(u, 0, 0)
;v=dim_standardize_n_Wrap(v, 0, 0)
;vort=dim_standardize_n_Wrap(vort, 0, 0)
;printVarSummary(u)
;*******************Write into one dataset*****************************
; Combine the normalized data into one variable ;
;**********************************************************************
dimw=dimsizes(u)
mtim=dimw(0)
mlat=dimw(1)
mlon=dimw(2)
cdata=new((/3*mlat,3*mlon,mtim/),typeof(u),getFillValue(u))
do m1=0,mlat-1
do m2=0,mlon-1
cdata(m1,m2,:)=(/u(:,m1,m2)/)
copy_VarAtts(u, cdata(m1,m2,:))
cdata(m1+mlat,m2+mlon,:)=(/v(:,m1,m2)/)
copy_VarMeta(u,cdata(m1+mlat,m2+mlon,:))
cdata(m1+2*mlat,m2+2*mlon,:)=(/vort(:,m1,m2)/)
copy_VarMeta(u,cdata(m1+2*mlat,m2+2*mlon,:))
end do
end do
printVarSummary(cdata)
;***************************************t*****************************
; Compute **combined** EOF; Sign of EOF is arbitrary ;
;**********************************************************************
neof=2
eof_cdata=eofunc(cdata,neof,False)
eof_ts_cdata=eofunc_ts(cdata,eof_cdata,False)
printVarSummary(eof_cdata)
printVarSummary(eof_ts_cdata)
nvar=3 ;p,u,v
ceof=new( (/nvar,neof,mlat,mlon/), typeof(cdata), getFillValue(cdata))
do n=0,neof-1
ceof(0,n,:,:)=eof_cdata(n,0:mlat-1,0:mlon-1); p
ceof(1,n,:,:)=eof_cdata(n,mlat:mlat*2-1,mlon:2*mlon-1); u
ceof(2,n,:,:)=eof_cdata(n,2*mlat:,2*mlon:); v
end do
ceof!0="var"
ceof!1="eof"
ceof!2="lat"
ceof!3="lon"
ceof&lat=u&lat
ceof&lon=u&lon
printVarSummary(ceof)
printMinMax(ceof(0,1,:,:),False)
;***************************************t*****************************
; plot now ;
;**********************************************************************
wks=gsn_open_wks("png","../../data/skx/mveof/eof1")
res= True
res@gsnFrame= False; don't advance frame yet
plot=gsn_csm_vector(wks,ceof(0,0,:,:), ceof(1,0,:,:),res)
plot=gsn_csm_contour(wks,ceof(2,0,:,:),res)
frame(wks)
wks=gsn_open_wks("png","../../data/skx/mveof/eof2")
res= True
res@gsnFrame= False; don't advance frame yet
plot=gsn_csm_vector(wks,ceof(0,1,:,:), ceof(1,1,:,:),res)
plot=gsn_csm_contour(wks,ceof(2,1,:,:),res)
frame(wks)