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

Method test_dropna

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

Source from the content-addressed store, hash-verified

4339 assert_equal(expected, actual)
4340
4341 def test_dropna(self, dtype):
4342 array1 = (
4343 create_nan_array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1], dtype)
4344 * unit_registry.degK
4345 )
4346 array2 = (
4347 create_nan_array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan], dtype)
4348 * unit_registry.Pa
4349 )
4350 ds = xr.Dataset({"a": ("x", array1), "b": ("x", array2)})
4351 units = extract_units(ds)
4352
4353 expected = attach_units(strip_units(ds).dropna(dim="x"), units)
4354 actual = ds.dropna(dim="x")
4355
4356 assert_units_equal(expected, actual)
4357 assert_equal(expected, actual)
4358
4359 @pytest.mark.parametrize(
4360 "unit",

Callers

nothing calls this directly

Calls 7

dropnaMethod · 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