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 dimensiongroupby(f"{dim}.{seasonality}"")
. Used inreference=climatology
andHindcastEnsemble.remove_bias()
.``PerfectModel_persistence_from_initialized_lead_0`` – {
True
,False
}, defaultFalse
# noqa: E501 Which persistence function to use inPerfectModelEnsemble.verify/bootstrap(reference="persistence")
. IfFalse
usecompute_persistence()
. IfTrue
usecompute_persistence_from_first_lead()
.``warn_for_failed_PredictionEnsemble_xr_call`` – {
True
,False
}, defaultTrue
. # noqa: E501 RaiseUserWarning
whenPredictionEnsemble.xr_call
, e.g..sel(lead=[1])
fails on one of the datasets.``warn_for_rename_to_climpred_dims`` – {
True
,False
}, defaultTrue
RaiseUserWarning
when dimensions are renamed toCLIMPRED_DIMS
whenPredictionEnsemble
is instantiated.``warn_for_init_coords_int_to_annual`` – {
True
,False
}, defaultTrue
RaiseUserWarning
wheninit
coordinate is of type integer and gets converted to annual cftime_range whenPredictionEnsemble
is instantiated.``climpred_warnings`` – {
True
,False
}, defaultTrue
Overwrites all options containing"*warn*"
.``bootstrap_resample_skill_func`` – {“loop”, “exclude_resample_dim_from_dim”, “resample_before”,”default”} # noqa: E501 Decide which resampling method to use in PredictionEnsemble.bootstrap().
default
as in code.loop
callsclimpred.bootstrap.resample_skill_loop()
whichloops over iterations and calls
verify
every single time. Most understandable and stable, but slow.
exclude_resample_dim_from_dim
callsclimpred.bootstrap.resample_skill_exclude_resample_dim_from_dim()
which callsverify(dim=dim_without_resample_dim)
, resamples overresample_dim
and then takes a mean overresample_dim
if indim
. EnablesHindcastEnsemble.bootstrap(resample_dim="init", alignment="same_verifs")
. Fast alternative forresample_dim="init"
.
resample_before
callsclimpred.bootstrap.resample_skill_resample_before()
which resamplesiteration
dimension and then callsverify
vectorized. Fast alternative forresample_dim="member"
.
``resample_iterations_func`` – {
"default"
,"resample_iterations"
,"resample_iterations_idx"
} # noqa: E501 Decide which resample_iterations function to use from xskillscore."default"
as in code:xskillscore.resample_iterations_idx()
creates one large chunkand consumes much memory and is not recommended for large files.
xskillscore.resample_iterations()
create many tasks but is morestable.
``bootstrap_uninitialized_from_iterations_mean`` – {
True
,False
} Exchangeuninitialized
skill with the iteration meanuninitialized
. Defaults to False.
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...>
Methods
__init__
(**kwargs)