爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
楼主: supersupergirl

[其他] 求问画panel组图时wrf_contour和gsn_csm_xy无法兼容问题

[复制链接]
 楼主| 发表于 2019-8-31 20:07:46 | 显示全部楼层
yusw 发表于 2019-8-31 20:03
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection1.ph ...

是的 我看了 他这个没有绘制地形 而且也没有绘制组图 都是单张出图的 所以没有用到gsn_csm_xy和gsn_panel这两个函数 还有我想问下他这个剖面的线段是选取的中间值画的吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-8-31 20:48:08 | 显示全部楼层
supersupergirl 发表于 2019-8-31 20:07
是的 我看了 他这个没有绘制地形 而且也没有绘制组图 都是单张出图的 所以没有用到gsn_csm_xy和gsn_panel ...

面板图是要用gsn_panel的,剖面线段选择有两种,可以沿着单点,不同方向做剖面;也可以两点确定一个线段做剖面
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-8-31 20:58:45 | 显示全部楼层
yusw 发表于 2019-8-31 20:48
面板图是要用gsn_panel的,剖面线段选择有两种,可以沿着单点,不同方向做剖面;也可以两点确定一个线段 ...

是的 那我这个问题应该怎么解决呢。。苦恼好久了 还有这个单点是自己设置还是系统默认中间值呀
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-8-31 21:24:44 | 显示全部楼层
supersupergirl 发表于 2019-8-31 20:58
是的 那我这个问题应该怎么解决呢。。苦恼好久了 还有这个单点是自己设置还是系统默认中间值呀

自己设置的,地形不需要单独画出来,地形是缺省值,自动画出来了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-8-31 21:27:42 | 显示全部楼层
yusw 发表于 2019-8-31 21:24
自己设置的,地形不需要单独画出来,地形是缺省值,自动画出来了

我看官网例子他只能设置沿经度或沿纬度 具体是多少度好像没有写出 求指教 可我除了地形还有风场也画不出来 用的是wrf_vector 请问是什么原因
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-8-31 21:57:44 | 显示全部楼层
supersupergirl 发表于 2019-8-31 21:27
我看官网例子他只能设置沿经度或沿纬度 具体是多少度好像没有写出 求指教 可我除了地形还有风场也画不出 ...

把你的全部脚本贴出来
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-8-31 22:13:12 | 显示全部楼层
yusw 发表于 2019-8-31 21:57
把你的全部脚本贴出来

脚本如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

a = addfile("d:/cygwin/home/0228_87.5/wrfout_d03_2018-02-27_12_00_00.nc","r")
a1 = addfile("d:/cygwin/home/0401_87.5/wrfout_d03_2018-04-01_00_00_00.nc","r")
a2 = addfile("d:/cygwin/home/0513_87.5/wrfout_d03_2018-05-13_00_00_00.nc","r")

type = "pdf"
wks = gsn_open_wks(type,"wrf_panel_dv_vector1")
gsn_define_colormap(wks, "ncl_default")

res              = True
res@MainTitle    = ""
res@InitTime     = False
res@ValidTime    = False
res@Footer       = False

pltres           = True
pltres@NoTitles  = True
pltres@PanelPlot = True
;set lat/lon
FirstTime = True
FirstTimeMap = True
times  = wrf_user_getvar(a,"times",-1) ; 读取所有时次
ntimes = dimsizes(times)         ; number of times in the file
plots  = new (3, graphic)
mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
dNames = getfilevardims(a,"P")    ; NCL 6.4.0 and earlier
nd = dimsizes(mdims)              ; 查看mdims为几围数组
print(nd)
print(mdims)
mdims1 = getfilevardimsizes(a1,"P") ; get some dimension sizes for the file
dNames1 = getfilevardims(a1,"P")    ; NCL 6.4.0 and earlier
nd1 = dimsizes(mdims1)              ; 查看mdims为几围数组
print(nd1)
print(mdims1)
mdims2 = getfilevardimsizes(a2,"P") ; get some dimension sizes for the file
dNames2 = getfilevardims(a2,"P")    ; NCL 6.4.0 and earlier
nd2 = dimsizes(mdims2)              ; 查看mdims为几围数组
print(nd2)
print(mdims2)
;20180228
xlat = wrf_user_getvar(a, "XLAT",0)
xlon = wrf_user_getvar(a, "XLONG",0)
ter  = wrf_user_getvar(a, "HGT",0)

