climpred.options.set_options¶
- class climpred.options.set_options(**kwargs)[source]¶
Set options for climpred in a controlled context. Analogous to xarray.set_options(**option).
Currently supported options:
seasonality
- Attribute to group dimension
groupby(f"{dim}.{seasonality}"")
. Used in
reference=climatology
andremove_bias()
.
- Attribute to group dimension
Allowed: [
"dayofyear"
,"weekofyear"
,"month"
,"season"
]Default:
dayofyear
.
warn_for_failed_PredictionEnsemble_xr_call
- Raise UserWarning when PredictionEnsemble.xr_call,
e.g.
.sel(lead=[1])
fails on one of the datasets.
Allowed: [True, False]
Default: True
warn_for_rename_to_climpred_dims
- Raise UserWarning when dimensions are renamed to
CLIMPRED_DIMS
when PredictionEnsemble is instantiated.
- Raise UserWarning when dimensions are renamed to
Allowed: [True, False]
Default: True
warn_for_init_coords_int_to_annual
- Raise UserWarning when
init
coordinate is of type integer and gets converted to annual cftime_range when PredictionEnsemble is instantiated.
- Raise UserWarning when
Allowed: [True, False]
Default: True
climpred_warnings
Overwrites all options containing
"*warn*"
.Allowed: [True, False]
Default: True
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'
Or to set global options:
>>> climpred.set_options(seasonality='month') <climpred.options.set_options object at 0x...>
Methods
__init__
(**kwargs)