Possible Duplicate:
Grouping 2D numpy array in average
I need to ‘down-sample’ a 2d array of shape (2880, 5760) to shape (360, 720) by averageing over blocks of 8×8 elements of the original array. Which would be an efficient way of doing that using NumPy?
EDIT
I just realize I need to do this on masked_arrays, so the chained mean() won’t do.
Here is the way which works for masked arrays as well