home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where author_association = "CONTRIBUTOR", issue = 911513701 and user = 31376402 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • caenrigen · 2 ✖

issue 1

  • bug or unclear definition of combine_attrs with xr.merge() · 2 ✖

author_association 1

  • CONTRIBUTOR · 2 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
872210975 https://github.com/pydata/xarray/issues/5436#issuecomment-872210975 https://api.github.com/repos/pydata/xarray/issues/5436 MDEyOklzc3VlQ29tbWVudDg3MjIxMDk3NQ== caenrigen 31376402 2021-07-01T12:37:52Z 2021-07-01T12:37:52Z CONTRIBUTOR

@keewis thank you for the reply

To fix this, I would vote for not using promote_attrs=True in merge (low confidence vote, though, I'm sure there was a reason for that). We could also try to allow specifying separate strategies for main object and variables, but that looks somewhat complicated (and I'm still not sure what syntax we could use for that).

Does this mean that my workaround is not fully working as I would like it to? (I want it to basically do nothing to the attrs)

Is it possible at the moment to pass promote_attrs=False to xr.merge()?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bug or unclear definition of combine_attrs with xr.merge() 911513701
871681764 https://github.com/pydata/xarray/issues/5436#issuecomment-871681764 https://api.github.com/repos/pydata/xarray/issues/5436 MDEyOklzc3VlQ29tbWVudDg3MTY4MTc2NA== caenrigen 31376402 2021-06-30T19:49:24Z 2021-06-30T19:49:24Z CONTRIBUTOR

Hey guys! First of all thank you for the work on maintaining this package 😃

I am running into the same issue and it is partially blocking an open-source package (used in experimental quantum computing) from adopting the latest version of xarray.

For our typical dataset this happens:

python import xarray as xr import numpy as np x0 = xr.DataArray(data=np.ones(5), name="x0", attrs={ 'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False}) y0 = xr.DataArray(data=np.ones(5), name="y0", attrs={ 'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True}) ds = xr.merge([x0, y0]) print(ds)

bash <xarray.Dataset> Dimensions: (dim_0: 5) Dimensions without coordinates: dim_0 Data variables: x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 Attributes: name: x long_name: X position units: m batched: False

As default behavior this is totally unexpected because the variables attributes have nothing to do with the dataset itself. I am just trying to put all my data in a single container. (Am i using the wrong function for this?)

And second, combine_attrs has no option for "do nothing" which was the behavior in xarray 0.17.0. I noticed the current master brach allows passing a function but not sure if that solves the problem. The "drop" option indeed acts in very weird way, I tried it in the hope that it will drop attrs on the resulting dataset instead of affecting the attributes of the variables.

My suggestion is to do nothing by default, i.e. combine_attrs = None, simply does not try to combine the attribute in any way.

I understand there might be cases where combining the attributes makes sense, so maybe my suggestion only applies when only DataArrays objects are merged into a Dataset (If i recall correctly the "what's new" list, this will be already enforced in 0.18.3).

Hope my use case helps this discussion.


In the meantime the workaround seems to be: combine_attrs = "override" (because it will not (?) affect the attributes of the variables) + and wipe attrs afterwards with dataset.attrs = dict():

python import xarray as xr import numpy as np x0 = xr.DataArray(data=np.ones(5), name="x0", attrs={ 'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False}) y0 = xr.DataArray(data=np.ones(5), name="y0", attrs={ 'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True}) ds = xr.merge([x0, y0]) ds.attrs = dict() print(ds) print("===") print(ds.x0)

```bash

<xarray.Dataset> Dimensions: (dim_0: 5) Dimensions without coordinates: dim_0 Data variables: x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0 === <xarray.DataArray 'x0' (dim_0: 5)> array([1., 1., 1., 1., 1.]) Dimensions without coordinates: dim_0 Attributes: name: x long_name: X position units: m batched: False ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  bug or unclear definition of combine_attrs with xr.merge() 911513701

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.206ms · About: xarray-datasette