(self)
| 2400 | reverse.resample(time=resample_freq).mean() |
| 2401 | |
| 2402 | def test_resample_and_first(self) -> None: |
| 2403 | times = pd.date_range("2000-01-01", freq="6h", periods=10) |
| 2404 | ds = Dataset( |
| 2405 | { |
| 2406 | "foo": (["time", "x", "y"], np.random.randn(10, 5, 3)), |
| 2407 | "bar": ("time", np.random.randn(10), {"meta": "data"}), |
| 2408 | "time": times, |
| 2409 | } |
| 2410 | ) |
| 2411 | |
| 2412 | actual = ds.resample(time="1D").first(keep_attrs=True) |
| 2413 | expected = ds.isel(time=[0, 4, 8]) |
| 2414 | assert_identical(expected, actual) |
| 2415 | |
| 2416 | # upsampling |
| 2417 | expected_time = pd.date_range("2000-01-01", freq="3h", periods=19) |
| 2418 | expected = ds.reindex(time=expected_time) |
| 2419 | rs = ds.resample(time="3h") |
| 2420 | for how in ["mean", "sum", "first", "last"]: |
| 2421 | method = getattr(rs, how) |
| 2422 | result = method() |
| 2423 | assert_equal(expected, result) |
| 2424 | for method in [np.mean]: |
| 2425 | result = rs.reduce(method) |
| 2426 | assert_equal(expected, result) |
| 2427 | |
| 2428 | def test_resample_min_count(self) -> None: |
| 2429 | times = pd.date_range("2000-01-01", freq="6h", periods=10) |
nothing calls this directly
no test coverage detected