0
# Example Datasets
1
2
PyVista provides an extensive collection of built-in and downloadable example datasets for testing, learning, and demonstration purposes, including geometric models, scientific data, and real-world datasets.
3
4
## Capabilities
5
6
### Built-in Examples
7
8
#### Basic Geometric Examples
9
10
Simple datasets included with PyVista installation.
11
12
```python { .api }
13
def load_ant() -> PolyData:
14
"""
15
Load ant mesh dataset.
16
17
Returns:
18
PolyData: Ant surface mesh
19
"""
20
21
def load_airplane() -> PolyData:
22
"""
23
Load airplane mesh dataset.
24
25
Returns:
26
PolyData: Airplane surface mesh
27
"""
28
29
def load_sphere() -> PolyData:
30
"""
31
Load sphere mesh dataset.
32
33
Returns:
34
PolyData: Spherical mesh with texture coordinates
35
"""
36
37
def load_nut() -> PolyData:
38
"""
39
Load nut (hardware) mesh dataset.
40
41
Returns:
42
PolyData: Nut surface mesh
43
"""
44
```
45
46
#### Grid Examples
47
48
Sample structured and unstructured grid datasets.
49
50
```python { .api }
51
def load_uniform() -> ImageData:
52
"""
53
Load uniform grid example.
54
55
Returns:
56
ImageData: 3D uniform grid with sample data
57
"""
58
59
def load_rectilinear() -> RectilinearGrid:
60
"""
61
Load rectilinear grid example.
62
63
Returns:
64
RectilinearGrid: Non-uniform rectilinear grid
65
"""
66
67
def load_structured() -> StructuredGrid:
68
"""
69
Load structured grid example.
70
71
Returns:
72
StructuredGrid: Curvilinear structured grid
73
"""
74
75
def load_hexbeam() -> UnstructuredGrid:
76
"""
77
Load hexahedral beam mesh.
78
79
Returns:
80
UnstructuredGrid: Hexahedral finite element mesh
81
"""
82
83
def load_tetbeam() -> UnstructuredGrid:
84
"""
85
Load tetrahedral beam mesh.
86
87
Returns:
88
UnstructuredGrid: Tetrahedral finite element mesh
89
"""
90
91
def load_globe() -> PolyData:
92
"""
93
Load globe mesh with continents.
94
95
Returns:
96
PolyData: Earth globe surface mesh
97
"""
98
99
def load_globe_texture() -> ImageData:
100
"""
101
Load globe texture image.
102
103
Returns:
104
ImageData: Earth texture map
105
"""
106
107
def load_channels() -> UnstructuredGrid:
108
"""
109
Load channels flow dataset.
110
111
Returns:
112
UnstructuredGrid: Flow field data
113
"""
114
115
def load_spline() -> PolyData:
116
"""
117
Load spline curve dataset.
118
119
Returns:
120
PolyData: Spline curve mesh
121
"""
122
123
def load_random_hills() -> PolyData:
124
"""
125
Load random hills surface.
126
127
Returns:
128
PolyData: Random hills terrain
129
"""
130
131
def load_sphere_vectors() -> PolyData:
132
"""
133
Load sphere with vector field.
134
135
Returns:
136
PolyData: Sphere with vector data
137
"""
138
139
def load_explicit_structured(dimensions=(5, 6, 7), spacing=(20, 10, 1)) -> ExplicitStructuredGrid:
140
"""
141
Load explicit structured grid example.
142
143
Parameters:
144
dimensions (tuple): Grid dimensions
145
spacing (tuple): Grid spacing
146
147
Returns:
148
ExplicitStructuredGrid: Example structured grid
149
"""
150
151
def load_frog_tissues() -> ImageData:
152
"""
153
Load frog tissue scan data.
154
155
Returns:
156
ImageData: Frog tissue volume
157
"""
158
159
def load_hydrogen_orbital(n=1, l=0, m=0, zoom_fac=1.0) -> ImageData:
160
"""
161
Load hydrogen orbital dataset.
162
163
Parameters:
164
n (int): Principal quantum number
165
l (int): Orbital angular momentum quantum number
166
m (int): Magnetic quantum number
167
zoom_fac (float): Zoom factor
168
169
Returns:
170
ImageData: Hydrogen orbital volume
171
"""
172
173
def load_logo() -> PolyData:
174
"""
175
Load PyVista logo mesh.
176
177
Returns:
178
PolyData: PyVista logo
179
"""
180
```
181
182
### Downloadable Datasets
183
184
#### Anatomical and Medical Data
185
186
Medical imaging and anatomical datasets.
187
188
```python { .api }
189
def download_head() -> ImageData:
190
"""
191
Download head CT scan dataset.
192
193
Returns:
194
ImageData: Medical imaging volume data
195
"""
196
197
def download_brain() -> ImageData:
198
"""
199
Download brain MRI dataset.
200
201
Returns:
202
ImageData: Brain volume with tissue segmentation
203
"""
204
205
def download_knee() -> ImageData:
206
"""
207
Download knee MRI dataset.
208
209
Returns:
210
ImageData: Knee joint imaging data
211
"""
212
213
def download_chest() -> ImageData:
214
"""
215
Download chest CT scan.
216
217
Returns:
218
ImageData: Chest cavity imaging data
219
"""
220
221
def download_foot_bones() -> PolyData:
222
"""
223
Download foot bone meshes.
224
225
Returns:
226
PolyData: Foot bone surface models
227
"""
228
229
def download_skull() -> PolyData:
230
"""
231
Download skull surface model.
232
233
Returns:
234
PolyData: Human skull mesh
235
"""
236
```
237
238
#### Natural and Organic Models
239
240
Real-world scanned objects and natural forms.
241
242
```python { .api }
243
def download_bunny() -> PolyData:
244
"""
245
Download Stanford bunny mesh.
246
247
Famous computer graphics test model.
248
249
Returns:
250
PolyData: Stanford bunny surface mesh
251
"""
252
253
def download_dragon() -> PolyData:
254
"""
255
Download Stanford dragon mesh.
256
257
Returns:
258
PolyData: Dragon surface mesh
259
"""
260
261
def download_cow() -> PolyData:
262
"""
263
Download cow mesh dataset.
264
265
Returns:
266
PolyData: Cow surface model
267
"""
268
269
def download_horse() -> PolyData:
270
"""
271
Download horse mesh dataset.
272
273
Returns:
274
PolyData: Horse surface model
275
"""
276
277
def download_teapot() -> PolyData:
278
"""
279
Download Utah teapot mesh.
280
281
Classic computer graphics reference object.
282
283
Returns:
284
PolyData: Teapot surface mesh
285
"""
286
287
def download_armadillo() -> PolyData:
288
"""
289
Download armadillo mesh.
290
291
Returns:
292
PolyData: Armadillo surface model
293
"""
294
```
295
296
#### Mechanical and Engineering Objects
297
298
CAD models and mechanical components.
299
300
```python { .api }
301
def download_gears() -> PolyData:
302
"""
303
Download gear assembly mesh.
304
305
Returns:
306
PolyData: Mechanical gear system
307
"""
308
309
def download_motor() -> MultiBlock:
310
"""
311
Download electric motor assembly.
312
313
Returns:
314
MultiBlock: Multi-part motor model
315
"""
316
317
def download_turbine_blade() -> PolyData:
318
"""
319
Download turbine blade mesh.
320
321
Returns:
322
PolyData: Turbine blade geometry
323
"""
324
325
def download_pump_bracket() -> PolyData:
326
"""
327
Download pump bracket CAD model.
328
329
Returns:
330
PolyData: Mechanical bracket mesh
331
"""
332
333
def download_bearing() -> PolyData:
334
"""
335
Download bearing assembly.
336
337
Returns:
338
PolyData: Ball bearing mesh
339
"""
340
341
def download_bolt_nut() -> MultiBlock:
342
"""
343
Download bolt and nut assembly.
344
345
Returns:
346
MultiBlock: Bolt and nut models
347
"""
348
```
349
350
#### Scientific and Simulation Data
351
352
Scientific datasets and simulation results.
353
354
```python { .api }
355
def download_blood_vessels() -> PolyData:
356
"""
357
Download blood vessel network.
358
359
Returns:
360
PolyData: Vascular network mesh
361
"""
362
363
def download_iron_protein() -> ImageData:
364
"""
365
Download iron protein molecular data.
366
367
Returns:
368
ImageData: Molecular density volume
369
"""
370
371
def download_combustion() -> ImageData:
372
"""
373
Download combustion simulation data.
374
375
Returns:
376
ImageData: Temperature and pressure fields
377
"""
378
379
def download_hurricane() -> StructuredGrid:
380
"""
381
Download hurricane simulation data.
382
383
Returns:
384
StructuredGrid: Atmospheric pressure and wind fields
385
"""
386
387
def download_kitchen() -> StructuredGrid:
388
"""
389
Download kitchen air flow simulation.
390
391
Returns:
392
StructuredGrid: Velocity and temperature fields
393
"""
394
395
def download_carotid() -> PolyData:
396
"""
397
Download carotid artery mesh.
398
399
Returns:
400
PolyData: Arterial geometry
401
"""
402
```
403
404
#### Geological and Environmental Data
405
406
Earth science and environmental datasets.
407
408
```python { .api }
409
def download_topo_global() -> PolyData:
410
"""
411
Download global topography mesh.
412
413
Returns:
414
PolyData: Earth surface with elevation data
415
"""
416
417
def download_topo_land() -> PolyData:
418
"""
419
Download land topography.
420
421
Returns:
422
PolyData: Continental topography mesh
423
"""
424
425
def download_st_helens() -> ImageData:
426
"""
427
Download Mount St. Helens DEM.
428
429
Returns:
430
ImageData: Digital elevation model
431
"""
432
433
def download_crater() -> PolyData:
434
"""
435
Download crater topography.
436
437
Returns:
438
PolyData: Crater surface mesh
439
"""
440
441
def download_geological_map() -> PolyData:
442
"""
443
Download geological formation data.
444
445
Returns:
446
PolyData: Geological surface with formation data
447
"""
448
```
449
450
#### Planetary and Astronomical Data
451
452
Space science and planetary datasets.
453
454
```python { .api }
455
def download_mars() -> ImageData:
456
"""
457
Download Mars surface data.
458
459
Returns:
460
ImageData: Martian topography and imagery
461
"""
462
463
def download_moon() -> ImageData:
464
"""
465
Download lunar surface data.
466
467
Returns:
468
ImageData: Moon elevation and imagery
469
"""
470
471
def download_jupiter() -> PolyData:
472
"""
473
Download Jupiter surface mesh.
474
475
Returns:
476
PolyData: Jupiter atmospheric data
477
"""
478
479
def download_saturn_rings() -> PolyData:
480
"""
481
Download Saturn rings model.
482
483
Returns:
484
PolyData: Saturn ring system
485
"""
486
```
487
488
### Texture and Image Datasets
489
490
#### Earth Textures
491
492
Planetary surface textures and imagery.
493
494
```python { .api }
495
def download_earth_texture() -> ImageData:
496
"""
497
Download Earth day texture.
498
499
Returns:
500
ImageData: Earth surface imagery
501
"""
502
503
def download_earth_night() -> ImageData:
504
"""
505
Download Earth night lights texture.
506
507
Returns:
508
ImageData: Night illumination imagery
509
"""
510
511
def download_mars_texture() -> ImageData:
512
"""
513
Download Mars surface texture.
514
515
Returns:
516
ImageData: Martian surface imagery
517
"""
518
519
def download_moon_texture() -> ImageData:
520
"""
521
Download Moon surface texture.
522
523
Returns:
524
ImageData: Lunar surface imagery
525
"""
526
```
527
528
#### Material Textures
529
530
Various material and pattern textures.
531
532
```python { .api }
533
def download_masonry_texture() -> ImageData:
534
"""
535
Download masonry wall texture.
536
537
Returns:
538
ImageData: Brick wall pattern
539
"""
540
541
def download_wood_texture() -> ImageData:
542
"""
543
Download wood grain texture.
544
545
Returns:
546
ImageData: Wood surface pattern
547
"""
548
549
def download_metal_texture() -> ImageData:
550
"""
551
Download metal surface texture.
552
553
Returns:
554
ImageData: Metallic surface pattern
555
"""
556
```
557
558
### Specialized Examples
559
560
#### Computer Graphics Test Cases
561
562
Standard computer graphics test models.
563
564
```python { .api }
565
def download_suzanne() -> PolyData:
566
"""
567
Download Suzanne monkey head mesh.
568
569
Blender's reference model.
570
571
Returns:
572
PolyData: Suzanne mesh
573
"""
574
575
def download_cessna() -> PolyData:
576
"""
577
Download Cessna aircraft mesh.
578
579
Returns:
580
PolyData: Aircraft surface model
581
"""
582
583
def download_trumpet() -> PolyData:
584
"""
585
Download trumpet mesh.
586
587
Returns:
588
PolyData: Musical instrument model
589
"""
590
```
591
592
#### Fluid Dynamics Examples
593
594
CFD and fluid simulation datasets.
595
596
```python { .api }
597
def download_backward_facing_step() -> UnstructuredGrid:
598
"""
599
Download backward facing step CFD simulation.
600
601
Returns:
602
UnstructuredGrid: Flow field data
603
"""
604
605
def download_channel_flow() -> StructuredGrid:
606
"""
607
Download channel flow simulation.
608
609
Returns:
610
StructuredGrid: Velocity and pressure fields
611
"""
612
613
def download_cavity_flow() -> StructuredGrid:
614
"""
615
Download lid-driven cavity flow.
616
617
Returns:
618
StructuredGrid: Classic CFD benchmark
619
"""
620
```
621
622
### Dataset Utilities
623
624
#### Download Management
625
626
Functions for managing downloaded datasets.
627
628
```python { .api }
629
def delete_downloads():
630
"""Delete all downloaded example datasets to free space."""
631
632
def get_downloads_cache_dir() -> str:
633
"""
634
Get path to downloads cache directory.
635
636
Returns:
637
str: Path to cache directory
638
"""
639
640
def set_downloads_cache_dir(path):
641
"""
642
Set custom downloads cache directory.
643
644
Parameters:
645
path (str): Path to cache directory
646
"""
647
648
def get_downloads_path(filename):
649
"""
650
Get full path to downloaded file.
651
652
Parameters:
653
filename (str): Filename of downloaded dataset
654
655
Returns:
656
str: Full path to file
657
"""
658
```
659
660
#### Example Categories
661
662
Access examples by category.
663
664
```python { .api }
665
def list_examples() -> dict:
666
"""
667
List all available example datasets by category.
668
669
Returns:
670
dict: Dictionary of categories and example names
671
"""
672
673
def load_random() -> 'DataSet':
674
"""
675
Load a random example dataset.
676
677
Returns:
678
DataSet: Random example dataset
679
"""
680
```
681
682
## Usage Examples
683
684
### Basic example loading
685
686
```python
687
import pyvista as pv
688
689
# Load built-in examples (no download required)
690
ant = pv.examples.load_ant()
691
airplane = pv.examples.load_airplane()
692
sphere = pv.examples.load_sphere()
693
694
# Plot built-in examples
695
plotter = pv.Plotter(shape=(1, 3))
696
plotter.subplot(0, 0)
697
plotter.add_mesh(ant, color='red')
698
plotter.subplot(0, 1)
699
plotter.add_mesh(airplane, color='blue')
700
plotter.subplot(0, 2)
701
plotter.add_mesh(sphere, color='green')
702
plotter.show()
703
```
704
705
### Working with downloaded datasets
706
707
```python
708
import pyvista as pv
709
710
# Download and visualize medical data
711
brain = pv.examples.download_brain()
712
head = pv.examples.download_head()
713
714
# Visualize volumetric data
715
brain.plot(volume=True, cmap='bone')
716
717
# Download and plot surface models
718
bunny = pv.examples.download_bunny()
719
dragon = pv.examples.download_dragon()
720
721
# Create comparison plot
722
plotter = pv.Plotter(shape=(1, 2))
723
plotter.subplot(0, 0)
724
plotter.add_mesh(bunny, color='pink')
725
plotter.add_title("Stanford Bunny")
726
plotter.subplot(0, 1)
727
plotter.add_mesh(dragon, color='green')
728
plotter.add_title("Stanford Dragon")
729
plotter.show()
730
```
731
732
### Scientific data visualization
733
734
```python
735
import pyvista as pv
736
737
# Load simulation data
738
hurricane = pv.examples.download_hurricane()
739
combustion = pv.examples.download_combustion()
740
741
# Visualize hurricane wind vectors
742
hurricane.plot(scalars='wind_speed', arrows='wind_vectors',
743
cmap='coolwarm', show_scalar_bar=True)
744
745
# Create isosurfaces from combustion data
746
iso = combustion.contour(isosurfaces=5, scalars='temperature')
747
iso.plot(scalars='temperature', cmap='hot')
748
```
749
750
### Texture mapping examples
751
752
```python
753
import pyvista as pv
754
755
# Create sphere and apply Earth texture
756
earth = pv.Sphere(radius=1.0, theta_resolution=50, phi_resolution=50)
757
earth_texture = pv.examples.download_earth_texture()
758
759
# Plot textured Earth
760
plotter = pv.Plotter()
761
plotter.add_mesh(earth, texture=earth_texture)
762
plotter.add_title("Earth with Day Texture")
763
plotter.show()
764
765
# Night texture version
766
night_texture = pv.examples.download_earth_night()
767
plotter = pv.Plotter()
768
plotter.add_mesh(earth, texture=night_texture)
769
plotter.add_title("Earth Night Lights")
770
plotter.show()
771
```
772
773
### Cache management
774
775
```python
776
import pyvista as pv
777
778
# Check cache directory
779
cache_dir = pv.examples.get_downloads_cache_dir()
780
print(f"Downloads cached in: {cache_dir}")
781
782
# List available examples
783
examples_dict = pv.examples.list_examples()
784
for category, examples in examples_dict.items():
785
print(f"{category}: {len(examples)} examples")
786
787
# Load random example for exploration
788
random_data = pv.examples.load_random()
789
random_data.plot()
790
791
# Clean up cache if needed
792
# pv.examples.delete_downloads() # Uncomment to delete all downloads
793
```