(self)
| 2907 | assert_identical(expected_y2, y2) |
| 2908 | |
| 2909 | def test_broadcast_misaligned(self) -> None: |
| 2910 | x = Dataset({"foo": DataArray([1, 2, 3], coords=[("x", [-1, -2, -3])])}) |
| 2911 | y = Dataset( |
| 2912 | { |
| 2913 | "bar": DataArray( |
| 2914 | [[1, 2], [3, 4]], |
| 2915 | dims=["y", "x"], |
| 2916 | coords={"y": [1, 2], "x": [10, -3]}, |
| 2917 | ) |
| 2918 | } |
| 2919 | ) |
| 2920 | x2, y2 = broadcast(x, y) |
| 2921 | expected_x2 = Dataset( |
| 2922 | { |
| 2923 | "foo": DataArray( |
| 2924 | [[3, 3], [2, 2], [1, 1], [np.nan, np.nan]], |
| 2925 | dims=["x", "y"], |
| 2926 | coords={"y": [1, 2], "x": [-3, -2, -1, 10]}, |
| 2927 | ) |
| 2928 | } |
| 2929 | ) |
| 2930 | expected_y2 = Dataset( |
| 2931 | { |
| 2932 | "bar": DataArray( |
| 2933 | [[2, 4], [np.nan, np.nan], [np.nan, np.nan], [1, 3]], |
| 2934 | dims=["x", "y"], |
| 2935 | coords={"y": [1, 2], "x": [-3, -2, -1, 10]}, |
| 2936 | ) |
| 2937 | } |
| 2938 | ) |
| 2939 | assert_identical(expected_x2, x2) |
| 2940 | assert_identical(expected_y2, y2) |
| 2941 | |
| 2942 | def test_broadcast_multi_index(self) -> None: |
| 2943 | # GH6430 |
nothing calls this directly
no test coverage detected