u10 = wrf_user_getvar(a,"U10",0)    ; u at 10 m, mass point
v10 = wrf_user_getvar(a,"V10",0)    ; v at 10 m, mass point

u10@units = "m/s"
v10@units = "m/s"

lat = xlat(:,0)
lon = xlon(0,:)
;20180401
xlat1 = wrf_user_getvar(a1, "XLAT",0)
xlon1 = wrf_user_getvar(a1, "XLONG",0)
ter1  = wrf_user_getvar(a1, "HGT",0)

u101  = wrf_user_getvar(a1,"U10",0)    ; u at 10 m, mass point
v101  = wrf_user_getvar(a1,"V10",0)    ; v at 10 m, mass point

u101@units = "m/s"
v101@units = "m/s"

lat1 = xlat1(:,0)
lon1 = xlon1(0,:)
;20180513
xlat2 = wrf_user_getvar(a2, "XLAT",0)
xlon2 = wrf_user_getvar(a2, "XLONG",0)
ter2  = wrf_user_getvar(a2, "HGT",0)
u102  = wrf_user_getvar(a2,"U10",0)    ; u at 10 m, mass point
v102  = wrf_user_getvar(a2,"V10",0)    ; v at 10 m, mass point

u102@units = "m/s"
v102@units = "m/s"

lat2 = xlat2(:,0)
lon2 = xlon2(0,:)

  it = 25
    print("Working on time: " + times(it) )
;20180228
    z    = wrf_user_getvar(a, "z",28)      ; grid point height
    u    = wrf_user_getvar(a,"ua",28)      ; 3D U at mass points
    v    = wrf_user_getvar(a,"va",28)      ; 3D V at mass points
    w    = wrf_user_getvar(a,"wa",28)
;20180401
    z1   = wrf_user_getvar(a1, "z",it)      ; grid point height
    u1   = wrf_user_getvar(a1,"ua",it)      ; 3D U at mass points
    v1   = wrf_user_getvar(a1,"va",it)      ; 3D V at mass points
    w1   = wrf_user_getvar(a1,"wa",it)
;20180513
    z2   = wrf_user_getvar(a2, "z",it)      ; grid point height
    u2   = wrf_user_getvar(a2,"ua",it)      ; 3D U at mass points
    v2   = wrf_user_getvar(a2,"va",it)      ; 3D V at mass points
    w2   = wrf_user_getvar(a2,"wa",it)

    if ( FirstTime ) then                ; get height info for labels
      zmin = 0.
      zmax = 15.                          ; We are only interested in the first 6km
      nz   = floattoint(zmax + 1)
    end if   

    ;plot AB垂直剖面的位置
     plane  = new(2,float)
     plane  = (/ mdims(nd-1)/2, mdims(nd-2)/2 /)    ; pivot point is center of domain (x,y)
     plane1 = new(2,float)
     plane1 = (/ mdims1(nd1-1)/2, mdims1(nd1-2)/2 /)    ; pivot point is center of domain (x,y)
     plane2 = new(2,float)
     plane2 = (/ mdims2(nd2-1)/2, mdims2(nd2-2)/2 /)    ; pivot point is center of domain (x,y)
     opts   = False

      angle = 0.
      PI=3.1415926
      alfa = (90-angle)*PI/180
      X_plane  = wrf_user_intrp2d(xlat,plane,angle,opts)
      X_plane1 = wrf_user_intrp2d(xlat1,plane1,angle,opts)
      X_plane2 = wrf_user_intrp2d(xlat2,plane2,angle,opts)
      uv       = u*sin(alfa)+v*cos(alfa)
      uv1      = u1*sin(alfa)+v1*cos(alfa)
      uv2      = u2*sin(alfa)+v2*cos(alfa)
      ;X_desc = "latitude"

  ;计算涡度和散度
   u@_FillValue = 9.96921e+36
   scale=1.e05
   dv = new ( dimsizes(u), typeof(u), u@_FillValue )
   dv@long_name  = "divengence"
   dv@units      = "scaled"
   dv  = uv2dv_cfd (u,v,lat,lon, 2) * scale     ;散度
   dv1 = uv2dv_cfd (u1,v1,lat1,lon1, 2) * scale     ;散度
   dv2 = uv2dv_cfd (u2,v2,lat2,lon2, 2) * scale     ;散度
   copy_VarCoords(u, dv)
   copy_VarCoords(u1, dv1)
   copy_VarCoords(u2, dv2)
