Description
MCVE Code Sample
import xarray as xr
import numpy as np
arr2 = xr.DataArray(np.ones((2, 2)), dims=['y', 'x'])
arr1 = xr.DataArray(np.ones((2, 2)), dims=['y', 'x'], coords={'y': [0, 1], 'x': [0, 1]})
del arr1.coords['y']
del arr1.coords['x']
# shows arr1 without coordinates
arr1
# shows coordinates in xarray 0.15
arr1 * arr2
Expected Output
<xarray.DataArray (y: 2, x: 2)>
array([[1., 1.],
[1., 1.]])
Dimensions without coordinates: y, x
Problem Description
In xarray 0.15, the coordinates are restored when doing the multiplication:
<xarray.DataArray (y: 2, x: 2)>
array([[1., 1.],
[1., 1.]])
Coordinates:
* y (y) int64 0 1
* x (x) int64 0 1
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.8.1 | packaged by conda-forge | (default, Jan 29 2020, 14:55:04)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.18.0-147.0.3.el8_1.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.3
xarray: 0.15.0
pandas: 1.0.0
numpy: 1.18.1
scipy: 1.4.1
netCDF4: 1.5.3
pydap: None
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: 2.3.2
cftime: 1.0.4.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.1.2
cfgrib: None
iris: None
bottleneck: 1.3.1
dask: 2.10.1
distributed: 2.10.0
matplotlib: 3.1.3
cartopy: 0.17.0
seaborn: None
numbagg: None
setuptools: 45.1.0.post20200119
pip: 20.0.2
conda: None
pytest: 5.3.5
IPython: 7.12.0
sphinx: 2.3.1