earthkit.meteo.stats.array.nanaverage

earthkit.meteo.stats.array.nanaverage(data, weights=None, **kwargs)

A merge of the functionality of np.nanmean and np.average.

Parameters:
  • data (array-like) – Data to average.

  • weights (array-like, None) – Weights to apply to the data for averaging. Weights will be normalised and must correspond to the shape of the numpy data array and axis/axes that is/are averaged over.

  • axis (axis/axes to compute the nanaverage over.)

  • kwargs (any other np.nansum kwargs)

Returns:

Mean of data (along axis) where nan-values are ignored and weights applied if provided.

Return type:

array-like