;把数据插值到各个高度上
;20180228
  dv_plane   = wrf_user_intrp3d(dv,z,"v",plane,angle,opts)
  ter_plane  = wrf_user_intrp2d(ter,plane,angle,opts)
  u_plane    = wrf_user_intrp3d(uv,z,"v",plane,angle,opts)
  w_plane    = wrf_user_intrp3d(w,z,"v",plane,angle,opts)
;20180401
  dv_plane1  = wrf_user_intrp3d(dv1,z1,"v",plane1,angle,opts)
  ter_plane1 = wrf_user_intrp2d(ter1,plane1,angle,opts)
  u_plane1   = wrf_user_intrp3d(uv1,z1,"v",plane1,angle,opts)
  w_plane1   = wrf_user_intrp3d(w1,z1,"v",plane1,angle,opts)
;20180513
  dv_plane2  = wrf_user_intrp3d(dv2,z2,"v",plane2,angle,opts)
  ter_plane2 = wrf_user_intrp2d(ter2,plane2,angle,opts)
  u_plane2   = wrf_user_intrp3d(uv2,z2,"v",plane2,angle,opts)
  w_plane2   = wrf_user_intrp3d(w2,z2,"v",plane2,angle,opts)

;20180228
   if ( FirstTime ) then
      zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts)
      b = ind(zz(:,0) .gt. zmax*1000. )
      zmax_pos = b(0) - 1
      if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then
        zspan = b(0) - 1
    else
        zspan = b(0)
    end if
    delete(zz)
    delete(b)
    FirstTime = False
end if
    print(zmax_pos)
    print(zspan)
;20180401
   FirstTime = True
   if ( FirstTime ) then
      zz = wrf_user_intrp3d(z1,z1,"v",plane1,angle,opts)
      b = ind(zz(:,0) .gt. zmax*1000. )
      zmax_pos1 = b(0) - 1
      if ( abs(zz(zmax_pos1,0)-zmax*1000.) .lt. abs(zz(zmax_pos1+1,0)-zmax*1000.) ) then
        zspan1 = b(0) - 1
    else
        zspan1 = b(0)
    end if
    delete(zz)
    delete(b)
    FirstTime = False
end if
    print(zmax_pos1)
    print(zspan1)
;201805013
   FirstTime = True
   if ( FirstTime ) then
      zz = wrf_user_intrp3d(z2,z2,"v",plane2,angle,opts)
      b = ind(zz(:,0) .gt. zmax*1000. )
      zmax_pos2 = b(0) - 1
      if ( abs(zz(zmax_pos2,0)-zmax*1000.) .lt. abs(zz(zmax_pos2+1,0)-zmax*1000.) ) then
        zspan2 = b(0) - 1
    else
        zspan2 = b(0)
    end if
    delete(zz)
    delete(b)
    FirstTime = False
end if
    print(zmax_pos2)
    print(zspan2)

; X-axis lables
dimsX = dimsizes(X_plane)
xmin  = X_plane(0)
xmax  = X_plane(dimsX(0)-1)
xspan = dimsX(0)-1
nx    = floattoint( (xmax-xmin)/2 + 1)
nx    = 10
;print("X_plane"+X_plane)
print("dimsX" + dimsX)
print("xmin and xmax in plot is " + xmin+" and "+xmax)
print("xspan and nx in plot is " + xspan+" and "+nx)

dimsX1 = dimsizes(X_plane1)
xmin1  = X_plane1(0)
xmax1  = X_plane1(dimsX1(0)-1)
xspan1 = dimsX1(0)-1
nx1    = floattoint( (xmax1-xmin1)/2 + 1)
nx1    = 10
;print("X_plane"+X_plane)
print("dimsX1" + dimsX)
print("xmin1 and xmax1 in plot is " + xmin1+" and "+xmax1)
print("xspan1 and nx1 in plot is " + xspan1+" and "+nx1)

dimsX2 = dimsizes(X_plane2)
xmin2  = X_plane2(0)
xmax2  = X_plane2(dimsX2(0)-1)
xspan2 = dimsX2(0)-1
nx2    = floattoint( (xmax2-xmin2)/2 + 1)
nx2    = 10
;print("X_plane"+X_plane)
print("dimsX2" + dimsX)
print("xmin2 and xmax2 in plot is " + xmin2+" and "+xmax2)
print("xspan2 and nx2 in plot is " + xspan2+" and "+nx2)

