[gradsusr] [EXTERNAL] Grads basic stats

Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] jennifer.m.adams at nasa.gov
Fri Nov 13 09:41:08 EST 2020


Hi, Carlos –
The variables ‘sum’ and ‘dum’ are doubles, not integers. Note that further down, sum is printed with ‘%g’ -- the default number of significant digits is 6, so you get 11359.8 for root(sumsqr) but 452778 with no decimal part for sum. If you really want to know the sum with greater precision, use the sum() function with ‘set gxout print’ and ‘set prnopts’.

The expression ‘dum = *(gr+i)’ is roughly equivalent to gr[i], where ‘gr’ is the array of data values, and ‘i’ is the counter, it’s just that GrADS uses pointers to move through arrays and treats them as 1-dimensional arrays with siz = isiz * jsiz.

--Jennifer

--
Jennifer Miletta Adams
ADNET Systems, Inc.
NASA/GSFC, Code 610.2
Building 32, Room S159
(301) 614-6070


From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Carlos Frederico <fredericorama at gmail.com>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org>
Date: Friday, November 13, 2020 at 8:51 AM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: [EXTERNAL] [gradsusr] Grads basic stats

Hello folks,

I have a question regarding the grads basic stats issued by the ‘set stat on’ or ‘set gxout stat’.

In the documentation page for the ‘stat’ function http://cola.gmu.edu/grads/gadoc/gradcomdsetstat.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__cola.gmu.edu_grads_gadoc_gradcomdsetstat.html&d=DwMFaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=M2mFZsxo0ZoztoK2Lyoypu1kKkBVKyEoM9CXGWO42zk&m=yDUqPQWw5DuxFIfjHmMaT3BXeMdUqkrvoNyYw7eoYto&s=fBG0xGYWIZ2bFb3ZF0qGpND0zXcRUWcn4Nve9pAMjoU&e=>, I see that the ‘sum' of the grid point values (I supposed) gives an integer value (in bold)? Why is it an integer value?

See:

Data Type = grid

Dimensions = 0 1

I Dimension = 1 to 73 Linear 0 5

J Dimension = 1 to 46 Linear -90 4

Sizes = 73 46 3358

Undef value = -2.56e+33

Undef count = 1763  Valid count = 1595

Min, Max = 243.008 302.818

Cmin, cmax, cint = 245 300 5

Stats[sum,sumsqr,root(sumsqr),n]:     452778 1.29046e+08 11359.8 1595

Stats[(sum,sumsqr,root(sumsqr))/n]:     283.874 80906.7 284.441

Stats[(sum,sumsqr,root(sumsqr))/(n-1)]: 284.052 80957.4 284.53

Stats[(sigma,var)(n)]:     17.9565 322.437

Stats[(sigma,var)(n-1)]:   17.9622 322.64

Contouring: 245 to 300 interval 5
I grab the grads source code and took a look at the source ‘gagx.c' and found the snippet attached. I get what 'sum += dum’ is (which should be the same as ‘sum = sum + dum’, but I’m not sure what ‘dum = *(gr+i)’ does. Can someone clarify exactly what the ‘sum’ is about?

Thank you!

[cid:image001.png at 01D6B9A1.1C44C330]

Carlos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201113/3f3a3c80/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 137443 bytes
Desc: image001.png
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201113/3f3a3c80/attachment-0001.png>


More information about the gradsusr mailing list