pyvista validate#
Command-line interface for validating one or more mesh files.
Using pyvista validate is similar to calling
validate_mesh() in Python.
Examples#
Note
To run the examples yourself locally, first change directory to pyvista/examples, e.g.
cd $(python -c "import pyvista.examples, pathlib; print(pathlib.Path(pyvista.examples.__file__).parent)")
Validate a PLY mesh file.
$ pyvista validate ant.ply
PolyData mesh 'ant.ply' is valid!
Only validate its cells, and exclude the non_convex field.
$ pyvista validate ant.ply --fields cells --exclude non_convex
PolyData mesh 'ant.ply' is valid!
Use wildcard patterns to validate all mesh files in a directory.
Use --skip-unreadable to skip non-mesh files.
$ pyvista validate *.* --skip-unreadable
Validating ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/24 • 0:00:00 < -:--:--
Validating 2k_earth_daymap.jpg ━━━━━━━━━━━━━━━━━━━━━━━ 0/24 • 0:00:00 < -:--:--
Validating channels.vti ━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 8/24 • 0:00:00 < 0:00:01
Validating channels.vti ━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 8/24 • 0:00:00 < 0:00:01
Validating channels.vti ━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 8/24 • 0:00:00 < 0:00:01
Validating download_3ds.py ━━━━━━━━━━╺━━━━━━━━━━━━━━━━ 9/24 • 0:00:00 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:01 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:01 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:01 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:01 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating frog_tissues.vti ━━━━━━━━━━━━━╺━━━━━━━━━━━━ 12/24 • 0:00:02 < 0:00:01
Validating output.png ━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━ 17/24 • 0:00:02 < 0:00:02
Validating vrml.py ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24/24 • 0:00:02 < 0:00:00
1 invalid mesh out of 15 meshes validated.
PolyData mesh 'globe.vtk' is not valid:
▪ Mesh has 70 TRIANGLE cells with coincident points. Invalid cell ids: [16, 24,
34, 68, 70, 82, ...]
▪ Mesh has 9 TRIANGLE cells with zero area. Invalid cell ids: [86, 226, 264,
290, 310, 615, ...]
9 files skipped (unreadable):
__init__.py
_dataset_loader.py
cells.py
download_3ds.py
downloads.py
examples.py
gltf.py
planets.py
vrml.py
API Reference#
Show the output from pyvista validate --help.
$ pyvista validate --help
Usage: pyvista validate PATH... [--fields FIELD...] [--exclude FIELD...]
Validate data, points, and cells for one or more mesh files.
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ Option Default Description │
│ * PATHS - Mesh(es) to validate. Must be readable with pyvista.read. │
│ Glob patterns (*, ?, [...]) are expanded; every match is │
│ validated in turn. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Parameters ─────────────────────────────────────────────────────────────────╮
│ Option Default Description │
│ --fields -f - Field(s) to validate. Specify individual │
│ field(s) or group(s) of fields: │
│ │
│ Data fields │
│ │
│ • cell_data_wrong_length: Ensure the length │
│ of each cell data array matches n_cells. │
│ • point_data_wrong_length: Ensure the │
│ length of each point data array matches │
│ n_points. │
│ │
│ Point fields │
│ │
│ • non_finite_points: Ensure all points have │
│ real values (i.e. no NaN or Inf). │
│ • unused_points: Ensure all points are │
│ referenced by at least one cell. │
│ │
│ Cell fields │
│ │
│ • coincident_points: Ensure there are no │
│ duplicate coordinates or repeated use of │
│ the same connectivity entry. │
│ • degenerate_faces: Ensure faces do not │
│ collapse to a line or a point through │
│ repeated collocated vertices. │
│ • intersecting_edges: Ensure two edges of a │
│ 2D cell do not intersect. │
│ • intersecting_faces: Ensure two faces of a │
│ 3D cell do not intersect. │
│ • invalid_point_references: Ensure all │
│ points referenced by cells are valid │
│ point ids that can be indexed by a │
│ dataset's points. │
│ • inverted_faces: Ensure the faces of a │
│ cell point in the direction required by │
│ its cell type. │
│ • negative_size: Ensure 1D, 2D, and 3D │
│ cells have positive length, area, and │
│ volume, respectively. │
│ • non_contiguous_edges: Ensure edges around │
│ the perimeter of a 2D cell are │
│ contiguous. │
│ • non_convex: Ensure all 2D and 3D cells │
│ are convex. │
│ • non_planar_faces: Ensure vertices for a │
│ face all lie in the same plane. │
│ • wrong_number_of_points: Ensure each cell │
│ has the minimum number of points needed │
│ to describe it. │
│ • zero_size: Ensure 1D, 2D, and 3D cells │
│ have non-zero length, area, and volume, │
│ respectively. │
│ │
│ Field groups │
│ │
│ • data: Validate all data fields. │
│ • points: Validate all point fields. │
│ • cells: Validate all cell fields. │
│ • memory_safe: Validate all fields that, if │
│ invalid, may cause a segmentation fault │
│ and crash Python. Includes │
│ cell_data_wrong_length, │
│ point_data_wrong_length, and │
│ invalid_point_references. │
│ --exclude -e - Field(s) to exclude from the validation. │
│ This is similar to using FIELDS, but is │
│ subtractive instead of additive. │
│ --tolerance - Value used for most floating point equality │
│ checks throughout the cell checking process, │
│ e.g. for checking coincident points or │
│ intersecting edges. │
│ --planarity-tolerance - Allowed relative distance a planar │
│ polyhedral cell face may protrude out of its │
│ plane compared to the largest distance │
│ between a face center and any of its corner │
│ points. │
│ --size-tolerance - Value used for evaluating the size of a │
│ cell. Cells with an absolute size less than │
│ or equal to this value are flagged as having │
│ zero size, and cells with a size less than │
│ this value are flagged as having negative │
│ size. │
│ --report - Show report. Control the body of the report │
│ with: │
│ │
│ • fields to show all validation fields. │
│ • message to show the error message (if │
│ any). │
│ │
│ message is used by default if no tokens are │
│ passed. │
│ --skip-unreadable False Skip any paths that are not readable instead │
│ of raising an error. │
╰──────────────────────────────────────────────────────────────────────────────╯