# Examples from pyvista.ImageData.cell_data
# =========================================

# Add cell arrays to a mesh and list the available `cell_data`.
import pyvista as pv
import numpy as np
mesh = pv.Cube()
mesh.clear_data()
mesh.cell_data['my_array'] = np.random.default_rng().random(mesh.n_cells)
mesh.cell_data['my_other_array'] = np.arange(mesh.n_cells)
mesh.cell_data

# Access an array from `cell_data`.
mesh.cell_data['my_other_array']

# Or access it directly from the mesh.
mesh['my_array'].shape

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

