Skip to content

Commit 1e36381

Browse files
authored
Merge pull request #941 from gempy-project/javoha_dev
Example for video tutorial series
2 parents 2e1bcfd + 0a9cbf1 commit 1e36381

File tree

2 files changed

+179
-113
lines changed

2 files changed

+179
-113
lines changed

examples/tutorials/z_other_tutorials/a1_fold.py

Lines changed: 0 additions & 113 deletions
This file was deleted.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
"""
2+
Modeling step by step
3+
^^^^^^^^^^^^^^^^^^^^^
4+
5+
This tutorial demonstrates step-by-step geological modeling using the `gempy` and `gempy_viewer` libraries.
6+
It follows the Video tutorial series available on the `gempy` YouTube channel (https://www.youtube.com/@GemPy3D).
7+
"""
8+
9+
# %%
10+
# Video tutorial 2: Input data
11+
# """"""""""""""""""""""""""""
12+
13+
# Required imports
14+
import gempy as gp
15+
import gempy_viewer as gpv
16+
17+
# %%
18+
19+
# Path to input data
20+
data_path = "https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/"
21+
path_to_data = data_path + "/data/input_data/video_tutorials_v3/"
22+
23+
# %%
24+
25+
# Create instance of geomodel
26+
geo_model = gp.create_geomodel(
27+
project_name = 'tutorial_model',
28+
extent=[0,2500,0,1000,0,1000],
29+
resolution=[100,40,40],
30+
importer_helper=gp.data.ImporterHelper(
31+
path_to_orientations=path_to_data+"tutorial_model_orientations.csv",
32+
path_to_surface_points=path_to_data+"tutorial_model_surface_points.csv"
33+
)
34+
)
35+
# %%
36+
37+
# Display a basic cross section of input data
38+
gpv.plot_2d(geo_model)
39+
40+
# %%
41+
42+
# Manually add a surface point
43+
gp.add_surface_points(
44+
geo_model=geo_model,
45+
x=[2250],
46+
y=[500],
47+
z=[750],
48+
elements_names=['rock1']
49+
)
50+
51+
# %%
52+
53+
# Show added point in cross section
54+
gpv.plot_2d(geo_model)
55+
56+
# %%
57+
# Video tutorial 3: Structural frame
58+
# """"""""""""""""""""""""""""""""""
59+
60+
# View structural frame
61+
geo_model.structural_frame
62+
63+
# %%
64+
65+
# View structural elements
66+
geo_model.structural_frame.structural_elements
67+
68+
# %%
69+
70+
# Define structural groups and age/stratigraphic relationship
71+
gp.map_stack_to_surfaces(
72+
gempy_model=geo_model,
73+
mapping_object={
74+
"Strat_Series2": ("rock3"),
75+
"Strat_Series1": ("rock2", "rock1")
76+
}
77+
)
78+
79+
# %%
80+
# Video tutorial 4: Computation and results
81+
# """""""""""""""""""""""""""""""""""""""""
82+
83+
# View interpolation options
84+
geo_model.interpolation_options
85+
86+
# %%
87+
88+
# Compute a solution for the model
89+
gp.compute_model(geo_model)
90+
91+
# %%
92+
93+
# Display the result in 2d section
94+
gpv.plot_2d(geo_model, cell_number=20)
95+
96+
# %%
97+
98+
# Some examples of how to access results
99+
print(geo_model.solutions.raw_arrays.lith_block)
100+
print(geo_model.grid.dense_grid.values)
101+
102+
# %%
103+
# Video tutorial 5: 2D visualization
104+
# """"""""""""""""""""""""""""""""""
105+
106+
# 2d plotting options
107+
gpv.plot_2d(geo_model, show_value=True, show_lith=False, show_scalar=True, series_n=1, cell_number=25)
108+
109+
# %%
110+
111+
# Create custom section lines
112+
gp.set_section_grid(
113+
grid=geo_model.grid,
114+
section_dict={
115+
'section1': ([0, 0], [2500, 1000], [100, 50]),
116+
'section2': ([1000, 1000], [1500, 0], [100, 100]),
117+
}
118+
)
119+
120+
# %%
121+
122+
# Show custom cross-section traces
123+
gpv.plot_section_traces(geo_model)
124+
125+
# %%
126+
127+
# Recompute model as a new grid was added
128+
gp.compute_model(geo_model)
129+
130+
# %%
131+
132+
# Display custom cross-sections
133+
gpv.plot_2d(geo_model, section_names=['section1', 'section2'], show_data=False)
134+
135+
# %%
136+
# Video tutorial 6: 3D visualization
137+
# """"""""""""""""""""""""""""""""""
138+
139+
# Display the result in 3d
140+
gpv.plot_3d(geo_model, show_lith=True, show_boundaries=True, ve=None)
141+
142+
# %%
143+
144+
# How to access DC meshes
145+
geo_model.solutions.dc_meshes[0].dc_data
146+
147+
# %%
148+
# Video tutorial 7: Topography
149+
# """""""""""""""""""""""""""""""
150+
151+
# Setting a randomly generated topography
152+
import numpy as np
153+
154+
gp.set_topography_from_random(
155+
grid=geo_model.grid,
156+
fractal_dimension=1.2,
157+
d_z=np.array([700, 900]),
158+
topography_resolution=np.array([250, 100])
159+
)
160+
161+
# %%
162+
163+
# Recompute model as a new grid was added
164+
gp.compute_model(geo_model)
165+
166+
# %%
167+
168+
# Display a cross-section with topography
169+
gpv.plot_2d(geo_model, show_topography=True)
170+
171+
# %%
172+
173+
# Displaying a geological map
174+
gpv.plot_2d(geo_model, show_topography=True, section_names=['topography'], show_boundaries=False, show_data=False)
175+
176+
# %%
177+
178+
# Display the 3d model with topography
179+
gpv.plot_3d(geo_model, show_lith=True, show_topography=True)

0 commit comments

Comments
 (0)