(dtype)
| 1497 | |
| 1498 | |
| 1499 | def test_dot_dataarray(dtype): |
| 1500 | array1 = ( |
| 1501 | np.linspace(0, 10, 5 * 10).reshape(5, 10).astype(dtype) |
| 1502 | * unit_registry.m |
| 1503 | / unit_registry.s |
| 1504 | ) |
| 1505 | array2 = ( |
| 1506 | np.linspace(10, 20, 10 * 20).reshape(10, 20).astype(dtype) * unit_registry.s |
| 1507 | ) |
| 1508 | |
| 1509 | data_array = xr.DataArray(data=array1, dims=("x", "y")) |
| 1510 | other = xr.DataArray(data=array2, dims=("y", "z")) |
| 1511 | |
| 1512 | with xr.set_options(use_opt_einsum=False): |
| 1513 | expected = attach_units( |
| 1514 | xr.dot(strip_units(data_array), strip_units(other)), {None: unit_registry.m} |
| 1515 | ) |
| 1516 | actual = xr.dot(data_array, other) |
| 1517 | |
| 1518 | assert_units_equal(expected, actual) |
| 1519 | assert_identical(expected, actual) |
| 1520 | |
| 1521 | |
| 1522 | class TestVariable: |
nothing calls this directly
no test coverage detected
searching dependent graphs…