Partitioned Datasets#

The pyvista.PartitionedDataSet class is a partitioned dataset that encapsulates a dataset consisting of partitions. PartitionedDataSet behaves mostly like a list.

List-like Features#

Create an empty partitioned dataset

import pyvista as pv
from pyvista import examples
partitions = pv.PartitionedDataSet()
partitions
InformationPartitions
PartitionedDataSetValues
N Partitions0
IndexType

Add some data to the collection.

partitions.append(pv.Sphere())
partitions.append(pv.Cube(center=(0, 0, -1)))

PartitionedDataSet is List-like so that individual partitions can be accessed via indices.

partitions[0]  # Sphere
HeaderData Arrays
PolyDataInformation
N Cells1680
N Points842
N Strips0
X Bounds-4.993e-01, 4.993e-01
Y Bounds-4.965e-01, 4.965e-01
Z Bounds-5.000e-01, 5.000e-01
N Arrays1
NameFieldTypeN CompMinMax
NormalsPointsfloat323-1.000e+001.000e+00

The length of the partition can be accessed through len()

len(partitions)
2

or through the n_partitions attribute

partitions.n_partitions
2

More specifically, PartitionedDataSet is a collections.abc.MutableSequence and supports operations such as append, insert, etc.

partitions.append(pv.Cone())
partitions.reverse()

Warning

pop is not supported in PartitionedDataSet class.

PartitionedDataSet also supports slicing to get or set partitions.

partitions[0:2]  # The Sphere and Cube objects in a new ``PartitionedDataSet``
InformationPartitions
PartitionedDataSetValues
N Partitions2
IndexType
0PolyData
1PolyData

PartitionedDataSet API Reference#

The pyvista.PartitionedDataSet class holds attributes that are common to all spatially referenced datasets in PyVista. This base class is analogous to VTK’s vtk.vtkPartitionedDataSetDataSet class.

pyvista.PartitionedDataSet(*args, **kwargs)

Wrapper for the vtkPartitionedDataSet class.