- 积分
- 862
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-4-14
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 zhi726 于 2018-1-23 12:16 编辑
由于在工作用经常需要在grads中绘制槽线,笔者想到一个简单的办法:利用贝塞尔曲线来绘制槽线,使用贝塞尔曲线最简单的二次方公式,由人工确定三点位置,再根据公式绘制槽线,槽线的起点和终点都在槽线上,但中间点一般不在槽线上,而是起到调整槽线曲率的作用,gs如下:
'reinit'
'open C:\dcz\20160627\fnl\fnldata\fnl.0627.ctl'
'enable print C:\dcz\20160627\fnl\hgt500.wind.gmf'
'set rgb 22 153 96 53'
'set lon 90 125'
'set lat 20 50'
'set t 1'
'set grads off'
'set grid off'
'set gxout contour'
'set lev 500'
'set cint 2'
'set ccolor 4'
'set cthick 6'
'set clab forced'
'set clopts 4 4 0.12'
'set clskip 2'
'set csmooth on'
'define hh=smth9(HGTprs/10)'
'd hh'
'set clevs 588'
'set ccolor 4'
'set cthick 12'
'd hh'
*******draw Trough line**********
*******need to locate three dots of the trough position, the first and the last is on the trough****
'q w2xy 108 33'
ln1=subwrd(result,3)
lt1=subwrd(result,6)
'q w2xy 106 30'
ln2=subwrd(result,3)
lt2=subwrd(result,6)
'q w2xy 101 28.5'
ln3=subwrd(result,3)
lt3=subwrd(result,6)
'set line 22 1 12'
rc = bezier(ln1,lt1,ln2,lt2,ln3,lt3)
'print'
'disable print'
'c'
'reinit'
function bezier(x1,y1,x2,y2,x3,y3)
bt=0
bt1=0
bt2=0
dt=0.1
while(bt<=1-dt)
bt1=bt
bt2=bt+dt
xs=(1-bt1)*(1-bt1)*x1 + 2*bt1*(1-bt1)*x2 + bt1*bt1*x3
ys=(1-bt1)*(1-bt1)*y1 + 2*bt1*(1-bt1)*y2 + bt1*bt1*y3
xe=(1-bt2)*(1-bt2)*x1 + 2*bt2*(1-bt2)*x2 + bt2*bt2*x3
ye=(1-bt2)*(1-bt2)*y1 + 2*bt2*(1-bt2)*y2 + bt2*bt2*y3
'draw line 'xs' 'ys' 'xe' 'ye''
say 't= 'bt2''
bt=bt+dt
endwhile
return
*******************************
|
-
500hPa trough
|