|
30 | 30 | "owner": "GemPy Team"
|
31 | 31 | },
|
32 | 32 | "surface_points": [
|
33 |
| - {"x": 0, "y": 200, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
34 |
| - {"x": 0, "y": 500, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
35 |
| - {"x": 0, "y": 800, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
36 |
| - {"x": 200, "y": 200, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
37 |
| - {"x": 200, "y": 500, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
38 |
| - {"x": 200, "y": 800, "z": 600, "id": 0, "nugget": 0.00002}, # rock1 |
39 |
| - {"x": 800, "y": 200, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
40 |
| - {"x": 800, "y": 500, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
41 |
| - {"x": 800, "y": 800, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
42 |
| - {"x": 1000, "y": 200, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
43 |
| - {"x": 1000, "y": 500, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
44 |
| - {"x": 1000, "y": 800, "z": 200, "id": 0, "nugget": 0.00002}, # rock1 |
45 |
| - {"x": 0, "y": 200, "z": 800, "id": 1, "nugget": 0.00002}, # rock2 |
46 |
| - {"x": 0, "y": 800, "z": 800, "id": 1, "nugget": 0.00002}, # rock2 |
47 |
| - {"x": 200, "y": 200, "z": 800, "id": 1, "nugget": 0.00002}, # rock2 |
48 |
| - {"x": 200, "y": 800, "z": 800, "id": 1, "nugget": 0.00002}, # rock2 |
49 |
| - {"x": 800, "y": 200, "z": 400, "id": 1, "nugget": 0.00002}, # rock2 |
50 |
| - {"x": 800, "y": 800, "z": 400, "id": 1, "nugget": 0.00002}, # rock2 |
51 |
| - {"x": 1000, "y": 200, "z": 400, "id": 1, "nugget": 0.00002}, # rock2 |
52 |
| - {"x": 1000, "y": 800, "z": 400, "id": 1, "nugget": 0.00002}, # rock2 |
53 |
| - {"x": 500, "y": 500, "z": 500, "id": 2, "nugget": 0.00002}, # fault |
54 |
| - {"x": 450, "y": 500, "z": 600, "id": 2, "nugget": 0.00002}, # fault |
55 |
| - {"x": 500, "y": 200, "z": 500, "id": 2, "nugget": 0.00002}, # fault |
56 |
| - {"x": 450, "y": 200, "z": 600, "id": 2, "nugget": 0.00002}, # fault |
57 |
| - {"x": 500, "y": 800, "z": 500, "id": 2, "nugget": 0.00002}, # fault |
58 |
| - {"x": 450, "y": 800, "z": 600, "id": 2, "nugget": 0.00002} # fault |
| 33 | + # rock1 points |
| 34 | + {"x": 0, "y": 200, "z": 600, "id": 0, "nugget": 0.00002}, |
| 35 | + {"x": 0, "y": 500, "z": 600, "id": 0, "nugget": 0.00002}, |
| 36 | + {"x": 0, "y": 800, "z": 600, "id": 0, "nugget": 0.00002}, |
| 37 | + {"x": 200, "y": 200, "z": 600, "id": 0, "nugget": 0.00002}, |
| 38 | + {"x": 200, "y": 500, "z": 600, "id": 0, "nugget": 0.00002}, |
| 39 | + {"x": 200, "y": 800, "z": 600, "id": 0, "nugget": 0.00002}, |
| 40 | + {"x": 800, "y": 200, "z": 200, "id": 0, "nugget": 0.00002}, |
| 41 | + {"x": 800, "y": 500, "z": 200, "id": 0, "nugget": 0.00002}, |
| 42 | + {"x": 800, "y": 800, "z": 200, "id": 0, "nugget": 0.00002}, |
| 43 | + {"x": 1000, "y": 200, "z": 200, "id": 0, "nugget": 0.00002}, |
| 44 | + {"x": 1000, "y": 500, "z": 200, "id": 0, "nugget": 0.00002}, |
| 45 | + {"x": 1000, "y": 800, "z": 200, "id": 0, "nugget": 0.00002}, |
| 46 | + # rock2 points |
| 47 | + {"x": 0, "y": 200, "z": 800, "id": 1, "nugget": 0.00002}, |
| 48 | + {"x": 0, "y": 800, "z": 800, "id": 1, "nugget": 0.00002}, |
| 49 | + {"x": 200, "y": 200, "z": 800, "id": 1, "nugget": 0.00002}, |
| 50 | + {"x": 200, "y": 800, "z": 800, "id": 1, "nugget": 0.00002}, |
| 51 | + {"x": 800, "y": 200, "z": 400, "id": 1, "nugget": 0.00002}, |
| 52 | + {"x": 800, "y": 800, "z": 400, "id": 1, "nugget": 0.00002}, |
| 53 | + {"x": 1000, "y": 200, "z": 400, "id": 1, "nugget": 0.00002}, |
| 54 | + {"x": 1000, "y": 800, "z": 400, "id": 1, "nugget": 0.00002}, |
| 55 | + # fault points |
| 56 | + {"x": 500, "y": 500, "z": 500, "id": 2, "nugget": 0.00002}, |
| 57 | + {"x": 450, "y": 500, "z": 600, "id": 2, "nugget": 0.00002}, |
| 58 | + {"x": 500, "y": 200, "z": 500, "id": 2, "nugget": 0.00002}, |
| 59 | + {"x": 450, "y": 200, "z": 600, "id": 2, "nugget": 0.00002}, |
| 60 | + {"x": 500, "y": 800, "z": 500, "id": 2, "nugget": 0.00002}, |
| 61 | + {"x": 450, "y": 800, "z": 600, "id": 2, "nugget": 0.00002} |
59 | 62 | ],
|
60 | 63 | "orientations": [
|
61 |
| - {"x": 100, "y": 500, "z": 800, "G_x": 0, "G_y": 0, "G_z": 1, "id": 1, "nugget": 0.00002, "polarity": 1}, # rock2 |
62 |
| - {"x": 100, "y": 500, "z": 600, "G_x": 0, "G_y": 0, "G_z": 1, "id": 0, "nugget": 0.00002, "polarity": 1}, # rock1 |
63 |
| - {"x": 900, "y": 500, "z": 400, "G_x": 0, "G_y": 0, "G_z": 1, "id": 1, "nugget": 0.00002, "polarity": 1}, # rock2 |
64 |
| - {"x": 900, "y": 500, "z": 200, "G_x": 0, "G_y": 0, "G_z": 1, "id": 0, "nugget": 0.00002, "polarity": 1}, # rock1 |
65 |
| - {"x": 500, "y": 500, "z": 500, "G_x": 0.866, "G_y": 0, "G_z": 0.5, "id": 2, "nugget": 0.00002, "polarity": 1} # fault |
| 64 | + # rock2 orientations |
| 65 | + {"x": 100, "y": 500, "z": 800, "G_x": 0, "G_y": 0, "G_z": 1, "id": 1, "nugget": 0.00002, "polarity": 1}, |
| 66 | + {"x": 900, "y": 500, "z": 400, "G_x": 0, "G_y": 0, "G_z": 1, "id": 1, "nugget": 0.00002, "polarity": 1}, |
| 67 | + # rock1 orientations |
| 68 | + {"x": 100, "y": 500, "z": 600, "G_x": 0, "G_y": 0, "G_z": 1, "id": 0, "nugget": 0.00002, "polarity": 1}, |
| 69 | + {"x": 900, "y": 500, "z": 200, "G_x": 0, "G_y": 0, "G_z": 1, "id": 0, "nugget": 0.00002, "polarity": 1}, |
| 70 | + # fault orientation (60-degree dip) |
| 71 | + {"x": 500, "y": 500, "z": 500, "G_x": 0.866, "G_y": 0, "G_z": 0.5, "id": 2, "nugget": 0.00002, "polarity": 1} |
66 | 72 | ],
|
67 | 73 | "series": [
|
68 | 74 | {
|
69 |
| - "name": "series1", |
70 |
| - "surfaces": ["rock1", "rock2"], |
71 |
| - "structural_relation": "ERODE", |
72 |
| - "colors": ["#015482", "#9f0052"] |
73 |
| - }, |
74 |
| - { |
75 |
| - "name": "fault_series", |
| 75 | + "name": "Fault_Series", |
76 | 76 | "surfaces": ["fault"],
|
77 | 77 | "structural_relation": "FAULT",
|
78 | 78 | "colors": ["#ffbe00"]
|
| 79 | + }, |
| 80 | + { |
| 81 | + "name": "Strat_Series", |
| 82 | + "surfaces": ["rock2", "rock1"], |
| 83 | + "structural_relation": "ERODE", |
| 84 | + "colors": ["#015482", "#9f0052"] |
79 | 85 | }
|
80 | 86 | ],
|
81 | 87 | "grid_settings": {
|
|
91 | 97 | "mesh_extraction": True,
|
92 | 98 | "number_octree_levels": 1
|
93 | 99 | },
|
94 |
| - "fault_relations": [[0, 1], [0, 0]], # Fault series affects series1 |
| 100 | + "fault_relations": [[0, 1], [0, 0]], # Fault series affects Strat_Series |
95 | 101 | "id_name_mapping": {
|
96 | 102 | "name_to_id": {
|
97 | 103 | "rock1": 0,
|
|
123 | 129 | print("\nStructural Groups:")
|
124 | 130 | print(model.structural_frame.structural_groups)
|
125 | 131 |
|
126 |
| -# %% |
127 |
| -# Set fault relations |
128 |
| -# Create a 2x2 matrix for fault relations (2 series: Fault_Series, Strat_Series) |
129 |
| -# 1 means the fault affects the series, 0 means it doesn't |
130 |
| -model.structural_frame.fault_relations = np.array([[0, 1], [0, 0]], dtype=bool) # Using NumPy array with boolean type |
131 |
| - |
132 |
| -# Explicitly set the structural relation for the fault series |
133 |
| -model.structural_frame.structural_groups[1].structural_relation = StackRelationType.FAULT |
134 |
| - |
135 |
| -# Set the fault series as a fault |
136 |
| -gp.set_is_fault( |
137 |
| - frame=model, |
138 |
| - fault_groups=['fault_series'] |
139 |
| -) |
140 |
| - |
141 | 132 | # %%
|
142 | 133 | # Compute the geological model
|
143 | 134 | gp.compute_model(model)
|
|
158 | 149 | print(f"Owner: {reloaded_model.meta.owner}")
|
159 | 150 |
|
160 | 151 | # %%
|
161 |
| -# Plot the model |
162 |
| -# Plot the initial geological model in the y direction without results |
163 |
| -fig, ax = plt.subplots(figsize=(10, 6)) |
164 |
| -gpv.plot_2d(model, direction=['y'], show_results=False, ax=ax) |
165 |
| -plt.title("Initial Geological Model (y direction)") |
166 |
| -plt.savefig('initial_model_y.png') |
| 152 | +# Create plots with proper configuration |
| 153 | +# Plot 1: Cross-section in Y direction (XZ plane) |
| 154 | +fig = plt.figure(figsize=(10, 8)) |
| 155 | +ax = fig.add_subplot(111) |
| 156 | +gpv.plot_2d( |
| 157 | + model, |
| 158 | + cell_number=25, # Middle of the model |
| 159 | + direction='y', |
| 160 | + show_data=True, |
| 161 | + show_boundaries=True, |
| 162 | + show_results=True, |
| 163 | + ax=ax |
| 164 | +) |
| 165 | +plt.title("Geological Model - Y Direction (XZ plane)") |
| 166 | +plt.savefig('model_y_direction.png', dpi=300, bbox_inches='tight') |
167 | 167 | plt.close()
|
168 | 168 |
|
169 |
| -# Plot the result of the model in the x and y direction with data and without boundaries |
170 |
| -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6)) |
171 |
| -gpv.plot_2d(model, direction=['x'], show_data=True, show_boundaries=False, ax=ax1) |
172 |
| -ax1.set_title("Model with Data (x direction)") |
173 |
| -gpv.plot_2d(model, direction=['y'], show_data=True, show_boundaries=False, ax=ax2) |
174 |
| -ax2.set_title("Model with Data (y direction)") |
175 |
| -plt.tight_layout() |
176 |
| -plt.savefig('model_with_data.png') |
| 169 | +# Plot 2: Cross-section in X direction (YZ plane) |
| 170 | +fig = plt.figure(figsize=(10, 8)) |
| 171 | +ax = fig.add_subplot(111) |
| 172 | +gpv.plot_2d( |
| 173 | + model, |
| 174 | + cell_number=25, # Middle of the model |
| 175 | + direction='x', |
| 176 | + show_data=True, |
| 177 | + show_boundaries=True, |
| 178 | + show_results=True, |
| 179 | + ax=ax |
| 180 | +) |
| 181 | +plt.title("Geological Model - X Direction (YZ plane)") |
| 182 | +plt.savefig('model_x_direction.png', dpi=300, bbox_inches='tight') |
| 183 | +plt.close() |
| 184 | + |
| 185 | +# Plot 3: Scalar field of the fault |
| 186 | +fig = plt.figure(figsize=(10, 8)) |
| 187 | +ax = fig.add_subplot(111) |
| 188 | +gpv.plot_2d( |
| 189 | + model, |
| 190 | + cell_number=25, |
| 191 | + direction='y', |
| 192 | + show_scalar=True, |
| 193 | + show_data=True, |
| 194 | + series_n=0, # Fault series |
| 195 | + show_results=False, |
| 196 | + ax=ax |
| 197 | +) |
| 198 | +plt.title("Fault Scalar Field - Y Direction") |
| 199 | +plt.savefig('fault_scalar_field.png', dpi=300, bbox_inches='tight') |
177 | 200 | plt.close()
|
178 | 201 |
|
179 |
| -# Plot the scalar field of the fault |
180 |
| -fig, ax = plt.subplots(figsize=(10, 6)) |
181 |
| -gpv.plot_2d(model, show_scalar=True, show_lith=False, series_n=0, ax=ax) |
182 |
| -plt.title("Fault Scalar Field") |
183 |
| -plt.savefig('fault_scalar_field.png') |
184 |
| -plt.close() |
| 202 | +# Plot 4: 3D visualization |
| 203 | +# Note: 3D plotting requires interactive backend |
| 204 | +try: |
| 205 | + import pyvista as pv |
| 206 | + p = pv.Plotter(notebook=False, off_screen=True) |
| 207 | + gpv.plot_3d( |
| 208 | + model, |
| 209 | + show_data=True, |
| 210 | + show_surfaces=True, |
| 211 | + show_boundaries=True, |
| 212 | + plotter=p |
| 213 | + ) |
| 214 | + p.screenshot('model_3d.png', transparent_background=False) |
| 215 | + p.close() |
| 216 | +except Exception as e: |
| 217 | + print(f"Could not create 3D plot: {e}") |
185 | 218 | # %%
|
0 commit comments