[gradsusr] Linear Regression with GrADS (Temperature vs. Time)
Corey Gabriel
cjgabriel7 at gmail.com
Tue Jun 10 12:40:26 EDT 2014
Hello GrADS Forum:
I have been trying to use GrADS to perform a linear regression for some
time now. My goal is to remove the linear trend in sea surface
temperatures over time in the NINO regions in the tropical Pacific so that
I can diagnose El Nino and La Nina events without being confounded by the
ongoing warming trend.
It seems reasonable to use sea surface temperature and time as the
independent and dependent variables.
Here is my code (important parts bolded and annotated)
xdfopen MIROCESMG43_24.ctl
set grads off
set display color white
set datawarn off
set y 1
set z 1
set t 1 1020
define nino34 = aave(sst, lon=190, lon=240, lat=-5, lat=5)
set t 1 12
define nino34clim=(ave(nino34,t+0,t=1020,12))
modify nino34clim seasonal
set y 1
set z 1
set t 1 1020
*nino34anom=nino34-nino34clim*
*# Remove all but the anomaly from the SST over the region*
*define tt=t*
*#Rename t (time) as 'tt' so that it can be used as the dependent variable
in the tregr function*
*coeff= tregr(nino34anom,tt,t=1,t=1020)*
*#Coeff is the output of the tregr function (see documentation page). *
*nino34detrend = nino34anom - tt* coeff*
*d nino34detrend*
Any assistance would be greatly appreciated!
Thanks,
Corey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140610/a929d9ba/attachment.html
More information about the gradsusr
mailing list