- 积分
- 1984
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-15
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想要处理最佳路径台风资料,用来画生命史图,
数据大概是这样的格式:
66666 0000 13 0005 0000 0 6 (nameless) 20110729
1950070606 0 178 1198 1008 0
1950070612 0 182 1194 1006 0
1950070618 0 187 1189 1005 0
1950070700 0 189 1180 1004 0
1950070706 0 190 1170 1003 0
1950070712 0 192 1162 1002 0
1950070718 0 194 1155 1002 0
1950070800 0 197 1148 1002 0
1950070806 0 202 1143 1002 0
1950070812 1 210 1140 1002 12
1950070818 1 216 1137 1002 12
1950070900 1 222 1132 1002 12
1950070906 0 228 1128 1005 10
66666 0000 26 0006 0000 3 6 (nameless) 20110729
1950070912 0 121 1494 1008 0
1950070918 0 115 1482 1008 0
1950071000 0 109 1470 1007 0
1950071006 0 103 1454 1007 0
1950071012 0 110 1441 1006 0
1950071018 0 123 1444 1005 0
1950071100 0 141 1451 1005 0
数据头记录(第一行)分别是:资料分类标志,年纪编号,数据路径记录行数,我国对热带气旋编号,热带气旋终结记录,数据间隔时间(6小时),台风英文名称,数据记录时间
数据内容分别是:台风的出现时间,强度,台风中心纬度,经度,中心最低气压,两小时平均近中心最大风速,2分钟平均风速
现在有一个gs文件(老师给的),要画台风的生命史。我不清楚老师是怎么处理的数据(老师忘掉了)
请教大神们要怎么处理数据,以及数据的ctl该怎样写
gs文件如下:
* piling program 1
function lifespan(args)
'reinit'
'set font 1'
years=subwrd(args,1)
path=subwrd(args,2)
* Light blue to dark blue, 10 steps
'set rgb 20 255 249 70'
'set rgb 21 255 191 85'
'set rgb 22 255 168 89'
'set rgb 23 255 142 89'
'set rgb 24 255 100 65'
'set rgb 25 255 56 43'
'set rgb 26 225 0 35'
'set rgb 27 168 0 54'
'set rgb 28 110 0 35'
'set rgb 29 80 0 12'
ar=substr(path,1,2)
if(path='sti'|path='STI')
ar='ch'
endif
file='tcs/'path%'/'ar%years'bst.txt'
'enable print lifespan.gmf'
'open c:/pcgrads/lib/tmpf.ctl'
'set time 00z25dec'years-1' 18z31jan'years+1
*'set time 00z1jan'years' 18z10jan'years+1
'set lon 1'
'set lat 0 50'
'define ug=lat(t=1)'
'set parea 0.75 10 0.5 8.1'
'set grads off'
'set datawarn off'
'set ylab off'
'set xyrev on'
'set cmin 1000000000000'
'd ug'
'close 1'
* looping (TCs in a year)
code=0
ino=1
while(code=0)
* header record
rc=rdfile(file)
code=subwrd(rc,1)
context=substr(rc,3,100)
points=subwrd(context,3)
serial=subwrd(context,4)
chinasn=subwrd(context,5)
if(chinasn='0000');chinasn=substr(serial,3,2);endif
name=subwrd(context,8)
if(substr(name,1,1)='1'|substr(name,1,1)='2'|name='NO')
name=''
endif
* 1st points of TCs
rc=rdfile(file)
code=subwrd(rc,1)
context=substr(rc,3,100)
int1=subwrd(context,2)
time=subwrd(context,1)
year=substr(time,1,4)
month=substr(time,5,2)
rc=mon(month)
month=subwrd(rc,1)
day=substr(time,7,2)
hour=substr(time,9,2)
*start time of the same intensity
start=hour%'z'%day%month%year
endt=start
if(points=1)
'q w2xy 'start' 'ino-1
x1=subwrd(result,3)
y1=subwrd(result,6)
'q w2xy 'endt' 'ino
x2=subwrd(result,3)
y2=subwrd(result,6)
xc=(x1+x2)/2
yc=(y1+y2)/2
if(path='STI'|path='sti')
* tropical disturbance or unknown intensity
if(int1=0); color=23; lab=''; endif
* tropical depression
if(int1=1); color=24; lab='1'; endif
* tropical storm
if(int1=2); color=25; lab='2'; endif
* severe tropical storm
if(int1=3); color=26; lab='3'; endif
* typhoon
if(int1=4); color=27; lab='4'; endif
* severe typhoon
if(int1=5); color=28; lab='5'; endif
* super typhoon
if(int1=6); color=29; lab='6'; endif
* Extra-tropical cyclone
if(int1=9); color=15; lab='9'; endif
else
* unknown
if(int1=0); color=21; lab=''; endif
* tropical depression
if(int1=1); color=22; lab='1'; endif
* tropical storm
if(int1=2); color=23; lab='2'; endif
* severe tropical storm
if(int1=3); color=24; lab='3'; endif
* typhoon (H1)
if(int1=4); color=25; lab='4'; endif
* severe typhoon (H2)
if(int1=5); color=26; lab='5'; endif
* super typhoon (H3)
if(int1=6); color=27; lab='6'; endif
* H4
if(int1=7); color=28; lab='7'; endif
* H5
if(int1=8); color=29; lab='8'; endif
* Extra-tropical cyclone
if(int1=9); color=15; lab='9'; endif
endif
'set line 'color' 1 1'
if(x1=x2|y1=y2)
'draw recf 'x1-0.01' 'y1' 'x2' 'y2+0.01
else
'draw recf 'x1' 'y1' 'x2' 'y2
endif
else
* looping (points of a TC)
ip=2
while(ip<=points&code=0)
rc=rdfile(file)
code=subwrd(rc,1)
context=substr(rc,3,100)
int2=subwrd(context,2)
if((path='sti'|path='STI')&int2=5)
wind=subwrd(context,6)
if(wind>41.5);int2=1;endif
endif
time=subwrd(context,1)
year=substr(time,1,4)
month=substr(time,5,2)
rc=mon(month)
month=subwrd(rc,1)
day=substr(time,7,2)
hour=substr(time,9,2)
tmpt=hour%'z'%day%month%year
if(int1!=int2|ip=points)
* end time of the same intensity
'q w2xy 'start' 'ino-1
x1=subwrd(result,3)
y1=subwrd(result,6)
'q w2xy 'endt' 'ino
x2=subwrd(result,3)
y2=subwrd(result,6)
start=tmpt
endt=tmpt
xc=(x1+x2)/2
yc=(y1+y2)/2
if(path='STI'|path='sti')
* tropical disturbance or unknown intensity
if(int1=0); color=23; lab=''; endif
* tropical depression
if(int1=1); color=24; lab='1'; endif
* tropical storm
if(int1=2); color=25; lab='2'; endif
* severe tropical storm
if(int1=3); color=26; lab='3'; endif
* typhoon
if(int1=4); color=27; lab='4'; endif
* severe typhoon
if(int1=5); color=28; lab='5'; endif
* super typhoon
if(int1=6); color=29; lab='6'; endif
* Extra-tropical cyclone
if(int1=9); color=15; lab='9'; endif
else
* unknown
if(int1=0); color=21; lab=''; endif
* tropical depression
if(int1=1); color=22; lab='1'; endif
* tropical storm
if(int1=2); color=23; lab='2'; endif
* severe tropical storm
if(int1=3); color=24; lab='3'; endif
* typhoon (H1)
if(int1=4); color=25; lab='4'; endif
* severe typhoon (H2)
if(int1=5); color=26; lab='5'; endif
* super typhoon (H3)
if(int1=6); color=27; lab='6'; endif
* H4
if(int1=7); color=28; lab='7'; endif
* H5
if(int1=8); color=29; lab='8'; endif
* Extra-tropical cyclone
if(int1=9); color=15; lab='9'; endif
endif
'set line 'color' 1 1'
if(x1=x2|y1=y2)
'draw recf 'x1-0.01' 'y1' 'x2' 'y2+0.01
else
'draw recf 'x1' 'y1' 'x2' 'y2
endif
'set string 'color' c 5'
* if(lab!='');'draw string 'xc' 'yc' 'lab;endif
int1=int2
else
endt=tmpt
endif
* plot the schedule of TC life
* looping (points)
ip=ip+1
endwhile
endif
'set line 1 1 1'
'draw line 0.75 'y1' 0.72 'y1
'draw line 0.75 'y2' 0.72 'y2
'set line 15 1 1'
'draw line 0.75 'y2' 10.0 'y2
'set strsiz 0.095'
'set string 1 r 5'
'draw string 0.72 'yc' 'chinasn
'set string 1 l 5'
if(name!='');'draw string 10.03 'yc' 'name;endif
* looping (TCs)
ino=ino+1
endwhile
if(path='sti'|path='STI')
'set string 23 l 1'
'draw string 1. 8.3 Unknown'
'set string 24 l 1'
'draw string 2.5 8.3 TD'
'set string 25 l 1'
'draw string 3.25 8.3 TS'
'set string 26 l 1'
'draw string 4 8.3 STS'
'set string 27 l 1'
'draw string 4.75 8.3 TY'
'set string 28 l 1'
'draw string 5.75 8.3 STY'
'set string 29 l 1'
'draw string 6.75 8.3 SuperTY'
'set string 15 l 1'
'draw string 7.75 8.3 ETC'
else
'set string 21 l 1'
'draw string 1 8.3 Unknown'
'set string 22 l 1'
'draw string 2.5 8.3 TD'
'set string 23 l 1'
'draw string 3.25 8.3 TS'
'set string 24 l 1'
'draw string 4. 8.3 STS'
'set string 25 l 1'
'draw string 4.75 8.3 TY(H1)'
'set string 26 l 1'
'draw string 5.75 8.3 STY(H2)'
'set string 27 l 1'
'draw string 6.75 8.3 STY(H3)'
'set string 28 l 1'
'draw string 7.75 8.3 STY(H4)'
'set string 29 l 1'
'draw string 8.75 8.3 STY(H5)'
'set string 15 l 1'
'draw string 9.75 8.3 ETC'
endif
'print'
'disable print'
'!gxeps -ac2i lifespan.gmf -o 'path'_lifespan'years'.ps'
*'!gxeps -a2i lifespan.gmf -o lifespan'years'_p.ps'
return
****************************************************8888
* subroutines
*
function rdfile(file)
res=read(file)
code=sublin(res,1)
if(code!=0)
say "Can not open the file: "%file
return
endif
context=sublin(res,2)
rtns=code' 'context
return(rtns)
function mon(mo)
moo=mo
if(moo>12);say 'error: month';endif
if(moo=1); mo='Jan'; endif
if(moo=2); mo='Feb'; endif
if(moo=3); mo='Mar'; endif
if(moo=4); mo='Apr'; endif
if(moo=5); mo='May'; endif
if(moo=6); mo='Jun'; endif
if(moo=7); mo='Jul'; endif
if(moo=8); mo='Aug'; endif
if(moo=9); mo='Sep'; endif
if(moo=10); mo='Oct'; endif
if(moo=11); mo='Nov'; endif
if(moo=12); mo='Dec'; endif
return(mo)
|
|