xrspatial.classify.maximum_breaks#
- xrspatial.classify.maximum_breaks(agg: DataArray, k: int = 5, num_sample: int | None = 20000, name: str | None = 'maximum_breaks') DataArray[source]#
Classify data using the Maximum Breaks algorithm.
Finds the k-1 largest gaps between sorted unique values and uses midpoints of those gaps as bin edges.
- Parameters:
agg (xr.DataArray or xr.Dataset) – 2D NumPy, CuPy, NumPy-backed Dask, or CuPy-backed Dask array of values to be classified.
k (int, default=5) – Number of classes to be produced.
num_sample (int or None, default=20000) – Number of sample data points used to fit the model. For dask-backed arrays the sample is drawn lazily to avoid materialising the entire array into RAM.
Nonemeans use all data (safe for numpy/cupy, automatically capped for dask).name (str, default='maximum_breaks') – Name of output aggregate array.
- Returns:
max_breaks_agg – 2D aggregate array of maximum break classifications. All other input attributes are preserved. If agg is a Dataset, returns a Dataset with each variable classified independently.
- Return type:
xr.DataArray or xr.Dataset
References