爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8537|回复: 6

NCL画箭头图请教 参考的箭头画不出来

[复制链接]
发表于 2013-1-10 21:30:05 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本人想将WRFDA同化出的数据与原始背景场做差值,画出风速增量的矢量图,但不知为何,表示单位长度箭头所表示风速大小的图例无法画出,特向高手求教。
以下为本人的ncl脚本:

load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"   

begin
   cdf_analysis = addfile("/home/wy/WRFDA_model/WRFDA/workdir/200804/2008040500/00d01/wrfvar_output.nc","r")
   cdf_bk = addfile("/home/wangy/WRFV3/test/em_real/wrfinput_d01.nc","r")
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        
   it=0
   Za  = wrf_user_getvar(cdf_analysis, "z",0)        ; grid point height
   Zb  = wrf_user_getvar(cdf_bk, "z",0)        ; grid point height

  Ua = wrf_user_getvar(cdf_analysis,"ua",0)  ; u averaged to mass points
   Ub = wrf_user_getvar(cdf_bk,"ua",0)

  Va = wrf_user_getvar(cdf_analysis,"va",0)
   Vb = wrf_user_getvar(cdf_bk,"va",0)
   
; The specific height levels that we want the data interpolated to.
; And interpolate to these levels
   height_levels = (/1500.,3000.,5500./)            ; height levels to plot - in meter
   nlevels       = dimsizes(height_levels)     ; number of height levels
   refvec        = 3.                               ; value of reference vector
; We generate plots, but what kind do we prefer?
;  type = "x11"
; type = "pdf"
   type = "ps"
; type = "ncgm"
   wks = gsn_open_wks(type,"Wind_INCREMENT")
   gsn_define_colormap(wks,"RainBow")
; Set some basic resources
   res = True
   res@MainTitle = "REAL-TIME WRF"
   res@Footer = False
   res@pmLegendDisplayMode         = "Always"
   res@vcRefMagnitudeF             = refvec           ; make vectors larger
   res@vcRefLengthF                = 0.030            ; ref vector length
   res@vcGlyphStyle                = "CurlyVector"    ; turn on curly vectors
   res@vcMinDistanceF              = 0.018            ; thin the vectors
   res@vcRefAnnoOrthogonalPosF     = -0.125           ; move ref vector
;  res@lgOrientation               = "horizontal"
;  res@pmLegendWidthF              = 0.6
;  res@pmLegendHeightF             = 0.3
    res@mpOutlineOn                 = True             ; turn on map outline
;  res@lgTitleOn                   = True
;  res@lgTitleString               = "wind"
;  res@vcRefAnnoString2            = "m/s"           ; unit string
;  res@vcRefAnnoString2On          = True            ; turn on second string
   

  pltres = True
   mpres = True
   mpres@mpGeophysicalLineColor = "Black"
   mpres@mpNationalLineColor    = "Black"
   mpres@mpUSStateLineColor     = "Black"
   mpres@mpGridLineColor        = "Black"
   mpres@mpLimbLineColor        = "Black"
   mpres@mpPerimLineColor       = "Black"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
   times = wrf_user_getvar(cdf_bk,"times",-1)  ; get all times in the file
   ntimes = dimsizes(times)         ; number of times in the file
it = 0
     print("Working on time: " + times(it) )
     res@TimeLabel = times(it)   ; Set Valid time to use on plots

do level = 0,nlevels-1                 ; LOOP OVER LEVELS
       height = height_levels(level)
    ; Add some level into to the plot
       res@PlotLevelID = .001*height + " km"
     Ua_plane  = wrf_user_intrp3d( Ua,Za,"h",height,0.,False)
     Ub_plane  = wrf_user_intrp3d( Ub,Zb,"h",height,0.,False)
     Va_plane  = wrf_user_intrp3d( Va,Za,"h",height,0.,False)
     Vb_plane  = wrf_user_intrp3d( Vb,Zb,"h",height,0.,False)
     du_plane  = Ua_plane - Ub_plane  
     dv_plane  = Va_plane - Vb_plane
printMinMax(du_plane,True)
printMinMax(dv_plane,True)
;print(aaaaaaaaaaaaaa)

; Plotting options for Wind Vectors                 
       opts = res         
      opts@FieldTitle = "Increment of Wind"   ; overwrite Field Title
       opts@NumVectors = 57       ; wind barb density
       vector = wrf_vector(cdf_bk,wks,du_plane,dv_plane,opts)
;      delete(opts)

; MAKE PLOTS                                       
       plot = wrf_map_overlays(cdf_bk,wks,(/vector/),pltres,mpres)
     end do      ; END OF LEVEL LOOP
end







下载附件 (133.25 KB)

密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-1-10 21:31:43 | 显示全部楼层
图就是这个样子 就是在 箭头的那个参考的没画出来 求教
111.JPG
密码修改失败请联系微信:mofangbao
发表于 2013-2-5 00:33:52 | 显示全部楼层
  res@vcRefAnnoString2On          = True            ; turn on second string
大概這樣吧
密码修改失败请联系微信:mofangbao
发表于 2013-8-9 01:15:59 | 显示全部楼层
wrf_map_overlays
密码修改失败请联系微信:mofangbao
发表于 2013-10-17 21:20:27 | 显示全部楼层
试试  res@vcRefAnnoOn       =  True
密码修改失败请联系微信:mofangbao
发表于 2015-7-11 09:27:08 | 显示全部楼层
请问你最后怎么解决的啊
密码修改失败请联系微信:mofangbao
发表于 2016-12-1 19:58:02 | 显示全部楼层
试试这句话 'set arrscl 0.2 4',参数适当改一下
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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