Example #1
0
"""
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 :class:`pyvista.MultiBlock` dataset

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

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

project.plot()

###############################################################################
# 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']
Example #2
0
 def test_file_io(self):
     # Write out the project using omf
     omf.OMFWriter(PROJECT, self.project_filename)
     # Read it back in using omfvista
     proj = omfvista.load_project(self.project_filename)
     self._check_multi_block(proj)
Decimate some of the surfaces to make them more manageable with web renderings
in VTK.js
"""

import gdc19

import pandas as pd
import numpy as np
import pyvista
import omfvista
import PVGeo
import omf

###############################################################################

surfaces = omfvista.load_project(gdc19.get_project_path('surfaces.omf'))
topo = surfaces['land_surface']

###############################################################################
# Decimate Topography Surface

dec = topo.extract_geometry().decimate(0.99, inplace=False)
dec.plot(notebook=True, show_edges=True, color=True)

###############################################################################
# Re-do the texture mapping
reader = omf.OMFReader(gdc19.get_project_path('surfaces.omf'))
project = reader.get_project()
# Assumes 'land_surface' is at index 0
surf = project.elements[0]
tex = surf.textures[0]
Example #4
0
import omfvista

# sphinx_gallery_thumbnail_number = 4
import pyvista as pv
from pyvista import examples

###############################################################################
# Load the Data
# +++++++++++++
#
# For this project, we have two data archives in the `Open Mining Format (OMF) <https://github.com/gmggroup/omf>`_ specification and we will use one of PyVista's companion projects, `omfvista <https://opengeovis.github.io/omfvista/>`_ to load those data archives into PyVista a ``MultiBlock`` dataset.

url = "https://dl.dropbox.com/s/3cuxvurj8zubchb/FORGE.omf?dl=0"
path, _ = examples.downloads._retrieve_file(url, "FORGE.omf")

project = omfvista.load_project(path)
project

###############################################################################
# Initial Inspection
# ++++++++++++++++++
#
# Now we can go ahead and create an integrated visualization of all of the data available to us.

p = pv.Plotter(window_size=np.array([1024, 768]) * 2)
p.add_mesh(project["Site Boundary"],
           color="yellow",
           render_lines_as_tubes=True,
           line_width=10)
p.add_mesh(project["Terrain"], texture="geo_aer", opacity=0.7, lighting=False)
p.add_mesh(project["Opal Mound Fault"], color="brown", opacity=0.7)
# Import project package
import sys
sys.path.append('../..')
import gdc19

###############################################################################
import pyvista
import PVGeo
import omfvista
import pandas as pd
import numpy as np

###############################################################################
#  Load all the datasets created in the data aggreagation section

gis_data = omfvista.load_project(gdc19.get_project_path('gis.omf'))
print(gis_data.keys())

###############################################################################
surfaces = omfvista.load_project(gdc19.get_project_path('surfaces.omf'))
print(surfaces.keys())

###############################################################################
temperature_data = omfvista.load_project(
    gdc19.get_project_path('temperature.omf'))
print(temperature_data.keys())

###############################################################################
# Grab data to be used
topo = surfaces['land_surface']
granitoid = surfaces['top_granitoid']
Example #6
0
def load_project():
    return omfvista.load_project(gdc19.get_omf_project_filename())
Example #7
0
 def test_load_project(self):
     """Test loading a sample project file"""
     data = omfvista.load_project(DATA_FILE)
     self.assertIsNotNone(data)
     self.assertTrue(isinstance(data, pyvista.MultiBlock))
     self.assertEqual(data.n_blocks, 9)