Description
The current behavior of the xarray's Groupby.groups
property provides a standard (unordered) dictionary. This is fine for most cases but leads to odd orderings in use cases like this one where I am using xarray's FacetGrid plotting:
plot_kwargs = dict(col='season', vmin=15, vmax=35, levels=12, extend='both')
da_obs = ds_obs.SALT.isel(depth=0).groupby('time.season').mean('time')
da_obs.plot(**plot_kwargs)
Note that MAM and JJA are out of order.
I think this could be easily fixed by using an OrderedDict
in xarray.core.Groupby.groups
.