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/4089#issuecomment-633922774,https://api.github.com/repos/pydata/xarray/issues/4089,633922774,MDEyOklzc3VlQ29tbWVudDYzMzkyMjc3NA==,14808389,2020-05-26T09:43:29Z,2020-05-26T09:43:29Z,MEMBER,thanks. Do you want to put in a PR fixing that?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633651803,https://api.github.com/repos/pydata/xarray/issues/4089,633651803,MDEyOklzc3VlQ29tbWVudDYzMzY1MTgwMw==,5635139,2020-05-25T16:55:26Z,2020-05-25T16:55:26Z,MEMBER,"Awesome @AndrewWilliams3142 ! Very excited we have this. Thanks for the review @mathause Hitting merge; any other feedback is welcome and we can iterate. ","{""total_count"": 3, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 2, ""rocket"": 1, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633590099,https://api.github.com/repos/pydata/xarray/issues/4089,633590099,MDEyOklzc3VlQ29tbWVudDYzMzU5MDA5OQ==,10194086,2020-05-25T14:08:35Z,2020-05-25T14:08:35Z,MEMBER,"If you insist ;) ``` da_a -= da_a.mean(dim=dim) ``` is indeed marginally faster. As they are already aligned, we don't have to worry about this.","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633449839,https://api.github.com/repos/pydata/xarray/issues/4089,633449839,MDEyOklzc3VlQ29tbWVudDYzMzQ0OTgzOQ==,10194086,2020-05-25T08:29:22Z,2020-05-25T08:29:22Z,MEMBER,"Could you also add a test for the `TypeError`? ```python with raises_regex(TypeError, ""Only xr.DataArray is supported""): xr.corr(xr.Dataset(), xr.Dataset()) ``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633393615,https://api.github.com/repos/pydata/xarray/issues/4089,633393615,MDEyOklzc3VlQ29tbWVudDYzMzM5MzYxNQ==,5635139,2020-05-25T06:03:24Z,2020-05-25T06:03:24Z,MEMBER,"This looks great! I think it's fine to have a simple implementation like this, even if it's not perfectly efficient. Well done for getting something working @AndrewWilliams3142 . For the future: let's move away from using `np.random` in docstrings, since they're not reproducible, and will never pass a doctest. Anything remaining before merging?","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633310925,https://api.github.com/repos/pydata/xarray/issues/4089,633310925,MDEyOklzc3VlQ29tbWVudDYzMzMxMDkyNQ==,14808389,2020-05-24T22:38:54Z,2020-05-24T22:38:54Z,MEMBER,"no worries about `hypothesis`, that's something we can add in a new PR. Also, I don't think there is a `hypothesis.extra.xarray` module, yet. Any comments on that, @Zac-HD?","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633299554,https://api.github.com/repos/pydata/xarray/issues/4089,633299554,MDEyOklzc3VlQ29tbWVudDYzMzI5OTU1NA==,10194086,2020-05-24T21:04:03Z,2020-05-24T21:04:03Z,MEMBER,"Currently `corr` needs to sanitize the inputs twice, which will be inefficient. One way around this is to define an internal method which can do both, depending on a `method` keyword (no need to write extra tests for this IMHO): ```python def corr(da_a, da_b, dim=None, ddof=0): return _cov_corr(da_a, da_b, dim=None, ddof=0, method=""corr"") def cov(da_a, da_b, dim=None, ddof=0): return _cov_corr(da_a, da_b, dim=None, ddof=0, method=""cov"") def _cov_corr(da_a, da_b, dim=None, ddof=0, method=None): # compute cov if method = ""cov"": return cov # compute corr return corr ``` Maybe you could use `xr.apply_ufunc` instead of looping in the tests (might be overkill).","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213 https://github.com/pydata/xarray/pull/4089#issuecomment-633216248,https://api.github.com/repos/pydata/xarray/issues/4089,633216248,MDEyOklzc3VlQ29tbWVudDYzMzIxNjI0OA==,14808389,2020-05-24T11:22:42Z,2020-05-24T12:09:51Z,MEMBER,"If you want to test individual values without reimplementing the function in the tests (which is what I suspect comparing with the result of `np.cov` would require), that might be the only way. If not, you could also check properties of covariance / correlation matrices, e.g. that `assert_allclose(xr.cov(a, b) / (a.std() * b.std()), xr.corr(a, b))` (I'm not sure if I remember that formula correctly) or that the diagonal of the auto-covariance matrix is the same as the variance of the array (with a 1D vector, not sure about more dimensions). If you decide to test using properties, you could also extend our small collection of tests using `hypothesis` (see #1846).","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,623751213