xoa.geo.pdist

xoa.geo.pdist(X, compact=False, radius=6371000.0, **kwargs)[source]

A scipy-distance like pdist function for the haversine method

Parameters:
  • X (numpy.array) – An m by 2 array of coordinates in a geographical space.

  • compact (bool) – Compact the distance matrix to remove duplicate and zeros. It is the strict upper triangle of the distance matrix.

  • radius (float) – Radius of the sphere which defaults to the earth radius

Returns:

numpy.array – Either 2D (square form) or 1D (compact form) the distance matrix

See also

haversine, cdist, numpy.triu, scipy.sparial.distances.pdist, scipy.sparial.distances.cdist, scipy.sparial.distances.squareform