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-706937046,https://api.github.com/repos/pydata/xarray/issues/4484,706937046,MDEyOklzc3VlQ29tbWVudDcwNjkzNzA0Ng==,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}",,714228717
https://github.com/pydata/xarray/pull/4484#issuecomment-705066436,https://api.github.com/repos/pydata/xarray/issues/4484,705066436,MDEyOklzc3VlQ29tbWVudDcwNTA2NjQzNg==,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}",,714228717
https://github.com/pydata/xarray/pull/4484#issuecomment-704037491,https://api.github.com/repos/pydata/xarray/issues/4484,704037491,MDEyOklzc3VlQ29tbWVudDcwNDAzNzQ5MQ==,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}",,714228717