MCPcopy
hub / github.com/pydata/xarray / test_real_and_imag

Method test_real_and_imag

xarray/tests/test_variable.py:648–657  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

646 assert_array_equal(result.data, new_data)
647
648 def test_real_and_imag(self):
649 v = self.cls("x", np.arange(3) - 1j * np.arange(3), {"foo": "bar"})
650 expected_re = self.cls("x", np.arange(3), {"foo": "bar"})
651 assert_identical(v.real, expected_re)
652
653 expected_im = self.cls("x", -np.arange(3), {"foo": "bar"})
654 assert_identical(v.imag, expected_im)
655
656 expected_abs = self.cls("x", np.sqrt(2 * np.arange(3) ** 2)).to_base_variable()
657 assert_allclose(abs(v), expected_abs)
658
659 def test_aggregate_complex(self):
660 # should skip NaNs

Callers

nothing calls this directly

Calls 5

assert_identicalFunction · 0.90
assert_allcloseFunction · 0.90
arangeMethod · 0.80
to_base_variableMethod · 0.80
clsMethod · 0.45

Tested by

no test coverage detected