- 积分
- 2648
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-5-22
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2017-10-6 05:14:20
|
显示全部楼层
;************************************************
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=45
nx=360
ny=180
;missing_value=-1.0E+30
lat = fspan(-89.5,89.5,180)
lon = fspan(-179.5,179.5,360)
lat@units = "degrees_north"
lon@units = "degrees_east"
x=fbindirread("/cygdrive/d/YYW/nino34/winter-nor/acc.grd",0,(/time/),"float")
x!0="time"
;std_f=stddev(f)
;print(std_f) ;计算年际标准差
y=fbindirread("/cygdrive/d/YYW/regression/sst/ACCESM1-0.grd",0,(/time,ny,nx/),"float")
y!0="time"
y!1="lat"
y!2="lon"
y&lat=lat
y&lon=lon
;printVarSummary(y)
rc = regCoef(x, y(lat|:,lon|:,time|:) ) ;交换维数,使最右维与x的最右维相同
rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = y&lat ; assign coordinate values to named dimensions
rc&lon = y&lon
;printVarSummary(rc) ; variable overview
;rc@long_name = "regression coefficient"
fout2="rc-ACCESM1-0.grd"
fbinrecwrite(fout2,-1,(/rc/))
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic
;printVarSummary(tval)
tval@FillValue= 9.96921e+36
tval!0 = "lat" ; name dimensions
tval!1 = "lon"
tval&lat = y&lat ; assign coordinate values to named dimensions
tval&lon = y&lon
tval@long_name = "probability"
;fout="111.txt"
;asciiwrite(fout,(/tval/))
fout="t-ACCESM1-0.grd"
fbinrecwrite(fout,-1,(/tval/))
wks = gsn_open_wks("png","ACCESM1-0")
gsn_define_colormap(wks,"bluered")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnInfoLabelOn = False
res@cnFillOn = False
res@cnLinesOn = True
res@cnLineLabelsOn = False
;res@gsnSpreadColors = True
res@lbLabelBarOn = False
res@tiMainString = ""
res@gsnRightString = ""
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = -0.6
res@cnMaxLevelValF = 2.4
res@cnLevelSpacingF = 0.3
;res@mpCenterLonF = 180
res@gsnContourNegLineDashPattern=1
res@gsnContourZeroLineThicknessF=3
res@gsnAddCyclic=False
plot1 = gsn_csm_contour(wks,rc,res)
res2 = True
res2@cnFillOn = True
res2@cnLinesOn = False
;res2@mpCenterLonF = 180
res2@gsnDraw = False ; do not draw
res2@gsnFrame = False ; do not advance frame
res2@gsnMaximize = True
res2@mpCenterLonF = 120. ; center plot at 180
res2@mpMinLonF = -60. ; select a subregion
res2@mpMaxLonF = 300.
res2@mpMinLatF = -70.
res2@mpMaxLatF = 60.
;res2@cnMonoFillPattern = False
;res2@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
;res2@cnMinLevelValF = 0.1 ; set min contour level
;res2@cnMaxLevelValF = 5. ; set max contour level
;res2@cnLevelSpacingF = 1. ; set contour interval
res2@lbLabelBarOn= True
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/-2.02,2.02/) ;; set to significance level
res2@cnFillColors =(/35,0,207/)
res2@gsnLeftString = ""
res2@mpFillDrawOrder= "PostDraw"
plot3 = gsn_csm_contour_map(wks,tval,res2)
overlay(plot3,plot1)
draw(plot3)
frame(wks)
end |
|