[gradsusr] Standard deviation of an area

David Nielsen davidnielsen at id.uff.br
Thu Nov 20 07:23:46 EST 2014


Sourabh,

You can try:

while (count < 22)
   'set t 'count
   'define average=ave("variable-name", x and y limits)'
   'd average'
   count=count+1
endwhile

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:

set lat -90 90
q dim

And it will tell you the equivalente x limits, for example.

Not sure about this must, though. You can check it here:
http://www.iges.org/grads/gadoc/gradfuncave.html

Hope it helps!

Julio, I will try your suggestion now! Thanks again!


On 20 November 2014 09:39, Sourabh Bal <sourabhbal at gmail.com> wrote:

> Hello David and Julio,
>
> if I want to plot time-latitude cross section (Y and T varying), with the
> data being averaged over longitude (120 to 180), where shall I fix the
> longitude.
>
> set lat -90 90
> set lon ??????
> set t 1 21
> d tloop(ave(aprl,lon=120,lon=180))
>
>
> Sourabh
>
>
>
> On Thu, Nov 20, 2014 at 1:35 AM, Julio Martinez <julioms24 at hotmail.com>
> wrote:
>
>> *David,*
>>
>> *Maybe you could try with*
>>
>> *d tloop(sqrt(pow(aave(uwnd,lon=200,lon=300,lat=0,lat=30),-uwnd,2)))*
>>
>>
>>
>>
>> Julio N. Martínez Sánchez
>> M.C. en Oceanografía Física
>> Consultor en Sitio
>> Subgerencia de Pronóstico a Mediano y Largo Plazo
>> Gerencia de Meteorología y Climatología
>> Servicio Meteorológico Nacional
>> Ext. 3156
>>
>>
>> ------------------------------
>> From: davidnielsen at id.uff.br
>> Date: Wed, 19 Nov 2014 21:13:14 -0200
>> To: gradsusr at gradsusr.org
>> Subject: Re: [gradsusr] Standard deviation of an area
>>
>>
>> Hi, Julio,
>>
>> My problem is not with the loop in time. I am using a "While" sintax to
>> execute the average along the series:
>>
>> while (count < "number of t-values +1")
>>    'set t 'count
>>    'define average=aave(sst,x=127.8,x=128.6,y=27.6,y=28.6)'
>>    'd average'
>>    average=subwrd(result,4)
>>    rc = write ("c:\path\file.txt",average)
>>    count=count+1
>> endwhile
>>
>> 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.
>>
>> Everything Ive seen before is a standard deviation of the whole series
>> (like below), and not for each time-value.
>>
>> 'define sdsst=sqrt(ave(pow(ave(sst,t=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.
>>
>> Any suggestions?
>>
>> Thanks!
>>
>>
>> On 19 November 2014 13:38, Julio Martinez <julioms24 at hotmail.com> wrote:
>>
>> *Hi David,*
>>
>>
>> *I think you could try with tloop command...*
>>
>> Julio N. Martínez Sánchez
>> M.C. en Oceanografía Física
>> Consultor en Sitio
>> Subgerencia de Pronóstico a Mediano y Largo Plazo
>> Gerencia de Meteorología y Climatología
>> Servicio Meteorológico Nacional
>> Ext. 3156
>>
>>
>> ------------------------------
>> From: davidnielsen at id.uff.br
>> Date: Wed, 19 Nov 2014 13:12:34 -0200
>> To: gradsusr at gradsusr.org
>> Subject: [gradsusr] Standard deviation of an area
>>
>>
>> Dear all grads users,
>>
>> I would like to calculate the standard deviation of an area in Grads.
>>
>> 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?
>>
>> Please find attached an example of a NetCDF file I want to treat this
>> way:
>> 1. Calculate average of SST in a certain area (lat, lon) using aave, for
>> each time value
>> 2. Calculate standard deviation of SST in a certain area (lat, lon), for
>> each time value
>>
>> Would anybody have any kind suggestions on how to address this #2 task?
>>
>> Many thanks in advance,
>>
>>
>>
>> --
>> David Marcolino Nielsen
>> Engenharia de Recursos Hídricos e do Meio Ambiente
>> Universidade Federal Fluminense
>> davidnielsen at id.uff.br
>>
>> _______________________________________________ gradsusr mailing list
>> gradsusr at gradsusr.org http://gradsusr.org/mailman/listinfo/gradsusr
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>>
>>
>> --
>> David Marcolino Nielsen
>> Engenharia de Recursos Hídricos e do Meio Ambiente
>> Universidade Federal Fluminense
>> davidnielsen at id.uff.br
>>
>> _______________________________________________ gradsusr mailing list
>> gradsusr at gradsusr.org http://gradsusr.org/mailman/listinfo/gradsusr
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Dr. Sourabh Bal
> Post-Doc Fellow
> Institute of Meteorology, Freie Universitat, Berlin
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
David Marcolino Nielsen
Engenharia de Recursos Hídricos e do Meio Ambiente
Universidade Federal Fluminense
davidnielsen at id.uff.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20141120/885a6456/attachment-0001.html 


More information about the gradsusr mailing list