climpred.options.set_options

class climpred.options.set_options(**kwargs)[source]

Set options for climpred in a controlled context.

Analogous to set_options.

Parameters
  • ``seasonality`` – {"dayofyear", "weekofyear", "month", "season"}, default: "month" # noqa: E501 Attribute to group dimension groupby(f"{dim}.{seasonality}""). Used in reference=climatology and HindcastEnsemble.remove_bias().

  • ``PerfectModel_persistence_from_initialized_lead_0`` – {True, False}, default False # noqa: E501 Which persistence function to use in PerfectModelEnsemble.verify/bootstrap(reference="persistence"). If False use compute_persistence(). If True use compute_persistence_from_first_lead().

  • ``warn_for_failed_PredictionEnsemble_xr_call`` – {True, False}, default True Raise UserWarning when PredictionEnsemble.xr_call, e.g. .sel(lead=[1]) fails on one of the datasets.

  • ``warn_for_rename_to_climpred_dims`` – {True, False}, default True Raise UserWarning when dimensions are renamed to CLIMPRED_DIMS when PredictionEnsemble is instantiated.

  • ``warn_for_init_coords_int_to_annual`` – {True, False}, default True Raise UserWarning when init coordinate is of type integer and gets converted to annual cftime_range when PredictionEnsemble is instantiated.

  • ``climpred_warnings`` – {True, False}, default True Overwrites all options containing "*warn*".

Examples

You can use set_options either as a context manager:

>>> kw = dict(
...     metric="mse",
...     comparison="e2o",
...     dim="init",
...     alignment="same_verifs",
...     reference="climatology",
... )
>>> with climpred.set_options(seasonality="month"):
...     HindcastEnsemble.verify(**kw).SST.sel(skill="climatology")
...
<xarray.DataArray 'SST' (lead: 10)>
array([0.03712573, 0.03712573, 0.03712573, 0.03712573, 0.03712573,
       0.03712573, 0.03712573, 0.03712573, 0.03712573, 0.03712573])
Coordinates:
  * lead     (lead) int32 1 2 3 4 5 6 7 8 9 10
    skill    <U11 'climatology'
Attributes:
    units:    (C)^2

Or to set global options:

>>> climpred.set_options(seasonality="month")  
<climpred.options.set_options object at 0x...>
__init__(**kwargs)[source]

Methods

__init__(**kwargs)