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

Function test_dask_gradient

xarray/tests/test_duck_array_ops.py:807–818  ·  view source on GitHub ↗
(axis, edge_order)

Source from the content-addressed store, hash-verified

805@pytest.mark.parametrize("axis", [0, -1, 1])
806@pytest.mark.parametrize("edge_order", [1, 2])
807def test_dask_gradient(axis, edge_order):
808 import dask.array as da
809
810 array = np.array(np.random.randn(100, 5, 40))
811 x = np.exp(np.linspace(0, 1, array.shape[axis]))
812
813 darray = da.from_array(array, chunks=[(6, 30, 30, 20, 14), 5, 8])
814 expected = gradient(array, x, axis=axis, edge_order=edge_order)
815 actual = gradient(darray, x, axis=axis, edge_order=edge_order)
816
817 assert isinstance(actual, da.Array)
818 assert_array_equal(actual, expected)
819
820
821@pytest.mark.parametrize("dim_num", [1, 2])

Callers

nothing calls this directly

Calls 3

gradientFunction · 0.90
linspaceMethod · 0.80
from_arrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…