fips.covariance.distances.haversine_matrix#

fips.covariance.distances.haversine_matrix(lats, lons)[source]#

Calculate the pairwise great-circle (haversine) distance matrix between points.

The Earth is a sphere of radius 6371 km.

Parameters:
  • lats (ArrayLike) – 1D array-like of latitudes in degrees.

  • lons (ArrayLike) – 1D array-like of longitudes in degrees.

Returns:

The matrix of distances in kilometers, zero on the diagonal.

Return type:

ndarray

Raises:

ValueError – If lats or lons is not 1D.