Damavand Volcano

Visualize 3D models of Damavand Volcano, Alborz, Iran.

This is an adaption of Alexey Pechnikov and A.V.Durandin’s ParaView-MoshaFault.

See LinkedIn posts for more details:

Originally posted: https://github.com/banesullivan/damavand-volcano

# sphinx_gallery_thumbnail_number = 6
import pyvista as pv
from pyvista import examples
import numpy as np
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,
)
p.show()
damavand

Out:

[(962759.682893736, 4390399.944685736, 385481.9418857361),
 (552532.741008, 3980173.0028, -24745.0),
 (0.0, 0.0, 1.0)]
voi = gebco.extract_subset([175, 200, 105, 132, 98, 170])

p = pv.Plotter()
p.add_mesh(gebco.outline(), color="k")
p.add_mesh(voi, cmap="magma")
p.show()
damavand

Out:

[(962759.6918857361, 4390399.941885736, 385481.9418857361),
 (552532.75, 3980173.0, -24745.0),
 (0.0, 0.0, 1.0)]
p = pv.Plotter()
p.add_volume(voi, cmap="magma", clim=clim, opacity=opacity, opacity_unit_distance=2000)
p.camera_position = [
    (531554.5542909054, 3944331.800171338, 26563.04809259223),
    (599088.1433822059, 3982089.287834022, -11965.14728669936),
    (0.3738545892415734, 0.244312810377319, 0.8947312427698892),
]
p.show()
damavand

Out:

[(531554.5542909054, 3944331.800171338, 26563.04809259223),
 (599088.1433822059, 3982089.287834022, -11965.14728669936),
 (0.37385458924157344, 0.24431281037731903, 0.8947312427698894)]
contours = voi.contour(np.arange(5, 55, 5))
contours
HeaderData Arrays
PolyDataInformation
N Cells49181
N Points25586
X Bounds5.880e+05, 6.130e+05
Y Bounds3.969e+06, 3.996e+06
Z Bounds-2.015e+04, 4.949e+03
N Arrays1
NameFieldTypeN CompMinMax
dataPointsfloat3215.000e+005.000e+01


contours.plot(cmap="nipy_spectral", opacity=0.15)
damavand

Out:

[(650212.2062091012, 4032352.4562091012, 42079.206209101285),
 (600532.75, 3982673.0, -7600.25),
 (0.0, 0.0, 1.0)]
roi = [*voi.bounds[0:4], *aoi.bounds[4:6]]
aoi_clipped = aoi.clip_box(roi, invert=False)
pv.plot([aoi, pv.Box(roi).outline()], cpos="xy")
damavand

Out:

[(552782.0, 3980173.0, 705486.0238073843),
 (552782.0, 3980173.0, 2297.55078125),
 (0.0, 1.0, 0.0)]
p = pv.Plotter(window_size=np.array([1024, 768]) * 2)

# Add all the data we want to see
p.add_mesh(contours, cmap="nipy_spectral", opacity=0.15)
p.add_mesh(gebco_a, color="#ff0000")
p.add_mesh(gebco_b, color="#ff0000")
p.add_mesh(aoi_clipped, cmap="coolwarm", opacity=0.7)

# Add a title
p.add_text("Vent and Magma Chambers\nDamavand Volcano, Alborz")

# A nice perspective
p.camera_position = [
    (544065.5831913119, 3924518.576093113, 24324.3096344195),
    (597885.1732914157, 3982998.0900773173, -12587.537450058662),
    (0.33162714740718435, 0.26609487244915314, 0.9051060456978746),
]
p.show()
damavand

Out:

[(544065.5831913119, 3924518.576093113, 24324.3096344195),
 (597885.1732914157, 3982998.0900773173, -12587.537450058662),
 (0.3316271474071843, 0.2660948724491531, 0.9051060456978743)]

Total running time of the script: ( 0 minutes 14.722 seconds)

Gallery generated by Sphinx-Gallery