- 积分
- 10605
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-10-10
- 最后登录
- 1970-1-1
|
发表于 2014-3-19 14:21:43
|
显示全部楼层
本帖最后由 longlivehj 于 2014-3-19 14:26 编辑
贝頥嚫 发表于 2014-3-19 10:27
好了!!我发现下面还有一个res@tmXBMode。。嘻嘻
对了,我还想在每个数据点上面加上风向杆,指示风向和 ...
是这个意思么?
这个要用到wmbarb,具体用法看看ncl的帮助吧!
下面是代码,用随机函数造的uwnd和vwnd(为了让它有点意义,把范围控制在-20~20,呵呵!),其它变量和之间的一样。你作为参考!
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
begin
units = "hours since 1-1-1 00:00:0.0"
xbrange = tointeger(cd_inv_calendar((/1, 1/), (/1, 1/), (/12, 15/), (/12, 18/), (/0, 0/), (/0, 0/), units, 0))
xbvalues = ispan(xbrange(0), xbrange(1), 6)
xbvalues@units = units
xblabels = cd_string(xbvalues, "%d.%H")
npts = dimsizes(xbvalues)
random = new(npts, "float")
do i = 0, npts - 1
random(i) = rand()
end do
low = -20.0
high = 20.0
con = (high - low) / 32766.0
srand(1234)
uwnd = new(npts, "float")
do i = 0, npts - 1
uwnd(i)= low + con * rand()
end do
srand(5678)
vwnd = uwnd
do i = 0, npts - 1
vwnd(i) = low + con * rand()
end do
xyres = True
xyres@gsnFrame = False
xyres@tmXBMode = "Explicit"
xyres@tmXBValues = xbvalues
xyres@tmXBLabels = xblabels
xyres@tmXBLabelFontHeightF = .01
xyres@tmYLLabelFontHeightF = .01
xyres@trXMinF = xbvalues(0)
xyres@trXMaxF = xbvalues(npts - 1)
wks = gsn_open_wks ("x11", "time_axis")
xyplot = gsn_csm_xy(wks, xbvalues, random, xyres)
wmsetp("wdf", 1)
wmbarb(wks, tofloat(xbvalues), random, uwnd, vwnd)
frame(wks)
end
|
|