-
-
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
to_dataset lossy #1047
Comments
If you don't use import xarray as xr
da = xr.DataArray([1, 2, 3], name='da', attrs={'myattr':3})
da.to_dataset().da
<xarray.DataArray 'da' (dim_0: 3)>
array([1, 2, 3])
Coordinates:
* dim_0 (dim_0) int64 0 1 2
Attributes:
myattr: 3 |
Ah thanks. Would you be be interested in a pull request to make that more clear in the docs? |
Sure, improvements to the docs are always welcome! Note that in the next release of xarray we will have a |
Oh, that will be excellent. When is that coming out? On Fri, Oct 14, 2016 at 4:12 PM, Stephan Hoyer [email protected]
|
I am looking at saving a DataArray to netcdf. This appears to require turning into a dataset. However, the conversion to and from datasets appears to be lossy.
d = DataArray(...)
n = d.to_dataset().to_array()
looses attrs and the name of the DataArray gets moved to a "variable" coordinate.
I can manually add the attrs to the created dataset, but it seems like they should either be transfered by default, or have an option to preserve them. Is there a reason this is not done?
The text was updated successfully, but these errors were encountered: