climpred.classes.HindcastEnsemble.verify

HindcastEnsemble.verify(metric: Optional[Union[str, climpred.metrics.Metric]] = None, comparison: Optional[Union[str, climpred.comparisons.Comparison]] = None, dim: Optional[Union[str, List[str]]] = None, alignment: Optional[str] = None, reference: Optional[Union[List[str], str]] = None, groupby: Optional[Union[str, xarray.DataArray]] = None, **metric_kwargs: Optional[Any]) xarray.Dataset[source]

Verify the initialized ensemble against observations.

Note

This will automatically verify against all shared variables between the initialized ensemble and observations/verification data.

Parameters
  • metric – Metric to apply for verification, see metrics

  • comparison – How to compare to the observations/verification data. See comparisons.

  • dim – Dimension(s) to apply metric over. dim is passed on to xskillscore.{metric} and includes xskillscore’s member_dim. dim should contain member when comparison is probabilistic but should not contain member when comparison=e2o. Defaults to None meaning that all dimensions other than lead are reduced.

  • alignment – which inits or verification times should be aligned?

    • "maximize": maximize the degrees of freedom by slicing initialized and verif to a common time frame at each lead.

    • "same_inits": slice to a common init frame prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of initializations.

    • "same_verif": slice to a common/consistent verification time frame prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of verification dates.

  • reference – Type of reference forecasts with which to verify against. One or more of ["uninitialized", "persistence", "climatology"]. Defaults to None meaning no reference.

  • groupby – group init before passing initialized to verify.

  • **metric_kwargs – arguments passed to metric.

Returns

initialized and reference forecast skill reduced by dimensions dim

Example

Continuous Ranked Probability Score (crps) comparing every member with the verification (m2o) over the same verification time (same_verifs) for all leads reducing dimensions init and member:

>>> HindcastEnsemble.verify(
...     metric="rmse",
...     comparison="m2o",
...     alignment="same_verifs",
...     dim=["init", "member"],
... )
<xarray.Dataset>
Dimensions:  (lead: 10)
Coordinates:
  * lead     (lead) int32 1 2 3 4 5 6 7 8 9 10
    skill    <U11 'initialized'
Data variables:
    SST      (lead) float64 0.08516 0.09492 0.1041 ... 0.1525 0.1697 0.1785
Attributes:
    prediction_skill_software:     climpred https://climpred.readthedocs.io/
    skill_calculated_by_function:  HindcastEnsemble.verify()
    number_of_initializations:     64
    number_of_members:             10
    alignment:                     same_verifs
    metric:                        rmse
    comparison:                    m2o
    dim:                           ['init', 'member']
    reference:                     []

Root mean square error ("rmse") comparing the ensemble mean with the verification ("e2o") over the same initializations ("same_inits") for all leads reducing dimension init while also calculating reference skill for the "persistence", "climatology" and "uninitialized" forecast.

>>> HindcastEnsemble.verify(
...     metric="rmse",
...     comparison="e2o",
...     alignment="same_inits",
...     dim="init",
...     reference=["persistence", "climatology", "uninitialized"],
... )
<xarray.Dataset>
Dimensions:  (skill: 4, lead: 10)
Coordinates:
  * lead     (lead) int32 1 2 3 4 5 6 7 8 9 10
  * skill    (skill) <U13 'initialized' 'persistence' ... 'uninitialized'
Data variables:
    SST      (skill, lead) float64 0.08135 0.08254 0.086 ... 0.07377 0.07409
Attributes:
    prediction_skill_software:     climpred https://climpred.readthedocs.io/
    skill_calculated_by_function:  HindcastEnsemble.verify()
    number_of_initializations:     64
    number_of_members:             10
    alignment:                     same_inits
    metric:                        rmse
    comparison:                    e2o
    dim:                           init
    reference:                     ['persistence', 'climatology', 'uninitiali...