[SciPy-user] Array selection help

Stéfan van der Walt stefan at sun.ac.za
Tue Feb 10 17:14:31 EST 2009


Hi Jose

2009/2/10 Jose Luis Gomez Dans <josegomez at gmx.net>:
> Let's say I have two 2D arrays, arr1 and arr2. The elements of arr1 contain
> different numbers (such as labels, for example), and the elements of arr2
> contain some floating point data (say, height above sea level or something
> like that). For each unique value in arr1, I want to work out the mean (...
> sum, std dev, etc) of arr2 for the overlapping region. So far, I have used
> the following code:

Also take a look at scipy.ndimage, which has functions to calculate
means and variances over labeled data.

Cheers
Stéfan



More information about the SciPy-User mailing list