title: groupby multiple coords along a single dimension in xarray
body: <p>I have an xarray with multiple coordinates along a single dimension. In the example below, coords <code>a</code> and <code>b</code> are defined along dimension <code>dim1</code>. How would I <code>groupby</code> using two coordinates that are defined along the same dimension(s)? Unlike <a href="https://stackoverflow.com/questions/52453426/grouping-by-multiple-dimensions">this question</a>, I am not trying to group along different dimensions, but a single one. </p>
  
  <pre><code>import xarray as xr
  
  d = xr.DataArray([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],
      coords={
          'a': ('dim1',['A', 'A', 'B', 'B']),
          'b': ('dim1',['1', '2', '1', '2']),
          'c': ('dim2',['x', 'y', 'z'])
      },
      dims=['dim1', 'dim2'])
  d.groupby(['a','b']) # this gives: TypeError: `group` must be an xarray.DataArray or the name of an xarray variable or dimension
  </code></pre>