Plotting trend

Charles Seman Charles.Seman at NOAA.GOV
Tue Jun 28 16:50:48 EDT 2005


Hi Everyone,

I'm confused and have a question... how does what Arindam sent below
differ from the GrADS "tregr" function?
http://grads.iges.org/grads/gadoc/gradfunctregr.html

Thanks for all your help in advance,
Chuck

Arindam Chakraborty wrote:

>hi Shailendra,
>        to plot a linear trend, you need to compute the slop and
>y-intercept of the time series. A least square fit can be done
>to obtain those two parameters. Here is an example to calculate
>those and plot the linear trend.
>
> 'open file'
> 'set lon 88'
> 'set lat 0'
> 'set t 1 24' * assuming this is the time limit
> 'define yvar = aave(...)'
>
> 'd yvar'
>
>* make a variable 1, 2, ..., 24 to calculate m and c of y = mx + c
> 'xvar = yvar*0 + 1'
> 'xvar = const(xvar,1,-u)'
> 'xvar = 25 - sum(xvar,t+0,t=24)'
>
> 'set t 1'
>
> 'define p = sum(xvar,t=1,t=24)'
> 'define q = sum(yvar,t=1,t=24)'
> 'define r = sum(xvar*yvar,t=1,t=24)'
> 'define s = sum(xvar*xvar,t=1,t=24)'
>
> 'define rn = ave(xvar*yvar,t=1,t=24)'
> 'define n = r/rn'
>
> 'define amp =  (n*r - p*q)/(n*s - p*p)' * this is m
> 'define ave = (q - amp*p)/n' * this is c
>
> 'set t 1 24'
> 'd amp*xvar + ave'
>
>
>
>Hope this helps,
>----------------------------
> ARINDAM CHAKRABORTY
> Department of Meteorology
> Florida State University
> Tallahassee, FL-32306, USA
> Tel: +001-850-6443524 (Off)
>      +001-850-5758550 (Res)
> Fax: +001-850-6449642
>____________________________
>
>
>On Sat, 25 Jun 2005, Shailendra Rai wrote:
>
>
>
>>Hello,
>>
>>
>I have plotted a time series of area averaged variable variable with time. Is their any way in gradsc to plot the trend as a straight line ???
>
>With regards
>Shailendra Rai
>K. Banerjee Centre of Atmospheric and Ocean Studies
>University of Allahabad
>Allahabad
>INDIA
>
>

--

********************************************************************
 Charles Seman                                charles.seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20050628/4af03e2a/attachment.html 


More information about the gradsusr mailing list