- 积分
- 576
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-1-21
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2022-5-15 20:22:18
|
显示全部楼层
就是这个指数要分别和U、V回归然后用回归后的UV数据画矢量图,我的程序仅供参考,我画的是OLR经过EOF分析之后的PC1与OLR回归并且叠加PC1和UV回归之后的风场
begin
f1 = addfile("/home/mars/Liubs/QBWO_PC_INDEX.nc","r")
x = (f1->PC1)
;print(x)
f2 = addfile("/home/mars/Liubs/lunwen/processing data/10-20olr.nc","r")
time = (f2->time)
time@units = "hours since 1800-01-01 00:00:0.0"
; Convert to UTC time.
time_ut = cd_calendar(time,0)
; Store return information into more meaningful variables.
;year = time_ut(:,0) ; Convert to integer for
month = time_ut(:,1) ; Convert to integer for
; print(year)
indtime = ind((month.ge.6).and.(month.le.11))
y = f2->olr(indtime,:,:)
rc = regCoef_n(x, y, 0, 0) ; rc(nlat,mlon)
;print(rc)
rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = y&lat ; assign coordinate values to named dimensions
rc&lon = y&lon
tval = onedtond(rc@tval , dimsizes(rc))
tval@FillValue= -9.96921e+36
tval!0 = "lat" ; name dimensions
tval!1 = "lon"
tval&lat = y&lat
tval&lon = y&lon
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic
df = onedtond(rc@nptxy, dimsizes(rc)) - 2 ;自由度
b = tval ; b must be same size as tval (and df)
b = 0.5 ; b must be same size as tval (and df)
prob = betainc(df/(df+tval^2),df/2.0,b)
prob!0 = "lat" ; name dimensions
prob!1 = "lon"
prob&lat = y&lat
prob&lon = y&lon ; assign coordinate values to named dimensions
;print (prob)
rc@long_name = "regression coefficient"
prob@long_name = "probability"
f2 = addfile ("/home/mars/Liubs/QBWO-PC1_U-anormal.nc", "r")
f3 = addfile ("/home/mars/Liubs/QBWO-PC1_V-anormal.nc", "r")
u = (f2->uwnd(:,:))
v = (f3->vwnd(:,:))
;*******************************************
; plots
;*******************************************
wks = gsn_open_wks ("png", " QBWO-PC1&UV1")
;;set contour;;
res = True
res@gsnAddCyclic = False
res@gsnLeftString = ""
res@gsnRightString = ""
res@tiYAxisString = ""
res@tiMainString = "QBWO"
res@cnFillOn = True
;res@cnFillMode = "AreaFill"
res@cnFillPalette = "BlueDarkRed18"
res@cnFillColor = True
;res@cnMonoFillColor = False
res@cnLinesOn = False
;res@cnLineThicknessF = 2
res@cnLineLabelsOn = False
res@mpMinLatF = 0
res@mpMaxLatF = 50
res@mpMinLonF = 100
res@mpMaxLonF = 180
res@cnLevelSelectionMode = "AutomaticLevels"
;res@lbBoxMinorExtentF = 0.15
res@pmLabelBarWidthF = 0.6
res@pmLabelBarHeightF = 0.08
res@pmLabelBarOrthogonalPosF = 0.1
res@lbLabelFontHeightF = 0.01
res@lbLabelAngleF = 0
res2 = True
res2@gsnDraw = False
res2@gsnFrame = False
res2@cnFillOn = True
res@cnLinesOn = False
res2@cnLineLabelsOn = False
res2@cnInfoLabelOn = False
res2@lbLabelBarOn = False
res2@cnMonoFillPattern = False
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/0.05/) ;; set to significance level
res2@cnFillPatterns = (/17,-1/)
res2@cnFillColors = (/1,0/)
res2@gsnLeftString = ""
gsn_define_colormap(wks,"BkBlAqGrYeOrReViWh200")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnMaximize = True
res@tmXTOn = False
res@tmYROn = False
res@gsnLeftString = ""
res@gsnRightString = ""
;;set map;;
mpres = res
mpres@mpDataSetName = "Earth..4"
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpOutlineOn = True
mpres@mpGeophysicalLineThicknessF = 2
mpres@mpNationalLineThicknessF = 2
mpres@mpFillDrawOrder = "PostDraw"
mpres@mpFillOn = False
;;set area;;
mpres@mpMinLatF = 0
mpres@mpMaxLatF = 50
mpres@mpMinLonF = 100
mpres@mpMaxLonF = 180
;;set vector;;
res_vc = True
res_vc@vcGlyphStyle = "LineArrow"
res_vc@vcLineArrowThicknessF = 2.5
res_vc@vcMinDistanceF = 0.025
res_vc@vcRefLengthF = 0.02
res_vc@vcGlyphStyle = "CurlyVector"
res_vc@vcMinFracLengthF = 0
res_vc@vcRefMagnitudeF = 2.0
res_vc@vcRefAnnoOn = True
res_vc@vcRefMagnitudeF = 1
res_vc@vcRefAnnoString1 = "1"
res_vc@vcRefAnnoSide = "Top"
res_vc@vcRefAnnoString2On = False
res_vc@vcRefAnnoPerimOn = False
res_vc@vcRefAnnoOrthogonalPosF = -0.12
res_vc@vcRefAnnoParallelPosF = 0.999
;res_vc@vcRefAnnoBackgroundColor = "Purple"
res_vc@vcVectorDrawOrder = "PostDraw"
res_vc@gsnLeftString = ""
txres = True
txres@txFontHeightF = 0.02
txres@txFontColor = "black"
txres@txPerimOn = True
txres@txPerimColor = "black"
txres@txBackgroundFillColor = "White"
txres@txFontOpacityF = 0.8
txres@txFontThicknessF = 5.0
;;plot;;
map = gsn_csm_map(wks,mpres)
vector = gsn_csm_vector(wks,u,v,res_vc)
plot1 = gsn_csm_contour(wks,rc, res)
plot2 = gsn_csm_contour(wks,prob,res2)
dum = gsn_add_text(wks,(/map/),"(a)PC1-OLR-UV",110,47,txres)
;;overlay filled contours and vectors on the map;;
overlay(map,plot1)
overlay(map,plot2)
overlay(map,vector)
overlay(plot1,plot2)
;;drawing "map" will draw everything: map, contours, vectors, and text;;
draw(map)
frame(wks)
end
|
|