does GrADS have a way to calculate spatial standard deviation?

Rafael Rosolem rosolem at GMAIL.COM
Tue Jun 21 13:37:26 EDT 2005


Charles,

thank you for your email. I was concerned about the script you sent to
me because it didn't work first time I tried. then, I saw that it was
missing a "tempmed" in the line

'define tempstd = sqrt(sum(pow(temp,2),t=1,t=12)/11)'

the fixed version is:

'define tempstd = sqrt(sum(pow(temp-tempmed,2),t=1,t=12)/11)' , where
tempmed is previously defined by user

then the script worked fine.

many thanks.

R.






Charles Seman wrote:

> Dear Rafael,
>
> From statistics (reference: "Statistical Concepts and Methods" by
> Bhattacharyya and Johnson (1977)), the sample variance s**2 for a set
> of "N" observations of a variable "xi" (x1,...,xN) is defined as:
>
> sample variance = s**2 = [(x1-xbar)**2 + (x2-xbar)**2 + (x3-xbar)**2
> +....+ (xN-xbar)**2 ]/(N-1) ,  (from page 34)
>
> where the sample mean = xbar = (x1+x2+x3+...+xN)/N , ( from page 27)
>
> Note, the sample variance sums over "N" observations, and divides the
> sum by "N-1"...
>
> I am not exactly sure what your definition is for a "spatial average
> and the standard deviation for a variable"... here is my attempt to
> try to help...
>
> In GrADS we could do this (please see
> http://grads.iges.org/grads/gadoc/variable.html#new and/or
> http://grads.iges.org/grads/gadoc/gradfuncave.html):
>
> 'set x 'x1' 'x2   (or use "lon")
> 'set y 'y1' 'y2   (or use "lat")
> 'set z 1'
> 'set t 1'
> 'define tempstd = sqrt(sum(pow(temp,2),t=1,t=12)/11)'
> 'set x 'x1
> 'set y 'y1
> 'set z 1'
> 'set t 1'
> 'define atempstd = aave(tempstd,x='x1',x='x2',y='y1',y='y2')'
>
> This would give us an area average of the 2D field of the square root
> of the sample variance (that is, the sample standard deviation;  see
> for example, page 35 in the book referenced above)...
>
> I hope the above attempt is somewhat helpful...
>
> If the LORD will, I am planning to be on annual leave June 20-24
> (attending a Bible Conference in Towson, MD, which is being organized
> by Family Radio, a Christian, Bible-based ministry
> (www.familyradio.com)), and am planning to return to work on June 27.
> Family Radio has been a blessing in my life, and I wanted to share it
> with you.
>
> Sincerely,
> Chuck
>
>
> Rafael Rosolem wrote:
>
>> hi there,
>>
>> I would like to have both the spatial average and the standard deviation
>> for a variable (let's say temperature). in other words, does GrADS have
>> a "astd" (similarly to aave) command I could use?
>>
>> many thanks.
>>
>> R.
>
>
>



More information about the gradsusr mailing list