[Numpy-discussion] creating zonal statistics from two arrays

2010-12-08 Thread Gregory, Matthew
Hi all, Likely a very newbie type of question. I'm using numpy with GDAL to calculate zonal statistics on images. The basic approach is that I have a zone raster and a value raster which are aligned spatially and I am storing each zone's corresponding values in a dictionary, then calculating

[Numpy-discussion] accumulated sum-of-squared-differences

2010-08-02 Thread Gregory, Matthew
Hi all, I'm trying to calculate accumulated sum-of-squared-differences for an array in the following manner: import numpy as np a = np.array([1, 2, 3, 49., 50, 51, 98, 99, 100], dtype=np.float32) # Calculate accumulated means over all elements means = np.add.accumulate(a) / (np.arange(a.size) +

[Numpy-discussion] newbie: convert recarray to floating-point ndarray with mixed types

2010-05-12 Thread Gregory, Matthew
Apologies for what is likely a simple question and I hope it hasn't been asked before ... Given a recarray with a dtype consisting of more than one type, e.g. >>> import numpy as n >>> a = n.array([(1.0, 2), (3.0, 4)], dtype=[('x', float), ('y', int)]) >>> b = a.view(n.recarray) >>> b

Re: [Numpy-discussion] calculating weighted majority using two 3D arrays

2008-03-06 Thread Gregory, Matthew
Eads, Damian wrote: > You may need to be a bit more specific by what you mean by > weighted majority. What are the range of values for values > and weights, specifically? This sounds a lot like pixel > classification where each pixel is classified with a majority > vote over its weights and val

[Numpy-discussion] calculating weighted majority using two 3D arrays

2008-03-05 Thread Gregory, Matthew
Hi list, I'm a definite newbie to numpy, but finding the library to be incredibly useful. I'm trying to calculate a weighted majority using numpy functions. I have two sets of image stacks (one is values, the other weights) that I read into 3D numpy arrays. Assuming I read in a 100 row x 100 co