MCPcopy
hub / github.com/pydata/xarray / test_groupby_bins_math

Function test_groupby_bins_math

xarray/tests/test_groupby.py:1108–1119  ·  view source on GitHub ↗
(groupby_method, args, indexed_coord)

Source from the content-addressed store, hash-verified

1106 ),
1107)
1108def test_groupby_bins_math(groupby_method, args, indexed_coord) -> None:
1109 N = 7
1110 da = DataArray(np.random.random((N, N)), dims=("x", "y"))
1111 if indexed_coord:
1112 da["x"] = np.arange(N)
1113 da["y"] = np.arange(N)
1114
1115 g = getattr(da, groupby_method)(*args)
1116 mean = g.mean()
1117 expected = da.isel(x=slice(1, None)) - mean.isel(x_bins=("x", [0, 0, 0, 1, 1, 1]))
1118 actual = g - mean
1119 assert_identical(expected, actual)
1120
1121
1122def test_groupby_math_nD_group() -> None:

Callers

nothing calls this directly

Calls 6

iselMethod · 0.95
DataArrayClass · 0.90
assert_identicalFunction · 0.90
arangeMethod · 0.80
meanMethod · 0.45
iselMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…