(self)
| 2614 | xr.align(left, right, join="exact") |
| 2615 | |
| 2616 | def test_align_override(self) -> None: |
| 2617 | left = xr.Dataset(coords={"x": [0, 1, 2]}) |
| 2618 | right = xr.Dataset(coords={"x": [0.1, 1.1, 2.1], "y": [1, 2, 3]}) |
| 2619 | expected_right = xr.Dataset(coords={"x": [0, 1, 2], "y": [1, 2, 3]}) |
| 2620 | |
| 2621 | new_left, new_right = xr.align(left, right, join="override") |
| 2622 | assert_identical(left, new_left) |
| 2623 | assert_identical(new_right, expected_right) |
| 2624 | |
| 2625 | new_left, new_right = xr.align(left, right, exclude="x", join="override") |
| 2626 | assert_identical(left, new_left) |
| 2627 | assert_identical(right, new_right) |
| 2628 | |
| 2629 | new_left, new_right = xr.align( |
| 2630 | left.isel(x=0, drop=True), right, exclude="x", join="override" |
| 2631 | ) |
| 2632 | assert_identical(left.isel(x=0, drop=True), new_left) |
| 2633 | assert_identical(right, new_right) |
| 2634 | |
| 2635 | with pytest.raises( |
| 2636 | ValueError, match=r"cannot align.*join.*override.*same size" |
| 2637 | ): |
| 2638 | xr.align(left.isel(x=0).expand_dims("x"), right, join="override") |
| 2639 | |
| 2640 | def test_align_exclude(self) -> None: |
| 2641 | x = Dataset( |
nothing calls this directly
no test coverage detected