;---------------------------------------------------------------
;20180228
; Options for XY Plots
opts_xy                         = res
;opts_xy@tiXAxisString           = X_desc
opts_xy@tiYAxisString           = "Height (km)"
opts_xy@tmXTOn                  = False
opts_xy@tmYROn                  = False

;;-------------------想要绘制的数据的经纬度范围-------------------------------------------------

;;-----------------------------------------------------------------------------------------------
opts_xy@tmXBOn                  = True
opts_xy@tmYLOn                  = True
opts_xy@tmXBMode                = "Explicit"
opts_xy@tmXBValues              = fspan(0,xspan,nx)                    ; Create tick marks
;opts_xy@tmXBLabels              = sprintf("%.1f",fspan(xmin,xmax,nx))  ; Create labels
opts_xy@tmXBLabels              = (/"41.9~S~o~N~N","42.2~S~o~N~N","42.7~S~o~N~N","43.2~S~o~N~N","43.7~S~o~N~N","44.2~S~o~N~N","44.7~S~o~N~N","45.2~S~o~N~N","45.7~S~o~N~N","46.2~S~o~N~N"/)
opts_xy@tmXBLabelFontHeightF    = 0.010
opts_xy@tmYLMode                = "Explicit"
opts_xy@tmYLValues              = fspan(0,zspan,nz)                    ; Create tick marks
opts_xy@tmYLLabels              = sprintf("%.1f",fspan(zmin,zmax,nz))  ; Create labels
opts_xy@tiXAxisFontHeightF      = 0.020
opts_xy@tiYAxisFontHeightF      = 0.020
opts_xy@tmXBMajorLengthF        = 0.02
opts_xy@tmYLMajorLengthF        = 0.02
opts_xy@tmYLLabelFontHeightF    = 0.015

; Plotting options for terrain
opts_ter = opts_xy
opts_ter@gsnYRefLine = 0.0
opts_ter@gsnAboveYRefLineColor = "black"
opts_ter@gsnDraw = False
opts_ter@gsnFrame = False
opts_ter@trYMaxF = zmax*1000 ;地形数据为m,因此这里要放大倍数为km

;;plot for dv
opts_dv                = opts_xy  
opts_dv@gsnDraw        = False
opts_dv@gsnFrame       = False                    
opts_dv@cnFillOn       = True  
opts_dv@cnLinesOn      = False
opts_dv@cnInfoLabelOn  = False
opts_dv@cnLineLabelsOn = False
opts_dv@cnSmoothingOn  = True
opts_dv@lbLabelBarOn   = False
opts_dv@lbTitleOn      = False   
opts_dv@cnSmoothingDistanceF=0.015
opts_dv@cnSmoothingTensionF=0.001
opts_dv@cnLineLabelInterval=1
opts_dv@cnLineLabelPlacementMode="Computed"
opts_dv@cnLineLabelAngleF=0.5          ;大于0则平行于X轴,小于0为曲线切线方向
opts_dv@cnLineLabelDensityF=1.0
opts_dv@cnLineThicknessF = 4.0
opts_dv@cnInfoLabelOrthogonalPosF=0.00                  
opts_dv@ContourParameters=(/-10, 10, 2 /)
opts_dv@gsnContourPosLineDashPattern=0
opts_dv@cnLineDashPattern=0

vcres = opts_xy
vcres@vcGlyphStyle       = "CurlyVector";"LineArrow";   
vcres@vcPositionMode     = "ArrowTail"
vcres@vcRefAnnoOn        = True
vcres@vcMinDistanceF     = 0.03
vcres@vcRefMagnitudeF    = 8.   ;单位长度
vcres@vcLineArrowThicknessF = 3.0
vcres@vcMapDirection        = False
vcres@vcFillArrowsOn     = True
vcres@vcVectorDrawOrder     = "PreDraw"
vcres@vcRefLengthF       = 0.015 ;矢量长度
vcres@vcFillArrowHeadXF  = 0.2
vcres@vcFillArrowHeadYF  = 0.2
vcres@vcFillArrowHeadInteriorXF = 0.5

