爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4818|回复: 2

[图形美化] 画两个台风路径时,出图有误

[复制链接]

新浪微博达人勋

发表于 2014-10-1 19:17:50 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
国庆假期的第一天,祝大家节日快乐!值班的同学辛苦了!最近在画两个台风路径的时候,出图的时候 出现一些错误,想在这里跟大家请教一下,希望能得到大家的点拨,不胜感激。(两个台风路径的信息格式为:61406 20.6 116.8 18 ...........四列分别代表时间 纬度 经度 风速)
'reinit'
'open e:\zhuang\u.ctl'
'enable print E:\zhuang\picture\Typhoon.gmf'
'set grads off'
'set font 2'
'set parea 2 6 3 9.5'
'set lat 20 40'
'set lon 115 130'
'set mpdraw on'
i0=fake(1)
'set rgb 71 120 185 250'
'set rgb 61 15 160 15'
'set rgb 51 255 97 0'
'set rgb 41 227 23 13'
'set rgb 31 255 0 255'
'set rgb 21 138 43 226'
'draw title The TC  201308 VS 201407'

i=1
while(i<=40)
ret=read('E:\zhuang\xml.txt')
rc=sublin(ret,1)
if(rc>0)
say 'file error'
return
endif
b1=sublin(ret,2)
time=subwrd(b1,1)
xx=subwrd(b1,3)
yy=subwrd(b1,2)
'q w2xy 'xx' 'yy''
y1=subwrd(result,3)
x1=subwrd(result,6)
'set line 4 1 7'
'draw mark 3  'x1' 'y1' 0.1'
if(adv>=2)
'set line 4 1 7'
'draw line  'x2' 'y2' 'x1' 'y1''
endif
if(adv=1)
'set strsiz 0.15 0.15'
'set font 0'
'draw string 'x1' 'y1' 'num''
endif
i=i+1
x2=x1
y2=y1
endwhile
ff=close(ret)
x1=20.6
y1=116.8
i=1
aa='E:\zhuang\hbs.txt'
while(i<=38)
a1=read(aa)
b1=sublin(a1,2)
time=subwrd(b1,1)
lat=subwrd(b1,2)
lon=subwrd(b1,3)
'q w2xy 'lon' 'lat''
x1=subwrd(result,3)
y1=subwrd(result,6)
'draw mark 3  'x1' 'y1' 0.1'
if(adv>=2)
'set line 2 1 7'
'draw line  'x2' 'y2' 'x1' 'y1''
endif
if(adv=1)
'set strsiz 0.15 0.15'
'set font 0'
'draw string 'x1' 'y1' 'num''
endif
i=i+1
x2=x1
y2=y1
endwhile
ff=close(ret)

'print'
'disable print'
;
function fake(i0)
'set mpdraw on'
*'set poli on'
'set mproj scaled'
'set map 1 1 5'
'set frame circle'
'set xlopts 1 6 0.13'
'set ylopts 1 6 0.13'
'set vpage 0 8.5 0 10.5'
'set parea 1 8.0 1.5 10'
'set z 1'
'set xlint 1'
'set ylint 1'
'set lon 110 135'  
'set lat 18 32'
'set xlab on'
'set ylab on'
'set gxout contour'
'set grads off'
'set grid off'
'set cthick 3'

'set xlopts 1 4 0.15'
'set ylopts 1 4 0.15'
'set xlint 2'
'set ylint 2'
'set mpdset cnbase'
'set mpdset cnriver'
'set mpdset cnworld'
*'set mpdset cnscs'
'set cmin 10000'
'set cmax 10000'
*'set cint 0.5'
'd u'
return(2)
;
function getwind(u,v)
'set gxout stat'
'd mag('u','v')'
rec=sublin(result,8)
val=subwrd(rec,4)
return(val)
function wind(u,v, x,y,lh,wh,wb,wscale,fill)
* (x,y) the end point for wind arrow
* lh: head length
* wh: head width
* wb: body width
w=getwind(u,v)
sin=v/w
cos=u/w
w=wsacle
x1=x+wscale*cos
y1=y+wscale*sin
xa=x1-lh*cos
ya=y1-lh*sin
x2=xa-0.5*wh*sin
y2=ya+0.5*wh*cos
x3=xa-0.5*wb*sin
y3=ya+0.5*wb*cos
x4=x-0.5*wb*sin
y4=y+0.5*wb*cos
x5=x+0.5*wb*sin
y5=y-0.5*wb*cos
x6=xa+0.5*wb*sin
y6=ya-0.5*wb*cos
x7=xa+0.5*wh*sin
y7=ya-0.5*wh*cos
if(fill=1)
'draw polyf 'x1' 'y1' 'x2' 'y2' 'x3' 'y3' 'x4' 'y4' 'x5' 'y5' 'x6' 'y6' 'x7' 'y7' 'x1' 'y1
else
'set line 2 1 10'
'draw line 'x1' 'y1' 'x2' 'y2
'draw line 'x2' 'y2' 'x3' 'y3
'draw line 'x3' 'y3' 'x4' 'y4
'draw line 'x4' 'y4' 'x5' 'y5
'draw line 'x5' 'y5' 'x6' 'y6
'draw line 'x6' 'y6' 'x7' 'y7
'draw line 'x7' 'y7' 'x1' 'y1
endif
return

                               
登录/注册后可看大图


密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-1-11 16:20:55 | 显示全部楼层
楼主,你的问题解决了没呀
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-2-9 15:22:06 | 显示全部楼层
路过学习,也遇到相同问题,应该是默认把前一个台风和后一个台风的点连接一起了。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表