home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 613717463

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
613717463 MDU6SXNzdWU2MTM3MTc0NjM= 4042 DataArray coordinates transformed into variables when saved to disk 10676434 closed 0     1 2020-05-07T01:51:36Z 2020-05-07T18:42:52Z 2020-05-07T18:42:52Z NONE      

When I save my DataArray to disk using to_netcdf, then try to reload it as a DataArray, it fails the roundtrip. When I load it as a DataSet, I see that the coordinates have been transformed into variables.

Also, the attributes have disappeared.

MCVE Code Sample

bug_data.p.zip

Unzip the file. It should be a pickle file.

```python import pickle import xarray as xr

data = pickle.load(open('/path/to/bug_data.p', 'rb'))

print(type(data) == xr.DataArray)

>>> True

path = '/var/tmp/bug_data.nc'

data.to_netcdf(path, format='NETCDF4', mode='w')

xr.open_dataarray(path) # fails due to multiple variables

xr.open_dataset(path) # succeeds ```

Expected Output

I expect xr.open_dataarray(path) to succeed, and for the result to be equal to data.

Problem Description

The DataArray -> Disk -> DataArray roundtrip should be seamless.

Versions

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:05:27) [Clang 9.0.1 ] python-bits: 64 OS: Darwin OS-release: 19.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.ISO8859-1 libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.15.1 pandas: 1.0.1 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: 0.8.0 h5py: 2.10.0 Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.11.0 distributed: 2.14.0 matplotlib: 3.1.3 cartopy: None seaborn: 0.10.0 numbagg: None setuptools: 45.2.0.post20200209 pip: 20.0.2 conda: None pytest: 5.3.5 IPython: 7.12.0 sphinx: 2.4.3
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4042/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.595ms · About: xarray-datasette