climpred.classes.HindcastEnsemble.smooth

climpred.classes.HindcastEnsemble.smooth#

HindcastEnsemble.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:

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 to lon and lat and temporally listening to lead or time.

>>> 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