xarray.groupers.SeasonResampler#

class xarray.groupers.SeasonResampler(seasons, *, drop_incomplete=True)[source]#

Allows grouping using a custom definition of seasons.

Parameters:
  • seasons (Sequence[str]) – An ordered list of seasons.

  • drop_incomplete (bool) – Whether to drop seasons that are not completely included in the data. For example, if a time series starts in Jan-2001, and seasons includes “DJF” then observations from Jan-2001, and Feb-2001 are ignored in the grouping since Dec-2000 isn’t present.

Examples

>>> SeasonResampler(["JF", "MAM", "JJAS", "OND"])
SeasonResampler(seasons=['JF', 'MAM', 'JJAS', 'OND'], drop_incomplete=True)
>>> SeasonResampler(["DJFM", "AM", "JJA", "SON"])
SeasonResampler(seasons=['DJFM', 'AM', 'JJA', 'SON'], drop_incomplete=True)
__init__(seasons, *, drop_incomplete=True)[source]#

Methods

__init__(seasons, *[, drop_incomplete])

factorize(group)

Creates intermediates necessary for GroupBy.

reset()

Creates a new version of this Grouper clearing any caches.

Attributes

drop_incomplete

seasons

season_inds

season_tuples