9
9
# %%
10
10
# Import necessary libraries
11
11
import matplotlib
12
- matplotlib .use ('Agg' ) # Use non-interactive backend
12
+ # matplotlib.use('Agg') # Use non-interactive backend
13
13
import gempy as gp
14
14
import gempy_viewer as gpv
15
15
import numpy as np
18
18
import matplotlib .pyplot as plt
19
19
from gempy_engine .core .data .stack_relation_type import StackRelationType
20
20
from gempy .modules .json_io .json_operations import JsonIO # Updated import path
21
+ from datetime import datetime
21
22
22
23
# %%
23
24
# Define the model data
24
25
model_data = {
25
26
"metadata" : {
26
- "name" : "multiple_series_faults " ,
27
- "creation_date" : "2024-03-19" ,
28
- "last_modification_date" : "2024-03-19" ,
29
- "owner" : "tutorial "
27
+ "name" : "Multiple Series and Faults Model " ,
28
+ "creation_date" : datetime . now (). isoformat () ,
29
+ "last_modification_date" : datetime . now (). isoformat () ,
30
+ "owner" : "GemPy Team "
30
31
},
31
32
"surface_points" : [
32
- # fault surface points (previously rock1 points)
33
- {"x" : 0.0 , "y" : 200.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
34
- {"x" : 0.0 , "y" : 500.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
35
- {"x" : 0.0 , "y" : 800.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
36
- {"x" : 200.0 , "y" : 200.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
37
- {"x" : 200.0 , "y" : 500.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
38
- {"x" : 200.0 , "y" : 800.0 , "z" : 600.0 , "id" : 2 , "nugget" : 0.00002 },
39
- {"x" : 800.0 , "y" : 200.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
40
- {"x" : 800.0 , "y" : 500.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
41
- {"x" : 800.0 , "y" : 800.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
42
- {"x" : 1000.0 , "y" : 200.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
43
- {"x" : 1000.0 , "y" : 500.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
44
- {"x" : 1000.0 , "y" : 800.0 , "z" : 200.0 , "id" : 2 , "nugget" : 0.00002 },
45
- # rock2 surface points
46
- {"x" : 0.0 , "y" : 200.0 , "z" : 800.0 , "id" : 1 , "nugget" : 0.00002 },
47
- {"x" : 0.0 , "y" : 800.0 , "z" : 800.0 , "id" : 1 , "nugget" : 0.00002 },
48
- {"x" : 200.0 , "y" : 200.0 , "z" : 800.0 , "id" : 1 , "nugget" : 0.00002 },
49
- {"x" : 200.0 , "y" : 800.0 , "z" : 800.0 , "id" : 1 , "nugget" : 0.00002 },
50
- {"x" : 800.0 , "y" : 200.0 , "z" : 400.0 , "id" : 1 , "nugget" : 0.00002 },
51
- {"x" : 800.0 , "y" : 800.0 , "z" : 400.0 , "id" : 1 , "nugget" : 0.00002 },
52
- {"x" : 1000.0 , "y" : 200.0 , "z" : 400.0 , "id" : 1 , "nugget" : 0.00002 },
53
- {"x" : 1000.0 , "y" : 800.0 , "z" : 400.0 , "id" : 1 , "nugget" : 0.00002 },
54
- # rock1 surface points (previously fault points)
55
- {"x" : 500.0 , "y" : 500.0 , "z" : 500.0 , "id" : 0 , "nugget" : 0.00002 },
56
- {"x" : 450.0 , "y" : 500.0 , "z" : 600.0 , "id" : 0 , "nugget" : 0.00002 },
57
- {"x" : 500.0 , "y" : 200.0 , "z" : 500.0 , "id" : 0 , "nugget" : 0.00002 },
58
- {"x" : 450.0 , "y" : 200.0 , "z" : 600.0 , "id" : 0 , "nugget" : 0.00002 },
59
- {"x" : 500.0 , "y" : 800.0 , "z" : 500.0 , "id" : 0 , "nugget" : 0.00002 },
60
- {"x" : 450.0 , "y" : 800.0 , "z" : 600.0 , "id" : 0 , "nugget" : 0.00002 },
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
61
59
],
62
60
"orientations" : [
63
- # rock2 orientation (upper layer at x=100)
64
- {"x" : 100.0 , "y" : 500.0 , "z" : 800.0 , "G_x" : 0.0 , "G_y" : 0.0 , "G_z" : 1.0 , "id" : 1 , "nugget" : 0.01 , "polarity" : 1 },
65
- # rock1 orientation (lower layer at x=100)
66
- {"x" : 100.0 , "y" : 500.0 , "z" : 600.0 , "G_x" : 0.0 , "G_y" : 0.0 , "G_z" : 1.0 , "id" : 2 , "nugget" : 0.01 , "polarity" : 1 },
67
- # fault orientation (at x=500)
68
- {"x" : 500.0 , "y" : 500.0 , "z" : 500.0 , "G_x" : 0.8 , "G_y" : 0.0 , "G_z" : 0.6 , "id" : 0 , "nugget" : 0.01 , "polarity" : 1 },
69
- # rock2 orientation (upper layer at x=900)
70
- {"x" : 900.0 , "y" : 500.0 , "z" : 400.0 , "G_x" : 0.0 , "G_y" : 0.0 , "G_z" : 1.0 , "id" : 1 , "nugget" : 0.01 , "polarity" : 1 },
71
- # rock1 orientation (lower layer at x=900)
72
- {"x" : 900.0 , "y" : 500.0 , "z" : 200.0 , "G_x" : 0.0 , "G_y" : 0.0 , "G_z" : 1.0 , "id" : 2 , "nugget" : 0.01 , "polarity" : 1 },
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
73
66
],
74
67
"series" : [
75
68
{
76
- "name" : "Fault_Series " ,
77
- "surfaces" : ["fault " ],
78
- "structural_relation" : "FAULT " ,
79
- "color " : "#015482" # Blue color for fault
69
+ "name" : "series1 " ,
70
+ "surfaces" : ["rock1" , "rock2 " ],
71
+ "structural_relation" : "ERODE " ,
72
+ "colors " : [ "#015482" , "#9f0052" ]
80
73
},
81
74
{
82
- "name" : "Strat_Series " ,
83
- "surfaces" : ["rock2" , "rock1 " ],
84
- "structural_relation" : "ERODE " ,
85
- "colors" : ["#ffbe00" , "#9f0052" ] # Yellow for rock2, Pink for rock1
75
+ "name" : "fault_series " ,
76
+ "surfaces" : ["fault " ],
77
+ "structural_relation" : "FAULT " ,
78
+ "colors" : ["#ffbe00" ]
86
79
}
87
80
],
88
81
"grid_settings" : {
89
- "regular_grid_resolution" : [90 , 30 , 30 ], # Increased resolution for better visualization
82
+ "regular_grid_resolution" : [50 , 50 , 50 ],
90
83
"regular_grid_extent" : [0 , 1000 , 0 , 1000 , 0 , 1000 ],
91
84
"octree_levels" : None
92
85
},
93
- "interpolation_options" : {}
86
+ "interpolation_options" : {
87
+ "kernel_options" : {
88
+ "range" : 1.7 ,
89
+ "c_o" : 10
90
+ },
91
+ "mesh_extraction" : True ,
92
+ "number_octree_levels" : 1
93
+ },
94
+ "fault_relations" : [[0 , 1 ], [0 , 0 ]], # Fault series affects series1
95
+ "id_name_mapping" : {
96
+ "name_to_id" : {
97
+ "rock1" : 0 ,
98
+ "rock2" : 1 ,
99
+ "fault" : 2
100
+ }
101
+ }
94
102
}
95
103
96
104
# %%
119
127
# Set fault relations
120
128
# Create a 2x2 matrix for fault relations (2 series: Fault_Series, Strat_Series)
121
129
# 1 means the fault affects the series, 0 means it doesn't
122
- model .structural_frame .fault_relations = np .array ([
123
- [0 , 1 ], # Fault_Series affects Strat_Series
124
- [0 , 0 ] # Strat_Series doesn't affect any series
125
- ])
130
+ model .structural_frame .fault_relations = np .array ([[0 , 1 ], [0 , 0 ]], dtype = bool ) # Using NumPy array with boolean type
126
131
127
132
# Explicitly set the structural relation for the fault series
128
- model .structural_frame .structural_groups [0 ].structural_relation = StackRelationType .FAULT
133
+ model .structural_frame .structural_groups [1 ].structural_relation = StackRelationType .FAULT
129
134
130
135
# Set the fault series as a fault
131
136
gp .set_is_fault (
132
137
frame = model ,
133
- fault_groups = ['Fault_Series ' ]
138
+ fault_groups = ['fault_series ' ]
134
139
)
135
140
136
141
# %%
176
181
gpv .plot_2d (model , show_scalar = True , show_lith = False , series_n = 0 , ax = ax )
177
182
plt .title ("Fault Scalar Field" )
178
183
plt .savefig ('fault_scalar_field.png' )
179
- plt .close ()
184
+ plt .close ()
185
+ # %%
0 commit comments