arbitrary cross-section
Xuguang Sun
sunxg007 at YAHOO.COM.CN
Thu May 5 07:41:00 EDT 2005
*********************************************************************
* The following lines will display an arbitrary X
section
* from one specified point to another.
*
* lon1 is the westernmost longitude point
* lon2 is the easternmost longitude point
* lat1 is the latitude that corresponds to lon1
* lat2 is the latitude that corresponds to lon2
*
* The loop is used to interpolate between points in
* the arbitrary cross section. This code will plot
* any cross section as long as you specify the points.
* My code plots cross sections of PV after I
calculated
* PV on 11 pressure surfaces. I have another script
* that plots cross sections of potential temperature,
and
* the code is very similar to this, except theta is
substituted
* for PV.
*
* Many thanks to Brian Doty at COLA for his help with
this code.
*
********************************************************************
function cross_sec(args)
say 'Usage: cross_sec var lon1 lon2 x1 x2 lat1 lat2
lev1 lev2'
say ' var ---- variable'
say ' lon1 ---- leftmost longitude'
say ' lon2 ---- rightmost longitude'
say ' x1 ---- leftmost x coordinate'
say ' x2 ---- rightmost x coordinate'
say ' lat1 ---- southmost latitude'
say ' lat2 ---- northmost latitude'
say ' lev1 ---- lowmost level'
say ' lev2 ---- highmost level'
var = subwrd(args,1)
lon1 = subwrd(args,2)
lon2 = subwrd(args,3)
x1 = subwrd(args,4)
x2 = subwrd(args,5)
lat1 = subwrd(args,6)
lat2 = subwrd(args,7)
lev1 = subwrd(args,8)
lev2 = subwrd(args,9)
if(var=''|lon1=''|lon2=''|x1=''|x2=''|lat1=''|lat2=''|lev1=''|lev2='');
say 'Incorrect input args';
return;
endif
'set grads off'
'set zlog on'
'set x 1'
'set y 1'
'set z 'lev1' 'lev2''
lon = lon1
'collect 1 free'
while (lon <= lon2)
lat = lat1 + (lat2-lat1)*(lon-lon1) / (lon2-lon1)
'collect 1 gr2stn('var','lon','lat')'
lon = lon + 1
endwhile
'set x 'x1' 'x2''
'set xaxis 'lon1' 'lon2
'set clab on'
'set gxout shaded'
*'set clevs 0 .5 15'
*'set ccols 0 0 7 0'
'd coll2gr(1,-u)'
'set gxout contour'
*'set cint .5'
'd coll2gr(1,-u)'
return
SUN Xuguang
Department of Atmospheric Sciences
22 Hankou Road, Nanjing University, 210093
Nanjing, P.R.China
_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
More information about the gradsusr
mailing list