xrspatial.mahalanobis.mahalanobis#
- xrspatial.mahalanobis.mahalanobis(bands: List[DataArray], mean: ndarray | None = None, inv_cov: ndarray | None = None, name: str = 'mahalanobis') DataArray[source]#
Compute per-pixel Mahalanobis distance from a multi-band reference.
- Parameters:
bands (list of xr.DataArray) – N 2-D rasters (same shape, dtype family, and chunk structure). Must contain at least 2 bands.
mean (numpy array, shape (N,), optional) – Mean vector of the reference distribution. Must be provided together with inv_cov, or both omitted (auto-computed).
inv_cov (numpy array, shape (N, N), optional) – Inverse covariance matrix. Must be provided together with mean, or both omitted (auto-computed).
name (str) – Name for the output DataArray.
- Returns:
2-D float64 raster with same coords/dims/attrs as
bands[0].- Return type:
xr.DataArray