Skip to content

Commit 61ae466

Browse files
committed
[ENH] Make geophysics input optional
1 parent 3a290f1 commit 61ae466

File tree

3 files changed

+225
-4
lines changed

3 files changed

+225
-4
lines changed

gempy/core/data/geo_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class GeoModel(BaseModel):
6363
# region GemPy engine data types
6464
_interpolation_options: InterpolationOptions #: The interpolation options provided by the user.
6565

66-
geophysics_input: GeophysicsInput = Field(default=None, exclude=False) #: The geophysics input of the geological model.
66+
geophysics_input: GeophysicsInput | None = Field(default=None, exclude=False) #: The geophysics input of the geological model.
6767
input_transform: Transform = Field(default=None, exclude=False) #: The transformation used in the geological model for input points.
6868

6969
interpolation_grid: EngineGrid = Field(default=None, exclude=True) #: ptional grid used for interpolation. Can be seen as a cache field.

test/test_modules/test_faults/test_finite_faults.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import gempy as gp
55
import gempy_viewer as gpv
66
from gempy.core.data.enumerators import ExampleModel
7+
from gempy.modules.serialization.save_load import verify_model_serialization
78
from gempy_viewer.optional_dependencies import require_pyvista
89
from test.conftest import TEST_SPEED, TestSpeed
910

@@ -32,13 +33,11 @@ def test_finite_fault_scalar_field_on_fault():
3233
radius=scaled_radius,
3334
max_slope=k # * This controls the speed of the transition
3435
)
35-
3636
transform = gp.data.Transform(
3737
position=np.array([0, 0, 0]),
3838
rotation=np.array([0, 60, 0]),
3939
scale=np.ones(3)
4040
)
41-
4241
faults_data = gp.data.FaultsData(
4342
fault_values_everywhere=np.zeros(0),
4443
fault_values_on_sp=np.zeros(0),
@@ -53,10 +52,16 @@ def test_finite_fault_scalar_field_on_fault():
5352
)
5453

5554
geo_model.structural_frame.structural_groups[0].faults_input_data = faults_data
55+
56+
verify_model_serialization(
57+
model=geo_model,
58+
verify_moment="after",
59+
file_name=f"verify/{geo_model.meta.name}"
60+
)
61+
5662
gp.compute_model(geo_model)
5763

5864
# TODO: Try to do this afterwards
59-
# scalar_fault = scalar_funtion(regular_grid.values)
6065

