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

Method test_pad_coords

xarray/tests/test_dataarray.py:4678–4705  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4676 ar.pad(x=1, constant_values=np.nan)
4677
4678 def test_pad_coords(self) -> None:
4679 ar = DataArray(
4680 np.arange(3 * 4 * 5).reshape(3, 4, 5),
4681 [("x", np.arange(3)), ("y", np.arange(4)), ("z", np.arange(5))],
4682 )
4683 actual = ar.pad(x=(1, 3), constant_values=1)
4684 expected = DataArray(
4685 np.pad(
4686 np.arange(3 * 4 * 5).reshape(3, 4, 5),
4687 mode="constant",
4688 pad_width=((1, 3), (0, 0), (0, 0)),
4689 constant_values=1,
4690 ),
4691 [
4692 (
4693 "x",
4694 np.pad(
4695 np.arange(3).astype(np.float32),
4696 mode="constant",
4697 pad_width=(1, 3),
4698 constant_values=np.nan,
4699 ),
4700 ),
4701 ("y", np.arange(4)),
4702 ("z", np.arange(5)),
4703 ],
4704 )
4705 assert_identical(actual, expected)
4706
4707 @pytest.mark.parametrize("mode", ("minimum", "maximum", "mean", "median"))
4708 @pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

padMethod · 0.95
DataArrayClass · 0.90
assert_identicalFunction · 0.90
arangeMethod · 0.80
padMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected