earth2studio.statistics.std#

class earth2studio.statistics.std(reduction_dimensions, weights=None, batch_update=False)[source]#

Statistic for calculating the sample standard deviation over a set of given dimensions.

Parameters:
  • reduction_dimensions (List[str]) – A list of names corresponding to dimensions to perform the statistical reduction over. Example: [‘lat’, ‘lon’]

  • weights (torch.Tensor, optional) – A tensor containing weights to assign to the reduction dimensions. Note that these weights must have the same number of dimensions as passed in reduction_dimensions. Example: if reduction_dimensions = [‘lat’, ‘lon’] then assert weights.ndim == 2. By default None.

  • batch_update (bool, optional) – Whether to applying batch updates to the standard deviation with each invocation of __call__. This is particularly useful when data is recieved in a stream of batches. Each invocation of __call__ will return the running standard deviation. By default False.

__call__(x, coords)[source]#

Apply the sample standard deviation operation over the tensor x.

If batch_update was passed True upon metric initialization then this method returns the running sample standard deviation over all seen batches.

Parameters:
  • x (torch.Tensor) – Input data to compute sample standard deviation.

  • coords (CoordSystem) – Coordinates referring to the input data, x.

Return type:

tuple[Tensor, OrderedDict[str, ndarray]]