- 积分
- 184
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-9-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 tulipwaugh 于 2012-10-26 16:34 编辑
本人想将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
此处为该脚本出的图,共3张,只贴1张
|
|