Thank you Serge for this generous reply, Vectorized code seems a great choice to compute the distance. If I understand well, vectorized code can only work when you don't need to access the values of the array, but only need to know the indices. This works well for the distance, but I need to access the array values in the openness function.
As regards array.array, it seems a bit complicated to reduce all my 2D arrays to 1D arrays because I am working with the gdal library, which works only with 'numeric' arrays. Julien -- http://mail.python.org/mailman/listinfo/python-list