Description
Code Sample, a copy-pastable example if possible
A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you:
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
from xarray import Dataset, DataArray
ds = Dataset(coords={'foo':[1,2,3], 'bar':[1,2,3]})
da = DataArray([0], dims='test')
da.name = 'abc'
ds[(1,2)] = da
print(da.name)
print(ds[(1,2)].name)
print(type(ds[(1,2)].name))
print(ds[(1,2)]) # throws error
Problem description
The name gets overwritten with the tuple key, but is should stay intact?!?
Secondly the print statement throws an error because internally name_str = '%r ' % arr.name
is called. But here arr.name
is a tuple
!!
Instead, it should be repr(arr.name)
or F"{arr.name}"
Expected Output
The name should not change.
Output of xr.show_versions()
xarray: 0.12.0
pandas: 0.24.2
numpy: 1.16.2
scipy: 1.2.1
netCDF4: 1.4.2
pydap: None
h5netcdf: None
h5py: 2.9.0
Nio: None
zarr: None
cftime: 1.0.3.4
nc_time_axis: None
PseudonetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: None
distributed: None
matplotlib: 3.0.3
cartopy: None
seaborn: None
setuptools: 40.8.0
pip: 19.0.3
conda: 4.6.8
pytest: None
IPython: 7.3.0
sphinx: 1.8.5