pyvista_validation.check.check_nonnegative

pyvista_validation.check.check_nonnegative#

pyvista_validation.check.check_nonnegative(array: _ArrayLikeOrScalar[NumberType], /, *, name: str = 'Array') None#

Check if an array’s elements are all nonnegative.

Parameters:
arrayfloat | ArrayLike[float]

Number or array to check.

namestr, default: “Array”

Variable name to use in the error messages if any are raised.

Raises:
ValueError

If the array has any negative values.

Examples

Check if an array’s values are non-negative.

>>> from pyvista_validation import check_nonnegative
>>> check_nonnegative([1, 2, 3])