pyvista.convert_array

Contents

pyvista.convert_array#

convert_array(arr, name=None, deep=False, array_type=None)[source]#

Convert a NumPy array to a vtkDataArray or vice versa.

Parameters:
arrnp.ndarray | vtkDataArray

A numpy array or vtkDataArry to convert.

namestr, optional

The name of the data array for VTK.

deepbool, default: False

If input is numpy array then deep copy values.

array_typeint, optional

VTK array type ID as specified in vtkType.h.

Returns:
vtkDataArray or numpy.ndarray

The converted array. If input is a numpy.ndarray then returns vtkDataArray or is input is vtkDataArray then returns NumPy ndarray.