|
2 | 2 | import numpy as np
|
3 | 3 | import os
|
4 | 4 |
|
5 |
| -from orientations_generator._orientations_generator import select_nearest_surfaces_points |
| 5 | +from orientations_generator import select_nearest_surfaces_points |
| 6 | +from orientations_generator._orientations_generator import NearestSurfacePointsSearcher |
6 | 7 |
|
7 | 8 | input_path = os.path.dirname(__file__) + '/../../examples/data'
|
8 | 9 |
|
@@ -38,67 +39,34 @@ def test_set_orientations():
|
38 | 39 |
|
39 | 40 |
|
40 | 41 | def test_select_nearest_surface_points():
|
41 |
| - data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/' |
42 |
| - path_to_data = data_path + "/data/input_data/jan_models/" |
43 |
| - |
44 |
| - geo_data = gp.create_data_legacy('fault', extent=[0, 1000, 0, 1000, 0, 1000], |
45 |
| - resolution=[50, 50, 50], |
46 |
| - path_o=path_to_data + "model5_orientations.csv", |
47 |
| - path_i=path_to_data + "model5_surface_points.csv") |
48 | 42 |
|
49 | 43 | geo_model = _model_factory()
|
50 | 44 | print(geo_model)
|
51 |
| - |
52 |
| - # detect fault names |
53 |
| - f_id = geo_data._faults.df.index.categories[ |
54 |
| - geo_data._faults.df.isFault.values] |
55 |
| - # find fault points |
56 |
| - fault_poi = geo_data._surface_points.df[ |
57 |
| - geo_data._surface_points.df.series.isin(f_id)] |
| 45 | + |
| 46 | + # TODO: This is to select the surface points we want to use to calculate the orientations |
| 47 | + |
| 48 | + element: gp.data.StructuralElement = geo_model.structural_frame.get_element_by_name("fault") |
58 | 49 |
|
59 | 50 | # find neighbours
|
60 | 51 | knn = select_nearest_surfaces_points(
|
61 |
| - geo_model=geo_data, |
62 |
| - surface_points=fault_poi, |
63 |
| - searchcrit=1 |
| 52 | + surface_points_xyz=element.surface_points.xyz, |
| 53 | + searchcrit=3 |
64 | 54 | )
|
65 | 55 |
|
66 | 56 | radius = select_nearest_surfaces_points(
|
67 |
| - geo_model=geo_data, |
68 |
| - surface_points=fault_poi, |
69 |
| - searchcrit=200. |
| 57 | + surface_points_xyz=element.surface_points.xyz, |
| 58 | + searchcrit=200., |
| 59 | + search_type=NearestSurfacePointsSearcher.RADIUS |
70 | 60 | )
|
71 |
| - |
72 |
| - # sort neighbours, necessary for equal testing |
73 |
| - knn = [k.sort_values() for k in knn] |
74 |
| - radius = [r.sort_values() for r in radius] |
75 |
| - |
76 |
| - # define reference |
77 |
| - reference = [[16, 17], [16, 17], [18, 19], [18, 19], [20, 21], [20, 21]] |
78 |
| - |
79 |
| - assert np.array_equal(reference, knn) and np.array_equal(reference, radius) |
| 61 | + |
| 62 | + return knn |
80 | 63 |
|
81 | 64 |
|
82 | 65 | def test_set_orientation_from_neighbours():
|
83 |
| - data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/' |
84 |
| - path_to_data = data_path + "/data/input_data/jan_models/" |
85 |
| - |
86 |
| - geo_data = gp.create_data_legacy('fault', extent=[0, 1000, 0, 1000, 0, 1000], |
87 |
| - resolution=[50, 50, 50], |
88 |
| - path_o=path_to_data + "model5_orientations.csv", |
89 |
| - path_i=path_to_data + "model5_surface_points.csv") |
90 |
| - |
91 |
| - # Assigning series to formations as well as their order (timewise) |
92 |
| - gp.map_stack_to_surfaces(geo_data, {"Fault_Series": 'fault', |
93 |
| - "Strat_Series": ('rock2', 'rock1')}) |
94 |
| - geo_data.set_is_fault(['Fault_Series']) |
95 |
| - |
96 |
| - # detect fault names |
97 |
| - f_id = geo_data._faults.df.index.categories[ |
98 |
| - geo_data._faults.df.isFault.values] |
99 |
| - # find fault points |
100 |
| - fault_poi = geo_data._surface_points.df[ |
101 |
| - geo_data._surface_points.df.series.isin(f_id)] |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
102 | 70 | # find neighbours
|
103 | 71 | neighbours = gp.select_nearest_surfaces_points(geo_data, fault_poi, 5)
|
104 | 72 | # calculate one fault orientation
|
|
0 commit comments