<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi, Carlos – <o:p></o:p></p>
<p class="MsoNormal">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’.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">--Jennifer<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt">-- <span style="color:black"><br>
Jennifer Miletta Adams<br>
ADNET Systems, Inc.<br>
NASA/GSFC, Code 610.2</span><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black">Building 32, Room S159<br>
(301) 614-6070<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">gradsusr <gradsusr-bounces@gradsusr.org> on behalf of Carlos Frederico <fredericorama@gmail.com><br>
<b>Reply-To: </b>GrADS Users Forum <gradsusr@gradsusr.org><br>
<b>Date: </b>Friday, November 13, 2020 at 8:51 AM<br>
<b>To: </b>GrADS Users Forum <gradsusr@gradsusr.org><br>
<b>Subject: </b>[EXTERNAL] [gradsusr] Grads basic stats<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Hello folks,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have a question regarding the grads basic stats issued by the ‘set stat on’ or ‘set gxout stat’.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In the documentation page for the ‘stat’ function <a href="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=">http://cola.gmu.edu/grads/gadoc/gradcomdsetstat.html</a>,
 I see that the ‘sum' of the grid point values (I supposed) gives an integer value (in bold)? Why is it an integer value?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">See: <o:p></o:p></p>
</div>
<div>
<pre>Data Type = grid<o:p></o:p></pre>
<pre>Dimensions = 0 1<o:p></o:p></pre>
<pre>I Dimension = 1 to 73 Linear 0 5<o:p></o:p></pre>
<pre>J Dimension = 1 to 46 Linear -90 4<o:p></o:p></pre>
<pre>Sizes = 73 46 3358<o:p></o:p></pre>
<pre>Undef value = -2.56e+33<o:p></o:p></pre>
<pre>Undef count = 1763  Valid count = 1595<o:p></o:p></pre>
<pre>Min, Max = 243.008 302.818<o:p></o:p></pre>
<pre>Cmin, cmax, cint = 245 300 5<o:p></o:p></pre>
<pre>Stats[sum,sumsqr,root(sumsqr),n]:     <b>452778</b> 1.29046e+08 11359.8 1595<o:p></o:p></pre>
<pre>Stats[(sum,sumsqr,root(sumsqr))/n]:     283.874 80906.7 284.441<o:p></o:p></pre>
<pre>Stats[(sum,sumsqr,root(sumsqr))/(n-1)]: 284.052 80957.4 284.53<o:p></o:p></pre>
<pre>Stats[(sigma,var)(n)]:     17.9565 322.437<o:p></o:p></pre>
<pre>Stats[(sigma,var)(n-1)]:   17.9622 322.64<o:p></o:p></pre>
<pre>Contouring: 245 to 300 interval 5 <o:p></o:p></pre>
<div>
<p class="MsoNormal">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?<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><img border="0" width="622" height="702" style="width:6.4791in;height:7.3125in" id="_x0037_696B087-4C1A-446C-821D-9CC4439A37B1" src="cid:image001.png@01D6B9A1.1C44C330"><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Carlos<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>