earth2studio.statistics.acc#

class earth2studio.statistics.acc(reduction_dimensions, climatology=None, weights=None)[source]#

Statistic for calculating the anomaly correlation coefficient of two tensors over a set of given dimensions, with respect to some optional climatology.

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

  • climatology (DataSource) – Optional (by default None) climatology to remove from tensors to create anomalies before computing the correlation coefficient.

  • weights (torch.Tensor = None) – 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.

__call__(x, x_coords, y, y_coords)[source]#

Apply metric to data x and y, checking that their coordinates are broadcastable.

Parameters:
  • x (torch.Tensor) – Input tensor, typically the forecast or prediction tensor, but ACC is symmetric with respect to x and y.

  • x_coords (CoordSystem) – Ordered dict representing coordinate system that describes the x tensor. reduction_dimensions must be in coords. “time” and “variable” must be in x_coords.

  • y (torch.Tensor) – Input tensor #2 intended to be used as validation data, but ACC is symmetric with respect to x and y.

  • y_coords (CoordSystem) – Ordered dict representing coordinate system that describes the y tensor. reduction_dimensions must be in coords. “time” and “variable” must be in y_coords. If “lead_time” is in x_coords, then “lead_time” must also be in y_coords. The intention, in this case, is that users will use fetch_data to make it easier to match validation times.

Returns:

Returns anomaly correlation coefficient tensor with appropriate reduced coordinates.

Return type:

tuple[torch.Tensor, CoordSystem]