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-218513335,https://api.github.com/repos/pydata/xarray/issues/422,218513335,MDEyOklzc3VlQ29tbWVudDIxODUxMzMzNQ==,2443309,2016-05-11T16:26:55Z,2016-05-11T16:26:55Z,MEMBER,"@mathause -
I would think you want the latter (`da.weighted(weight).mean(dim='time')`). `weighted` should handle the brodcasting of `weight` such that you could do this:
``` Python
>>> da.shape
(72, 10, 15)
>>> da.dims
('time', 'x', 'y')
>>> weights = some_func_of_time(time)
>>> da.weighted(weights).mean(dim=('time', 'x'))
...
```
","{""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-218358372,https://api.github.com/repos/pydata/xarray/issues/422,218358372,MDEyOklzc3VlQ29tbWVudDIxODM1ODM3Mg==,2443309,2016-05-11T04:24:05Z,2016-05-11T04:24:05Z,MEMBER,"@MaximilianR has suggested a `groupby`/`rolling`-like interface to weighted reductions.
``` Python
da.weighted(weights=ds.dim).mean()
# or maybe
da.weighted(time=days_per_month(da.time)).mean()
```
I really like this idea, as does @shoyer. I'm going to close my PR in hopes of this becoming reality.
","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,84127296