# xarray.groupers.SeasonGrouper

### *class* xarray.groupers.SeasonGrouper(seasons)[[source]](https://github.com/pydata/xarray/blob/main/xarray/groupers.py#L801-L873)

Allows grouping using a custom definition of seasons.

* **Parameters:**
  **seasons** ([sequence](https://docs.python.org/3/glossary.html#term-sequence) of [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – List of strings representing seasons. E.g. `"JF"` or `"JJA"` etc.
  Overlapping seasons are allowed (e.g. `["DJFM", "MAMJ", "JJAS", "SOND"]`)

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('a7f5f5ea-286d-4cfe-bc86-e4dba0b4103f','74dbf735-bbeb-42ce-a68e-d76cfdb27770','c92eabba-9be3-4794-8b99-27a425f4954e','../lite/tree/../notebooks/index.html?path=ede243b8_b439_44e3_9f1f_2a013eec3a9a.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> SeasonGrouper(["JF", "MAM", "JJAS", "OND"])
SeasonGrouper(seasons=['JF', 'MAM', 'JJAS', 'OND'])
```

The ordering is preserved

```pycon
>>> SeasonGrouper(["MAM", "JJAS", "OND", "JF"])
SeasonGrouper(seasons=['MAM', 'JJAS', 'OND', 'JF'])
```

Overlapping seasons are allowed

```pycon
>>> SeasonGrouper(["DJFM", "MAMJ", "JJAS", "SOND"])
SeasonGrouper(seasons=['DJFM', 'MAMJ', 'JJAS', 'SOND'])
```

<div id="c92eabba-9be3-4794-8b99-27a425f4954e" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('a7f5f5ea-286d-4cfe-bc86-e4dba0b4103f','c92eabba-9be3-4794-8b99-27a425f4954e')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('a7f5f5ea-286d-4cfe-bc86-e4dba0b4103f','c92eabba-9be3-4794-8b99-27a425f4954e')">Open In Tab</button></div><div id="74dbf735-bbeb-42ce-a68e-d76cfdb27770" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

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

### Methods

| [`__init__`](#xarray.groupers.SeasonGrouper.__init__)(seasons)   |                                                           |
|----------------------------------------------------------------------|-----------------------------------------------------------|
| `factorize`(group)                                                   | Create intermediates necessary for GroupBy.               |
| `reset`()                                                            | Create a new version of this Grouper clearing any caches. |

### Attributes

| `seasons`   |    |
|-------------|----|
