climpred.classes.PerfectModelEnsemble.smooth#
- PerfectModelEnsemble.smooth(smooth_kws: str | Dict[str, int] | None = None, how: str = 'mean', **xesmf_kwargs: str)#
Smooth in space and/or aggregate in time in
PredictionEnsemble
.- Parameters:
smooth_kws – Dictionary to specify the dims to smooth compatible with
spatial_smoothing_xesmf()
ortemporal_smoothing()
. Shortcut for Goddard et al. [2013]goddard2013
. Defaults toNone
.how – how to smooth temporally. From Choose from
["mean", "sum"]
. Defaults to"mean"
.**xesmf_kwargs – 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: SST (init, lead, lat, lon) float32 -0.3236 -0.3161 -0.3083 ... 0.0 0.0 Uninitialized: None Observations: SST (time, lat, lon) float32 0.002937 0.001561 0.002587 ... 0.0 0.0 0.0
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 * lat (lat) float64 -9.75 -4.75 * lon (lon) float64 250.8 254.8 258.8 262.8 valid_time (lead, init) object 1955-01-01 00:00:00 ... 2026-01-01 00:00:00 >>> 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 * lat (lat) float64 -9.75 -4.75 * lon (lon) float64 250.8 255.8 260.8 265.8 valid_time (lead, init) object 1955-01-01 00:00:00 ... 2024-01-01 00:00:00