<div dir="ltr"><div><div><div><div>There was a bug in the &#39;fspan&#39; function that allowed something it should not have. <br><br></div><div>Some considered that a &quot;feature&quot;    :-)<br><br>---<br></div><div><br></div><div>See: <a href="http://ncl.ucar.edu/prev_releases.shtml#6.2.1">http://ncl.ucar.edu/prev_releases.shtml#6.2.1</a><br></div><div>        Specifically, the &#39;Bugs Fixed&#39; note of &#39;fspan<br></div><div>---<br></div>The &#39;pie-chart&#39; code inadvertently took advantage of that &quot;feature&quot;.<br><br></div>You can be a tester of a fix which will be released with 6.4.0.<br><br><br></div><div>load  &quot;./pie_chart.ncl&quot;<br></div><div><br></div>See attached.<br><br></div>Cheers<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 3:57 PM, Brian Squitieri <span dir="ltr">&lt;<a href="mailto:brianjs@iastate.edu" target="_blank">brianjs@iastate.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Good Afternoon,<div><br></div><div>I have been attempting to plot percentages within a pie chart, but I receive the following output and associated error for my NCL script:</div><div><br></div><div><div>(0)     Percent of peak wind times at 0000 UTC: 0%</div><div>(0)     Percent of peak wind times at 0300 UTC: 6.45161%</div><div>(0)     Percent of peak wind times at 0600 UTC: 51.6129%</div><div>(0)     Percent of peak wind times at 0900 UTC: 35.4839%</div><div>(0)     Percent of peak wind times at 1200 UTC: 6.45161%</div><div>(0)     Percent Total: 100%</div><div>fatal:fspan: number of elements parameter is less-than-or-equal-to one, can&#39;t continue</div><div>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 4026 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl</div><div><br></div><div>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 44 in file pie_chart_example.ncl</div></div><div><br></div><div>Reviewing past NCL help requests in 2010 and 2015 have shown that an adjustment was necessary for the pie_chart function; specifically</div><div>npts = round( pcPie(n), 3) </div><div>changes to</div><div>npts = max( (/round( pcPie(n), 3), 1/) ) </div><div><br></div><div>I run NCL version 6.3.0 and this adjustment is already made in the base code, and all variables in my script are converted to floats. Output shows that the sum of all percentages equates to one hundred, so I am unsure what is wrong here. I had attempted to round both with and without truncation, but nothing was helpful. Any assistance would be greatly appreciated. Below is the code and attached is the .txt file which contains the data set used. </div><div><br></div><div><br></div><div><div>;Load vital libraries and begin program</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;</div><div>begin</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;Retrieve data from .txt file</div><div>        ruc  = asciiread(&quot;/tera0/brianjs/observations/ruc_analysis/LLJ_stats/LLJ_stats_all.txt&quot;,-1,&quot;string&quot;)</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;First, retrieve time data as a string</div><div>        ruc_time  = str_get_field(ruc,4,&quot;,&quot;)</div><div><br></div><div>;Convert data into floats</div><div>        ruc_times  = stringtofloat(ruc_time)</div><div>        dimall = new(1,float)</div><div>        dimall = dimsizes(ruc_times)</div><div><br></div><div>;Calculate time percentages statistics</div><div>        count = new(5,float)</div><div>        count = (/1,3,6,9,12/)          ;Corresponds to 0000 UTC, 0300 UTC, 0600 UTC, 0900 UTC, and 1200 UTC, respectively</div><div><br></div><div>        time_percents = new(5,float)</div><div>do i = 0,4</div><div>        time_percents(i) = (num(ruc_times.eq.count(i))/dimall)*100</div><div>end do</div><div>print(&quot;Percent of peak wind times at 0000 UTC: &quot;+time_percents(0)+&quot;%&quot;)</div><div>print(&quot;Percent of peak wind times at 0300 UTC: &quot;+time_percents(1)+&quot;%&quot;)</div><div>print(&quot;Percent of peak wind times at 0600 UTC: &quot;+time_percents(2)+&quot;%&quot;)</div><div>print(&quot;Percent of peak wind times at 0900 UTC: &quot;+time_percents(3)+&quot;%&quot;)</div><div>print(&quot;Percent of peak wind times at 1200 UTC: &quot;+time_percents(4)+&quot;%&quot;)</div><div>print(&quot;Percent Total: &quot;+sum(time_percents)+&quot;%&quot;)</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;Pie chart resources</div><div>        wks = gsn_open_wks(&quot;x11&quot;,&quot;LLJ_time_stats&quot;)</div><div>        color = (/&quot;red&quot;,&quot;dark green&quot;,&quot;blue&quot;,&quot;purple&quot;,&quot;sienna3&quot;/)</div><div>        name = (/&quot;0000 UTC&quot;,&quot;0300 UTC&quot;,&quot;0600 UTC&quot;,&quot;0900 UTC&quot;,&quot;1200 UTC&quot;/)</div><div><br></div><div>        pres = True</div><div>        pres@gsnDraw  = False</div><div>        pres@gsnFrame = False</div><div><br></div><div>;Pie Chart</div><div>        pie = pie_chart(wks,time_percents,name,color,pres)</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>end</div></div><div><br></div><div><br></div><div><br></div></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>