xrspatial.local.popularity

xrspatial.local.popularity(raster, ref_var, data_vars=None)[source]

Calculates the popularity, the number of occurrences of each value, of raster dataset on a cell-by-cell basis. The output value is assigned based on the reference data variable nth most popular.

Parameters
  • raster (xarray.Dataset) – 2D or 3D labelled array.

  • ref_var (string) – The reference variable name.

  • data_vars (list of string) – Variable name list.

Returns

final_arr

Return type

xarray.DataArray

References