home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 391166924

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2172#issuecomment-391166924 https://api.github.com/repos/pydata/xarray/issues/2172 391166924 MDEyOklzc3VlQ29tbWVudDM5MTE2NjkyNA== 1217238 2018-05-22T22:56:59Z 2018-05-22T22:56:59Z MEMBER

Thanks for the report. This is definitely a bug, calling dir() on an xarray object should never raise an error: ```python import numpy as np import xarray as xr

sample_data = np.random.uniform(size=[2,2000,10000]) x = xr.Dataset({"sample_data": (sample_data.shape, sample_data)}) x2 = x["sample_data"] dir(x2) Results in:python-traceback


TypeError Traceback (most recent call last) <ipython-input-2-39db0ce27e1d> in <module>() ----> 1 dir(x2)

/usr/local/lib/python3.6/dist-packages/xarray/core/common.py in dir(self) 195 """ 196 extra_attrs = [item --> 197 for sublist in self._attr_sources 198 for item in sublist 199 if isinstance(item, basestring)]

/usr/local/lib/python3.6/dist-packages/xarray/core/dataarray.py in _attr_sources(self) 494 def _attr_sources(self): 495 """List of places to look-up items for attribute-style access""" --> 496 return self._item_sources + [self.attrs] 497 498 @property

/usr/local/lib/python3.6/dist-packages/xarray/core/dataarray.py in _item_sources(self) 499 def _item_sources(self): 500 """List of places to look-up items for key-completion""" --> 501 return [self.coords, {d: self[d] for d in self.dims}, 502 LevelCoordinatesSource(self)] 503

/usr/local/lib/python3.6/dist-packages/xarray/core/dataarray.py in <dictcomp>(.0) 499 def _item_sources(self): 500 """List of places to look-up items for key-completion""" --> 501 return [self.coords, {d: self[d] for d in self.dims}, 502 LevelCoordinatesSource(self)] 503

/usr/local/lib/python3.6/dist-packages/xarray/core/dataarray.py in getitem(self, key) 471 else: 472 # xarray-style array indexing --> 473 return self.isel(**self._item_key_to_dict(key)) 474 475 def setitem(self, key, value):

TypeError: isel() keywords must be strings ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  325470877
Powered by Datasette · Queries took 0.604ms · About: xarray-datasette