<div dir="ltr">Hello GrADS Forum:<div><br></div><div>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.</div>
<div><br></div><div>It seems reasonable to use sea surface temperature and time as the independent and dependent variables.</div><div> <br></div><div><br></div><div><div>Here is my code (important parts bolded and annotated)</div>
<div><br></div><div>xdfopen MIROCESMG43_24.ctl</div><div>set grads off</div><div>set display color white</div><div>set datawarn off</div><div>set y 1<br></div><div>set z 1</div><div>set t 1 1020</div><div>define nino34 = aave(sst, lon=190, lon=240, lat=-5, lat=5)</div>
<div>set t 1 12<br></div><div>define nino34clim=(ave(nino34,t+0,t=1020,12))</div><div>modify nino34clim seasonal</div><div>set y 1</div><div>set z 1 </div><div>set t 1 1020</div><div><b>nino34anom=nino34-nino34clim<br></b></div>
<div><i># Remove all but the anomaly from the SST over the region</i></div><div><b>define tt=t</b></div><div><i>#Rename t (time) as &#39;tt&#39; so that it can be used as the dependent variable in the tregr function</i></div>
<div><b>coeff= tregr(nino34anom,tt,t=1,t=1020)</b></div><div><i>#Coeff is the output of the tregr function (see documentation page).  </i></div><div><b>nino34detrend = nino34anom - tt* coeff</b></div><div><b>d nino34detrend</b></div>
</div><div><br></div><div>Any assistance would be greatly appreciated!</div><div><br></div><div>Thanks,</div><div>Corey</div><div><br></div><div><br></div></div>