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
partitions = pv.PartitionedDataSet()
partitions
PartitionedDataSet (0x703918d70220) N Partitions 0
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
PolyData (0x703869748520) N Cells: 1680 N Points: 842 N Strips: 0 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 Arrays: 1
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``
PartitionedDataSet (0x70386965bdc0) N Partitions 2
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 vtkPartitionedDataSet class.
|
Wrapper for the vtkPartitionedDataSet class. |