(self)
| 8343 | |
| 8344 | @requires_sparse |
| 8345 | def test_from_sparse(self) -> None: |
| 8346 | import sparse |
| 8347 | |
| 8348 | arr = np.diagflat([1, 2, 3]) |
| 8349 | sparr = sparse.COO.from_numpy(arr) |
| 8350 | ds = xr.Dataset( |
| 8351 | {"a": (["x", "y"], sparr)}, coords={"elev": (("x", "y"), sparr + 3)} |
| 8352 | ) |
| 8353 | |
| 8354 | expected = xr.Dataset( |
| 8355 | {"a": (["x", "y"], arr)}, coords={"elev": (("x", "y"), arr + 3)} |
| 8356 | ) |
| 8357 | assert_identical(ds.as_numpy(), expected) |
| 8358 | |
| 8359 | @requires_cupy |
| 8360 | def test_from_cupy(self) -> None: |
nothing calls this directly
no test coverage detected