We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
This may be related to #733, but I am not sure, so I create a new one to keep it clean. It was discovered when creating the second example for #722 .
When the coords from #722 are changed to coords=[np.array([0, 1], np.int64)], they are not written to the netcdf file.
coords
coords=[np.array([0, 1], np.int64)]
Example:
In [1]: import xray as xr In [2]: import numpy as np In [3]: var1 = xr.DataArray(np.array([1, 2], np.float64), coords=[np.array([0, 1], np.int64)], dims=["coor1",], name = "var1") In [4]: var2 = xr.DataArray(np.array([3, 4], np.float64), dims=["dim1",], name = "var2") In [5]: ds = xr.Dataset({"var1": var1, "var2": var2}) In [6]: ds Out[6]: <xray.Dataset> Dimensions: (coor1: 2, dim1: 2) Coordinates: * coor1 (coor1) int64 0 1 * dim1 (dim1) int64 0 1 Data variables: var1 (coor1) float64 1.0 2.0 var2 (dim1) float64 3.0 4.0 In [7]: ds.to_netcdf("/tmp/from_xr_2.nc")
And then, no coor1 data variable in the file:
coor1
$ ncdump /tmp/from_xr_2.nc netcdf from_xr_2 { dimensions: coor1 = 2 ; dim1 = 2 ; variables: double var1(coor1) ; double var2(dim1) ; data: var1 = 1, 2 ; var2 = 3, 4 ; }
Change it back:
In [8]: var1 = xr.DataArray(np.array([1, 2], np.float64), coords=[np.array([1, 2], np.int64)], dims=["coor1",], name = "var1") In [9]: ds = xr.Dataset({"var1": var1, "var2": var2}) In [10]: ds.to_netcdf("/tmp/from_xr_3.nc")
and coor1 is back in the file:
$ ncdump /tmp/from_xr_3.nc netcdf from_xr_3 { dimensions: coor1 = 2 ; dim1 = 2 ; variables: int64 coor1(coor1) ; double var1(coor1) ; double var2(dim1) ; data: coor1 = 1, 2 ; var1 = 1, 2 ; var2 = 3, 4 ; }
That is, when the coords seem like they are similar to a range.
range
The text was updated successfully, but these errors were encountered:
Yep, this is exactly the same issue as #733... closing this in favor of that issue
Sorry, something went wrong.
No branches or pull requests
This may be related to #733, but I am not sure, so I create a new one to keep it clean. It was discovered when creating the second example for #722 .
When the
coords
from #722 are changed tocoords=[np.array([0, 1], np.int64)]
, they are not written to the netcdf file.Example:
And then, no
coor1
data variable in the file:Change it back:
and
coor1
is back in the file:That is, when the coords seem like they are similar to a
range
.The text was updated successfully, but these errors were encountered: