()
| 948 | |
| 949 | |
| 950 | def test_groupby_dataset_math() -> None: |
| 951 | def reorder_dims(x): |
| 952 | return x.transpose("dim1", "dim2", "dim3", "time") |
| 953 | |
| 954 | ds = create_test_data() |
| 955 | ds["dim1"] = ds["dim1"] |
| 956 | grouped = ds.groupby("dim1") |
| 957 | |
| 958 | expected = reorder_dims(ds + ds.coords["dim1"]) |
| 959 | actual = grouped + ds.coords["dim1"] |
| 960 | assert_identical(expected, reorder_dims(actual)) |
| 961 | |
| 962 | # Order matters for attrs - coord + grouped will not have attrs |
| 963 | # since coord has no attrs and binary ops keep attrs from first operand |
| 964 | expected_reversed = reorder_dims(ds.coords["dim1"] + ds) |
| 965 | actual = ds.coords["dim1"] + grouped |
| 966 | assert_identical(expected_reversed, reorder_dims(actual)) |
| 967 | |
| 968 | ds2 = 2 * ds |
| 969 | expected = reorder_dims(ds + ds2) |
| 970 | actual = grouped + ds2 |
| 971 | assert_identical(expected, reorder_dims(actual)) |
| 972 | |
| 973 | actual = ds2 + grouped |
| 974 | assert_identical(expected, reorder_dims(actual)) |
| 975 | |
| 976 | |
| 977 | def test_groupby_math_more() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…