[gradsusr] linear trend in grads

J-P Michael jpmichael at fsu.edu
Fri Aug 3 12:28:14 EDT 2012


  Robert,

Here is my solution. Perhaps someone else has a more eloquent script for 
this.

function get_trend (args)

varname=subwrd(args,1)
xlimit=subwrd(args,2)
ylimit=subwrd(args,3)
zlimit=subwrd(args,4)
tlimit=subwrd(args,5)
if (varname = '')
   say ''
   say 'you must first open the file to be detrended'
   say ''
   say 'then you must call this script like so: '
   say 'scripts/get_trend.gs varname x y z t'
   say 'example:'
   say 'scripts/get_trend.gs temp 320 366 1 2400'
   say ''
   return
endif


'set x 1 'xlimit
'set y 1 'ylimit
'set loopdim z'

'set t 1 'tlimit
'set z 1 'zlimit
'set x 1'
'set y 1'
'define base = const ('varname', 1, -a)'
'define ttime = sum(base, t = 1, t+1)'
'set z 1 'zlimit
'set x 1 'xlimit
'set y 1 'ylimit
'set t 1'
'define trend = tregr(ttime, 'varname', t=1, t = 'tlimit')'
'set z 1 'zlimit




More information about the gradsusr mailing list