-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MergeError: coordinate mytime1 shares a name with a dataset dimension …. This is disallowed by the xarray data model. #2931
Comments
So in xarray coordinates which have the same name as dimensions are given special status - they are known as "dimension coordinates". (Yes this is confusing and I think there are plans to make this structure clearer in the future.) Dimension coordinates have to be 1D along the corresponding dimension, as indicated by the error message. However in your example you didn't specify the dimension which you want the coordinate import xarray as xr
import pandas as p
import numpy as np
var1 = np.ones((364))
tt1=p.date_range('1/1/2018','12/30/2018')
tt1.name= 'time1_name'
var=xr.Dataset(
data_vars={
'var1':(('mytime1'),var1),
},
coords={
'mytime1':(('mytime1'), tt1),
}
) which when printed gives
|
Thanks ... in case I used delattr to delete the name so that I can avoid the error message, then what is the difference between specifing or ignoring the dimnsion that the coordinate is attached. |
Yes, we'd like to remove this "feature" -- see #2368 for more discussion |
…he xarray dataset, see this issue: pydata/xarray#2931 xarray.core.merge.MergeError: Error that needed fixing: coordinate point_id shares a name with a dataset dimension, but is not a 1D variable along that dimension. This is disallowed by the xarray data model.
Problem description
I got the following error "MergeError: coordinate mytime1 shares a name with a dataset dimension, but is not a 1D variable along that dimension. This is disallowed by the xarray data model." when I inlcude name attribue "time1_name" to the var1 dimension mytime1.
Expected Output
Output of
xr.show_versions()
xarray: 0.10.9
pandas: 0.23.4
numpy: 1.14.2
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: None
h5py: 2.7.1
Nio: None
zarr: None
cftime: None
PseudonetCDF: None
rasterio: None
iris: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.16.1
distributed: 1.20.2
matplotlib: 2.1.2
cartopy: 0.16.0
seaborn: 0.8.1
setuptools: 40.8.0
pip: 18.1
conda: 4.4.10
pytest: 3.3.2
IPython: 5.4.1
sphinx: 1.6.6
The text was updated successfully, but these errors were encountered: