shnitsel.core.xrhelpers.mgroupby¶
- mgroupby(obj, levels)¶
Group a Dataset or DataArray by several levels of a MultiIndex it contains.
- Parameters:
- Returns:
The grouped object, which behaves as documented at
xr.Dataset.groupby()
and xr.DataArray.groupby with the caveat that the specified levels have been
”flattened” into a single Multiindex level of tuples.
- Raises:
ValueError – If no MultiIndex is found, or if the named levels belong to different MultiIndexes.
- Return type:
Warning
The function does not currently check whether the levels specified are really levels of a MultiIndex, as opposed to names of non-MultiIndex indexes.