MCPcopy Index your code
hub / github.com/pydata/xarray / test_dot_dataarray

Function test_dot_dataarray

xarray/tests/test_units.py:1499–1519  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

1497
1498
1499def 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
1522class TestVariable:

Callers

nothing calls this directly

Calls 7

assert_identicalFunction · 0.90
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
linspaceMethod · 0.80
dotMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…