1
1
import gempy as gp
2
2
import numpy as np
3
3
import os
4
+
4
5
input_path = os .path .dirname (__file__ ) + '/../../examples/data'
5
6
7
+ data_path = os .path .abspath ('../data' )
8
+
6
9
7
10
def test_set_orientations ():
8
11
# 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
+ )
12
31
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
-
23
32
24
33
def test_select_nearest_surface_points ():
25
34
data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/'
@@ -51,7 +60,7 @@ def test_select_nearest_surface_points():
51
60
radius = [r .sort_values () for r in radius ]
52
61
53
62
# 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 ]]
55
64
56
65
assert np .array_equal (reference , knn ) and np .array_equal (reference , radius )
57
66
@@ -67,7 +76,7 @@ def test_set_orientation_from_neighbours():
67
76
68
77
# Assigning series to formations as well as their order (timewise)
69
78
gp .map_stack_to_surfaces (geo_data , {"Fault_Series" : 'fault' ,
70
- "Strat_Series" : ('rock2' , 'rock1' )})
79
+ "Strat_Series" : ('rock2' , 'rock1' )})
71
80
geo_data .set_is_fault (['Fault_Series' ])
72
81
73
82
# detect fault names
@@ -84,7 +93,7 @@ def test_set_orientation_from_neighbours():
84
93
test = geo_data ._orientations .df .sort_index ().iloc [- 1 ][['dip' , 'azimuth' ]].values
85
94
86
95
# calculate reference
87
- reference = [90 - np .arctan (0.5 )/ np .pi * 180 , 90 ]
96
+ reference = [90 - np .arctan (0.5 ) / np .pi * 180 , 90 ]
88
97
89
98
assert np .array_equal (reference , test )
90
99
@@ -110,4 +119,4 @@ def test_set_orientation_from_neighbours_all():
110
119
length_after = geo_data ._orientations .df .shape [0 ]
111
120
112
121
assert np .array_equal (geo_data ._surface_points .df .shape [0 ],
113
- length_after - length_pre )
122
+ length_after - length_pre )
0 commit comments