Xarray.dataset.grouby_bins without squishing other dimensions

Nancy, this is a great question. The limitations of groupby_bins for this sort of application are one thing motivated us to create xhistogram.

What you want to do is quite straightforward in xhistogram. Something like

from xhistogram.xarray import histogram
ds_dens = histogram(ds, bins=[bins], dim=['lat'])
1 Like