UnstructuredGridFilters.sample(target, tolerance=None, pass_cell_data=True, pass_point_data=True, categorical=False, progress_bar=False, **kwargs)#

Resample array data from a passed mesh onto this mesh.

This uses vtk.vtkResampleWithDataSet.


The vtk data object to sample from - point and cell arrays from this object are sampled onto the nodes of the dataset mesh.

tolerancefloat, optional

Tolerance used to compute whether a point in the source is in a cell of the input. If not given, tolerance is automatically generated.

pass_cell_databool, optional

Preserve source mesh’s original cell data arrays.

pass_point_databool, optional

Preserve source mesh’s original point data arrays.

categoricalbool, optional

Control whether the source point data is to be treated as categorical. If the data is categorical, then the resultant data will be determined by a nearest neighbor interpolation scheme.

progress_barbool, optional

Display a progress bar to indicate progress.

**kwargsdict, optional

Depreciated keyword arguments pass_cell_arrays and pass_point_arrays.


Dataset containing resampled data.


Resample data from another dataset onto a sphere.

>>> import pyvista
>>> from pyvista import examples
>>> mesh = pyvista.Sphere(center=(4.5, 4.5, 4.5), radius=4.5)
>>> data_to_probe = examples.load_uniform()
>>> result = mesh.sample(data_to_probe)
>>> result.plot(scalars="Spatial Point Data")

See Resampling for more examples using this filter.