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

Method test_missing_value_filling

xarray/tests/test_units.py:4268–4285  ·  view source on GitHub ↗
(self, func, dtype)

Source from the content-addressed store, hash-verified

4266 @pytest.mark.xfail(reason="ffill and bfill lose the unit")
4267 @pytest.mark.parametrize("func", (method("ffill"), method("bfill")), ids=repr)
4268 def test_missing_value_filling(self, func, dtype):
4269 array1 = (
4270 create_nan_array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1], dtype)
4271 * unit_registry.degK
4272 )
4273 array2 = (
4274 create_nan_array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan], dtype)
4275 * unit_registry.Pa
4276 )
4277
4278 ds = xr.Dataset({"a": ("x", array1), "b": ("y", array2)})
4279 units = extract_units(ds)
4280
4281 expected = attach_units(func(strip_units(ds), dim="x"), units)
4282 actual = func(ds, dim="x")
4283
4284 assert_units_equal(expected, actual)
4285 assert_equal(expected, actual)
4286
4287 @pytest.mark.parametrize(
4288 "unit,error",

Callers

nothing calls this directly

Calls 7

assert_equalFunction · 0.90
create_nan_arrayFunction · 0.85
extract_unitsFunction · 0.85
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
funcFunction · 0.70

Tested by

no test coverage detected