积分 2547
贡献
精华
在线时间 小时
注册时间 2016-3-29
最后登录 1970-1-1
100 金钱
我是用ERA5数据画的,X11画的没有任何报错报错,换成PDF,PNG都报错,
这是换成pdf画的出现以下报错,但是用NECP数据画就是正常出图。这是程序部分: u_file = addfile("/mnt/d/SHUJU/U_quan.nc","r") v_file = addfile("/mnt/d/SHUJU/V_quan.nc","r")
uwnd1 = u_file->u(:,{850},:,:)
vwnd1 = v_file->v(:,{850},:,:)
uwnd2 = short2flt(uwnd1)
vwnd2 = short2flt(vwnd1)
uwnd = uwnd2(:,{0:80},{60:240})
vwnd = vwnd2(:,{0:80},{60:240})
dim = dimsizes(uwnd)
ntim = dim(0)
nlat = dim(1)
nlon = dim(2)
;-----------------------------------------------------------------------------去趋势(不循环结果一样)
d_uwnd = new((/ntim,nlat,nlon/), "float", "No_FillValue")
do i=0,11
d_uwnd(i:ntim-1:12,:,:) = dtrend_leftdim(uwnd(i:ntim-1:12,:,:), False)
end do
copy_VarCoords(uwnd, d_uwnd)
d_vwnd = new((/ntim,nlat,nlon/), "float", "No_FillValue")
do i=0,11
d_vwnd(i:ntim-1:12,:,:) = dtrend_leftdim(vwnd(i:ntim-1:12,:,:), False)
end do
copy_VarCoords(vwnd, d_vwnd)
;;---------------------------------------------------------------------------------选季节(去趋势和季节先后不影响)
Tseason11 = month_to_season(d_uwnd, "SON")
Tseason22 = month_to_season(d_vwnd, "SON")
;;--------------------------------------------------------------------------------回归Iw REG 850
r1 = regCoef_n(Pn(0:59),Tseason11(0:59,:,:),0,0)
r1!0 = "latitude"
r1&latitude = uwnd&latitude
r1!1 = "longitude"
r1&longitude = uwnd&longitude
;r1@_FillValue = 9.96921e+36
;printVarSummary(r1)
;;----------------------------------
tval = onedtond(r1@tval , dimsizes(r1)) ; t-statistic of rc
df = onedtond(r1@nptxy, dimsizes(r1)) - 2 ; 自由度
b = tval ; b must be same size as tval (and df)
b = 0.5
prob1 = betainc(df/(df+tval^2),df/2.0,b) ; prob1(nlatitude,nlon)
prob1!0 = "latitude" ; name dimensions
prob1!1 = "longitude"
prob1&latitude = uwnd&latitude ; assign coordinate values to named dimensions
prob1&longitude = uwnd&longitude
;prob1@long_name = "probability"
;printVarSummary(prob1)
;;-----------------------------
r2 = regCoef_n(Pn(0:59),Tseason22(0:59,:,:),0,0)
r2!0 = "latitude"
r2&latitude = vwnd&latitude
r2!1 = "longitude"
r2&longitude = vwnd&longitude
;r2@_FillValue = 9.96921e+36
;printVarSummary(r2)
;;------------------------
tval = onedtond(r2@tval , dimsizes(r2)) ; t-statistic of rc
df = onedtond(r2@nptxy, dimsizes(r2)) - 2 ; 自由度
b = tval ; b must be same size as tval (and df)
b = 0.5
prob2 = betainc(df/(df+tval^2),df/2.0,b) ; prob2(nlatitude,nlon)
prob2!0 = "latitude" ; name dimensions
prob2!1 = "longitude"
prob2&latitude = vwnd&latitude ; assign coordinate values to named dimensions
prob2&longitude = vwnd&longitude
;prob2@long_name = "probability"
;printVarSummary(prob2)
;;===========================================================================v
wks = gsn_open_wks("x11","UV850_Pn")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnMaximize = False
res@gsnAddCyclic = False
res@gsnLeftString = ""
res@gsnRightString = ""
res@gsnCenterString = ""
;=======================================================================
rest = res
;-----------------------------------------------------------------------
rest@mpMinLatF = 0
rest@mpMaxLatF = 80
rest@mpMinLonF = 60
rest@mpMaxLonF = 240
rest@mpCenterLonF = 180
rest@mpFillOn = True
rest@mpLandFillColor = "white"
;rest@tmYLValues = ispan(-80, 80, 40) ;-10到60 ,每隔20
;rest@tmYLLabels = (/"80S","40S","0","40E","80E"/)
;rest@tmYLLabels = (/"20S","0","20~N~N","40~N~N",\
;"60~N~N","80~N~N"/)
rest@tmYLLabelFont = "times-roman"
;rest@tmXBMode = "Explicit"
;rest@tmXBValues = ispan(40, 160, 10)
;rest@tmXBLabels = (/"40~S~o~N~E","50~S~o~N~E","60~S~o~N~E","70~S~o~N~E","80~S~o~N~E","90~S~o~N~E","100~S~o~N~E",\
;"110~S~o~N~E","120~S~o~N~E","130~S~o~N~E","140~S~o~N~E","150~S~o~N~E","160~S~o~N~E"/)
rest@tmXBLabelFont = "times-roman"
rest@tmXBLabelFontHeightF = 0.015
rest@tmYLLabelFontHeightF = 0.015
rest@cnInfoLabelOn = False
;-------------------------------------------------------------------------
res1 = rest
;-------------------------------------------------------------------------
res1@cnFillOn = True
res1@cnLinesOn = False
res1@cnLineLabelsOn = False
res1@cnMonoFillPattern = False
res1@cnLevelSelectionMode = "ExplicitLevels"
res1@cnLevels = (/0.05/)
res1@cnFillPatterns = (/0,-1/)
res1@cnFillColors = (/"steelblue4"/)
res1@tmXUseBottom = False
res1@tmYUseLeft = False
res1@tmXTMinorOn = False
res1@tmYRMinorOn = False
res1@tmXTMajorLineColor = "white"
res1@tmYRMajorLineColor = "white"
res1@lbLabelBarOn = False
res1@cnSmoothingOn = True
res1@cnSmoothingDistanceF = 0.001
res1@cnSmoothingTensionF = 0.01
res1@cnInfoLabelFontAspectF = 25
res1@cnInfoLabelOn = False
;=============================================================================
res2 = True
;-----------------------------------------------------------------------------出现警告得原因在这里
res2@gsnAddCyclic = False
res2@cnFillOn = True
res2@cnLinesOn = False
res2@cnLineLabelsOn = False
res2@cnMonoFillPattern = False
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/0.05/)
res2@cnFillPatterns = (/0,-1/)
res2@cnFillColors = (/"steelblue4"/)
res2@tmXUseBottom = False
res2@tmYUseLeft = False
res2@tmXTMinorOn = False
res2@tmYRMinorOn = False
res2@tmXTMajorLineColor = "white"
res2@tmYRMajorLineColor = "white"
;res2@lbLabelBarOn = False
res2@cnSmoothingOn = True
res2@cnSmoothingDistanceF = 0.001
res2@cnSmoothingTensionF = 0.01
res2@cnInfoLabelOn = False
;=============================================================================
uvres1 = res
;-----------------------------------------------------------------------------
uvres1@vcGlyphStyle="CurlyVector"
;uvres1@vcMinMagnitudeF = 0.3
uvres1@gsnDraw = False
uvres1@gsnFrame = False
uvres1@vcRefMagnitudeF = 2
uvres1@vcRefAnnoOrthogonalPosF = -1.0
uvres1@vcRefAnnoString2 = ""
;uvres1@vcRefAnnoParallelPosF = 0.999
uvres1@vcMinDistanceF = 0.018
uvres1@vcRefLengthF = 0.045 ; define length of vec ref
uvres1@vcMapDirection = False
;uvres1@vcRefAnnoParallelPosF = 0.999
uvres1@vcLineArrowThicknessF = 1.
;;----------------------------------------------------------------------------叠加地形
resdx = res
;resdx@cnConstFEnableFill= True
resdx@cnFillOn = True
resdx@cnLinesOn = False
resdx@cnLineLabelsOn = False
;resdx@cnSmoothingOn = True
;resdx@cnSmoothingDistanceF = 0.08
;resdx@cnSmoothingTensionF = 0.01
resdx@cnLevelSelectionMode = "ExplicitLevels"
resdx@cnLevels = (/3000/)
resdx@cnFillColors = (/"-1","black"/)
resdx@lbLabelBarOn = False
resdx@cnInfoLabelOn = False
;r;esdx@cnLevels = (/3000/) ;画出3000m等值线
;resdx@cnLineColor = "black"
;resdx@cnLineThicknessF = 3
;=============================================================================
;resc@cnInfoLabelOn = False
;******************************************************************************
;绘制图案
;******************************************************************************
plot = gsn_csm_contour_map_overlay(wks, prob2, prob1, res1, res2)
plot0 = gsn_csm_vector(wks, r1, r2, uvres1)
plotdixing = gsn_csm_contour(wks, elev, resdx)
overlay(plot, plot0)
;;=====================================================================================
plotdixing = gsn_csm_contour(wks, elev, resdx)
overlay(plot, plotdixing)
我来回答