[Numpy-discussion] effectively computing variograms with numpy

Timothy Hochberg tim.hochberg@ieee....
Fri Jun 22 09:51:20 CDT 2007


On 6/22/07, Hanno Klemm <klemm@phys.ethz.ch> wrote:
>
>
> Hi,
>
> I have an array which represents regularly spaced spatial data. I now
> would like to compute the (semi-)variogram, i.e.
>
> gamma(h) = 1/N(h) \sum_{i,j\in N(h)} (z_i - z_j)**2,
>
> where h is the (approximate) spatial difference between the
> measurements z_i, and z_j, and N(h) is the number of measurements with
> distance h.
>
> However, I only want to calculate the thing along the rows and
> columns. The naive approach involves two for loops and a lot of
> searching, which becomes painfully slow on large data sets. Are there
> better implementations around in numpy/scipy or does anyone have a
> good idea of how to do that more efficient? I looked around a bit but
> couldn't find anything.


Can you send the naive code as well. Its often easier to see what's going on
with code in addition to the equations.

Regards.

-tim



-- 
.  __
.   |-\
.
.  tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070622/ffde1187/attachment.html 


More information about the Numpy-discussion mailing list