- 积分
- 816
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-6-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想做某一个区域的降水量与整个北半球的500hpa高度场之间的回归分析。参考论坛中的相关的帖子后,改成了下面的这段,但出来的图我觉得是有问题的,高手替我看一看是哪儿出错了,刚刚学ncl不久,菜鸟一个。谢谢。
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
time=33
nx=480
ny=121
missing_value=-32767
lat = fspan(0,90,121)
lon = fspan(-180,179.25,480)
lat@units = "degrees_north"
lon@units = "degrees_east"
x= asciiread("/data/ncep/temperature.dat",-1,"float")
x!0="time"
y=addfile("/data/ncep/1980-2013_500hgt_850tem.nc","r")
hgt_tmp=y->z
hgt_tmp2=hgt_tmp*0.1570313334503227+52855.71054683327
hgt_tmp3=hgt_tmp2(:,0:0,:,:)
temp_data=new((/1,ny,nx,33/),float)
do i=0,32
temp_data(:,:,:,i:i)=dim_avg_n(hgt_tmp3((0+6*i):(5+6*i),:,:,:),0)
end do
temp_data2=onedtond(temp_data,(/ny,nx,33/))
temp_data2!0="lat"
temp_data2!1="lon"
temp_data2!2="time"
temp_data2&lat=lat
temp_data2&lon=lon
;printVarSummary(y)
rc=regCoef(x,temp_data2)
;rc = regCoef(x, y(lat|:,lon|:,time|:) )
rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = temp_data2&lat ; assign coordinate values to named dimensions
rc&lon = temp_data2&lon
printVarSummary(rc) ; variable overview
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic
tval!0 = "lat" ; name dimensions
tval!1 = "lon"
tval&lat = temp_data2&lat ; assign coordinate values to named dimensions
tval&lon = temp_data2&lon
df = onedtond(rc@nptxy, dimsizes(rc)) - 2 ;自由度
b = tval ; b must be same size as tval (and df)
b = 0.5
prob = betainc(df/(df+tval^2),df/2.0,b) ; prob(nlat,nlon)
;print(prob)
prob!0 = "lat" ; name dimensions
prob!1 = "lon"
prob&lat = temp_data2&lat ; assign coordinate values to named dimensions
prob&lon = temp_data2&lon
rc@long_name = "regression coefficient"
prob@long_name = "probability"
wks = gsn_open_wks("png","regression")
gsn_define_colormap(wks,"BlWhRe")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnInfoLabelOn = False
res@cnFillOn = True
res@cnLineLabelsOn = False
res@gsnSpreadColors = True
res@lbLabelBarOn = False
res@tiMainString = "" ; main title
res@gsnRightString = "" ;units
res@gsnLeftString = "" ;long_name
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnMinLevelValF = -1.
res@cnMaxLevelValF = 1.
res@cnLevelSpacingF = 0.5
res@mpCenterLonF=0
res@mpMinLatF=0
res@mpMaxLatF=90
res@mpMinLonF=-180
res@mpMaxLonF=180
plot1 = gsn_csm_contour_map_ce(wks,rc,res)
res2 = res
res2@gsnDraw = False ; do not draw
res2@gsnFrame = False ; do not advance frame
res2@gsnMaximize = True
res2@cnMonoFillPattern = False
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/b/) ;; set to significance level
res2@cnFillPatterns = (/3/)
res2@gsnLeftString = ""
res2@mpMinLatF=0
res2@mpMaxLatF=90
res2@mpMinLonF=-180
res2@mpMaxLonF=180
plot2 = gsn_csm_contour(wks,tval,res2)
opt = True
opt@gsnShadeFillType = "pattern" ; pattern fill
opt@gsnShadeLow = 17
opt@gsnShadeHigh = 17 ; use pattern #17
opt@gsnLeftString = " "
opt@gsnRightString = " "
opt@cnLinesOn = False ; turn off contour lines
opt@cnLineLabelsOn = False ; turn off contour line labels
plot2 = gsn_contour_shade(plot2,-2.0,2.0,opt)
overlay(plot1,plot2)
draw(plot1)
frame(wks)
end
|
|