<div>Hi you all!</div>
<div> </div>
<div>I have found myself the answer to my inquiry.</div>
<div> </div>
<div>For this may help someone else, the way to estimate a linear trend (or regression) on one-monthly series from a multi-year multi-monthly data file, wihtout having to seperate the chosen month interannual series into a single file, is just to perform the regression calculus for that month!</div>
<div> </div>
<div>I help myself from other previous prompts from the GRADSUSRS Archive.</div>
<div> </div>
<div>Here it is the script that can do that:</div>
<div> </div>
<div>'sdfopen <a href="http://file.nc">file.nc</a>'<br>'set lev 'k''<br>'set lat -90 0'<br>'set lon -180 180'<br>'set t 1 276'<br>'define yvar = z' *this is the variable on which to estimate the linear trend</div>
<div><br>* the lineal variable 1, 2, ..., 276 to estimate m and c of y = mx + c<br>* y = mx + c<br>* y = amp*x + ave</div>
<div>'set lat -60'<br>'set lon -180'<br>'set t 1 276'<br>'xvar = yvar*0 + 1'<br>'xvar = const(xvar,1,-u)'<br>'xvar = 277 - sum(xvar,t+0,t=276)'</div>
<div>'set lat -90 0'<br>'set lon -180 180'<br>'set t 1'</div>
<div>'define p = sum(xvar,t=10,t=276,12)' * starttime=10, supposing you want to estimate October linear trend<br>'define q = sum(yvar,t=10,t=276,12)'<br>'define r = sum(xvar*yvar,t=10,t=276,12)'<br>
'define s = sum(xvar*xvar,t=10,t=276,12)'</div>
<div>'define rn = ave(xvar*yvar,t=10,t=276,12)'<br>'define n = r/rn'</div>
<div>'define amp = (n*r - p*q)/(n*s - p*p)' *this is m<br>'define ave = (q - amp*p)/n'</div>
<div>'set t 1 276'<br>'monmask 10' * this is for month October, you need the <a href="http://monmas.gs">monmas.gs</a> script from the Archive<br>'define trend=amp*xvar*mmask + ave' * this is the final linear trend for Oct alone<br>
</div>
<div> </div>
<div>That`s all!!</div>
<div> </div>
<div>Bye.</div>
<div> </div>
<div>Eduardo.</div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">2008/7/2 Eduardo Agosta Scarel <<a href="mailto:eduardo.agosta@gmail.com">eduardo.agosta@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="gmail_quote">
<div>Dear Grads' Users,</div>
<div> </div>
<div>I am trying to extimate linear trend in an interannual series of one-monthly data from a multy-year monthly data file.</div>
<div>I can estimate properly the linear trend using the script below, if the data file has the one-monthly data series previously separately. The problem is when using the full monthly multy-year data file.</div>
<div> </div>
<div>How can I just select one given month from the data , for instance June, and estimate the linear trend for the June-series alone, having a multy-year data file with all the months of the year?<br clear="all"></div>
<div>I have tried using the function monmask (with argument 6), but I cannot solve it properly.</div>
<div> </div>
<div>Any suggestion I will much appreciate.</div>
<div> </div>
<div>Eduardo.<br></div>
<div> </div>
<div>reinit'<br>'sdfopen d:\anterior\era\<a href="http://mes.nc/" target="_blank">mes.nc</a>'</div>
<div>'set clopts -1 -1 0.16'<br>'set mproj sps'</div>
<div>k=70</div>
<div><br>'set grads off'<br>'set lev 'k''<br>'set mproj sps'<br>'set lat -90 0'<br>'set lon -180 180'</div>
<div><br>'set lat -60'<br>'set lon -180'<br>'set t 1 132'</div>
<div>* contruyo variable lineal 1, 2, ..., 276 to para calcular m y c de y = mx + c<br>'xvar = 100*t*0 + 1'<br>'xvar = const(xvar,1,-u)'<br>'xvar = 133 - sum(xvar,t+0,t=132)'</div>
<div> </div>
<div>'set lat -90 0'<br>'set lon -180 180'<br>'set t 1'</div>
<div><br>'define coeff = tregr(xvar,100*t,t=1, t=132)'<br>'define tave = ave(100*t, t=1, t=132)'<br>'define xvarave = ave(xvar, t=1, t=132)'<br>'define trend = coeff*(xvar - xvarave) + tave'</div>
</div></blockquote></div>