(self, dtype)
| 3661 | |
| 3662 | @pytest.mark.skip(reason="indexes don't support units") |
| 3663 | def test_to_unstacked_dataset(self, dtype): |
| 3664 | array = ( |
| 3665 | np.linspace(0, 10, 5 * 10).reshape(5, 10).astype(dtype) |
| 3666 | * unit_registry.pascal |
| 3667 | ) |
| 3668 | x = np.arange(array.shape[0]) * unit_registry.m |
| 3669 | y = np.arange(array.shape[1]) * unit_registry.s |
| 3670 | |
| 3671 | data_array = xr.DataArray( |
| 3672 | data=array, coords={"x": x, "y": y}, dims=("x", "y") |
| 3673 | ).stack(z=("x", "y")) |
| 3674 | |
| 3675 | func = method("to_unstacked_dataset", dim="z") |
| 3676 | |
| 3677 | expected = attach_units( |
| 3678 | func(strip_units(data_array)), |
| 3679 | { |
| 3680 | "y": y.units, |
| 3681 | **dict(zip(x.magnitude, [array.units] * len(y), strict=True)), |
| 3682 | }, |
| 3683 | ).rename({elem.magnitude: elem for elem in x}) |
| 3684 | actual = func(data_array) |
| 3685 | |
| 3686 | assert_units_equal(expected, actual) |
| 3687 | assert_identical(expected, actual) |
| 3688 | |
| 3689 | @pytest.mark.parametrize( |
| 3690 | "func", |
nothing calls this directly
no test coverage detected