DataSet.get_array_association#
- DataSet.get_array_association(
- name: str,
- preference: Literal['cell', 'point', 'field'] = 'cell',
Get the association of an array.
- Parameters:
- Returns:
pyvista.core.utilities.arrays.FieldAssociationField association of the array.
Examples#
Download Python source code | Download Jupyter notebook
Create a DataSet with a variety of arrays.
>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> mesh.clear_data()
>>> mesh.point_data['point-data'] = range(mesh.n_points)
>>> mesh.cell_data['cell-data'] = range(mesh.n_cells)
>>> mesh.field_data['field-data'] = ['a', 'b', 'c']
>>> mesh.array_names
['point-data', 'field-data', 'cell-data']
Get the point data array association.
>>> mesh.get_array_association('point-data')
<FieldAssociation.POINT: 0>
Get the cell data array association.
>>> mesh.get_array_association('cell-data')
<FieldAssociation.CELL: 1>
Get the field data array association.
>>> mesh.get_array_association('field-data')
<FieldAssociation.NONE: 2>