脚本如下:
*垂直环流图,要求有两个变量,一个是平行于高度(Z轴)的omega场,另一个是平行于斜线的风场分量。后者需要用u,v投影到斜线上。
*顺便将地形(orog1.ctl)加入其中,具体gs文件如下:
'reinit'
'open G:\ncep\2017/201702.ctl'
'open G:\test\orog1.ctl'
'set dfile 2'
'set t 1'
'set x 1'
'set y 1'
'set z 1 17'
*先插值第一条斜线上的地形数据
lon1=140.0
lon2=160.0
lat1=60.0
lat2=70.0
lon=lon1
'collect 3 free'
while(lon<=lon2)
lat=lat1+(lat2-lat1)*(lon-lon1)/(lon2-lon1)
'collect 3 gr2stn(orog.2,'lon','lat')'
lon=lon+1
endwhile
*再插值第二条斜线上的数据
lon1=75.0
lon2=100.0
lat1=30.0
lat2=40.0
lon=lon1
*'collect 3 free' 注意这句已经注释掉了,这样就把第二条斜线上的数据增加到数据集3 中了
while(lon<=lon2)
lat=lat1+(lat2-lat1)*(lon-lon1)/(lon2-lon1)
'collect 3 gr2stn(orog.2,'lon','lat')'
lon=lon+1
endwhile
'set dfile 1'
'set x 1 360'
'set y 1 181'
'set z 1 21'
'set t 3'
'define alfa=atan2('lat2-lat1','lon2-lon1')'
*atan2返回的结果单位是弧度
'define uv=UGRDprs*cos(alfa)+VGRDprs*sin(alfa)'
'set x 1'
'set y 1'
'set z 1 21'
lon1=140.0
lon2=160.0
lat1=60.0
lat2=70.0
lon=lon1
'collect 1 free'
'collect 2 free'
while(lon<=lon2)
lat=lat1+(lat2-lat1)*(lon-lon1)/(lon2-lon1)
'collect 1 gr2stn(-VVELprs.1*100,'lon','lat')'
'collect 2 gr2stn(uv,'lon','lat')'
lon=lon+1
endwhile
lon1=75.0
lon2=100.0
lat1=30.0
lat2=40.0
lon=lon1
*'collect 1 free'
*'collect 2 free'
while(lon<=lon2)
lat=lat1+(lat2-lat1)*(lon-lon1)/(lon2-lon1)
'collect 1 gr2stn(-VVELprs.1*100,'lon','lat')'
'collect 2 gr2stn(uv,'lon','lat')'
lon=lon+1
endwhile
'set parea 1.5 10.5 0.5 7.5'
'set grads off'
'set zlog on'
'set grid off'
'set lon 70 180'
'set z 1 21'
*'set xlab off'
'set csmooth on'
*'set ylevs 1000 925 850 700 600 500 400 300 200 100 '
'set xlabs 60N,140E||||70N,160E(35N,70E)|||||40N,100E'
*先画地形阴影图
'set clevs 0'
'set ccols 0 1 0'
'set gxout shade2b'
'd coll2gr(3,-u)'
*再画折线上的全风速
'set gxout contour'
'set cint 30'
*'set clab on'
*'set strmden 5 0.5 0.05 1'
'd smth9(mag(coll2gr(2,-u),coll2gr(1,-u)))'
*标记两条斜线的分界
'drawline1 Lon 120'
'draw title along (60N,140E) to (70N,160E)\and (35N,75E) to (40N,100E)'
'gxprint g:/test/anypoumian3(3).png white'
say 'ok'
;