<div dir="ltr"><div class="gmail_default" style="font-size:small">Carl,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'll have to look into this. Thanks for taking the time to provide a fix.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It's also possible that the documentation was written incorrectly, because I know I created several tests for the histogram binning routines, and the change you are suggesting will likely change the results of the binning.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It does seem like the routine should be changed to meet the documentation, however.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'll keep you posted. The ticket for this is NCL-2167 for your reference.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 7:00 AM, Carl Schreck <span dir="ltr"><<a href="mailto:cjschrec@ncsu.edu" target="_blank">cjschrec@ncsu.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">After some more testing, I figured out that it's a misalignment between the gsn_code and the documentation: <div><a href="http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnHistogramBinIntervals" target="_blank">http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnHistogramBinIntervals</a></div><div><br></div><div>It says that gsnHistogramBinIntervals of (/1,2,5,7/) would be binned as:</div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333330154419px;line-height:16px;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"> 1 <= bin_1 <= 2
2 < bin_2 <= 5
5 < bin_3 <= 7</pre></div><div>But actually it's binning it as </div><div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333330154419px;line-height:16px;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"> 1 <= bin_1 < 2
2 <= bin_2 < 5
5 <= bin_3 <= 7</pre></div></div><div>What I recommend is editing the code in compute_hist_vals in gsn_code. Change: </div><div><div><font face="monospace, monospace">;</font></div><div><font face="monospace, monospace">; Special tests for last interval are required.</font></div><div><font face="monospace, monospace">;</font></div><div><font face="monospace, monospace"> if(i.eq.(nbars-1)) then</font></div><div><font face="monospace, monospace"> if(nbars.gt.1.and.new_binlocs(i).eq.new_binlocs(i-1)) then</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).gt.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).le.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> else</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).ge.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).le.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> end if</font></div><div><font face="monospace, monospace"> else</font></div><div><font face="monospace, monospace">;</font></div><div><font face="monospace, monospace">; If the previous interval was not really an interval, but an exact</font></div><div><font face="monospace, monospace">; bin value, then be careful not to count those values in the current</font></div><div><font face="monospace, monospace">; interval.</font></div><div><font face="monospace, monospace">;</font></div><div><font face="monospace, monospace"> if(i.gt.0.and.new_binlocs(i).eq.new_binlocs(i-1)) then</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).gt.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).lt.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> else</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).ge.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).lt.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> end if</font></div><div><font face="monospace, monospace"> end if</font></div><div><font face="monospace, monospace"> end if</font></div></div><div>---------</div><div>TO:</div><div><div><font face="monospace, monospace">; If the previous interval was not really an interval, but an exact</font></div><div><font face="monospace, monospace">; bin value, then be careful not to count those values in the current</font></div><div><font face="monospace, monospace">; interval.</font></div><div><font face="monospace, monospace">;</font></div><div><font face="monospace, monospace"> if(i.gt.0.and.new_binlocs(i).eq.new_binlocs(i-1)) then</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).gt.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).lt.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> else</font></div><div><font face="monospace, monospace"> num_in_bins(j,i) = num(x(j,:).ge.new_binlocs(i).and. \</font></div><div><font face="monospace, monospace"> x(j,:).lt.new_binlocs(i+1))</font></div><div><font face="monospace, monospace"> end if</font></div><div><font face="monospace, monospace"> end if</font></div></div><div>--------</div><div>Essentially remove the special handling for the last bin. And then change the documentation to:</div><div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333330154419px;line-height:16px;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"> 1 <= bin_1 < 2
2 <= bin_2 < 5
5 <= bin_3 < 7</pre></div></div><div>Let me know what you think of if you have further questions.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> Carl</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 2, 2015 at 3:40 PM, Carl Schreck <span dir="ltr"><<a href="mailto:cjschrec@ncsu.edu" target="_blank">cjschrec@ncsu.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">Sorry to come back with another binning issue, but I've found a similar problem in gsn_histogram.<div><br></div><div>This time, the problem only happens with the right-most bin, and only when the data can equal the bin boundary, such as with integer data.</div><div><br></div><div>Here's some simple sample code and a plot. Notice how in the first group of figures, when the data is a float, the bars move seamlessly to the left as the range increases.</div><div><br></div><div>In the second half of the figures, the data are integer, and sometimes will equal the top boundary. In this case, the rightmost bar changes before as a new bar is added to its right. </div><div><br></div><div>Let me know if you have any questions or suggestions. Thanks!</div><div><br></div><div> Carl</div><div><div><br></div>-- <br><div><div dir="ltr"><br><table border="0" cellpadding="2" cellspacing="2" style="max-width:100%;border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-size:14px;border:3px solid rgb(170,170,170);font-family:Times;line-height:12px;background-color:transparent"><tbody><tr><td align="center" height="71" width="71"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank"><img src="http://www.cicsnc.org/assets/images/cicsnc-logo.png" width="96" height="93"></a> <a href="http://www.researcherid.com/rid/B-8711-2011" target="_blank"><br></a></span></span><br><font size="4"><b style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif"> <a href="http://www.cyclonecenter.org/" style="color:rgb(38,58,143);text-decoration:none" target="_blank">Cyclone</a></b><a href="http://www.cyclonecenter.org/" style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;text-decoration:none" target="_blank">Center.org</a> </font></td><td valign="top"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><b>Carl J. Schreck III, PhD</b><br><b>Research Associate</b><br><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">Cooperative Institute for Climate and Satellites NC</a> <br><a href="http://ncsu.edu/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">North Carolina State University</a><br><a href="http://ncdc.noaa.gov/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">NOAA's National Climatic Data Center</a><br>151 Patton Ave, Asheville, NC 28801<br>e: </span></span><a href="mailto:cjschrec@ncsu.edu" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">cjschrec@ncsu.edu</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif">o: <a href="tel:%2B1%20828%20257%203140" value="+18282573140" target="_blank">+1 828 257 3140</a><br></span></span><a href="http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">Publications</a><br><a href="http://monitor.cicsnc.org/mjo/" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">monitor.cicsnc.org/mjo</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"></td></tr></tbody></table></div></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><br><table border="0" cellpadding="2" cellspacing="2" style="max-width:100%;border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-size:14px;border:3px solid rgb(170,170,170);font-family:Times;line-height:12px;background-color:transparent"><tbody><tr><td align="center" height="71" width="71"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank"><img src="http://www.cicsnc.org/assets/images/cicsnc-logo.png" width="96" height="93"></a> <a href="http://www.researcherid.com/rid/B-8711-2011" target="_blank"><br></a></span></span><br><font size="4"><b style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif"> <a href="http://www.cyclonecenter.org/" style="color:rgb(38,58,143);text-decoration:none" target="_blank">Cyclone</a></b><a href="http://www.cyclonecenter.org/" style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;text-decoration:none" target="_blank">Center.org</a> </font></td><td valign="top"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><b>Carl J. Schreck III, PhD</b><br><b>Research Associate</b><br><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">Cooperative Institute for Climate and Satellites NC</a> <br><a href="http://ncsu.edu/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">North Carolina State University</a><br><a href="http://ncdc.noaa.gov/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">NOAA's National Climatic Data Center</a><br>151 Patton Ave, Asheville, NC 28801<br>e: </span></span><a href="mailto:cjschrec@ncsu.edu" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">cjschrec@ncsu.edu</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif">o: <a href="tel:%2B1%20828%20257%203140" value="+18282573140" target="_blank">+1 828 257 3140</a><br></span></span><a href="http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">Publications</a><br><a href="http://monitor.cicsnc.org/mjo/" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">monitor.cicsnc.org/mjo</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"></td></tr></tbody></table></div></div>
</div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>