does GrADS have a way to calculate spatial standard deviation?

Charles Seman Charles.Seman at NOAA.GOV
Mon Jun 27 11:50:49 EDT 2005


Thanks, Rafael, for correcting this error,
Chuck

Rafael Rosolem wrote:

> 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.
>>
>>
>>
>>

--

********************************************************************
 Charles Seman                                charles.seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."



More information about the gradsusr mailing list