*
*  see http://grads.iges.org/grads/gadoc/variable.html#new
*
'reinit'
rc = gsfallow("on")
'open pptn.ctl'
'set t 1 12'
'q time'
say result
'define pptna = ave(pptn,t+0,t=120,1yr)'
'modify pptna seasonal'
'set t 1 120'
'q time'
say result
'define anom = pptn-pptna'
'set gxout shaded'
'd anom'
pause()
*
*  simple JJAS average...
*
'set t 78'
'define JJASa1 = ave(anom,t=78,t=81)'
'c'
'd JJASa1'
'run cbar 0.7'
'set t 78 81'
'q time'
say result ; ts = subwrd(result,3) ; tf = subwrd(result,5)
'draw title \\ "JJASa1" for 'ts' to 'tf
pause()
*
*  time-weighted JJAS average...
*
'set t 78'
'define JJASa2 = (30*anom(t=78)+31*anom(t=79)+31*anom(t=80)+30*anom(t=81))/122'
'c'
'd JJASa2'
'set t 78 81'
'q time'
say result ; ts = subwrd(result,3) ; tf = subwrd(result,5)
'draw title \\ weighted "JJASa2" for 'ts' to 'tf
'run cbar 0.7'
pause()
*
*  difference...
*
'c'
'set t 78'
'd JJASa2-JJASa1'
'set t 78 81'
'q time'
say result ; ts = subwrd(result,3) ; tf = subwrd(result,5)
'draw title \\ "JJASa2-JJASa1" for 'ts' to 'tf
'run cbar 0.7'
