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

Method test_resample_doctest

xarray/tests/test_groupby.py:1945–1970  ·  view source on GitHub ↗
(self, use_cftime: bool)

Source from the content-addressed store, hash-verified

1943 reverse.resample(time=resample_freq).mean()
1944
1945 def test_resample_doctest(self, use_cftime: bool) -> None:
1946 # run the doctest example here so we are not surprised
1947 da = xr.DataArray(
1948 np.array([1, 2, 3, 1, 2, np.nan]),
1949 dims="time",
1950 coords=dict(
1951 time=(
1952 "time",
1953 xr.date_range(
1954 "2001-01-01", freq="ME", periods=6, use_cftime=use_cftime
1955 ),
1956 ),
1957 labels=("time", np.array(["a", "b", "c", "c", "b", "a"])),
1958 ),
1959 )
1960 actual = da.resample(time="3ME").count()
1961 expected = DataArray(
1962 [1, 3, 1],
1963 dims="time",
1964 coords={
1965 "time": xr.date_range(
1966 "2001-01-01", freq="3ME", periods=3, use_cftime=use_cftime
1967 )
1968 },
1969 )
1970 assert_identical(actual, expected)
1971
1972 def test_da_resample_func_args(self) -> None:
1973 def func(arg1, arg2, arg3=0.0):

Callers

nothing calls this directly

Calls 4

resampleMethod · 0.95
DataArrayClass · 0.90
assert_identicalFunction · 0.90
countMethod · 0.45

Tested by

no test coverage detected