- 积分
- 10589
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-10-10
- 最后登录
- 1970-1-1
|
发表于 2014-4-21 13:36:36
|
显示全部楼层
回帖奖励 +5 金钱
给你一个另外的实现方式,供参考!
这个用到了gsn_csm_vector,可以比较灵活地控制箭头的属性。之前用wmvectmap的版本,正如你说的,箭头好像是没有太好的办法进行更改。
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"
begin
lat = -30.
lon = 90.
len = .04
fonthgt = .015
wks = gsn_open_wks("png", "dir")
; map
mapres = True
mapres@gsnDraw = False
mapres@gsnFrame = False
plot = gsn_csm_map(wks, mapres)
; arrows
u = (/(/0., 0., 0./), (/-10, 0., 10./), (/0., 0., 0./)/)
v = (/(/0., 10., 0./), (/0., 0., 0./), (/0., -10., 0./)/)
lat2 = lat + (/.01, 0., -.01/)
lat2@units = "degrees_north"
lon2 = lon + (/-.01, 0., .01/)
lon2@units = "degrees_east"
u!0 = "lat"
u!1 = "lon"
u&lat = lat2
u&lon = lon2
copy_VarCoords(u, v)
vectres = True
vectres@gsnDraw = False
vectres@gsnFrame = False
vectres@vcGlyphStyle = "FillArrow"
vectres@vcFillArrowEdgeColor = "black"
vectres@vcPositionMode = "ArrowTail"
vectres@vcRefMagnitudeF = 10.
vectres@vcRefLengthF = len * .9
vectres@vcRefAnnoOn = False
vectplot = gsn_csm_vector(wks, u, v, vectres)
overlay(plot, vectplot)
draw(plot)
; text
xout = 0.
yout = 0.
datatondc(plot, lon, lat, xout, yout)
len2 = len * 1.1
txtres = True
txtres@txFontHeightF = fonthgt
txtres@txJust = "CenterLeft"
gsn_text_ndc(plot, "3", xout + len2, yout, txtres)
txtres@txJust = "TopCenter"
gsn_text_ndc(plot, "6", xout, yout - len2, txtres)
txtres@txJust = "CenterRight"
gsn_text_ndc(plot, "9", xout - len2, yout, txtres)
txtres@txJust = "BottomCenter"
gsn_text_ndc(plot, "12", xout, yout + len2, txtres)
; circle
rad = atan(1.0) / 45.
npts = 361
xcirc = new(npts, float)
ycirc = xcirc
xcirc = xout + len * cos(fspan(0, 360, npts) * rad)
ycirc = yout + len * sin(fspan(0, 360, npts) * rad)
gsn_polyline_ndc(wks, xcirc, ycirc, False)
frame(wks)
end
|
|