Earth2Studio is now OSS!

earth2studio.statistics.rank_histogram#

class earth2studio.statistics.rank_histogram(ensemble_dimension, reduction_dimensions, number_of_bins=10)[source]#

Compute the Rank Histogram for a given set of ensemble forecasts.

This statistic reduces over a single dimension, where the presumed ensemble dimension does not appear in the truth/observation tensor.

Parameters:
  • ensemble_dimension (str) – A name corresponding to a dimension to perform the ranking over. Example: ‘ensemble’

  • reduction_dimensions (list[str]) – A list of dimensions over which to bin the ranks.

  • number_of_bins (int) – The number of bins to discretize the unit interval over. by default, 10

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

Apply metric to data x and y, checking that their coordinates are broadcastable. While reducing over reduction_dimensions.

Parameters:
  • x (torch.Tensor) – Input tensor of ensemble data. The rank of observation input tensor y is determined with respect to the ensemble dimension of x.

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

  • y (torch.Tensor) – The observation input tensor.

  • y_coords (CoordSystem) – Ordered dict representing coordinate system that describes the y tensor. reduction_dimensions must be in coords.

Returns:

Returns rank histogram tensor with appropriate reduced coordinates.

Return type:

tuple[torch.Tensor, CoordSystem]