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

Function test_gappy_resample_reductions

xarray/tests/test_groupby.py:3170–3189  ·  view source on GitHub ↗
(reduction)

Source from the content-addressed store, hash-verified

3168@requires_flox_0_9_12
3169@pytest.mark.parametrize("reduction", ["any", "all", "count"])
3170def test_gappy_resample_reductions(reduction):
3171 # GH8090
3172 dates = (("1988-12-01", "1990-11-30"), ("2000-12-01", "2001-11-30"))
3173 times = [xr.date_range(*d, freq="D") for d in dates]
3174
3175 da = xr.concat(
3176 [
3177 xr.DataArray(np.random.rand(len(t)), coords={"time": t}, dims="time")
3178 for t in times
3179 ],
3180 dim="time",
3181 ).chunk(time=100)
3182
3183 rs = (da > 0.5).resample(time="YS-DEC")
3184 method = getattr(rs, reduction)
3185 with xr.set_options(use_flox=True):
3186 actual = method(dim="time")
3187 with xr.set_options(use_flox=False):
3188 expected = method(dim="time")
3189 assert_identical(expected, actual)
3190
3191
3192def test_groupby_transpose() -> None:

Callers

nothing calls this directly

Calls 5

assert_identicalFunction · 0.90
methodClass · 0.85
chunkMethod · 0.45
concatMethod · 0.45
resampleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…