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

Method test_interpolate_na

xarray/tests/test_units.py:2941–2954  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2939
2940 @pytest.mark.xfail(reason="uses numpy.vectorize")
2941 def test_interpolate_na(self):
2942 array = (
2943 np.array([-1.03, 0.1, 1.4, np.nan, 2.3, np.nan, np.nan, 9.1])
2944 * unit_registry.m
2945 )
2946 x = np.arange(len(array))
2947 data_array = xr.DataArray(data=array, coords={"x": x}, dims="x")
2948
2949 units = extract_units(data_array)
2950 expected = attach_units(strip_units(data_array).interpolate_na(dim="x"), units)
2951 actual = data_array.interpolate_na(dim="x")
2952
2953 assert_units_equal(expected, actual)
2954 assert_identical(expected, actual)
2955
2956 @pytest.mark.parametrize(
2957 "unit,error",

Callers

nothing calls this directly

Calls 8

interpolate_naMethod · 0.95
assert_identicalFunction · 0.90
extract_unitsFunction · 0.85
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
arangeMethod · 0.80
interpolate_naMethod · 0.45

Tested by

no test coverage detected