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

Function test_datarray_1d_method

xarray/tests/test_sparse.py:562–572  ·  view source on GitHub ↗
(func, sparse_output)

Source from the content-addressed store, hash-verified

560 ],
561)
562def test_datarray_1d_method(func, sparse_output):
563 arr_s = make_xrarray({"x": 10}, coords={"x": np.arange(10)})
564 arr_d = xr.DataArray(arr_s.data.todense(), coords=arr_s.coords, dims=arr_s.dims)
565 ret_s = func(arr_s)
566 ret_d = func(arr_d)
567
568 if sparse_output:
569 assert isinstance(ret_s.data, sparse.SparseArray)
570 assert np.allclose(ret_s.data.todense(), ret_d.data, equal_nan=True)
571 else:
572 assert np.allclose(ret_s, ret_d, equal_nan=True)
573
574
575class TestSparseDataArrayAndDataset:

Callers

nothing calls this directly

Calls 4

make_xrarrayFunction · 0.85
arangeMethod · 0.80
funcFunction · 0.70
todenseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…