validate_arrayNx3#
- validate_arrayNx3( )[source]#
Validate an array is numeric and has shape Nx3.
The array is checked to ensure its input values:
have shape
(N, 3)or can be reshaped to(N, 3)are numeric
The returned array is formatted so that its values:
have shape
(N, 3).
- Parameters:
- Returns:
np.ndarrayValidated array with shape
(N, 3).
See also
validate_arrayNSimilar function for one-dimensional arrays.
validate_arrayGeneric array validation function.
Examples#
Download Python source code | Download Jupyter notebook
Validate an Nx3 array.
>>> from pyvista import _validation
>>> _validation.validate_arrayNx3(((1, 2, 3), (4, 5, 6)))
array([[1, 2, 3],
[4, 5, 6]])
One-dimensional 3-element arrays are automatically reshaped to 2D.
>>> _validation.validate_arrayNx3([1, 2, 3])
array([[1, 2, 3]])
Add additional constraints.
>>> _validation.validate_arrayNx3(
... ((1, 2, 3), (4, 5, 6)), must_be_in_range=[0, 10]
... )
array([[1, 2, 3],
[4, 5, 6]])