xarray.core.weighted.DatasetWeighted#

class xarray.core.weighted.DatasetWeighted(obj, weights)[source]#
__init__(obj, weights)[source]#

Create a Weighted object

Parameters:
  • obj (DataArray or Dataset) ‚Äď Object over which the weighted reduction operation is applied.

  • weights (DataArray) ‚Äď An array of weights associated with the values in the obj. Each value in the obj contributes to the reduction operation according to its associated weight.

Notes

weights must be a DataArray and cannot contain missing values. Missing values can be replaced by weights.fillna(0).

Methods

__init__(obj, weights)

Create a Weighted object

mean([dim, skipna, keep_attrs])

Reduce this Dataset's data by a weighted mean along some dimension(s).

quantile(q, *[, dim, keep_attrs, skipna])

Apply a weighted quantile to this Dataset's data along some dimension(s).

std([dim, skipna, keep_attrs])

Reduce this Dataset's data by a weighted std along some dimension(s).

sum([dim, skipna, keep_attrs])

Reduce this Dataset's data by a weighted sum along some dimension(s).

sum_of_squares([dim, skipna, keep_attrs])

Reduce this Dataset's data by a weighted sum_of_squares along some dimension(s).

sum_of_weights([dim, keep_attrs])

Calculate the sum of weights, accounting for missing values in the data.

var([dim, skipna, keep_attrs])

Reduce this Dataset's data by a weighted var along some dimension(s).

Attributes

obj

weights