Skip to content

Commit 7a8e7d0

Browse files
committed
- [ENH] Added the option for orientations from surface points
1 parent 4a34233 commit 7a8e7d0

File tree

3 files changed

+60
-17
lines changed

3 files changed

+60
-17
lines changed

tests/data/model5_orientations.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
X,Y,Z,azimuth,dip,polarity,formation
2+
100,500,800,90,0,1,rock2
3+
100,500,600,90,0,1,rock1
4+
900,500,400,90,0,1,rock2
5+
900,500,200,90,0,1,rock1
6+
500,500,500,90,60,1,fault

tests/data/model5_surface_points.csv

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
X,Y,Z,formation
2+
0,200,600,rock1
3+
0,500,600,rock1
4+
0,800,600,rock1
5+
200,200,600,rock1
6+
200,500,600,rock1
7+
200,800,600,rock1
8+
800,200,200,rock1
9+
800,500,200,rock1
10+
800,800,200,rock1
11+
1000,200,200,rock1
12+
1000,500,200,rock1
13+
1000,800,200,rock1
14+
0,200,800,rock2
15+
0,800,800,rock2
16+
200,200,800,rock2
17+
200,800,800,rock2
18+
800,200,400,rock2
19+
800,800,400,rock2
20+
1000,200,400,rock2
21+
1000,800,400,rock2
22+
500,500,500,fault
23+
450,500,600,fault
24+
500,200,500,fault
25+
450,200,600,fault
26+
500,800,500,fault
27+
450,800,600,fault
28+

tests/test_addons/TODO_test_orientations_from_surface_points.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
import gempy as gp
22
import numpy as np
33
import os
4+
45
input_path = os.path.dirname(__file__) + '/../../examples/data'
56

7+
data_path = os.path.abspath('../data')
8+
69

710
def test_set_orientations():
811
# Importing the data from CSV-files and setting extent and resolution
9-
geo_data = gp.create_data_legacy(extent=[0, 2000, 0, 2000, 0, 2000], resolution=[50, 50, 50],
10-
path_o=input_path + '/input_data/tut_chapter1/simple_fault_model_orientations.csv',
11-
path_i=input_path + '/input_data/tut_chapter1/simple_fault_model_points.csv')
12+
geo_data = gp.create_geomodel(
13+
extent=[0, 2000, 0, 2000, 0, 2000],
14+
resolution=[50, 50, 50],
15+
importer_helper=gp.data.ImporterHelper(
16+
path_to_orientations=f"{data_path}/model5_orientations.csv",
17+
path_to_surface_points=f"{data_path}/model5_surface_points.csv",
18+
)
19+
)
20+
21+
orientations: gp.data.OrientationsTable = gp.create_orientations_from_surface_points(geo_data.surface_points)
22+
23+
gp.add_orientations(
24+
geo_model=geo_data,
25+
x=orientations.data['X'],
26+
y=orientations.data['Y'],
27+
z=orientations.data['Z'],
28+
pole_vector=orientations.grads,
29+
elements_names=geo_data.structural_frame.elements_names[0],
30+
)
1231

13-
gp.get_data(geo_data)
14-
15-
# Assigning series to formations as well as their order (timewise)
16-
gp.map_stack_to_surfaces(geo_data, {"Fault_Series": 'Main_Fault',
17-
"Strat_Series": ('Sandstone_2', 'Siltstone')})
18-
19-
geo_data._orientations.create_orientation_from_surface_points(geo_data.surface_points, [0, 1, 2])
20-
21-
gp.set_orientation_from_surface_points(geo_data, [0, 1, 2])
22-
2332

2433
def test_select_nearest_surface_points():
2534
data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/'
@@ -51,7 +60,7 @@ def test_select_nearest_surface_points():
5160
radius = [r.sort_values() for r in radius]
5261

5362
# define reference
54-
reference = [[16,17],[16,17],[18,19],[18,19],[20,21],[20,21]]
63+
reference = [[16, 17], [16, 17], [18, 19], [18, 19], [20, 21], [20, 21]]
5564

5665
assert np.array_equal(reference, knn) and np.array_equal(reference, radius)
5766

@@ -67,7 +76,7 @@ def test_set_orientation_from_neighbours():
6776

6877
# Assigning series to formations as well as their order (timewise)
6978
gp.map_stack_to_surfaces(geo_data, {"Fault_Series": 'fault',
70-
"Strat_Series": ('rock2', 'rock1')})
79+
"Strat_Series": ('rock2', 'rock1')})
7180
geo_data.set_is_fault(['Fault_Series'])
7281

7382
# detect fault names
@@ -84,7 +93,7 @@ def test_set_orientation_from_neighbours():
8493
test = geo_data._orientations.df.sort_index().iloc[-1][['dip', 'azimuth']].values
8594

8695
# calculate reference
87-
reference = [90-np.arctan(0.5)/np.pi*180, 90]
96+
reference = [90 - np.arctan(0.5) / np.pi * 180, 90]
8897

8998
assert np.array_equal(reference, test)
9099

@@ -110,4 +119,4 @@ def test_set_orientation_from_neighbours_all():
110119
length_after = geo_data._orientations.df.shape[0]
111120

112121
assert np.array_equal(geo_data._surface_points.df.shape[0],
113-
length_after-length_pre)
122+
length_after - length_pre)

0 commit comments

Comments
 (0)