Closed
Description
Code Sample, a copy-pastable example if possible
arr = xr.DataArray(
np.arange(5),
dims=('x',),
coords={
'x': ('x', np.array([1, 1, 1, 2, 2])),
}
)
gr = arr.groupby('x')
gr.first()
arr
<xarray.DataArray (x: 5)>
array([0, 1, 2, 3, 4])
Coordinates:
* x (x) int64 1 2
Problem description
A side effect of the GroupBy.first method call is that it substitutes the original array coordinates with the grouped ones .
Expected Output
arr
<xarray.DataArray (x: 5)>
array([0, 1, 2, 3, 4])
Coordinates:
- x (x) int64 1 1 1 2 2
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.0.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-41-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
xarray: 0.10.4
pandas: 0.22.0
numpy: 1.14.3
scipy: 1.1.0
netCDF4: 1.3.1
h5netcdf: None
h5py: 2.7.1
Nio: None
zarr: None
bottleneck: None
cyordereddict: None
dask: 0.17.4
distributed: 1.21.8
matplotlib: 2.2.2
cartopy: 0.16.0
seaborn: None
setuptools: 38.4.1
pip: 10.0.1
conda: None
pytest: 3.5.1
IPython: 6.2.1
sphinx: 1.7.4