# Remove Cells
# ============

# Remove specific cells from a mesh.
# Cells can be removed from any dataset by index or with a boolean mask using
# `remove_cells()`. The output is a
# `PolyData` for `PolyData` input and an
# `UnstructuredGrid` otherwise.
from pyvista import examples

mesh = examples.load_channels()

# Decide which cells to remove with a criterion (feel free to adjust this
# or manually create this array to remove specific cells).
remove = mesh['facies'] < 1.0

# Remove the cells and plot the result.
mesh = mesh.remove_cells(remove)
mesh.plot(clim=[0, 4])

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
