Beispiel #1
0
    def test_plot_topography_high(self, one_fault_model_topo_solution):
        """
        Args:
            vista_object_computed_topo:
        """
        vista_object_computed_topo = GemPyToVista(one_fault_model_topo_solution,
                                                  plotter_type='basic', off_screen=True)

        vista_object_computed_topo.plot_topography(scalars='topography')
        img = vista_object_computed_topo.p.show(screenshot=True)
        plt.imshow(img[1])
        plt.show()
        print('foo')
Beispiel #2
0
    def test_plot_several3(self, one_fault_model_topo_solution):
        vista_object_computed_topo = GemPyToVista(one_fault_model_topo_solution,
                                                  plotter_type='basic', off_screen=True)

        vista_object_computed_topo.plot_surface_points()
        vista_object_computed_topo.plot_surfaces()
        vista_object_computed_topo.plot_structured_grid(render_topography=True,
                                                        scalar_field='scalar',
                                                        series='Strat_Series',
                                                        )
        vista_object_computed_topo.plot_topography(scalars='topography')
        img = vista_object_computed_topo.p.show(screenshot=True)
        plt.imshow(img[1])
        plt.show()
Beispiel #3
0
    def test_plot_several2(self, one_fault_model_topo_solution):
        vista_object_computed_topo = GemPyToVista(one_fault_model_topo_solution,
                                                  plotter_type='basic', off_screen=True)

        vista_object_computed_topo.plot_surface_points()
        vista_object_computed_topo.plot_surfaces()
        vista_object_computed_topo.plot_structured_grid(render_topography=False)
        img = vista_object_computed_topo.p.show(screenshot=True)
        plt.imshow(img[1])
        plt.show()
Beispiel #4
0
    def vista_object_only_data_interactive(self, one_fault_model_no_interp):
        """
        Args:
            one_fault_model:
        """
        from gempy.plot.vista import GemPyToVista

        return GemPyToVista(one_fault_model_no_interp,
                            plotter_type='background')
Beispiel #5
0
    def vista_object_computed(self, one_fault_model_solution):
        """
        Args:
            one_fault_model_solution:
        """
        from gempy.plot.vista import GemPyToVista

        return GemPyToVista(one_fault_model_solution,
                            plotter_type='basic',
                            off_screen=True)
Beispiel #6
0
    def vista_object_only_data(self, one_fault_model_no_interp):
        """
        Args:
            one_fault_model:
        """
        from gempy.plot.vista import GemPyToVista

        return GemPyToVista(one_fault_model_no_interp,
                            #plotter_type='background')
                            plotter_type='basic',  off_screen=True)
Beispiel #7
0
def plot_interactive_3d(
    geo_model,
    scalar_field: str = 'all',
    series=None,
    show_topography: bool = False,
    **kwargs,
):
    """Plot interactive 3-D geomodel with three cross sections in subplots.
    Args:
        geo_model: Geomodel object with solutions.
        name (str): Can be either one of the following
                'lith' - Lithology id block.
                'scalar' - Scalar field block.
                'values' - Values matrix block.
        render_topography: Render topography. Defaults to False.
        **kwargs:
    Returns:
        :class:`gempy.plot.vista.GemPyToVista`

    """
    gpv = GemPyToVista(geo_model, plotter_type='background', shape="1|3")
    gpv.plot_data()
    gpv.plot_structured_grid_interactive(scalar_field=scalar_field,
                                         series=series,
                                         render_topography=show_topography,
                                         **kwargs)

    return gpv
Beispiel #8
0
    def vista_object_computed_topo(self, one_fault_model_solution):
        """
        Args:
            one_fault_model_solution:
        """

        from gempy.plot.vista import GemPyToVista
        one_fault_model_solution.update_additional_data()
        one_fault_model_solution.update_to_interpolator()
        one_fault_model_solution.set_topography()
        gp.compute_model(one_fault_model_solution)

        return GemPyToVista(one_fault_model_solution, plotter_type='basic', off_screen=True)
