|
6 | 6 | xr = pytest.importorskip("xarray")
|
7 | 7 | # isort: on
|
8 | 8 |
|
9 |
| -from flox.xarray import rechunk_for_blockwise, resample_reduce, xarray_reduce |
| 9 | +from flox.xarray import rechunk_for_blockwise, xarray_reduce |
10 | 10 |
|
11 | 11 | from . import assert_equal, has_dask, raise_if_dask_computes, requires_dask
|
12 | 12 |
|
@@ -245,48 +245,6 @@ def test_xarray_reduce_errors():
|
245 | 245 | xarray_reduce(da, by.chunk(), func="mean")
|
246 | 246 |
|
247 | 247 |
|
248 |
| -@pytest.mark.parametrize("isdask", [True, False]) |
249 |
| -@pytest.mark.parametrize("dataarray", [True, False]) |
250 |
| -@pytest.mark.parametrize("chunklen", [27, 4 * 31 + 1, 4 * 31 + 20]) |
251 |
| -def test_xarray_resample(chunklen, isdask, dataarray, engine): |
252 |
| - if isdask: |
253 |
| - if not has_dask: |
254 |
| - pytest.skip() |
255 |
| - ds = xr.tutorial.open_dataset("air_temperature", chunks={"time": chunklen}) |
256 |
| - else: |
257 |
| - ds = xr.tutorial.open_dataset("air_temperature") |
258 |
| - |
259 |
| - if dataarray: |
260 |
| - ds = ds.air |
261 |
| - |
262 |
| - resampler = ds.resample(time="M") |
263 |
| - with pytest.warns(DeprecationWarning): |
264 |
| - actual = resample_reduce(resampler, "mean", engine=engine) |
265 |
| - expected = resampler.mean() |
266 |
| - xr.testing.assert_allclose(actual, expected) |
267 |
| - |
268 |
| - with xr.set_options(use_flox=True): |
269 |
| - actual = resampler.mean() |
270 |
| - xr.testing.assert_allclose(actual, expected) |
271 |
| - |
272 |
| - |
273 |
| -@requires_dask |
274 |
| -def test_xarray_resample_dataset_multiple_arrays(engine): |
275 |
| - # regression test for #35 |
276 |
| - times = pd.date_range("2000", periods=5) |
277 |
| - foo = xr.DataArray(range(5), dims=["time"], coords=[times], name="foo") |
278 |
| - bar = xr.DataArray(range(1, 6), dims=["time"], coords=[times], name="bar") |
279 |
| - ds = xr.merge([foo, bar]).chunk({"time": 4}) |
280 |
| - |
281 |
| - resampler = ds.resample(time="4D") |
282 |
| - # The separate computes are necessary here to force xarray |
283 |
| - # to compute all variables in result at the same time. |
284 |
| - expected = resampler.mean().compute() |
285 |
| - with pytest.warns(DeprecationWarning): |
286 |
| - result = resample_reduce(resampler, "mean", engine=engine).compute() |
287 |
| - xr.testing.assert_allclose(expected, result) |
288 |
| - |
289 |
| - |
290 | 248 | @requires_dask
|
291 | 249 | @pytest.mark.parametrize(
|
292 | 250 | "inchunks, expected",
|
@@ -439,20 +397,6 @@ def test_cache():
|
439 | 397 | assert len(cache.data) == 2
|
440 | 398 |
|
441 | 399 |
|
442 |
| -@pytest.mark.parametrize("use_cftime", [True, False]) |
443 |
| -@pytest.mark.parametrize("func", ["count", "mean"]) |
444 |
| -def test_datetime_array_reduce(use_cftime, func, engine): |
445 |
| - time = xr.DataArray( |
446 |
| - xr.date_range("2009-01-01", "2012-12-31", use_cftime=use_cftime), |
447 |
| - dims=("time",), |
448 |
| - name="time", |
449 |
| - ) |
450 |
| - expected = getattr(time.resample(time="YS"), func)() |
451 |
| - with pytest.warns(DeprecationWarning): |
452 |
| - actual = resample_reduce(time.resample(time="YS"), func=func, engine=engine) |
453 |
| - assert_equal(expected, actual) |
454 |
| - |
455 |
| - |
456 | 400 | @requires_dask
|
457 | 401 | @pytest.mark.parametrize("method", ["cohorts", "map-reduce"])
|
458 | 402 | def test_groupby_bins_indexed_coordinate(method):
|
|
0 commit comments