climpred.classes.HindcastEnsemble.smooth¶
- HindcastEnsemble.smooth(smooth_kws=None, how='mean', **xesmf_kwargs)¶
Smooth all entries of PredictionEnsemble in the same manner to be able to still calculate prediction skill afterwards.
- Parameters
smooth_kws (dict or str) – Dictionary to specify the dims to smooth compatible with
spatial_smoothing_xesmf()
ortemporal_smoothing()
. Shortcut for Goddard et al. 2013 recommendations: ‘goddard2013’. Defaults to None.how (str) – how to smooth temporally. From [‘mean’,’sum’]. Defaults to ‘mean’.
**xesmf_kwargs (args) – kwargs passed to
spatial_smoothing_xesmf()
Examples
>>> PerfectModelEnsemble.get_initialized().lead.size 20 >>> PerfectModelEnsemble.smooth({'lead':4}, how='sum').get_initialized().lead.size 17
>>> HindcastEnsemble_3D.smooth({'lon':1, 'lat':1}) <climpred.HindcastEnsemble> Initialized Ensemble: SST (init, lead, lat, lon) float64 -0.3236 -0.3161 -0.3083 ... 0.0 0.0 Observations: SST (time, lat, lon) float64 0.002937 0.001561 0.002587 ... 0.0 0.0 0.0 Uninitialized: None
smooth
simultaneously aggregates spatially listening tolon
andlat
and temporally listening tolead
ortime
.>>> HindcastEnsemble_3D.smooth({'lead': 2, 'lat': 5, 'lon': 4}).get_initialized().coords Coordinates: * init (init) object 1954-01-01 00:00:00 ... 2017-01-01 00:00:00 * lead (lead) int32 1 2 3 4 5 6 7 8 9 * lon (lon) float64 250.8 254.8 258.8 262.8 * lat (lat) float64 -9.75 -4.75 >>> HindcastEnsemble_3D.smooth('goddard2013').get_initialized().coords Coordinates: * init (init) object 1954-01-01 00:00:00 ... 2017-01-01 00:00:00 * lead (lead) int32 1 2 3 4 5 6 7 * lon (lon) float64 250.8 255.8 260.8 265.8 * lat (lat) float64 -9.75 -4.75