Exemple #1
0
def test_plot_over_line():
    """this requires matplotlib"""
    mesh = examples.load_channels()
    # Make two points to construct the line between
    a = [mesh.bounds[0], mesh.bounds[2], mesh.bounds[4]]
    b = [mesh.bounds[1], mesh.bounds[3], mesh.bounds[5]]
    mesh.plot_over_line(a, b, resolution=1000, show=False)
Exemple #2
0
def test_plot_over_line():
    """this requires matplotlib"""
    mesh = examples.load_channels()
    # Make two points to construct the line between
    a = [mesh.bounds[0], mesh.bounds[2], mesh.bounds[4]]
    b = [mesh.bounds[1], mesh.bounds[3], mesh.bounds[5]]
    mesh.plot_over_line(a, b, resolution=1000, show=False)
    # Test multicomponent
    mesh['foo'] = np.random.rand(mesh.n_cells, 3)
    mesh.plot_over_line(a,
                        b,
                        resolution=None,
                        scalars='foo',
                        title='My Stuff',
                        ylabel='3 Values',
                        show=False)
Exemple #3
0
def test_load_channels():
    """ Loads geostat training image """
    mesh = examples.load_channels()
    assert mesh.n_points
Exemple #4
0
from pyvista import examples
import matplotlib.pyplot as plt
import numpy as np

###############################################################################
# PyVista meshes have several slicing filters bound directly to all datasets.
# These filters allow you to slice through a volumetric dataset to extract and
# view sections through the volume of data.
#
# One of the most common slicing filters used in PyVista is the
# :func:`pyvista.DataSetFilters.slice_orthogonal` filter which creates three
# orthogonal slices through the dataset parallel to the three Cartesian planes.
# For example, let's slice through the sample geostatistical training image
# volume. First, load up the volume and preview it:

mesh = examples.load_channels()
# define a categorical colormap
cmap = plt.cm.get_cmap("viridis", 4)


mesh.plot(cmap=cmap)

###############################################################################
# Note that this dataset is a 3D volume and there might be regions within this
# volume that we would like to inspect. We can create slices through the mesh
# to gain further insight about the internals of the volume.

slices = mesh.slice_orthogonal()

slices.plot(cmap=cmap)
Exemple #5
0
bodies.plot(show_grid=True, multi_colors=True, cpos=[-2, 5, 3])

###############################################################################
# -----
#
# A Real Dataset
# ++++++++++++++
#
# Here is a realistic training dataset of fluvial channels in the subsurface.
# This will threshold the channels from the dataset then separate each
# significantly large body and compute the volumes for each!
#
# Load up the data and threshold the channels:

data = examples.load_channels()
channels = data.threshold([0.9, 1.1])

###############################################################################
# Now extract all the different bodies and compute their volumes:

bodies = channels.split_bodies()
# Now remove all bodies with a small volume
for key in bodies.keys():
    b = bodies[key]
    vol = b.volume
    if vol < 1000.0:
        del bodies[key]
        continue
    # Now lets add a volume array to all blocks
    b.cell_arrays["TOTAL VOLUME"] = np.full(b.n_cells, vol)
Exemple #6
0
"""
Hide Cells with Ghosting
~~~~~~~~~~~~~~~~~~~~~~~~

Specify specific cells to hide when plotting.

This is a lightwieght alternative to thresholding to quickly hide cells in a
mesh without creating a new mesh.

Notably, the mesh must be cast to an :class:`pyvista.UnstructuredGrid` type
for this to work (use the ``cast_to_unstructured_grid`` filter).
"""
import pyvista as pv
from pyvista import examples
import numpy as np

vol = examples.load_channels()
mesh = vol.cast_to_unstructured_grid()

###############################################################################
# Decide which cells are ghosted with a criteria (feel free to adjust this
# or manually create this array to hide specific cells).
ghosts = np.argwhere(mesh["facies"] < 1.0)

# This will act on the mesh inplace to mark those cell indices as ghosts
mesh.remove_cells(ghosts)

###############################################################################
# Now we can plot the mesh and those cells will be hidden
mesh.plot(clim=[0,4])
Exemple #7
0
import pyvista as pv
from pyvista import examples
import matplotlib.pyplot as plt

################################################################################
# PyVista meshes have several slicing filters bound directly to all datasets.
# Thes filters allow you to slice through a volumetric dataset to extract and
# view sections through the volume of data.
#
# One of the most common slicing filters used in PyVista is the
# :func:`pyvista.DataSetFilters.slice_orthogonal` filter which creates three
# orthogonal slices through the dataset on the three caresian planes.
# For example, let's slice through the sample geostatitical training image
# volume. First, load up the volume and preview it:

mesh = examples.load_channels()
# define a categorical colormap
cmap = plt.cm.get_cmap('viridis', 4)

mesh.plot(cmap=cmap)

################################################################################
# Note that this dataset is a 3D volume and their might be regions within the
# volume that we would like to inspect. We can create slices through the mesh
# to gain insight about the internals of the volume.

slices = mesh.slice_orthogonal()

slices.plot(cmap=cmap)

################################################################################
Exemple #8
0
 def __init__(self):
     self._example_data = examples.load_channels()
     _ExampleLoader.__init__(self)