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

Method test_from_cupy

xarray/tests/test_dataarray.py:7575–7585  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7573
7574 @requires_cupy
7575 def test_from_cupy(self) -> None:
7576 import cupy as cp
7577
7578 arr = np.array([1, 2, 3])
7579 da = xr.DataArray(
7580 cp.array(arr), dims="x", coords={"lat": ("x", cp.array(arr + 3))}
7581 )
7582
7583 expected = xr.DataArray(arr, dims="x", coords={"lat": ("x", arr + 3)})
7584 assert_identical(da.as_numpy(), expected)
7585 np.testing.assert_equal(da.to_numpy(), arr)
7586
7587 @requires_dask
7588 @requires_pint

Callers

nothing calls this directly

Calls 3

as_numpyMethod · 0.95
to_numpyMethod · 0.95
assert_identicalFunction · 0.90

Tested by

no test coverage detected