[SciPy-User] -inf when summing arrays

Kytt MacManus kmacmanu@ciesin.columbia....
Thu Sep 22 08:34:10 CDT 2011


Thanks Zach...this suggestion helped me solve my problem when I realized 
that summing any axis of my array was producing a -inf result.  This 
issue it turns out was the values assigned to the NoData areas in the 
32bit floating point raster which I had produced in ArcGIS.   I was able 
to get things to work by recoding NoData as 0.

Thanks for your help.

-Kytt

On 9/19/2011 11:04 AM, Zachary Pincus wrote:
> Can you provide a small/self-contained example of values/labels arrays that reproduce this issue? (Perhaps by trying various chunks of your input arrays until you find the error-producing region?)
>
> Also, does numpy.all(numpy.isfinite(valueArray)) return True?
>
> Zach
>
>
> On Sep 19, 2011, at 10:57 AM, Kytt MacManus wrote:
>
>> Hello and good day,
>>
>> I am a newbie to the numpy/scipy so I apologize if this is a trivial
>> question.
>>
>> I have been attempting to do a simple zonal sum of 2 arrays.  I have one
>> integer array of zones (labels), and another array of floating point values.
>>
>> For some reason when I attempt
>> scipy.ndimage.sum(valueArray,labels=zoneArray,index=1)
>>
>> The return value is -inf for each of my zones.
>>
>> If I run valueArray.sum() an actual number is returned.
>>
>> I am not sure what the -inf signifies and have not been able to locate
>> any useful documentation on the subject.
>>
>> Any insight or advice would be much appreciated.
>>
>> Thanks,
>> Kytt
>>
>> -- 
>> Kytt MacManus
>> Geographic Information Specialist
>> CIESIN
>> Earth Institute
>> Columbia University
>>
>> Adjunct Lecturer
>> School of International and Public Affairs
>> Columbia University
>>
>> P.O. Box 1000
>> 61 Route 9W
>> Palisades, NY  10964
>>
>> 845-365-8939 (V)
>> 845-365-8922 (F)
>> www.ciesin.columbia.edu
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

-- 
Kytt MacManus
Geographic Information Specialist
CIESIN
Earth Institute
Columbia University

Adjunct Lecturer
School of International and Public Affairs
Columbia University

P.O. Box 1000
61 Route 9W
Palisades, NY  10964

845-365-8939 (V)
845-365-8922 (F)
www.ciesin.columbia.edu



More information about the SciPy-User mailing list