validate_array3(arr, /, *, reshape=True, broadcast=False, **kwargs)[source]#

Validate a numeric 1D array with 3 elements.

The array is checked to ensure its input values:

  • have shape (3,) or can be reshaped to (3,)

  • are numeric and real

The returned array is formatted so that it has shape (3,).

arrarray_like[float, float, float]

Array to validate.

reshapebool, default: True

If True, 2D vectors with shape (1, 3) are considered valid input, and are reshaped to (3,) to ensure the output is consistently one-dimensional.

broadcastbool, default: False

If True, scalar values or 1D arrays with a single element are considered valid input and the single value is broadcast to a length 3 array.

**kwargsdict, optional

Additional keyword arguments passed to validate_array().


Validated 1D array with 3 elements.

See also


Similar function for a single number.


Similar function for one-dimensional arrays.


Generic array validation function.


Validate a 1D array with three elements.

>>> from pyvista import _validation
>>> _validation.validate_array3((1, 2, 3))
array([1, 2, 3])

2D 3-element arrays are automatically reshaped to be 1D.

>>> _validation.validate_array3([[1, 2, 3]])
array([1, 2, 3])

Scalar 0-dimensional values can be automatically broadcast as a 3-element 1D array.

>>> _validation.validate_array3(42.0, broadcast=True)
array([42.0, 42.0, 42.0])

Add additional constraints if needed.

>>> _validation.validate_array3((1, 2, 3), must_be_nonnegative=True)
array([1, 2, 3])