<div dir="ltr"><div><div><div><div>Mary<br><br></div>Attached is a fortran-77 subroutine and a variation of your/Carl's test ncl script to which I added a 4th test: gcnt_so.<br><br></div>%> WRAPIT bindata_ncl.f<br><br></div><div>For the following script you will have to add a new path for the shared object: <br><br>external TEST "/Users/shea/fcode/bindata_ncl.so" ; <=== change to your local path<br></div><div><br></div>%> ncl bindata_tst.ncl<br><br></div><div>OK?<br><br></div><div>D</div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 2:08 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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"><div class="gmail_default" style="font-size:small">The one thing to note about the min/max values and the binning algorithm is that the lat/lon values that are given for the binning represent the *centers* of the binning ranges, and not the edges. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">So, if you specify latitudes (/ -85,-80,-75,...,80,85/), and longitudes (/-175,-170,...,170,175/):</div><div class="gmail_default" style="font-size:small"><ul><li>The first bin range will be lat: [-87.5 to -82.5 ] and lon: [-177.5 to -172.5].</li><li>The second range will be [-82.5 to -77.5] and [-172.5 to -167.5]</li><li>...</li><li>The last range will be [82.5 to 87.5] and [172.5 to 177.5]<br></li></ul></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We will hopefully get this fixed by V6.3.0. We actually have the fix, but are trying to determine if it's the best fix.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Feb 27, 2015 at 5:36 PM, Carl Schreck <span dir="ltr"><<a href="mailto:cjschrec@ncsu.edu" target="_blank">cjschrec@ncsu.edu</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Mary. It makes sense to me that it was something to do with the out of range values. I'm still don't really understand why the ml/nl values come out wrong, but the important thing is that it works. <div><br></div><div>I'm sure it was originally assumed that bin_sum would be used to bin to a global grid so this wouldn't be an issue. But it'll be good for it to have better exception handling. Thanks again!</div><span><font color="#888888"><div><br></div><div> Carl</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 26, 2015 at 4:14 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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"><div class="gmail_default" style="font-size:small">Hi Carl,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Unless I am misunderstanding how bin_sum is supposed to work, I agree that there appears to be a bug.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I recreated the "bin_sum" function entirely in NCL so it was easier to debug. It also makes it easier to try out a fix.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Please see the attached code, which is based on your original code. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm calculating the binned sums using three methods:</div><div class="gmail_default"><ul><li>The original "bin_sum" function (see function "<b>bin_sum_builtin</b>")<br><br></li><li>An NCL script version of "bin_sum" (see "<b>bin_sum_ncl</b>")<br><br></li><li>A third method of binning that uses a slightly different algorithm ("<b>bin_sum_other</b>")</li></ul><div>I loop across the various bin ranges and show plots of the three results in a panel plot.</div><div><ul><li>The leftmost plot is from using <b>bin_sum_builtin</b>. This will always be wrong, except for the first time in the loop.<br><br></li><li>The middle plot is from <b>bin_sum_ncl</b>. This will be wrong if APPLY_THE_FIX is False, and correct otherwise.<br><br></li><li>The right plot is from <b>bin_sum_other</b>. This should always be correct</li></ul></div><div><br></div><div>If you agree with the fix, then you can use "<b>bin_sum_ncl</b>" (with APPLY_THE_FIX set to True) or "<b>bin_sum_other</b>" as a work-around. You can remove all the print statements.</div><span><font color="#888888"><div><br></div><div>--Mary</div><div><br></div></font></span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 10:16 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">No problem. Here's a slight update that also calculates it manually. Surprisingly, the manual one looks completely different than all the others.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 10:56 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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"><div class="gmail_default" style="font-size:small">Hi Carl,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I started to look at this yesterday and got pulled away on something else.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'll try to take a look today. Thanks for providing a sample code!</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"><div><div>On Tue, Feb 24, 2015 at 8:15 AM, Carl Schreck <span dir="ltr"><<a href="mailto:cjschrec@ncsu.edu" target="_blank">cjschrec@ncsu.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">I'm getting some strange results with bin_sum (see attached script and figures). This simple script is using bin_sum to make a 2-d histogram of some random data. The shading in each box tells how many points fall within that box. <div><br></div><div>The data are the same in all plots, and so are the bin widths. The only thing I change is the range of bins. If I change the high end of the range (page 1-2), the figure stays the same as expected. But if I change the low end of the range (page 2-3), the whole plot changes in a seemingly random way.</div><div><br></div><div>Any thoughts on what might be causing this? I'm using 6.2.1. Thanks!</div><div><br></div><div> Carl<br clear="all"><div><br></div>-- <br><div><div dir="ltr"><br><table 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" border="0" cellpadding="2" cellspacing="2"><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" height="93" width="96"></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>
<br></div></div>_______________________________________________<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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><br><table 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" border="0" cellpadding="2" cellspacing="2"><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" height="93" width="96"></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></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><br><table 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" border="0" cellpadding="2" cellspacing="2"><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" height="93" width="96"></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></blockquote></div></div></div><br></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>