MCPcopy Index your code
hub / github.com/pydata/xarray / np_cov

Function np_cov

xarray/tests/test_computation.py:1641–1653  ·  view source on GitHub ↗
(ts1, ts2)

Source from the content-addressed store, hash-verified

1639 else:
1640
1641 def np_cov(ts1, ts2):
1642 # Ensure the ts are aligned and missing values ignored
1643 ts1, ts2 = broadcast(ts1, ts2)
1644 valid_values = ts1.notnull() & ts2.notnull()
1645
1646 ts1 = ts1.where(valid_values)
1647 ts2 = ts2.where(valid_values)
1648
1649 return np.ma.cov(
1650 np.ma.masked_invalid(ts1.data.flatten()),
1651 np.ma.masked_invalid(ts2.data.flatten()),
1652 ddof=ddof,
1653 )[0, 1]
1654
1655 expected = np_cov(da_a, da_b)
1656 actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

Callers 1

test_covFunction · 0.85

Calls 4

broadcastFunction · 0.90
covMethod · 0.80
notnullMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…