in space. We commonly refer to any spatially referenced dataset as a mesh, so often the distinction between a mesh, a grid, and a volume can get fuzzy - but that does not matter in PyVista as we have worked really hard to make working with these spatial data structures as simple as possible. For more details, check out: `What is a mesh? <https://docs.pyvista.org/getting-started/what-is-a-mesh.html>`_ Anyways, let's look at some code and especially some 3D visualizations! """ import pyvista as pv from pyvista import examples # Load OMF archive as PyVista MulitBlock dataset model = examples.download_damavand_volcano() model ############################################################################### # Initial Inspection # ~~~~~~~~~~~~~~~~~~ # # Now we can go ahead and create a visualization of the 3D model of the region # surrounding the Damavand Volcano. # All we have to do is pass the mesh to the :class:`pyvista.Plotter`'s # ``add_mesh`` method with keyword arguments for how we want it displayed # (e.g. color, opacity, etc.). # # Below, I define an opacity mapping and colorbar limits:
p.add_volume(frog, cmap="viridis", opacity="sigmoid_6") p.camera_position = [(929., 1067., -278.9), (249.5, 234.5, 101.25), (-0.2048, -0.2632, -0.9427)] p.show() ############################################################################### # Extracting a VOI # ++++++++++++++++ # # Use the :func:`pyvista.UniformGridFilters.extract_subset` filter to extract # a volume of interest/subset volume to volume render. This is ideal when # dealing with particularly large volumes and you want to volume render only # a specific region. # Load a particularly large volume large_vol = examples.download_damavand_volcano() large_vol ############################################################################### opacity = [0, 0.75, 0, 0.75, 1.0] clim = [0, 100] p = pv.Plotter() p.add_volume( large_vol, cmap="magma", clim=clim, opacity=opacity, opacity_unit_distance=6000, ) p.show()
Originally posted: https://github.com/banesullivan/damavand-volcano """ import numpy as np # sphinx_gallery_thumbnail_number = 6 import pyvista as pv from pyvista import examples ############################################################################### a, _ = examples.downloads._download_file("gebco7510_49cl.stl") b, _ = examples.downloads._download_file("gebco7510_55cl.stl") c, _ = examples.downloads._download_file("AOI.Damavand.32639.vtp") gebco = examples.download_damavand_volcano() gebco_a = pv.read(a) gebco_b = pv.read(b) aoi = pv.read(c) ############################################################################### opacity = [0, 0.75, 0, 0.75, 1.0] clim = [0, 100] p = pv.Plotter() p.add_volume( gebco, cmap="magma", clim=clim, opacity=opacity, opacity_unit_distance=6000,