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

Method test_quantile

xarray/tests/test_variable.py:1913–1921  ·  view source on GitHub ↗
(self, q, axis, dim, skipna)

Source from the content-addressed store, hash-verified

1911 zip([None, 0, [0], [0, 1]], [None, "x", ["x"], ["x", "y"]], strict=True),
1912 )
1913 def test_quantile(self, q, axis, dim, skipna):
1914 d = self.d.copy()
1915 d[0, 0] = np.nan
1916
1917 v = Variable(["x", "y"], d)
1918 actual = v.quantile(q, dim=dim, skipna=skipna)
1919 _percentile_func = np.nanpercentile if skipna in (True, None) else np.percentile
1920 expected = _percentile_func(d, np.array(q) * 100, axis=axis)
1921 np.testing.assert_allclose(actual.values, expected)
1922
1923 @requires_dask
1924 @pytest.mark.parametrize("q", [0.25, [0.50], [0.25, 0.75]])

Callers

nothing calls this directly

Calls 3

quantileMethod · 0.95
VariableClass · 0.90
copyMethod · 0.45

Tested by

no test coverage detected