Load ProjectΒΆ

Load and visualize an OMF project file

# sphinx_gallery_thumbnail_number = 3
import pyvista as pv
import omfvista

Load the project into an pyvista.MultiBlock dataset

project = omfvista.load_project('../assets/test_file.omf')
print(project)

Out:

MultiBlock (0x7f57ee75f348)
  N Blocks:     9
  X Bounds:     443941.105, 447059.611
  Y Bounds:     491941.536, 495059.859
  Z Bounds:     2330.000, 3555.942

Once the data is loaded as a pyvista.MultiBlock dataset from omfvista, then that object can be directly used for interactive 3D visualization from pyvista:

project.plot()
../_images/sphx_glr_load-project_001.png

Out:

[(450605.70583080064, 498606.04540880054, 8048.318718998364),
 (445500.3579790001, 493500.697557, 2942.97086719778),
 (0.0, 0.0, 1.0)]

Or an interactive scene can be created and manipulated to create a compelling figure directly in a Jupyter notebook. First, grab the elements from the project:

# Grab a few elements of interest and plot em up!
vol = project['Block Model']
assay = project['wolfpass_WP_assay']
topo = project['Topography']
dacite = project['Dacite']
assay.set_active_scalar('DENSITY')

p = pv.Plotter()
p.add_mesh(assay.tube(radius=3))
p.add_mesh(topo, opacity=0.5)
p.show()
../_images/sphx_glr_load-project_002.png

Out:

/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pyvista/core/common.py:639: UserWarning: DEPRECATED: please use `.set_active_scalars` instead.
  warnings.warn("DEPRECATED: please use `.set_active_scalars` instead.")

[(450590.5515598323, 498590.8911378322, 8059.037822401073),
 (445500.3579790001, 493500.697557, 2968.84424156883),
 (0.0, 0.0, 1.0)]

Then apply a filtering tool from pyvista to the volumetric data:

# Threshold the volumetric data
thresh_vol = vol.threshold([1.09, 4.20])
print(thresh_vol)

Out:

UnstructuredGrid (0x7f57ecf02f48)
  N Cells:      92525
  N Points:     107807
  X Bounds:     4.447e+05, 4.457e+05
  Y Bounds:     4.929e+05, 4.942e+05
  Z Bounds:     2.330e+03, 3.110e+03
  N Arrays:     1

Then you can put it all in one environment!

# Create a plotting window
p = pv.Plotter()
# Add the bounds axis
p.show_bounds()
p.add_bounding_box()

# Add our datasets
p.add_mesh(topo, opacity=0.5)
p.add_mesh(dacite, color='orange', opacity=0.6,)
p.add_mesh(thresh_vol, cmap='coolwarm', clim=vol.get_data_range())

# Add the assay logs: use a tube filter that varius the radius by an attribute
p.add_mesh(assay.tube(radius=3), cmap='viridis')

p.show()
../_images/sphx_glr_load-project_003.png

Out:

[(450605.73033793643, 498606.06594899646, 8048.341830134237),
 (445500.359375, 493500.69498606, 2942.97086719778),
 (0.0, 0.0, 1.0)]

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

Gallery generated by Sphinx-Gallery