[ncl-talk] Issues with bin_sum
Carl Schreck
cjschrec at ncsu.edu
Fri Feb 27 17:57:32 MST 2015
I also noticed that I had some bugs in my manual version. But once I fixed
those, it matches yours exactly.
FWIW, I made a version of your bin_sum_other that has the identical
interface to the original bin_sum. It's attached here in case anyone wants
it, but you'll probably just fix the fortran code for the next release.
Have a good weekend!
Carl
On Fri, Feb 27, 2015 at 7:36 PM, Carl Schreck <cjschrec at ncsu.edu> wrote:
> 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.
>
> 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!
>
> Carl
>
> On Thu, Feb 26, 2015 at 4:14 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Hi Carl,
>>
>> Unless I am misunderstanding how bin_sum is supposed to work, I agree
>> that there appears to be a bug.
>>
>> 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.
>>
>> Please see the attached code, which is based on your original code.
>>
>> I'm calculating the binned sums using three methods:
>>
>> - The original "bin_sum" function (see function "*bin_sum_builtin*")
>>
>> - An NCL script version of "bin_sum" (see "*bin_sum_ncl*")
>>
>> - A third method of binning that uses a slightly different algorithm
>> ("*bin_sum_other*")
>>
>> I loop across the various bin ranges and show plots of the three results
>> in a panel plot.
>>
>> - The leftmost plot is from using *bin_sum_builtin*. This will always
>> be wrong, except for the first time in the loop.
>>
>> - The middle plot is from *bin_sum_ncl*. This will be wrong if
>> APPLY_THE_FIX is False, and correct otherwise.
>>
>> - The right plot is from *bin_sum_other*. This should always be
>> correct
>>
>>
>> If you agree with the fix, then you can use "*bin_sum_ncl*" (with
>> APPLY_THE_FIX set to True) or "*bin_sum_other*" as a work-around. You
>> can remove all the print statements.
>>
>> --Mary
>>
>>
>> On Wed, Feb 25, 2015 at 10:16 AM, Carl Schreck <cjschrec at ncsu.edu> wrote:
>>
>>> No problem. Here's a slight update that also calculates it manually.
>>> Surprisingly, the manual one looks completely different than all the others.
>>>
>>> On Wed, Feb 25, 2015 at 10:56 AM, Mary Haley <haley at ucar.edu> wrote:
>>>
>>>> Hi Carl,
>>>>
>>>> I started to look at this yesterday and got pulled away on something
>>>> else.
>>>>
>>>> I'll try to take a look today. Thanks for providing a sample code!
>>>>
>>>> --Mary
>>>>
>>>>
>>>> On Tue, Feb 24, 2015 at 8:15 AM, Carl Schreck <cjschrec at ncsu.edu>
>>>> wrote:
>>>>
>>>>> 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.
>>>>>
>>>>> 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.
>>>>>
>>>>> Any thoughts on what might be causing this? I'm using 6.2.1. Thanks!
>>>>>
>>>>> Carl
>>>>>
>>>>> --
>>>>>
>>>>> <http://www.cicsnc.org/>
>>>>> <http://www.researcherid.com/rid/B-8711-2011>
>>>>> * Cyclone <http://www.cyclonecenter.org/>*Center.org
>>>>> <http://www.cyclonecenter.org/> *Carl J. Schreck III, PhD*
>>>>> *Research Associate*
>>>>> Cooperative Institute for Climate and Satellites NC
>>>>> <http://www.cicsnc.org/>
>>>>> North Carolina State University <http://ncsu.edu/>
>>>>> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
>>>>> 151 Patton Ave, Asheville, NC 28801
>>>>> e: cjschrec at ncsu.edu
>>>>> o: +1 828 257 3140
>>>>> Publications
>>>>> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
>>>>> monitor.cicsnc.org/mjo
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> <http://www.cicsnc.org/>
>>> <http://www.researcherid.com/rid/B-8711-2011>
>>> * Cyclone <http://www.cyclonecenter.org/>*Center.org
>>> <http://www.cyclonecenter.org/> *Carl J. Schreck III, PhD*
>>> *Research Associate*
>>> Cooperative Institute for Climate and Satellites NC
>>> <http://www.cicsnc.org/>
>>> North Carolina State University <http://ncsu.edu/>
>>> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
>>> 151 Patton Ave, Asheville, NC 28801
>>> e: cjschrec at ncsu.edu
>>> o: +1 828 257 3140
>>> Publications
>>> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
>>> monitor.cicsnc.org/mjo
>>>
>>
>>
>
>
> --
>
> <http://www.cicsnc.org/>
> <http://www.researcherid.com/rid/B-8711-2011>
> * Cyclone <http://www.cyclonecenter.org/>*Center.org
> <http://www.cyclonecenter.org/> *Carl J. Schreck III, PhD*
> *Research Associate*
> Cooperative Institute for Climate and Satellites NC
> <http://www.cicsnc.org/>
> North Carolina State University <http://ncsu.edu/>
> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
> 151 Patton Ave, Asheville, NC 28801
> e: cjschrec at ncsu.edu
> o: +1 828 257 3140
> Publications
> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
> monitor.cicsnc.org/mjo
>
--
<http://www.cicsnc.org/>
<http://www.researcherid.com/rid/B-8711-2011>
* Cyclone <http://www.cyclonecenter.org/>*Center.org
<http://www.cyclonecenter.org/> *Carl J. Schreck III, PhD*
*Research Associate*
Cooperative Institute for Climate and Satellites NC <http://www.cicsnc.org/>
North Carolina State University <http://ncsu.edu/>
NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec at ncsu.edu
o: +1 828 257 3140
Publications
<http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
monitor.cicsnc.org/mjo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150227/b770f411/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sub.bin_sum_other.ncl
Type: application/octet-stream
Size: 2681 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150227/b770f411/attachment.obj
More information about the ncl-talk
mailing list