Page 1 of 1

A couple handy GrADS scripts

Posted: Mon Oct 31, 2011 9:58 am
by chilimac
I call this script animall.gs. It's a general purpose animation routine that will work for any variable and any number of forecast cycles. The .ctl filename, # cycles, and desired display variable are entered via responses to prompts. The forecast cycles frames are displayed at 2-second intervals. No big deal.

Code: Select all

prompt 'Enter filename: '
pull filex
say filex

prompt 'Enter # of cycles to display: '
pull times
say times

prompt 'Enter name of variable to display: '
pull vdisp
say vdisp

'open 'filex' '

'set mpdset hires'

'q time'
res = subwrd(result,3)
vtime = substr(res,1,12)

*loop through all times

it=1

'set dbuff on'

while (it <=times)
 'set t 'it
 'set grads off'
 'display 'vdisp' '
 'draw title 'vtime' 'vdisp' FCST HR ' it-1''


 'swap'

 '!sleep 2'

*increment the counter
 it=it+1

endwhile

A slight modification of animall.gs, called animtemp-F.gs, does the same thing but displays the temps in Deg F, for those of us who will never get used to thinking in Celsius.

Code: Select all

prompt 'Enter filename: '
pull filex
say filex

prompt 'Enter # of cycles to display: '
pull times
say times

prompt 'Enter name of variable to display: '
pull vdisp
say vdisp

'open 'filex' '

'set mpdset hires'

'q time'
res = subwrd(result,3)
vtime = substr(res,1,12)


*loop through all times

it=1

'set dbuff on'

while (it <=times)
 'set t 'it
 'set grads off'
 'display ('vdisp'-273)*1.8+32'
 'draw title 'vtime' 'vdisp' FCST HR ' it-1''

 'swap'

 '!sleep 2'

*increment the counter
 it=it+1

endwhile