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

Function test_mean_with_cftime_objects_dask

xarray/tests/test_groupby.py:3918–3937  ·  view source on GitHub ↗

Test mean with cftime objects using dask backend (issue #5897)

()

Source from the content-addressed store, hash-verified

3916@requires_dask
3917@requires_cftime
3918def test_mean_with_cftime_objects_dask():
3919 """Test mean with cftime objects using dask backend (issue #5897)"""
3920 ds = xr.Dataset(
3921 {
3922 "var1": (
3923 ("time",),
3924 xr.date_range("2021-10-31", periods=10, freq="D", use_cftime=True),
3925 ),
3926 "var2": (("x",), list(range(10))),
3927 }
3928 )
3929
3930 # Test with dask backend
3931 dsc = ds.chunk({})
3932 result_time_dask = dsc.mean("time")
3933 assert "var1" in result_time_dask.data_vars
3934
3935 result_x_dask = dsc.mean("x")
3936 assert "var2" in result_x_dask.data_vars
3937 assert result_x_dask.var2.compute().item() == 4.5
3938
3939
3940def test_groupby_bins_datetime_mean():

Callers

nothing calls this directly

Calls 3

chunkMethod · 0.95
meanMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…