(self)
| 5263 | assert_identical(data, selected) |
| 5264 | |
| 5265 | def test_to_dataarray(self) -> None: |
| 5266 | ds = Dataset( |
| 5267 | {"a": 1, "b": ("x", [1, 2, 3])}, |
| 5268 | coords={"c": 42}, |
| 5269 | attrs={"Conventions": "None"}, |
| 5270 | ) |
| 5271 | data = [[1, 1, 1], [1, 2, 3]] |
| 5272 | coords = {"c": 42, "variable": ["a", "b"]} |
| 5273 | dims = ("variable", "x") |
| 5274 | expected = DataArray(data, coords, dims, attrs=ds.attrs) |
| 5275 | actual = ds.to_dataarray() |
| 5276 | assert_identical(expected, actual) |
| 5277 | |
| 5278 | actual = ds.to_dataarray("abc", name="foo") |
| 5279 | expected = expected.rename({"variable": "abc"}).rename("foo") |
| 5280 | assert_identical(expected, actual) |
| 5281 | |
| 5282 | def test_to_and_from_dataframe(self) -> None: |
| 5283 | x = np.random.randn(10) |
nothing calls this directly
no test coverage detected