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

Method test_resample

xarray/tests/test_units.py:3900–3913  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

3898 assert_allclose(expected, actual)
3899
3900 def test_resample(self, dtype):
3901 array = np.linspace(0, 5, 10).astype(dtype) * unit_registry.m
3902
3903 time = xr.date_range("10-09-2010", periods=len(array), freq="YE")
3904 data_array = xr.DataArray(data=array, coords={"time": time}, dims="time")
3905 units = extract_units(data_array)
3906
3907 func = method("resample", time="6ME")
3908
3909 expected = attach_units(func(strip_units(data_array)).mean(), units)
3910 actual = func(data_array).mean()
3911
3912 assert_units_equal(expected, actual)
3913 assert_identical(expected, actual)
3914
3915 @pytest.mark.parametrize("compute_backend", ["numbagg", None], indirect=True)
3916 @pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 10

assert_identicalFunction · 0.90
extract_unitsFunction · 0.85
methodClass · 0.85
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
linspaceMethod · 0.80
funcFunction · 0.70
astypeMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected