home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 714228717 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 5

  • shoyer 3
  • kefirbandi 3
  • max-sixty 2
  • dcherian 1
  • pep8speaks 1

author_association 3

  • MEMBER 6
  • CONTRIBUTOR 3
  • NONE 1

issue 1

  • xarray.map · 10 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
706937046 https://github.com/pydata/xarray/pull/4484#issuecomment-706937046 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNjkzNzA0Ng== kefirbandi 1277781 2020-10-12T07:36:34Z 2020-10-12T07:36:34Z CONTRIBUTOR

If we're doing to do this, I would suggest that the right signature is xarray.map(func, *datasets, **optional_kwargs), matching Python's builtin map.

What I'd like to ensure is a clean separation between the arguments of xarray.map and func. Map has three "own" parameters, like func, datasets and keep_attrs. By using the **kwargs approach we are excluding these parameter names from func. Not saying that is likely that anyone would apply a function with such parameter names. But not impossible either. Also having a real dict for keyword args (and maybe a list for positional arguments of func) is more explicit.

In my implementation the order of parameters is datasets and then func to match that of Dataset.map with the implicit self. But probably func and then the datasets is more intuitive.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
705078481 https://github.com/pydata/xarray/pull/4484#issuecomment-705078481 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNTA3ODQ4MQ== shoyer 1217238 2020-10-07T17:17:48Z 2020-10-07T17:17:48Z MEMBER

I think some version of xarray.map could indeed be pretty useful more generally. In particular, it could implement each of the ways to "align" variables between different datasets, e.g., should we use the intersection of the variables, or the union, inserting dummy variables with fill values? The dataset_join argument to xarray.apply_ufunc controls this behavior, but it would be nice to have a self-contained version of this.

One challenge for using this internally in xarray (vs. implementing things only on Dataset objects) is that the coordinates on the DataArray objects inside a Dataset can be redundant, so mapping over DataArrays may be less efficient, due to duplicate work on coordinates. In contrast, once everything is in Dataset objects, all the variables/coordinates are pre-aligned and de-deduplicated.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
705066436 https://github.com/pydata/xarray/pull/4484#issuecomment-705066436 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNTA2NjQzNg== kefirbandi 1277781 2020-10-07T16:56:04Z 2020-10-07T16:56:04Z CONTRIBUTOR
* Are there many other cases outside of `xr.dot` which only operate on `DataArray`s? If not, we could update that function to take a `Dataset`

I think it would be a good idea to extend dot to Datasets. However a user may wish to map a custom DataArray function to Dataset.

* Maybe jumping ahead — are there functions where the result of `func(ds1, ds2)` shouldn't be that function mapped over the matching variables?

Not sure of the context of this. In the most general case one can certainly implement any function on ds1 and ds2. Or are you referring to the built-ins such as .dot?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
704647248 https://github.com/pydata/xarray/pull/4484#issuecomment-704647248 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNDY0NzI0OA== dcherian 2448579 2020-10-07T01:59:59Z 2020-10-07T01:59:59Z MEMBER

Are there many other cases outside of xr.dot which only operate on DataArrays? If not, we could update that function to take a Dataset

I think we should do this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
704632636 https://github.com/pydata/xarray/pull/4484#issuecomment-704632636 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNDYzMjYzNg== max-sixty 5635139 2020-10-07T01:05:37Z 2020-10-07T01:05:37Z MEMBER

The motivating use case was that I wanted to compute the dot-product of two DataSets (=all of their matching variables).

Thanks, that's a good case.

A couple of thoughts: - Are there many other cases outside of xr.dot which only operate on DataArrays? If not, we could update that function to take a Dataset - Along those lines, I wonder whether this becomes an underlying function — functions which currently operate only on DataArrays could have Dataset inputs run through this. - NB: In many of the computation functions, the logic runs the other way (we define the DataArray function to be the Dataset operation on a single-variable Dataset); having a more consistent way of doing this could make extending functions between DataArrays & Datasets easier. - Maybe jumping ahead — are there functions where the result of func(ds1, ds2) shouldn't be that function mapped over the matching variables?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
704037491 https://github.com/pydata/xarray/pull/4484#issuecomment-704037491 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNDAzNzQ5MQ== kefirbandi 1277781 2020-10-06T05:32:04Z 2020-10-06T05:32:04Z CONTRIBUTOR

Could I ask what the common use cases for this would be? If I understand correctly, running map(x, y, lambda x: x + y) is equivalent to x + y.

The motivating use case was that I wanted to compute the dot-product of two DataSets (=all of their matching variables). But in general any other function which is not as simple as x + y could be used here.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
704033519 https://github.com/pydata/xarray/pull/4484#issuecomment-704033519 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNDAzMzUxOQ== shoyer 1217238 2020-10-06T05:19:44Z 2020-10-06T05:19:44Z MEMBER

I think this could make sense as a generalization of Dataset.map. I would indeed be interested to hear more about the specific use cases that motivated this, though.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
704031645 https://github.com/pydata/xarray/pull/4484#issuecomment-704031645 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwNDAzMTY0NQ== shoyer 1217238 2020-10-06T05:13:29Z 2020-10-06T05:13:29Z MEMBER

If we're doing to do this, I would suggest that the right signature is xarray.map(func, *datasets, **optional_kwargs), matching Python's builtin map.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
703962448 https://github.com/pydata/xarray/pull/4484#issuecomment-703962448 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwMzk2MjQ0OA== max-sixty 5635139 2020-10-06T00:37:46Z 2020-10-06T00:37:46Z MEMBER

Hi @kefirbandi , thanks for the PR!

Could I ask what the common use cases for this would be? If I understand correctly, running map(x, y, lambda x: x + y) is equivalent to x + y.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717
703199290 https://github.com/pydata/xarray/pull/4484#issuecomment-703199290 https://api.github.com/repos/pydata/xarray/issues/4484 MDEyOklzc3VlQ29tbWVudDcwMzE5OTI5MA== pep8speaks 24736507 2020-10-04T04:11:38Z 2020-10-04T04:43:38Z NONE

Hello @kefirbandi! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2020-10-04 04:43:38 UTC
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.map 714228717

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