home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where user = 8020943 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray 1
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
550067372 MDU6SXNzdWU1NTAwNjczNzI= 3696 AttributeError: cannot set attribute '_accessors' on a 'DataArray' object. prisae 8020943 closed 0     6 2020-01-15T09:31:18Z 2020-01-16T12:09:52Z 2020-01-15T15:18:05Z NONE      

MCVE Code Sample

Create two conda environments: - conda create --name xr140 python xarray==0.14.0 ipython -y - conda create --name xr141 python xarray==0.14.1 ipython -y

The following works if you run all of it within the same environment. However, if you store it with xarray=0.14.0, and load it with xarray=0.14.1, then it fails.

```python import shelve import xarray as xr import numpy as np

data = xr.DataArray(data=np.arange(10), dims=["test"])

Store data

with shelve.open('test') as db: db['data'] = data

Load data

with shelve.open('test') as db: newdata = db['data']

np.allclose(data, newdata) ```

Expected Output

One should be able to load the pickle no matter what the version of xarray is.

Problem Description

Storing with xarray=0.14.0 and trying to load with xarray=0.14.1 results in the following output: ```


KeyError Traceback (most recent call last) ~/anaconda3/envs/xarray141/lib/python3.8/shelve.py in getitem(self, key) 110 try: --> 111 value = self.cache[key] 112 except KeyError:

KeyError: 'data'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) ~/anaconda3/envs/xarray141/lib/python3.8/site-packages/xarray/core/common.py in setattr(self, name, value) 261 try: --> 262 object.setattr(self, name, value) 263 except AttributeError as e:

AttributeError: 'DataArray' object has no attribute '_accessors'

The above exception was the direct cause of the following exception:

AttributeError Traceback (most recent call last) <ipython-input-1-f8dc3ae27b24> in <module> 5 # Load data 6 with shelve.open('test') as db: ----> 7 newdata = db['data'] 8

~/anaconda3/envs/xarray141/lib/python3.8/shelve.py in getitem(self, key) 112 except KeyError: 113 f = BytesIO(self.dict[key.encode(self.keyencoding)]) --> 114 value = Unpickler(f).load() 115 if self.writeback: 116 self.cache[key] = value

~/anaconda3/envs/xarray141/lib/python3.8/site-packages/xarray/core/common.py in setattr(self, name, value) 268 ): 269 raise --> 270 raise AttributeError( 271 "cannot set attribute %r on a %r object. Use setitem style" 272 "assignment (e.g., ds['name'] = ...) instead of assigning variables."

AttributeError: cannot set attribute '_accessors' on a 'DataArray' object. Use setitem styleassignment (e.g., ds['name'] = ...) instead of assigning variables. ```

Output of xr.show_versions()

The xr.show_versions() for the two environments are identical, except for the xarray versions.

INSTALLED VERSIONS ------------------ commit: None python: 3.8.1 (default, Jan 8 2020, 22:29:32) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-74-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 libhdf5: None libnetcdf: None xarray: 0.14.0 OR 0.14.1 pandas: 0.25.3 numpy: 1.17.4 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None setuptools: 44.0.0.post20200106 pip: 19.3.1 conda: None pytest: None IPython: 7.11.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3696/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 27.964ms · About: xarray-datasette