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

Function test_cftime_resample_gh_9108

xarray/tests/test_groupby.py:2860–2872  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2858@requires_cftime
2859@pytest.mark.filterwarnings("ignore")
2860def test_cftime_resample_gh_9108() -> None:
2861 import cftime
2862
2863 ds = Dataset(
2864 {"pr": ("time", np.random.random((10,)))},
2865 coords={"time": xr.date_range("0001-01-01", periods=10, freq="D")},
2866 )
2867 actual = ds.resample(time="ME").mean()
2868 expected = ds.mean("time").expand_dims(
2869 time=[cftime.DatetimeGregorian(1, 1, 31, 0, 0, 0, 0, has_year_zero=False)]
2870 )
2871 assert actual.time.data[0].has_year_zero == ds.time.data[0].has_year_zero
2872 assert_equal(actual, expected)
2873
2874
2875def test_custom_grouper() -> None:

Callers

nothing calls this directly

Calls 5

resampleMethod · 0.95
DatasetClass · 0.90
assert_equalFunction · 0.90
meanMethod · 0.45
expand_dimsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…