home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "MEMBER" and issue = 144683276 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • shoyer 6
  • fmaussion 1

issue 1

  • Selection based on boolean DataArray · 7 ✖

author_association 1

  • MEMBER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
204499580 https://github.com/pydata/xarray/issues/811#issuecomment-204499580 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwNDQ5OTU4MA== shoyer 1217238 2016-04-01T18:13:52Z 2016-04-01T18:13:52Z MEMBER

Also, just for future reference usually we close feature requests when the corresponding PR has been merged :)

On Fri, Apr 1, 2016 at 11:04 AM, Phillip Wolfram notifications@github.com wrote:

Closed #811 https://github.com/pydata/xarray/issues/811.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/pydata/xarray/issues/811#event-611609243

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203691509 https://github.com/pydata/xarray/issues/811#issuecomment-203691509 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzY5MTUwOQ== shoyer 1217238 2016-03-31T00:08:39Z 2016-03-31T00:08:39Z MEMBER

If I'm understanding you correctly, the use case is to trim off all NA regions when using where for selection. If your mask is not perfectly rectangular, some values will still be replaced with NA.

A starting point would be something like this:

python def sel_where(data, mask): data, mask = xr.broadcast(xr.align(data, mask, join='left', copy=False)) # possibly not a good idea to expand mask to the full dimensions of the data indexes = tuple(mask.any(dim).values for dim in mask.dims) return data[indexes].where(mask[indexes])

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203678531 https://github.com/pydata/xarray/issues/811#issuecomment-203678531 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzY3ODUzMQ== shoyer 1217238 2016-03-30T23:18:32Z 2016-03-30T23:18:32Z MEMBER

I'm still not sure exactly what you mean by this "contraction" like behavior. Could you write this out in pseudo code?

This is pretty different from .sel and not in the way that reindex_like is different from reindex, so possibly another name would be appropriate.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203662498 https://github.com/pydata/xarray/issues/811#issuecomment-203662498 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzY2MjQ5OA== shoyer 1217238 2016-03-30T22:11:35Z 2016-03-30T22:11:35Z MEMBER

I would rather make a sel_like method for remapping acase.sel_like(idx) -> acase.sel(x=idx.x.values, y=idx.y.values). That would mirror the current reindex/reindex_like distinction, though reindex_like does solve many of these use cases.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203633885 https://github.com/pydata/xarray/issues/811#issuecomment-203633885 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzYzMzg4NQ== shoyer 1217238 2016-03-30T20:57:24Z 2016-03-30T20:57:24Z MEMBER

If acase and idx (a boolean) both have dimensions ('x', 'y'), what should acase.sel(idx) or acase[idx] do?

NumPy will return a 1D flattened array in this case. We could do that (with a MultiIndex) but that's not so useful in xarray.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203628130 https://github.com/pydata/xarray/issues/811#issuecomment-203628130 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzYyODEzMA== shoyer 1217238 2016-03-30T20:44:34Z 2016-03-30T20:44:34Z MEMBER

You can write acase.where(idx), but we don't support acase.sel(idx) because it's not clear what do to if idx has more than one dimension.

I suppose we could allow acase.sel(idx1, idx2, ...) if all the provided arguments are 1D.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276
203615938 https://github.com/pydata/xarray/issues/811#issuecomment-203615938 https://api.github.com/repos/pydata/xarray/issues/811 MDEyOklzc3VlQ29tbWVudDIwMzYxNTkzOA== fmaussion 10050469 2016-03-30T20:23:03Z 2016-03-30T20:23:03Z MEMBER

Should xarray indexing account for boolean values without resorting to a call to np.where?

as far as I know, it does:

python In [1]: import xarray as xr In [2]: import numpy as np In [3]: da = xr.DataArray(np.arange(10), coords={'time':np.arange(10)}) In [4]: da.sel(time=da.time > 4) Out[4]: <xarray.DataArray (time: 5)> array([5, 6, 7, 8, 9]) Coordinates: * time (time) int64 5 6 7 8 9

But according to the traceback it seems to have something to do with the shape or your array?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Selection based on boolean DataArray 144683276

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