home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 788534915 and user = 10194086 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

  • mathause · 4 ✖

issue 1

  • combine_by_coords can succed when it shouldn't · 4 ✖

author_association 1

  • MEMBER 4
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
841244252 https://github.com/pydata/xarray/issues/4824#issuecomment-841244252 https://api.github.com/repos/pydata/xarray/issues/4824 MDEyOklzc3VlQ29tbWVudDg0MTI0NDI1Mg== mathause 10194086 2021-05-14T13:28:50Z 2021-05-14T13:28:50Z MEMBER

I add the example from https://github.com/pydata/xarray/pull/4753#discussion_r631399543 here. I am not 100% if that is the same problem or not:

```python def combine_by_coords_problem(name, join="override"):

ds0 = xr.Dataset(coords={"x1": [1, 2, 3], name: [10, 20, 30]})
ds1 = xr.Dataset(coords={"x1": [4, 5, 6], name: [40, 50, 60]})

return xr.combine_by_coords([ds0, ds1], join=join)

combine_by_coords_problem("x0") # concatenates 1, 2, 3, 4, 5, 6 combine_by_coords_problem("x2") # concatenates 10, 20, 30, 40, 50, 60 ```

with join= - "exact": error - "left", "right", "inner", "override": ambiguous result - "outer": sensible result

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  combine_by_coords can succed when it shouldn't 788534915
811309154 https://github.com/pydata/xarray/issues/4824#issuecomment-811309154 https://api.github.com/repos/pydata/xarray/issues/4824 MDEyOklzc3VlQ29tbWVudDgxMTMwOTE1NA== mathause 10194086 2021-03-31T18:24:19Z 2021-03-31T18:24:19Z MEMBER

But then it also overrides when it should concatenate...

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

data = np.arange(5).reshape(1, 5) x = np.arange(5) x_name = "lat"

da0 = xr.DataArray(data, dims=("t", x_name), coords={"t": [1], x_name: x}).to_dataset(name="a") x = x + 5 da1 = xr.DataArray(data, dims=("t", x_name), coords={"t": [2], x_name: x}).to_dataset(name="a") ds = xr.combine_by_coords((da0, da1), join="override")

outpython <xarray.Dataset> Dimensions: (lat: 5, t: 2) Coordinates: * lat (lat) int64 0 1 2 3 4 * t (t) int64 1 2 Data variables: a (t, lat) int64 0 1 2 3 4 0 1 2 3 4 ```

Again if we set x_name = "y" the following is returned:

```python <xarray.Dataset> Dimensions: (t: 1, y: 10) Coordinates: * t (t) int64 1 * y (y) int64 0 1 2 3 4 5 6 7 8 9 Data variables: a (t, y) int64 0 1 2 3 4 0 1 2 3 4

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  combine_by_coords can succed when it shouldn't 788534915
771530648 https://github.com/pydata/xarray/issues/4824#issuecomment-771530648 https://api.github.com/repos/pydata/xarray/issues/4824 MDEyOklzc3VlQ29tbWVudDc3MTUzMDY0OA== mathause 10194086 2021-02-02T10:19:21Z 2021-02-02T10:19:21Z MEMBER

Thanks for the thorough answer! Thus, we need to figure out if there is a "bug" in merge or if this has to be soved in combine_by_coords.

Disallowing "ragged hypercubes" certainly makes the problem much easier. Then we can say: "if two coords have the same start they need to be equal" (I think).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  combine_by_coords can succed when it shouldn't 788534915
770848655 https://github.com/pydata/xarray/issues/4824#issuecomment-770848655 https://api.github.com/repos/pydata/xarray/issues/4824 MDEyOklzc3VlQ29tbWVudDc3MDg0ODY1NQ== mathause 10194086 2021-02-01T13:15:18Z 2021-02-01T13:15:18Z MEMBER

combine_by_coords does a merge and a concat (in the _combine_1d function). The order of these operations makes a difference to the result. See details.

merge leads to interlaced coords ```python In [2]: xr.merge([da0, da1]) Out[2]: <xarray.Dataset> Dimensions: (lat: 10, t: 2) Coordinates: * lat (lat) float64 0.0 1e-06 1.0 1.0 2.0 2.0 3.0 3.0 4.0 4.0 * t (t) int64 1 2 Data variables: a (t, lat) float64 0.0 nan 1.0 nan 2.0 nan ... 2.0 nan 3.0 nan 4.0 ``` concat leads to - well - concatenated coords ```python xr.concat([da0, da1], dim="lat") Out[5]: <xarray.Dataset> Dimensions: (lat: 10, t: 2) Coordinates: * t (t) int64 1 2 * lat (lat) float64 0.0 1.0 2.0 3.0 4.0 1e-06 1.0 2.0 3.0 4.0 Data variables: a (t, lat) float64 0.0 1.0 2.0 3.0 4.0 nan ... 0.0 1.0 2.0 3.0 4.0 ```

Yes I think I'd be interested to fix this...


One question on the scope of combine_by_coords - consider the following example with 4 arrays ("a" through "d") arranged as follows:

aabbb cccdd

Or as Dataset:

```python ds_a = xr.Dataset({"data": (("y", "x"), [[1, 2]]), "x": [0, 1], "y": [0]}) ds_b = xr.Dataset({"data": (("y", "x"), [[3, 4, 5]]), "x": [2, 3, 4], "y": [0]})

ds_c = xr.Dataset({"data": (("y", "x"), [[11, 12, 14]]), "x": [0, 1, 2], "y": [1]}) ds_d = xr.Dataset({"data": (("y", "x"), [[14, 15]]), "x": [3, 4], "y": [1]})

xr.combine_by_coords([ds_a, ds_b, ds_c, ds_d]).data ```

Should that work or not?

Current behaviour

Currently it yields the following:

python <xarray.DataArray 'data' (y: 2, x: 5)> array([[ 1, 2, 3, 4, 5], [11, 12, 14, 14, 15]]) Coordinates: * x (x) int64 0 1 2 3 4 * y (y) int64 0 1

However, if "x" is renamed to "z" it fails ("resulting coords not monotonic").

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  combine_by_coords can succed when it shouldn't 788534915

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 1036.838ms · About: xarray-datasette