Skip to content

xarray_ Group by season #6664

Answered by dcherian
Bjrj92 asked this question in Q&A
Jun 4, 2022 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

On latest Xarray (>2024.04.0) this works:

import xarray as xr
from xarray.groupers import SeasonGrouper

ds = xr.tutorial.open_dataset("air_temperature")

ds.groupby(time=SeasonGrouper(["JF", "MAM", "JJAS", "OND"])).mean()

https://docs.xarray.dev/en/latest/user-guide/time-series.html#handling-seasons

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@mathause
Comment options

@Bjrj92
Comment options

@mathause
Comment options

@Bjrj92
Comment options

@mathause
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dcherian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants