earthkit.utils.array.namespace.PatchedNumpyNamespace¶
- class earthkit.utils.array.namespace.PatchedNumpyNamespace[source]¶
Bases:
UnknownPatchedNamespaceMethods
__init__()allclose(x, y, *[, rtol, atol, equal_nan])choice(a, size[, replace, generator])deg2rad(x)device(x)dtype(x)histogram2d(x, y, *[, bins])Compute a 2D histogram.
histogramdd(x, *[, bins])isclose(x, y, *[, rtol, atol, equal_nan])percentile(a, q[, axis])Compute percentiles by calling the quantile function.
polyval(*args, **kwargs)Evaluation of a polynomial using Horner's scheme.
quantile(a, q[, axis])rad2deg(x)shape(x)Return the shape of an array.
size(x)Return the size of an array.
to_device(x, device, **kwargs)Attributes
A thread-safe cached property decorator.
- histogram2d(x, y, *, bins=10)[source]¶
Compute a 2D histogram.
- Parameters:
x (array-like) – An array containing the x coordinates of the points to be histogrammed.
y (array-like) – An array containing the y coordinates of the points to be histogrammed.
bins (int or list of int, optional) – The number of bins for the histogram in each dimension. If bins is an int, it is used for both dimensions.
- polyval(*args, **kwargs)[source]¶
Evaluation of a polynomial using Horner’s scheme.
If
cis of lengthn + 1, this function returns the value\[p(x) = c_0 + c_1 * x + ... + c_n * x^n\]- Parameters:
x (array-like) – The values(s) at which to evaluate the polynomial. Its elements must support addition and multiplication with with themselves and with the elements of
c.c (array-like) – Array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n].
- Returns:
values – The value(s) of the polynomial at the given point(s).
- Return type:
array-like
- xp¶
A thread-safe cached property decorator.
It was implemented because the functools.cached_property is not thread-safe from Python 3.12 onwards.
- Parameters:
method (property method) – The property method to be decorated.
:param The
__get__method of the decorator only runs on lookups. On first call: :param it gets the underlying property’s value and stores it as the hiddennameattribute: :param of the instance it was called on. Subsequent calls return the cached value: :param i.e. the: :param hiddennameattribute.:
Comments¶
Based on the
numpy.polynomal.polynomial.polyvalfunction.