;---------------------------------------------------------------
;20180401
; Options for XY Plots
opts_xy1                         = res
;opts_xy1@tiXAxisString           = X_desc
;opts_xy1@tiYAxisString           = "Height (km)"
opts_xy1@tmXTOn                  = False
opts_xy1@tmYROn                  = False

;;-------------------想要绘制的数据的经纬度范围-------------------------------------------------

;;-----------------------------------------------------------------------------------------------
opts_xy1@tmXBOn                  = True
opts_xy1@tmYLOn                  = False
opts_xy1@tmXBMode                = "Explicit"
opts_xy1@tmXBValues              = fspan(0,xspan1,nx)                    ; Create tick marks
;opts_xy1@tmXBLabels              = sprintf("%.1f",fspan(xmin1,xmax1,nx))  ; Create labels
opts_xy1@tmXBLabels              = (/"41.9~S~o~N~N","42.2~S~o~N~N","42.7~S~o~N~N","43.2~S~o~N~N","43.7~S~o~N~N","44.2~S~o~N~N","44.7~S~o~N~N","45.2~S~o~N~N","45.7~S~o~N~N","46.2~S~o~N~N"/)
opts_xy1@tmXBLabelFontHeightF    = 0.010
opts_xy1@tmYLMode                = "Explicit"
opts_xy1@tmYLValues              = fspan(0,zspan1,nz)                    ; Create tick marks
opts_xy1@tmYLLabels              = sprintf("%.1f",fspan(zmin,zmax,nz))  ; Create labels
opts_xy1@tiXAxisFontHeightF      = 0.020
opts_xy1@tiYAxisFontHeightF      = 0.020
opts_xy1@tmXBMajorLengthF        = 0.02
opts_xy1@tmYLMajorLengthF        = 0.02
opts_xy1@tmYLLabelFontHeightF    = 0.015

; Plotting options for terrain
opts_ter1 = opts_xy1
opts_ter1@gsnYRefLine = 0.0
opts_ter1@gsnAboveYRefLineColor = "black"
opts_ter1@gsnDraw = False
opts_ter1@gsnFrame = False
opts_ter1@trYMaxF = zmax*1000 ;地形数据为m,因此这里要放大倍数为km

;;plot for dv
opts_dv1                = opts_xy1  
opts_dv1@gsnDraw        = False
opts_dv1@gsnFrame       = False                    
opts_dv1@cnFillOn       = True  
opts_dv1@cnLinesOn      = False
opts_dv1@cnInfoLabelOn  = False
opts_dv1@cnLineLabelsOn = False
opts_dv1@cnSmoothingOn  = True
opts_dv1@lbLabelBarOn   = False
opts_dv1@lbTitleOn      = False   
opts_dv1@cnSmoothingDistanceF=0.015
opts_dv1@cnSmoothingTensionF=0.001
opts_dv1@cnLineLabelInterval=1
opts_dv1@cnLineLabelPlacementMode="Computed"
opts_dv1@cnLineLabelAngleF=0.5          ;大于0则平行于X轴,小于0为曲线切线方向
opts_dv1@cnLineLabelDensityF=1.0
opts_dv1@cnLineThicknessF = 4.0
opts_dv1@cnInfoLabelOrthogonalPosF=0.00                  
opts_dv1@ContourParameters=(/-10, 10, 2 /)
opts_dv1@gsnContourPosLineDashPattern=0
opts_dv1@cnLineDashPattern=0

vcres1 = opts_xy1
vcres1@vcGlyphStyle       = "CurlyVector";"LineArrow";   
vcres1@vcPositionMode     = "ArrowTail"
vcres1@vcRefAnnoOn        = True
vcres1@vcMinDistanceF     = 0.03
vcres1@vcRefMagnitudeF    = 8.   ;单位长度
vcres1@vcLineArrowThicknessF = 3.0
vcres1@vcMapDirection        = False
vcres1@vcFillArrowsOn     = True
vcres1@vcVectorDrawOrder  = "PreDraw"
vcres1@vcRefLengthF       = 0.015 ;矢量长度
vcres1@vcFillArrowHeadXF  = 0.2
vcres1@vcFillArrowHeadYF  = 0.2
vcres1@vcFillArrowHeadInteriorXF = 0.5

;---------------------------------------------------------------
;20180513
; Options for XY Plots
opts_xy2                         = res
;opts_xy2@tiXAxisString           = X_desc
;opts_xy2@tiYAxisString           = "Height (km)"
opts_xy2@tmXTOn                  = False
opts_xy2@tmYROn                  = False

