[gradsusr] Standard deviation of an area

Julio Martinez julioms24 at hotmail.com
Thu Nov 20 14:24:58 EST 2014


David,
I think set y 1 set x 1 is used to set x-y dimentions fixed and only t-dimension varying so once you have x-y fixed now you can calculate time series of any variable at desired location.

Julio N. Martínez Sánchez
M.C. en Oceanografía Física
Consultor en SitioSubgerencia de Pronóstico a Mediano y Largo PlazoGerencia de Meteorología y ClimatologíaServicio Meteorológico NacionalExt. 3156

From: davidnielsen at id.uff.br
Date: Thu, 20 Nov 2014 15:39:26 -0200
To: gradsusr at gradsusr.org
Subject: Re: [gradsusr] Standard deviation of an area

Julio, 
The result indeed looks fine, but I'm not sure about what it represents. When you do:
set x 1set y 1
It means (for my variable):
LON set to 0 0LAT set to -90 -90
So the area is set to a point. I don't undersand the relation between these coordinates and the LAT and LON limits you used to define the rectangle for the "aave" function. So I'm not sure about what that plot represents. The tloop-part is prefect.

Thanks once more,



On 20 November 2014 13:17, Julio Martinez <julioms24 at hotmail.com> wrote:



David
This is what I get when executing
set y 1set x 1set t 1 lastd tloop(sqrt(pow(aave(uwnd,lon=200,lon=300,lat=0,lat=30)-uwnd,2)))
Im not sure if this is what you are expecting.Please let me know.




Julio N. Martínez Sánchez
M.C. en Oceanografía Física
Consultor en SitioSubgerencia de Pronóstico a Mediano y Largo PlazoGerencia de Meteorología y ClimatologíaServicio Meteorológico NacionalExt. 3156

From: davidnielsen at id.uff.br
Date: Thu, 20 Nov 2014 12:22:20 -0200
To: sourabhbal at gmail.com
CC: gradsusr at gradsusr.org
Subject: Re: [gradsusr] Standard deviation of an area

Sourabh,
First, if you want it to run from t=1 to 21, you should fix the loop to "while (count < 22)", so that it will run until t=21.

However, it will generate you a single number for each t: an average of the variable on the rectangle you defined, not a plot as you wish. I'm also curious to hear suggestions for that now.
Good luck,


On 20 November 2014 11:45, Sourabh Bal <sourabhbal at gmail.com> wrote:
Hi David, 

Thanks for your suggestion. I tried with the following 
'reinit'
'open SSt12.precip.lon-lat.allssws.ctl'

'x1=1000*24*60*60*(aprl+aprc)'
while (count<1)
'set t' count
'define area=aave(x1,lon=120,lon=180,lat=-90,lat=90)
'd area'
'enable print figure1.zonalpre120-180E.mf'
'print'
'disable print'
'!./gxeps -c -i figure1.zonalpre120-180E.mf -o SSt12.preci.120-180E.all.ssws.eps'
count=count+1
endwhile


but does not yield my result. 

After running the script there is no error but the eps file produced is blank. 

Actually I want zonal average over longitude (120 to 180). The plot would be X as time ( t=1 to t =21) and Y as latitude (90N to 90S). More over I also want calculate statistical significance (t test values) over this plot ( may be in shaded). 


Please help me

Sourabh







On Thu, Nov 20, 2014 at 2:00 PM, David Nielsen <davidnielsen at id.uff.br> wrote:
Julio, 
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):
   define var1 = sqrt( pow( aave( sst, lat=..., lon=...)))   define var2 = aave( var1, lat=..., lon=...)
Does it make any sense to you?
Thanks again!

Sourabh, 
So just checked, you can do:
while (count < 22)   'set t' count   'define area = aave (variable-name, lon=120, lon=180, lat=-90, lat-90)   'd area'   count = count +1endwhile
Works as fine as defining the area with x and y. Very small numerical difference though, don't know why. 
On 20 November 2014 10:23, David Nielsen <davidnielsen at id.uff.br> wrote:
Sourabh, 
You can try:
while (count < 22)   'set t 'count   'define average=ave("variable-name", x and y limits)'     'd average'    count=count+1endwhile
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 90q 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 SitioSubgerencia de Pronóstico a Mediano y Largo PlazoGerencia de Meteorología y ClimatologíaServicio Meteorológico NacionalExt. 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+1endwhile
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 SitioSubgerencia de Pronóstico a Mediano y Largo PlazoGerencia de Meteorología y ClimatologíaServicio Meteorológico NacionalExt. 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 value2. 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 NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen 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 NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen 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 BalPost-Doc Fellow Institute of Meteorology, Freie Universitat, Berlin





_______________________________________________

gradsusr mailing list

gradsusr at gradsusr.org

http://gradsusr.org/mailman/listinfo/gradsusr




-- 
David Marcolino NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen at id.uff.br



-- 
David Marcolino NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen at id.uff.br


_______________________________________________

gradsusr mailing list

gradsusr at gradsusr.org

http://gradsusr.org/mailman/listinfo/gradsusr




-- 
Dr. Sourabh BalPost-Doc Fellow Institute of Meteorology, Freie Universitat, Berlin






-- 
David Marcolino NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen 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 NielsenEngenharia de Recursos Hídricos e do Meio AmbienteUniversidade Federal Fluminensedavidnielsen at id.uff.br


_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20141120/11372b3c/attachment-0001.html 


More information about the gradsusr mailing list