<div dir="ltr"><div><div><div><div>There was a bug in the 'fspan' function that allowed something it should not have. <br><br></div><div>Some considered that a "feature" :-)<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 'Bugs Fixed' note of 'fspan<br></div><div>---<br></div>The 'pie-chart' code inadvertently took advantage of that "feature".<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 "./pie_chart.ncl"<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"><<a href="mailto:brianjs@iastate.edu" target="_blank">brianjs@iastate.edu</a>></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't continue</div><div>fatal:["Execute.c":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:["Execute.c":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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div>begin</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;Retrieve data from .txt file</div><div> ruc = asciiread("/tera0/brianjs/observations/ruc_analysis/LLJ_stats/LLJ_stats_all.txt",-1,"string")</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;First, retrieve time data as a string</div><div> ruc_time = str_get_field(ruc,4,",")</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("Percent of peak wind times at 0000 UTC: "+time_percents(0)+"%")</div><div>print("Percent of peak wind times at 0300 UTC: "+time_percents(1)+"%")</div><div>print("Percent of peak wind times at 0600 UTC: "+time_percents(2)+"%")</div><div>print("Percent of peak wind times at 0900 UTC: "+time_percents(3)+"%")</div><div>print("Percent of peak wind times at 1200 UTC: "+time_percents(4)+"%")</div><div>print("Percent Total: "+sum(time_percents)+"%")</div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div>;Pie chart resources</div><div> wks = gsn_open_wks("x11","LLJ_time_stats")</div><div> color = (/"red","dark green","blue","purple","sienna3"/)</div><div> name = (/"0000 UTC","0300 UTC","0600 UTC","0900 UTC","1200 UTC"/)</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>