;;-------------------想要绘制的数据的经纬度范围-------------------------------------------------

;;-----------------------------------------------------------------------------------------------
opts_xy2@tmXBOn                  = True
opts_xy2@tmYLOn                  = False
opts_xy2@tmXBMode                = "Explicit"
opts_xy2@tmXBValues              = fspan(0,xspan2,nx)                    ; Create tick marks
;opts_xy2@tmXBLabels              = sprintf("%.1f",fspan(xmin2,xmax2,nx))  ; Create labels
opts_xy2@tmXBLabels              = (/"41.9~S~o~N~N","42.2~S~o~N~N","42.7~S~o~N~N","43.2~S~o~N~N","43.7~S~o~N~N","44.2~S~o~N~N","44.7~S~o~N~N","45.2~S~o~N~N","45.7~S~o~N~N","46.2~S~o~N~N"/)
opts_xy2@tmXBLabelFontHeightF    = 0.010
opts_xy2@tmYLMode                = "Explicit"
opts_xy2@tmYLValues              = fspan(0,zspan2,nz)                    ; Create tick marks
opts_xy2@tmYLLabels              = sprintf("%.1f",fspan(zmin,zmax,nz))  ; Create labels
opts_xy2@tiXAxisFontHeightF      = 0.020
opts_xy2@tiYAxisFontHeightF      = 0.020
opts_xy2@tmXBMajorLengthF        = 0.02
opts_xy2@tmYLMajorLengthF        = 0.02
opts_xy2@tmYLLabelFontHeightF    = 0.015

; Plotting options for terrain
opts_ter2 = opts_xy2
opts_ter2@gsnYRefLine = 0.0
opts_ter2@gsnAboveYRefLineColor = "black"
opts_ter2@gsnDraw = False
opts_ter2@gsnFrame = False
opts_ter2@trYMaxF = zmax*1000 ;地形数据为m,因此这里要放大倍数为km

;;plot for dv
opts_dv2                = opts_xy2
opts_dv2@gsnDraw        = False
opts_dv2@gsnFrame       = False                    
opts_dv2@cnFillOn       = True  
opts_dv2@cnLinesOn      = False
opts_dv2@cnInfoLabelOn  = False
opts_dv2@cnLineLabelsOn = False
opts_dv2@cnSmoothingOn  = True
opts_dv2@lbLabelBarOn   = False
opts_dv2@lbTitleOn      = False   
opts_dv2@cnSmoothingDistanceF=0.015
opts_dv2@cnSmoothingTensionF=0.001
opts_dv2@cnLineLabelInterval=1
opts_dv2@cnLineLabelPlacementMode="Computed"
opts_dv2@cnLineLabelAngleF=0.5          ;大于0则平行于X轴,小于0为曲线切线方向
opts_dv2@cnLineLabelDensityF=1.0
opts_dv2@cnLineThicknessF = 4.0
opts_dv2@cnInfoLabelOrthogonalPosF=0.00                  
opts_dv2@ContourParameters=(/-10, 10, 2 /)
opts_dv2@gsnContourPosLineDashPattern=0
opts_dv2@cnLineDashPattern=0

vcres2 = opts_xy2
vcres2@vcGlyphStyle       = "CurlyVector";"LineArrow";   
vcres2@vcPositionMode     = "ArrowTail"
vcres2@vcRefAnnoOn        = True
vcres2@vcMinDistanceF     = 0.03
vcres2@vcRefMagnitudeF    = 8.   ;单位长度
vcres2@vcLineArrowThicknessF = 3.0
vcres2@vcMapDirection        = False
vcres2@vcFillArrowsOn        = True
vcres2@vcVectorDrawOrder     = "PreDraw"
vcres2@vcRefLengthF          = 0.015 ;矢量长度
vcres2@vcFillArrowHeadXF     = 0.2
vcres2@vcFillArrowHeadYF     = 0.2
vcres2@vcFillArrowHeadInteriorXF = 0.5