6166
if plot_pyvista := True:
6267
plot3d = gpv.plot_3d(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
{
2+
"meta": {
3+
"name": "fault",
4+
"creation_date": "<DATE_IGNORED>",
5+
"last_modification_date": null,
6+
"owner": null
7+
},
8+
"structural_frame": {
9+
"structural_groups": [
10+
{
11+
"name": "Fault_Series",
12+
"elements": [
13+
{
14+
"name": "fault",
15+
"is_active": true,
16+
"_color": "#527682",
17+
"surface_points": {
18+
"name_id_map": {
19+
"fault": 65970106,
20+
"rock1": 167239155,
21+
"rock2": 217776925
22+
},
23+
"_model_transform": null
24+
},
25+
"orientations": {
26+
"name_id_map": {
27+
"fault": 65970106,
28+
"rock1": 167239155,
29+
"rock2": 217776925
30+
},
31+
"_model_transform": null
32+
},
33+
"scalar_field_at_interface": null,
34+
"_id": 65970106
35+
}
36+
],
37+
"structural_relation": 3,
38+
"fault_relations": 1,
39+
"faults_input_data": {
40+
"fault_values_everywhere": [],
41+
"fault_values_on_sp": [],
42+
"fault_values_ref": [],
43+
"fault_values_rest": [],
44+
"thickness": null,
45+
"finite_fault_data": {
46+
"implicit_function_transform": {
47+
"position": [
48+
0,
49+
0,
50+
0
51+
],
52+
"rotation": [
53+
0,
54+
60,
55+
0
56+
],
57+
"scale": [
58+
1.0,
59+
1.0,
60+
1.0
61+
],
62+
"_is_default_transform": false,
63+
"_cached_pivot": null
64+
},
65+
"pivot": [
66+
0.0,
67+
0.0,
68+
0.0
69+
]
70+
}
71+
},
72+
"solution": null
73+
},
74+
{
75+
"name": "Strat_Series",
76+
"elements": [
77+
{
78+
"name": "rock2",
79+
"is_active": true,
80+
"_color": "#ffbe00",
81+
"surface_points": {
82+
"name_id_map": {
83+
"fault": 65970106,
84+
"rock1": 167239155,
85+
"rock2": 217776925
86+
},
87+
"_model_transform": null
88+
},
89+
"orientations": {
90+
"name_id_map": {
91+
"fault": 65970106,
92+
"rock1": 167239155,
93+
"rock2": 217776925
94+
},
95+
"_model_transform": null
96+
},
97+
"scalar_field_at_interface": null,
98+
"_id": 217776925
99+
},
100+
{
101+
"name": "rock1",
102+
"is_active": true,
103+
"_color": "#9f0052",
104+
"surface_points": {
105+
"name_id_map": {
106+
"fault": 65970106,
107+
"rock1": 167239155,
108+
"rock2": 217776925
109+
},
110+
"_model_transform": null
111+
},
112+
"orientations": {
113+
"name_id_map": {
114+
"fault": 65970106,
115+
"rock1": 167239155,
116+
"rock2": 217776925
117+
},
118+
"_model_transform": null
119+
},
120+
"scalar_field_at_interface": null,
121+
"_id": 167239155
122+
}
123+
],
124+
"structural_relation": 1,
125+
"fault_relations": 3,
126+
"faults_input_data": null,
127+
"solution": null
128+
}
129+
],
130+
"is_dirty": true,
131+
"basement_color": "#728f02",
132+
"binary_meta_data": {
133+
"sp_binary_length": 792
134+
}
135+
},
136+
"grid": {
137+
"_octree_grid": {
138+
"resolution": [
139+
64,
140+
64,
141+
64
142+
],
143+
"extent": [
144+
0.0,
145+
1000.0,
146+
0.0,
147+
1000.0,
148+
0.0,
149+
1000.0
150+
],
151+
"_transform": null
152+
},
153+
"_dense_grid": null,
154+
"_custom_grid": null,
155+
"_topography": null,
156+
"_sections": null,
157+
"_centered_grid": null,
158+
"_transform": null,
159+
"_octree_levels": -1,
160+
"active_grids": 1025
161+
},
162+
"geophysics_input": null,
163+
"input_transform": {
164+
"position": [
165+
-500.0,
166+
-500.0,
167+
-500.0
168+
],
169+
"rotation": [
170+
0.0,
171+
0.0,
172+
0.0
173+
],
174+
"scale": [
175+
0.0005,
176+
0.0005,
177+
0.0005
178+
],
179+
"_is_default_transform": false,
180+
"_cached_pivot": null
181+
},
182+
"_interpolation_options": {
183+
"kernel_options": {
184+
"range": 1.7,
185+
"c_o": 10.0,
186+
"uni_degree": 1,
187+
"i_res": 4.0,
188+
"gi_res": 2.0,
189+
"number_dimensions": 3,
190+
"kernel_function": "cubic",
191+
"kernel_solver": 1,
192+
"compute_condition_number": false,
193+
"optimizing_condition_number": false,
194+
"condition_number": null
195+
},
196+
"evaluation_options": {
197+
"_number_octree_levels": 6,
198+
"_number_octree_levels_surface": 4,
199+
"octree_curvature_threshold": -1.0,
200+
"octree_error_threshold": 1.0,
201+
"octree_min_level": 2,
202+
"mesh_extraction": true,
203+
"mesh_extraction_masking_options": 3,
204+
"mesh_extraction_fancy": true,
205+
"evaluation_chunk_size": 500000,
206+
"compute_scalar_gradient": false,
207+
"verbose": false
208+
},
209+
"debug": true,
210+
"cache_mode": 3,
211+
"cache_model_name": "fault",
212+
"block_solutions_type": 1,
213+
"sigmoid_slope": 5000000,
214+
"debug_water_tight": false
215+
}
216+
}

0 commit comments

Comments
 (0)