Loading...
Loading...
3D visualization and mesh analysis for geoscience data using PyVista/VTK. Use when Claude needs to: (1) Create 3D visualizations of geological models, (2) Render seismic volumes or voxel data, (3) Visualize point clouds or well paths, (4) Plot surfaces and meshes in 3D, (5) Read/write VTK, STL, OBJ files, (6) Create cross-sections through 3D models, (7) Export publication-quality figures or interactive HTML.
npx skill4agent add steadfastasart/geoscience-skills pyvistaimport pyvista as pv
mesh = pv.read('model.vtk')
plotter = pv.Plotter()
plotter.add_mesh(mesh, scalars='property', cmap='viridis')
plotter.show()| Class | Purpose |
|---|---|
| Main visualization window |
| Surface meshes, point clouds |
| Regular 3D grids |
| Irregular meshes |
| 3D voxel data (seismic) |
mesh = pv.read('model.vtk')
plotter = pv.Plotter()
plotter.add_mesh(mesh, scalars='lithology', cmap='Set1')
plotter.show()x, y = np.meshgrid(np.arange(-10, 10, 0.5), np.arange(-10, 10, 0.5))
z = np.sin(np.sqrt(x**2 + y**2))
grid = pv.StructuredGrid(x, y, z)
pv.Plotter().add_mesh(grid, scalars=z.ravel(), cmap='terrain').show()cloud = pv.PolyData(np.random.rand(1000, 3) * 100)
cloud['depth'] = cloud.points[:, 2]
pv.Plotter().add_mesh(cloud, scalars='depth', point_size=5,
render_points_as_spheres=True).show()grid = pv.ImageData(dimensions=(nx+1, ny+1, nz+1), spacing=(25, 25, 10))
grid.cell_data['amplitude'] = data.ravel(order='F')
pv.Plotter().add_volume(grid, cmap='seismic', opacity='sigmoid').show()volume = pv.read('seismic.vti')
slice_x = volume.slice(normal='x', origin=volume.center)
pv.Plotter().add_mesh(slice_x, cmap='seismic').show()points = np.column_stack([x, y, z]) # Well trajectory
tube = pv.Spline(points, 500).tube(radius=5)
pv.Plotter().add_mesh(tube, color='brown', label='Well').add_legend().show()plotter = pv.Plotter()
plotter.add_mesh(horizon1, color='gold', opacity=0.7, label='Top')
plotter.add_mesh(horizon2, color='blue', opacity=0.7, label='Base')
plotter.add_mesh(fault, color='red', opacity=0.5, label='Fault')
plotter.add_legend().show()plotter = pv.Plotter(off_screen=True)
plotter.add_mesh(mesh, cmap='terrain')
plotter.screenshot('figure.png', scale=3) # High-res image
plotter.export_html('model.html') # Interactive HTML| Map | Use Case |
|---|---|
| Topography, elevation |
| Seismic amplitudes (diverging) |
| General scientific |
| Categorical (lithology) |
.vtk.vtu.vti.vtp.stl.obj.ply| Tool | Best For | Limitations |
|---|---|---|
| pyvista | Pythonic 3D viz, VTK wrapper, mesh operations, scripting | Requires display or off-screen backend |
| Mayavi | Scientific 3D visualization, volume rendering | Heavier dependency, less active development |
| ParaView | Interactive GUI exploration of large 3D datasets | GUI-focused, scripting is secondary |
| matplotlib 3D | Simple 3D scatter/surface plots | Limited interactivity, not true 3D engine |
pv.read()pv.Plotter()off_screen=Trueplotter.add_mesh()pv.Spline().tube()plotter.add_axes()plotter.add_legend()plotter.screenshot()plotter.export_html()off_screen=Trueplotter.add_axes()