| 
 
	积分87贡献 精华在线时间 小时注册时间2012-4-26最后登录1970-1-1 
 | 
 
 
 楼主|
发表于 2014-4-8 15:16:11
|
显示全部楼层 
| 求救高手。我要把风向杆改成箭头,只表示方向。程序如下。但是画出来不显示箭头,其他和以前一样。求指导。
 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
 in=asciiread("text.txt",(/12,3/),"float")
 print(in)
 time=in(:,0)
 vector=in(:,1)
 speed=in(:,2)
 pi=3.1415926
 print(vector)
 
 print(speed)
 
 wks = gsn_open_wks("ps" ,"test")                ; open a ps file
 
 gsn_define_colormap(wks,"temp_diff_18lev")
 
 res                       = True     ; plot mods desired
 units = "hours since 1-1-1 00:00:0.0"
 xbrange = tointeger(cd_inv_calendar((/1, 1/), (/1, 1/), (/12, 15/), (/12, 06/), (/0, 0/), (/0, 0/), units, 0))
 print(xbrange)
 xbvalues = ispan(xbrange(0), xbrange(1), 6)
 print(xbvalues)
 ;xbvalues = array_append_record(xbvalues(0), xbrange(1),0)
 xbvalues@units = units
 xblabels = cd_string(xbvalues, "%d.%H")
 print(xbvalues)
 npts = dimsizes(xbvalues)
 random = new(npts,float)
 uwnd = new(npts,float)
 vwnd = new(npts,float)
 do a = 0, npts - 1
 random(a) = speed(a)
 end do
 
 do a = 0, npts - 1
 vwnd(a) = speed(a)*cos(vector(a)*pi/180.0)
 end do
 
 do a = 0, npts - 1
 uwnd(a) = speed(a)*sin(vector(a)*pi/180.0)
 end do
 
 res@tmXBMode = "Explicit"
 res@tmXBValues = xbvalues
 res@tmXBLabels = xblabels
 
 res@tmXBLabelFontHeightF = .01
 res@tmYLLabelFontHeightF = .01
 
 res@trXMinF = xbvalues(0)
 res@trXMaxF = xbvalues(npts - 1)
 ;res@vpWidthF = 0.6
 ; res@vpHeightF = 1.0
 
 
 plot = gsn_csm_xy(wks,xbvalues,random,res)
 
 ; wmsetp("vrs - reference vector size",50.)
 ; wmsetp("vrn - NDC size of a reference vector size",0.3)
 ; wmsetp("vcc - vector color",2)
 ; wmsetp("vcw - vector linewidth scale factor",4.)
 wmsetp("wdf",1)
 wmvect(wks,tofloat(xbvalues),random,uwnd,vwnd)
 
 draw(plot)
 frame(wks)
 end
 
 
 
 | 
 |