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/3575#issuecomment-594340481,https://api.github.com/repos/pydata/xarray/issues/3575,594340481,MDEyOklzc3VlQ29tbWVudDU5NDM0MDQ4MQ==,2448579,2020-03-04T05:51:37Z,2020-03-04T05:51:37Z,MEMBER,"With #3816, this becomes
```
import xarray as xr
ds = xr.tutorial.load_dataset('rasm').chunk({'y': 20})
def calculate_anomaly(ds):
gb = ds.groupby(""time.month"")
clim = gb.mean(dim='time')
return gb - clim
# the result looks like ds, so pass that as template
xr.map_blocks(calculate_anomaly, ds, template=ds)
```
@rabernat How does this look to you?","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,528884925
https://github.com/pydata/xarray/issues/3575#issuecomment-558779222,https://api.github.com/repos/pydata/xarray/issues/3575,558779222,MDEyOklzc3VlQ29tbWVudDU1ODc3OTIyMg==,2448579,2019-11-26T19:19:25Z,2019-11-26T19:19:25Z,MEMBER,"> +1, for the Dataset case, this would require some sort of dtype/shape schema though.
This is why I didn't do it for the first pass","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,528884925
https://github.com/pydata/xarray/issues/3575#issuecomment-558758173,https://api.github.com/repos/pydata/xarray/issues/3575,558758173,MDEyOklzc3VlQ29tbWVudDU1ODc1ODE3Mw==,2448579,2019-11-26T18:25:00Z,2019-11-26T18:25:00Z,MEMBER,"> p.s. In this case the default assumption, that the output would be the same shape and dtype as the input, would have been fine.
I've been sticking this at the top when necessary:
``` python
if sum(ds.shape) == 0:
return ds
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,528884925