home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 231811609

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
231811609 MDU6SXNzdWUyMzE4MTE2MDk= 1429 Orthogonal indexing and MemoryCachedArray 10050469 closed 0     5 2017-05-27T16:20:18Z 2017-11-06T17:21:56Z 2017-11-06T17:21:56Z MEMBER      

While working on https://github.com/pydata/xarray/pull/1260 I came upon this which looks like a bug in caching:

```python import numpy as np import xarray as xr from xarray.core import indexing

nx, ny = 8, 10 data = np.arange(nx*ny).reshape(ny, nx) cached = indexing.MemoryCachedArray(data)

data = xr.DataArray(data=data, dims=('y', 'x')) cached = xr.DataArray(data=cached, dims=('y', 'x'))

a = data.isel(x=[2, 4], y=[3, 5]) b = cached.isel(x=[2, 4], y=[3, 5]) ``` The last line raises:

```

AssertionError Traceback (most recent call last) <ipython-input-13-45cd1493cf6b> in <module>() 11 12 a = data.isel(x=[2, 4], y=[3, 5]) ---> 13 b = cached.isel(x=[2, 4], y=[3, 5])

/home/mowglie/Documents/git/xarray/xarray/core/dataarray.py in isel(self, drop, indexers) 668 DataArray.sel 669 """ --> 670 ds = self._to_temp_dataset().isel(drop=drop, indexers) 671 return self._from_temp_dataset(ds) 672

/home/mowglie/Documents/git/xarray/xarray/core/dataset.py in isel(self, drop, indexers) 1141 for name, var in iteritems(self._variables): 1142 var_indexers = dict((k, v) for k, v in indexers if k in var.dims) -> 1143 new_var = var.isel(var_indexers) 1144 if not (drop and name in var_indexers): 1145 variables[name] = new_var

/home/mowglie/Documents/git/xarray/xarray/core/variable.py in isel(self, **indexers) 547 if dim in indexers: 548 key[i] = indexers[dim] --> 549 return self[tuple(key)] 550 551 def squeeze(self, dim=None):

/home/mowglie/Documents/git/xarray/xarray/core/variable.py in getitem(self, key) 380 # orthogonal indexing should ensure the dimensionality is consistent 381 if hasattr(values, 'ndim'): --> 382 assert values.ndim == len(dims), (values.ndim, len(dims)) 383 else: 384 assert len(dims) == 0, len(dims)

AssertionError: (1, 2) ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1429/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

  • 2 rows from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 0.761ms · About: xarray-datasette