<div dir="ltr"><div class="gmail_default" style="font-size:small">Xia,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing a script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are running out of precision to do a calculation of this size. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In your script you are defining some variables to be float, but they should be double. Here are the changes I made to get your script to work:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace">32c32</font></div><div class="gmail_default"><font face="monospace, monospace">< dzTB=new((/mdims1(1),mdims1(2),mdims1(3)/),"float")</font></div><div class="gmail_default"><font face="monospace, monospace">---</font></div><div class="gmail_default"><font face="monospace, monospace">> dzTB=new((/mdims1(1),mdims1(2),mdims1(3)/),"double")</font></div><div class="gmail_default"><font face="monospace, monospace">40,41c40,41</font></div><div class="gmail_default"><font face="monospace, monospace">< TB = new((/tsize/),float)</font></div><div class="gmail_default"><font face="monospace, monospace">< TB2 = new((/tsize/),float)</font></div><div class="gmail_default"><font face="monospace, monospace">---</font></div><div class="gmail_default"><font face="monospace, monospace">> TB = new((/tsize/),double)</font></div><div class="gmail_default"><font face="monospace, monospace">> TB2 = new((/tsize/),double)</font></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">Once you implement this fix, you should get numbers like this for TB / TB2:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default">Variable: TB (subsection)</div><div class="gmail_default">Type: double</div><div class="gmail_default">. . .</div><div class="gmail_default">(0)<span class="" style="white-space:pre">        </span>13485314827.10813<br></div><div class="gmail_default">(1)<span class="" style="white-space:pre">        </span>13483945432.40879</div><div class="gmail_default">(2)<span class="" style="white-space:pre">        </span>13482898073.04566</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default">Variable: TB2 (subsection)</div><div class="gmail_default">Type: double</div><div class="gmail_default">. . .<br></div><div class="gmail_default">(0)<span class="" style="white-space:pre">        </span>13485314827.13124</div><div class="gmail_default">(1)<span class="" style="white-space:pre">        </span>13483945432.41978</div><div class="gmail_default" style="">(2)<span class="" style="white-space:pre">        </span>13482898073.05505</div><br></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">I made some other changes to your script to clean it up a little. It is not necessary to have that "if" statement inside your code. You can create TB / TB2 outside the loop and get rid of the "if" statement entirely.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached modified script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><br><div class="gmail_quote">On Fri, Apr 15, 2016 at 4:19 PM, Xia Chu <span dir="ltr"><<a href="mailto:xchu1@uwyo.edu" target="_blank">xchu1@uwyo.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div style="font-family:-moz-fixed;font-size:14px" lang="x-unicode">Dear helpers,
<br>
<br>
I'm trying to do summation of a 3D array using function (sum).
When the
<br>
data is 60x512x512 in dimension it works fine. However, with a
larger
<br>
data set of 60x1536x1536, the summation came to 4.29497e+09 which
is
<br>
definitely wrong. I had to use dim_sum_n to sum two dimension
first and
<br>
then another sum. I also find summation value varies if I
dim_sum_n
<br>
different dimensions first. This problem only stands out with
variable
<br>
QVAPOR (not QCLOUD or other mixing ratios) which have values at
every
<br>
grids.
<br>
<br>
The code is attached. I'm working on Yellowstone supercomputer.
The
<br>
script has my working directory. You should be able to run the
script on
<br>
Yellowstone. I'm using ncl/<a href="http://6.3.0." target="_blank">6.3.0.</a>
<br>
<br>
Would you recommend a good way to do summation? I'm trying to
calculate
<br>
total mass.
<br>
<br>
I would appreciate any of your help! Thanks in advance.
<br>
<br>
Best,
<br>
Xia
<br><span class=""><font color="#888888">
<br>
<div><span>-- <br>
</span>Xia Chu
<br>
<br>
PhD Candidate
<br>
Graduate Research Assistant
<br>
Department of Atmospheric Science
<br>
University of Wyoming
<br>
Dept. 3038, 1000 E. University Ave.
<br>
Laramie, Wyoming 82071
<br>
<br>
</div>
</font></span></div>
<br>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>