<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">Julio, </div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">The way you suggested still returned a gridded result, not a number representig the area. Then I tried averaging the result over the same area (everything for each t-value):</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> define var1 = sqrt( pow( aave( sst, lat=..., lon=...)))</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> define var2 = aave( var1, lat=..., lon=...)</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">Does it make any sense to you?</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">Thanks again!</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">Sourabh, </div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">So just checked, you can do:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">while (count < 22)</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> 'set t' count</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> 'define area = aave (variable-name, lon=120, lon=180, lat=-90, lat-90)</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> 'd area'</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"> count = count +1</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">endwhile</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:#000000">Works as fine as defining the area with x and y. Very small numerical difference though, don't know why. </div><div class="gmail_extra"><br><div class="gmail_quote">On 20 November 2014 10:23, David Nielsen <span dir="ltr"><<a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Sourabh, </div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">You can try:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><div class="gmail_default" style="font-size:13.3333339691162px">while (count < 22)</div><div class="gmail_default" style="font-size:13.3333339691162px"> 'set t 'count</div><div class="gmail_default" style="font-size:13.3333339691162px"> 'define average=ave("variable-name", x and y limits)' </div><div class="gmail_default" style="font-size:13.3333339691162px"> 'd average' </div><div class="gmail_default" style="font-size:13.3333339691162px"> count=count+1</div><div class="gmail_default" style="font-size:13.3333339691162px">endwhile</div></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">You have to express lat and lon in terms of x and y in the "ave" formula. For that, open the file in Grads and:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">set lat -90 90</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">q dim</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">And it will tell you the equivalente x limits, for example.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Not sure about this must, though. You can check it here: <a href="http://www.iges.org/grads/gadoc/gradfuncave.html" target="_blank">http://www.iges.org/grads/gadoc/gradfuncave.html</a></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Hope it helps!</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Julio, I will try your suggestion now! Thanks again!</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 20 November 2014 09:39, Sourabh Bal <span dir="ltr"><<a href="mailto:sourabhbal@gmail.com" target="_blank">sourabhbal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hello David and Julio, <br><br></div>if I want to plot time-latitude cross section (Y and T
varying), with the data being averaged over longitude (120 to 180),<code> where shall I fix the longitude. <br><br></code></div><code>set lat -90 90<br></code></div><code>set lon ??????<br></code></div><code>set t 1 21<br></code></div><code>d tloop(ave(aprl,lon=120,lon=180))<br><br><br></code></div><code>Sourabh<br></code><div><div><div><div><div><div><code><br><br></code></div></div></div></div></div></div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 1:35 AM, Julio Martinez <span dir="ltr"><<a href="mailto:julioms24@hotmail.com" target="_blank">julioms24@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b>David,</b></font><div><br></div><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b>Maybe you could try with</b></font></div><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b><br></b></font></div><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b>d tloop(sqrt(pow(aave(uwnd,lon=200,lon=300,lat=0,lat=30),-uwnd,2)))</b></font></div><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b><br></b></font></div><div><span><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b><br></b></font><br><br><span><font color="#888888">Julio N. Martínez Sánchez<br>M.C. en Oceanografía Física<br>Consultor en Sitio</font></span><div><font color="#888888">Subgerencia de Pronóstico a Mediano y Largo Plazo</font></div><div><font color="#888888">Gerencia de Meteorología y Climatología</font></div><div><font color="#888888">Servicio Meteorológico Nacional</font></div><div><font color="#888888">Ext. 3156</font></div><br><br></span><div><hr>From: <a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a><br>Date: Wed, 19 Nov 2014 21:13:14 -0200<br>To: <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>Subject: Re: [gradsusr] Standard deviation of an area<div><div><br><br><div dir="ltr"><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Hi, Julio, </div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">My problem is not with the loop in time. I am using a "While" sintax to execute the average along the series:</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><div>while (count < "number of t-values +1")</div><div> 'set t 'count</div><div> 'define average=aave(sst,x=127.8,x=128.6,y=27.6,y=28.6)'</div><div> 'd average' </div><div> average=subwrd(result,4)</div><div> rc = write ("c:\path\file.txt",average)</div><div> count=count+1</div><div>endwhile</div><div><br></div><div>This is working fine. What I need now, is a way to calculate the standard deviation of SST in the area of interest, also for each value of t, like something independent of time, for me to insert inside the loop. </div><div><br></div><div>Everything Ive seen before is a standard deviation of the whole series (like below), and not for each time-value.</div><div><br></div><div><span style="font-size:13.3333339691162px">'define sdsst=sqrt(ave(pow(ave(sst,t=</span><span style="font-size:13.3333339691162px">1,t=12)-sst,2),t=1,t=12))' -> calculates std of the series between t=1 and t=2. What I'd like to do is, for each t, an std of the area.</span><br></div><div><br></div><div>Any suggestions?</div><div><br></div><div>Thanks!</div></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div></div><div><br><div>On 19 November 2014 13:38, Julio Martinez <span dir="ltr"><<a href="mailto:julioms24@hotmail.com" target="_blank">julioms24@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b>Hi David,</b></font><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b><br></b></font></div><div><font style="font-size:10pt" color="#2672EC" face="Calibri,sans-serif"><b>I think you could try with tloop command...<br></b></font><br><br><span><font color="#888888">Julio N. Martínez Sánchez<br>M.C. en Oceanografía Física<br>Consultor en Sitio</font></span><div><font color="#888888">Subgerencia de Pronóstico a Mediano y Largo Plazo</font></div><div><font color="#888888">Gerencia de Meteorología y Climatología</font></div><div><font color="#888888">Servicio Meteorológico Nacional</font></div><div><font color="#888888">Ext. 3156</font></div><br><br><div><hr>From: <a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a><br>Date: Wed, 19 Nov 2014 13:12:34 -0200<br>To: <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>Subject: [gradsusr] Standard deviation of an area<div><div><br><br><div dir="ltr"><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Dear all grads users, </div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">I would like to calculate the standard deviation of an area in Grads.</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">I have a NetCDF wekly time series of SST (attached), and I am able to calculate the average of a certain area (defining LAT and LON) value using the "aave" formula, for each value of time, and generate a new series - ok. In addition to this seires, I would like to generate a series of standard deviations of this average, also for each time in the series. In other words, I need to to know, for a given area and time, what is the standard deviation of my variable?</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Please find attached an example of a NetCDF file I want to treat this way: </div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">1. Calculate average of SST in a certain area (lat, lon) using aave, for each time value</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">2. Calculate standard deviation of SST in a certain area (lat, lon), for each time value</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Would anybody have any kind suggestions on how to address this #2 task?</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Many thanks in advance,</div><div style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></div><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font color="#20124d" face="tahoma, sans-serif">David Marcolino Nielsen</font><div><font color="#20124d" face="tahoma, sans-serif">Engenharia de Recursos Hídricos e do Meio Ambiente</font></div><div><font color="#20124d" face="tahoma, sans-serif">Universidade Federal Fluminense</font></div><div><font color="#20124d" face="tahoma, sans-serif"><a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a></font></div></div></div></div>
<br></div></div>_______________________________________________
gradsusr mailing list
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a></div></div>                                            </div></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font color="#20124d" face="tahoma, sans-serif">David Marcolino Nielsen</font><div><font color="#20124d" face="tahoma, sans-serif">Engenharia de Recursos Hídricos e do Meio Ambiente</font></div><div><font color="#20124d" face="tahoma, sans-serif">Universidade Federal Fluminense</font></div><div><font color="#20124d" face="tahoma, sans-serif"><a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a></font></div></div></div>
</div>
<br>_______________________________________________
gradsusr mailing list
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a></div></div></div></div>                                            </div></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br></div></div><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Dr. Sourabh Bal</div><div dir="ltr">Post-Doc Fellow </div><div dir="ltr">Institute of Meteorology, Freie Universitat, Berlin<div><br></div><div><br><br></div></div></div></div></div></div>
</div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font face="tahoma, sans-serif" color="#20124d">David Marcolino Nielsen</font><div><font face="tahoma, sans-serif" color="#20124d">Engenharia de Recursos Hídricos e do Meio Ambiente</font></div><div><font face="tahoma, sans-serif" color="#20124d">Universidade Federal Fluminense</font></div><div><font face="tahoma, sans-serif" color="#20124d"><a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a></font></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font face="tahoma, sans-serif" color="#20124d">David Marcolino Nielsen</font><div><font face="tahoma, sans-serif" color="#20124d">Engenharia de Recursos Hídricos e do Meio Ambiente</font></div><div><font face="tahoma, sans-serif" color="#20124d">Universidade Federal Fluminense</font></div><div><font face="tahoma, sans-serif" color="#20124d"><a href="mailto:davidnielsen@id.uff.br" target="_blank">davidnielsen@id.uff.br</a></font></div></div></div>
</div></div>