countour_dv  = wrf_contour(a, wks, dv_plane(0:zmax_pos,:), opts_dv)
countour_dv1 = wrf_contour(a1, wks, dv_plane1(0:zmax_pos1,:), opts_dv1)
countour_dv2 = wrf_contour(a2, wks, dv_plane2(0:zmax_pos2,:), opts_dv2)
contour_ter  = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter)
contour_ter1 = gsn_csm_xy(wks,X_plane1,ter_plane1,opts_ter1)
contour_ter2 = gsn_csm_xy(wks,X_plane2,ter_plane2,opts_ter2)
vector  = gsn_vector(wks,u_plane(0:zmax_pos,:),w_plane(0:zmax_pos,:)*10.,vcres)
vector1 = gsn_vector(wks,u_plane1(0:zmax_pos1,:),w_plane1(0:zmax_pos1,:)*10.,vcres1)
vector2 = gsn_vector(wks,u_plane2(0:zmax_pos2,:),w_plane2(0:zmax_pos2,:)*10.,vcres2)

plots(0) = wrf_overlays(a,wks,(/countour_dv,vector,contour_ter/),True)    ; plot x-section
plots(1) = wrf_overlays(a1,wks,(/countour_dv1,vector1,contour_ter/),True)    ; plot x-section
plots(2) = wrf_overlays(a2,wks,(/countour_dv2,vector2,contour_ter2/),True)    ; plot x-section

; Delete options and fields, so we don't have carry over
delete(opts_xy)
delete(ter_plane)
delete(opts_xy1)
delete(ter_plane1)
delete(opts_xy2)
delete(ter_plane2)
  ;set panel
  pnlres = res
  pnlres@gsnPanelCenter             = True
  pnlres@gsnPanelLabelBar           = True
  pnlres@lbOrientation              = "Vertical"
  pnlres@lbLabelPosition            = "Right"
  pnlres@pmLabelBarParallelPosF     = 0.0
  pnlres@pmLabelBarOrthogonalPosF   = 0.0
  pnlres@pmLabelBarWidthF           = 0.05
  pnlres@pmLabelBarHeightF          = 0.15
  pnlres@gsnPanelRowSpec            = True
  pnlres@gsnPanelYWhiteSpacePercent = 5
  pnlres@gsnPanelScalePlotIndex     = 1
  pnlres@amJust                     = "TopLeft"
  gsn_panel(wks, (/plots/), (/3/), pnlres)

end
有点长 非常感谢!!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-8-31 22:30:41 | 显示全部楼层
plots(0) = wrf_overlays(a,wks,(/countour_dv,vector,contour_ter/),True)    ; plot x-section
plots(1) = wrf_overlays(a1,wks,(/countour_dv1,vector1,contour_ter/),True)    ; plot x-section
plots(2) = wrf_overlays(a2,wks,(/countour_dv2,vector2,contour_ter2/),True)    ; plot x-section
画这几张图的属性你直接写True了,你改为res,然后在前一行加上res@gsnDraw=False;res@gsnFrame=False,试试看
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-9-1 09:37:53 | 显示全部楼层
yusw 发表于 2019-8-31 22:30
plots(0) = wrf_overlays(a,wks,(/countour_dv,vector,contour_ter/),True)    ; plot x-section
plots(1) ...

不行的 wrf_overlays的描述就是最后要是true才行 还有我加上这两行也是没有用的 下面是wrf_overlays的描述
http://www.ncl.ucar.edu/Document ... /wrf_overlays.shtml
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-9-1 10:35:06 | 显示全部楼层
supersupergirl 发表于 2019-9-1 09:37
不行的 wrf_overlays的描述就是最后要是true才行 还有我加上这两行也是没有用的 下面是wrf_overlays的描 ...

Description

This function overlays a number of graphical plots, and returns the base plot that contains all the overlaid plots. This is typically used for idealized ARW WRF model runs.

Some special resources are recognized for the res resource list:

    NoTitles (default: False)

    If set to True, then the top left titles will not be drawn. The main titles will be left alone.

    This resource can be useful if you are planning to panel the plots.

    CommonTitle (default: True)

    If set to False, then the top field titles will not be drawn.

    FramePlot (default: True)

    If set to False, then the plot will be drawn, but the frame will not be advanced. This allows you to draw more graphical objects on the same page.

    PanelPlot (default: False)

    If set to True, then this flags to wrf_map_overlays that these plots are going to be eventually paneled (likely by gsn_panel.) Hence, the plot will not be drawn, nor will the frame be advanced, unless gsnDraw and/or gsnFrame are explicitly set to True.

不是说非得是True,是属性res,有很多属性设置的,下面的例子是最简单的情况
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表