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/5390#issuecomment-850650732,https://api.github.com/repos/pydata/xarray/issues/5390,850650732,MDEyOklzc3VlQ29tbWVudDg1MDY1MDczMg==,2448579,2021-05-28T20:19:56Z,2021-05-28T20:20:52Z,MEMBER,"``` python
# 3. Detrend along the given dim
# 4. Compute covariance along the given dim
# N.B. `skipna=False` is required or there is a bug when computing
# auto-covariance. E.g. Try xr.cov(da,da) for
# da = xr.DataArray([[1, 2], [1, np.nan]], dims=[""x"", ""time""])
def _mean(da):
return da.sum(dim=dim, skipna=True, min_count=1) / (valid_count)
cov = _mean(da_a * da_b) - _mean(da_a.mean(dim=dim) * da_b.mean(dim=dim))
```
This second term looks very weird to me, it should be a no-op
``` python
_mean(da_a.mean(dim=dim) * da_b.mean(dim=dim))
```
is it just
```
cov = _mean(da_a * da_b) - da_a.mean(dim=dim) * da_b.mean(dim=dim)
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,904153867
https://github.com/pydata/xarray/pull/5390#issuecomment-850535282,https://api.github.com/repos/pydata/xarray/issues/5390,850535282,MDEyOklzc3VlQ29tbWVudDg1MDUzNTI4Mg==,2448579,2021-05-28T16:31:36Z,2021-05-28T16:31:36Z,MEMBER,"@AndrewWilliams3142 I think that's right. You can confirm these ideas by profiling a test problem: https://docs.dask.org/en/latest/diagnostics-local.html#example
It does seem like with the new version dask will hold on on to `da_a*da_b` for a while, which is an improvement over holding `da_a` and `da_b` separately for a while","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,904153867