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

Method test_from_numpy

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

Source from the content-addressed store, hash-verified

7516class TestNumpyCoercion:
7517 # TODO once flexible indexes refactor complete also test coercion of dimension coords
7518 def test_from_numpy(self) -> None:
7519 da = xr.DataArray([1, 2, 3], dims="x", coords={"lat": ("x", [4, 5, 6])})
7520
7521 assert_identical(da.as_numpy(), da)
7522 np.testing.assert_equal(da.to_numpy(), np.array([1, 2, 3]))
7523 np.testing.assert_equal(da["lat"].to_numpy(), np.array([4, 5, 6]))
7524
7525 def test_to_numpy(self) -> None:
7526 arr = np.array([1, 2, 3])

Callers

nothing calls this directly

Calls 4

as_numpyMethod · 0.95
to_numpyMethod · 0.95
assert_identicalFunction · 0.90
to_numpyMethod · 0.45

Tested by

no test coverage detected