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/pull/4484#issuecomment-705078481,https://api.github.com/repos/pydata/xarray/issues/4484,705078481,MDEyOklzc3VlQ29tbWVudDcwNTA3ODQ4MQ==,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}",,714228717 https://github.com/pydata/xarray/pull/4484#issuecomment-704647248,https://api.github.com/repos/pydata/xarray/issues/4484,704647248,MDEyOklzc3VlQ29tbWVudDcwNDY0NzI0OA==,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}",,714228717 https://github.com/pydata/xarray/pull/4484#issuecomment-704632636,https://api.github.com/repos/pydata/xarray/issues/4484,704632636,MDEyOklzc3VlQ29tbWVudDcwNDYzMjYzNg==,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 `DataArray`s? 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 `DataArray`s 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 `DataArray`s & `Dataset`s 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}",,714228717 https://github.com/pydata/xarray/pull/4484#issuecomment-704033519,https://api.github.com/repos/pydata/xarray/issues/4484,704033519,MDEyOklzc3VlQ29tbWVudDcwNDAzMzUxOQ==,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}",,714228717 https://github.com/pydata/xarray/pull/4484#issuecomment-704031645,https://api.github.com/repos/pydata/xarray/issues/4484,704031645,MDEyOklzc3VlQ29tbWVudDcwNDAzMTY0NQ==,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}",,714228717 https://github.com/pydata/xarray/pull/4484#issuecomment-703962448,https://api.github.com/repos/pydata/xarray/issues/4484,703962448,MDEyOklzc3VlQ29tbWVudDcwMzk2MjQ0OA==,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}",,714228717