# Gempy 開源地質模型軟體課程筆記
###### tags: `建築工具開源軟體`
## 相關網站
[Gempy工作坊](https://github.com/cgre-aachen/gempy_workshops/blob/master/notebooks/GeoUtrecht_gempy.ipynb)
[官方網站 | GemPy](https://www.gempy.org/documentation)
[gempy · PyPI](https://pypi.org/project/gempy/#history)
## 軟體下載與安裝(使用ANANCONDA安裝)
1. 開啟Anaconda Prompt
2. 安裝Gempy環境
3. 本次使用2020/10/22 gempy2.2.7版本
```python=
conda create --name GempyEnve python=3.7
conda activate GempyEnve
conda install libpython m2w64-toolchain git
pip install theano==1.0.4
pip install gempy==2.2.7
conda install Jupyter nb_conda_kernels
pip install jupyter-conda
pip install pyevtk
conda install gdal
conda uninstall prompt_toolkit ipython
conda install prompt_toolkit ipython
conda install pyparsing mkl-service
```
Gempy-修改套件內容
檔案路徑:
D:\Hsintien_tsai\Anaconda3\envs\GempyEnve_1214\Lib\site-packages\gempy\plot
## gempy.plot_3d
Source code for gempy.plot.plot_api
```
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,
kwargs_plot_data=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()
if kwargs_plot_data is None:
kwargs_plot_data = 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(**kwargs_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
```