xoa.geo.clusterize

xoa.geo.clusterize(obj, npmax, split=False)[source]

Split data into clouds of points of max size npmax

Input object must have valid geographic coordinates.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset) – If a data array, it must have valid longitude and latitude coordinates.

  • npmax (int) – Maximal number of point per cluster

  • split – Return one dataset per cluster

Returns:

xarray.Dataset, list of xarray.Dataset – A dataset has its longitude and latitude coordinates renamed lon and lat, and its stacked dimension renamed npts. It contains only arrays that contains the npts dimension. If a clustering was needed, the dataset contains the following arrays:

iclust:

Index of the cluster points belongs to.

indices:

Indices in the original dataset.

centroid:

Coordinate of the centroid(s)

distorsion:

Distances to the centroid that the points belongs to.

If the input is a dataset, the global attribute var_names is set to the list of data var names.