class weatherbench2.regions.Region

Region selector for spatially averaged metrics.

.apply() method is called before spatial averaging in the Metrics classes. Region selection can be either applied as an operation on the dataset itself or a weights dataset, typically the latitude weights. The latter option is required to implement non-box regions without the use of .where() which would clash with skipna=False used as default in the metrics. The way this is implemented is by multiplying the input weights with a boolean weight dataset.

Since sometimes the dataset and sometimes the weights are modified, these must be used together, most likely insice the _spatial_average function defined in

Return type:




apply(dataset, weights)

Apply region selection to dataset and/or weights.