DataObjectFilters.point_data_to_cell_data#
- DataObjectFilters.point_data_to_cell_data( ) _DataSetOrMultiBlockType[source]#
Transform point data into cell data.
Point data are specified per node and cell data specified within cells. Optionally, the input point data can be passed through to the output.
String arrays are excluded from the conversion with a warning. They are passed through to the output when
pass_point_data=True.- Parameters:
- pass_point_databool, default:
False If enabled, pass the input point data through to the output.
- categoricalbool, default:
False Control whether the source point data is to be treated as categorical. If
True, histogramming is used to assign the cell data. Specifically, a histogram is populated for each cell from the scalar values at each point, and the bin with the most elements is selected. In case of a tie, the smaller value is selected.Note
If the point data is continuous, values that are almost equal (within
1e-6) are merged into a single bin. Otherwise, for discrete data the number of bins equals the number of unique values.- progress_barbool, default:
False Display a progress bar to indicate progress.
- pass_point_databool, default:
- Returns:
- output
DataSet|MultiBlock Dataset with the point data transformed into cell data. Return type matches input.
- output
Examples#
Download Python source code | Download Jupyter notebook
Color cells by their z coordinates. First, create point scalars based on z-coordinates of a sample sphere mesh. Then convert this point data to cell data. Use a low resolution sphere for emphasis of cell valued data.
First, plot these values as point values to show the difference between point and cell data.
>>> import pyvista as pv
>>> sphere = pv.Sphere(theta_resolution=10, phi_resolution=10)
>>> sphere['Z Coordinates'] = sphere.points[:, 2]
>>> sphere.plot()
Now, convert these values to cell data and then plot it.
>>> import pyvista as pv
>>> sphere = pv.Sphere(theta_resolution=10, phi_resolution=10)
>>> sphere['Z Coordinates'] = sphere.points[:, 2]
>>> sphere = sphere.point_data_to_cell_data()
>>> sphere.plot()
See Also#
cell_data_to_point_dataSimilar transformation applied to cell data.
points_to_cells()Re-mesh
ImageDatato a cells-based representation.