climpred.options.set_options#
- class climpred.options.set_options(**kwargs)[source]#
Set options for
climpredin 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=climatologyandHindcastEnsemble.remove_bias().``PerfectModel_persistence_from_initialized_lead_0`` – {
True,False}, defaultFalse# noqa: E501 Which persistence function to use inPerfectModelEnsemble.verify/bootstrap(reference="persistence"). IfFalseusecompute_persistence(). IfTrueusecompute_persistence_from_first_lead().``warn_for_failed_PredictionEnsemble_xr_call`` – {
True,False}, defaultTrue. # noqa: E501 RaiseUserWarningwhenPredictionEnsemble.xr_call, e.g..sel(lead=[1])fails on one of the datasets.``warn_for_rename_to_climpred_dims`` – {
True,False}, defaultTrueRaiseUserWarningwhen dimensions are renamed toCLIMPRED_DIMSwhenPredictionEnsembleis instantiated.``warn_for_init_coords_int_to_annual`` – {
True,False}, defaultTrueRaiseUserWarningwheninitcoordinate is of type integer and gets converted to annual cftime_range whenPredictionEnsembleis instantiated.``climpred_warnings`` – {
True,False}, defaultTrueOverwrites 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().
defaultas in code.loopcallsclimpred.bootstrap.resample_skill_loop()whichloops over iterations and calls
verifyevery single time. Most understandable and stable, but slow.
exclude_resample_dim_from_dimcallsclimpred.bootstrap.resample_skill_exclude_resample_dim_from_dim()which callsverify(dim=dim_without_resample_dim), resamples overresample_dimand then takes a mean overresample_dimif indim. EnablesHindcastEnsemble.bootstrap(resample_dim="init", alignment="same_verifs"). Fast alternative forresample_dim="init".
resample_beforecallsclimpred.bootstrap.resample_skill_resample_before()which resamplesiterationdimension and then callsverifyvectorized. 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} Exchangeuninitializedskill with the iteration meanuninitialized. Defaults to False.
Examples
You can use
set_optionseither 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)> Size: 80B 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 40B 1 2 3 4 5 6 7 8 9 10 skill <U11 44B '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)