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

Method test_interpolate_na

xarray/tests/test_units.py:4454–4473  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

4452
4453 @pytest.mark.xfail(reason="interpolate_na uses numpy.vectorize")
4454 def test_interpolate_na(self, dtype):
4455 array1 = (
4456 create_nan_array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1], dtype)
4457 * unit_registry.degK
4458 )
4459 array2 = (
4460 create_nan_array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan], dtype)
4461 * unit_registry.Pa
4462 )
4463 ds = xr.Dataset({"a": ("x", array1), "b": ("x", array2)})
4464 units = extract_units(ds)
4465
4466 expected = attach_units(
4467 strip_units(ds).interpolate_na(dim="x"),
4468 units,
4469 )
4470 actual = ds.interpolate_na(dim="x")
4471
4472 assert_units_equal(expected, actual)
4473 assert_equal(expected, actual)
4474
4475 @pytest.mark.parametrize(
4476 "unit,error",

Callers

nothing calls this directly

Calls 7

interpolate_naMethod · 0.95
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

Tested by

no test coverage detected