# xarray.groupers.SeasonResampler

### *class* xarray.groupers.SeasonResampler(seasons, , drop_incomplete=True)[[source]](https://github.com/pydata/xarray/blob/main/xarray/groupers.py#L876-L1114)

Allows grouping using a custom definition of seasons.

* **Parameters:**
  * **seasons** (`Sequence[str]`) – An ordered list of seasons.
  * **drop_incomplete** ([`bool`](https://docs.python.org/3/builtins/functions.html#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

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('e5d0a1d1-eb5e-4f25-8693-7db946d0070c','36711d03-bb97-4e84-9ce3-2281d5c05c58','81be0cce-892f-4dd4-983d-fb43d12aca8a','../lite/tree/../notebooks/index.html?path=34c40c9e_5e9b_4190_a627_f1a7912db141.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> SeasonResampler(["JF", "MAM", "JJAS", "OND"])
SeasonResampler(seasons=['JF', 'MAM', 'JJAS', 'OND'], drop_incomplete=True)
```

```pycon
>>> SeasonResampler(["DJFM", "AM", "JJA", "SON"])
SeasonResampler(seasons=['DJFM', 'AM', 'JJA', 'SON'], drop_incomplete=True)
```

<div id="81be0cce-892f-4dd4-983d-fb43d12aca8a" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('e5d0a1d1-eb5e-4f25-8693-7db946d0070c','81be0cce-892f-4dd4-983d-fb43d12aca8a')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('e5d0a1d1-eb5e-4f25-8693-7db946d0070c','81be0cce-892f-4dd4-983d-fb43d12aca8a')">Open In Tab</button></div><div id="36711d03-bb97-4e84-9ce3-2281d5c05c58" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

#### \_\_init_\_(seasons, , drop_incomplete=True)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../doc/<string>)

### Methods

| [`__init__`](#xarray.groupers.SeasonResampler.__init__)(seasons, \*[, drop_incomplete])                                         |                                                           |
|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [`compute_chunks`](xarray.groupers.SeasonResampler.compute_chunks.html.md#xarray.groupers.SeasonResampler.compute_chunks)(variable, \*, dim) | Compute chunk sizes for this season resampler.            |
| `factorize`(group)                                                                                                                | Create intermediates necessary for GroupBy.               |
| `reset`()                                                                                                                         | Create a new version of this Grouper clearing any caches. |

### Attributes

| `drop_incomplete`   |    |
|---------------------|----|
| `seasons`           |    |
| `season_inds`       |    |
| `season_tuples`     |    |
