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/issues/422#issuecomment-218520080,https://api.github.com/repos/pydata/xarray/issues/422,218520080,MDEyOklzc3VlQ29tbWVudDIxODUyMDA4MA==,1217238,2016-05-11T16:51:10Z,2016-05-11T16:51:10Z,MEMBER,"Yes, +1 for `da.weighted(weight).mean(dim='time')`. The `mean` method on `weighted` should have the same arguments as the `mean` method on `DataArray` -- it's just changed due to the context.
> We may still end up implementing all required methods separately in weighted.
This is a fair point, I haven't looked in to the details of these implementations yet. But I expect there are still at least a few picks of logic that we will be able to share.
","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,84127296
https://github.com/pydata/xarray/issues/422#issuecomment-218360875,https://api.github.com/repos/pydata/xarray/issues/422,218360875,MDEyOklzc3VlQ29tbWVudDIxODM2MDg3NQ==,1217238,2016-05-11T04:47:46Z,2016-05-11T04:47:46Z,MEMBER,"I would suggest not using keyword arguments for `weighted`. Instead, just align based on the labels of the argument like regular xarray operations. So we'd write `da.weighted(days_per_month(da.time)).mean()`
","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,84127296
https://github.com/pydata/xarray/issues/422#issuecomment-140797623,https://api.github.com/repos/pydata/xarray/issues/422,140797623,MDEyOklzc3VlQ29tbWVudDE0MDc5NzYyMw==,1217238,2015-09-16T16:40:20Z,2015-09-16T16:40:20Z,MEMBER,"Possibly using where, e.g., `weights.where(self.notnull()).sum(dim)`.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,84127296
https://github.com/pydata/xarray/issues/422#issuecomment-108118570,https://api.github.com/repos/pydata/xarray/issues/422,108118570,MDEyOklzc3VlQ29tbWVudDEwODExODU3MA==,1217238,2015-06-02T22:41:22Z,2015-06-02T22:41:22Z,MEMBER,"Module error checking, etc., this would look something like:
``` python
def average(self, dim=None, weights=None):
if weights is None:
return self.mean(dim)
else:
return (self * weights).sum(dim) / weights.sum(dim)
```
This is pretty easy to do manually, but I can see the value in having the standard method around, so I'm definitely open to PRs to add this functionality.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,84127296