Beispiel #9
0
    def test_plot_regular_grid_select_field(self, one_fault_model_solution):
        """
        Args:
            vista_object_computed:
        """

        vista_object_computed = GemPyToVista(one_fault_model_solution,
                                             plotter_type='basic',
                                             off_screen=True)
        vista_object_computed.plot_structured_grid('lith')
        with pytest.raises(AttributeError):
            vista_object_computed.set_active_scalar_fields(
                scalar_field='scalar')
        # vista_object_computed.plot_structured_grid('scalar')
        print('foo')
Beispiel #10
0
    def test_plot_regular_grid_scalar_topo(self, one_fault_model_topo_solution):
        """
        Args:
            vista_object_computed_topo:
        """
        vista_object_computed_topo = GemPyToVista(one_fault_model_topo_solution,
                                                  plotter_type='basic', off_screen=True)

        vista_object_computed_topo.plot_structured_grid('lith', render_topography=False)
        vista_object_computed_topo.plot_surfaces()
        # vista_object_computed_topo.set_scalar_bar()
        img = vista_object_computed_topo.p.show(screenshot=True)
        plt.imshow(img[1])
        plt.show()
        print('foo')
Beispiel #11
0
def plot_3d(model,
            plotter_type='basic',
            show_data: bool = True,
            show_results: bool = True,
            show_surfaces: bool = True,
            show_lith: bool = True,
            show_scalar: bool = False,
            show_boundaries: bool = True,
            show_topography: Union[bool, list] = False,
            scalar_field: str = None,
            ve=None,
            kwargs_plot_structured_grid=None,
            kwargs_plot_topography=None,
            image=False,
            off_screen=False,
            **kwargs) -> GemPyToVista:
    """foobar

    Args:

        model (:class:`gempy.core.model.Project`): Container class of all
         objects that constitute a GemPy model.
        plotter_type: PyVista plotter types. Supported plotters are:
         'basic', 'background', and 'notebook'.
        show_data (bool): Show original input data. Defaults to True.
        show_results (bool): If False, override show lith, show_scalar, show_values
        show_lith (bool): Show lithological block volumes. Defaults to True.
        show_scalar (bool): Show scalar field isolines. Defaults to False.
        show_boundaries (bool): Show surface boundaries as lines. Defaults to True.
        show_topography (bool): Show topography on plot. Defaults to False.
        scalar_field (str): Name of the field to be activated
        series_n (int): number of the scalar field.
        ve (float): Vertical Exaggeration
        kwargs_plot_structured_grid:
        kwargs_plot_topography:
        **kwargs:

    Returns:
        :class:`gempy.plot.vista.GemPyToVista`

    """
    if image is True:
        off_screen = True
        kwargs['off_screen'] = True
        plotter_type = 'basic'
    if show_results is False:
        show_surfaces = False
        show_scalar = False
        show_lith = False

    if kwargs_plot_topography is None:
        kwargs_plot_topography = dict()
    if kwargs_plot_structured_grid is None:
        kwargs_plot_structured_grid = dict()

    fig_path: str = kwargs.get('fig_path', None)

    gpv = GemPyToVista(model, plotter_type=plotter_type, **kwargs)
    if show_surfaces and len(model.solutions.vertices) != 0:
        gpv.plot_surfaces()
    if show_lith is True and model.solutions.lith_block.shape[0] != 0:
        gpv.plot_structured_grid('lith', **kwargs_plot_structured_grid)
    if show_scalar is True and model.solutions.scalar_field_matrix.shape[
            0] != 0:
        gpv.plot_structured_grid("scalar", series=scalar_field)

    if show_data:
        gpv.plot_data()
    if show_topography and model._grid.topography is not None:
        gpv.plot_topography(**kwargs_plot_topography)

    if ve is not None:
        gpv.p.set_scale(zscale=ve)

    if fig_path is not None:
        gpv.p.show(screenshot=fig_path)

    if image is True:
        img = gpv.p.show(screenshot=True)
        plt.imshow(img[1])
        plt.axis('off')
        plt.show()
        gpv.p.close()

    if off_screen is False:
        gpv.p.show()

    return gpv