home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 633299554

This data as json

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-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
Powered by Datasette · Queries took 1.532ms · About: xarray-datasette