home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1200473092

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/6852#issuecomment-1200473092 https://api.github.com/repos/pydata/xarray/issues/6852 1200473092 IC_kwDOAMm_X85HjcQE 17813788 2022-07-31T18:11:12Z 2022-07-31T18:11:12Z NONE

keep_attrs=True doesn't help ```python In [1]: import xarray as xr In [2]: xr.set_options(keep_attrs=True) Out[2]: <xarray.core.options.set_options at 0x1789a959fa0> In [3]: da_withunits = xr.DataArray([1, 1, 1], coords={"frequency": [1, 2, 3]}) In [4]: da_withunits.frequency.attrs["units"] = "GHz" In [5]: da_withunits.frequency.units Out[5]: 'GHz' In [6]: da_withoutunits = xr.DataArray([1, 1, 1], coords={"frequency": [1, 2, 3]}) In [7]: da_withunits == da_withoutunits Out[7]: <xarray.DataArray (frequency: 3)> array([ True, True, True]) Coordinates: * frequency (frequency) int32 1 2 3

In [8]: da_withunits.frequency.units

AttributeError Traceback (most recent call last) Input In [8], in <cell line: 1>() ----> 1 da_withunits.frequency.units File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\xarray\core\common.py:256, in AttrAccessMixin.getattr(self, name) 254 with suppress(KeyError): 255 return source[name] --> 256 raise AttributeError( 257 f"{type(self).name!r} object has no attribute {name!r}" 258 ) AttributeError: 'DataArray' object has no attribute 'units' ```

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