earthkit.utils.array.namespace.PatchedCupyNamespace

class earthkit.utils.array.namespace.PatchedCupyNamespace[source]

Bases: UnknownPatchedNamespace

__init__()[source]

Methods

__init__()

allclose(x, y, *[, rtol, atol, equal_nan])

asarray(*args, **kwargs)

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

xp

A thread-safe cached property decorator.

asarray(*args, **kwargs)[source]
choice(a, size, replace=True, generator=None)[source]
deg2rad(x)[source]
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.

histogramdd(x, *, bins=10)[source]
percentile(a, q, axis=None)[source]

Compute percentiles by calling the quantile function.

polyval(*args, **kwargs)[source]

Evaluation of a polynomial using Horner’s scheme.

If c is of length n + 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

Comments

Based on the numpy.polynomal.polynomial.polyval function.

quantile(a, q, axis=None)[source]
rad2deg(x)[source]
to_device(x, device, **kwargs)[source]
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 hidden name attribute: :param of the instance it was called on. Subsequent calls return the cached value: :param i.e. the: :param hidden name attribute.: