Skip to content

Commit 03e0366

Browse files
committed
[!WIP] Progress! F***** pivots in transformations
1 parent a905a7b commit 03e0366

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

gempy/core/data/geo_model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@ def surface_points_copy(self):
176176
@property
177177
def surface_points_copy_transformed(self) -> SurfacePointsTable:
178178
og_sp = self.surface_points_copy
179-
total_transform: Transform = self.input_transform + self.grid.transform
180-
og_sp.xyz_view = total_transform.apply(og_sp.xyz)
179+
og_sp.xyz_view = self.grid.transform.apply_with_pivot(
180+
points=og_sp.xyz,
181+
pivot=self.grid.corner_min
182+
)
183+
og_sp.xyz_view = self.input_transform.apply(og_sp.xyz)
181184
return og_sp
182185

183186
@property

test/test_modules/.benchmarks/test_transformed_space.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import numpy as np
2+
13
import gempy as gp
24
from gempy.core.data.enumerators import ExampleModel
35
from gempy.optional_dependencies import require_gempy_viewer
46

57
PLOT = True
68

79

8-
def test_plot_transformed_data():
10+
def test_plot_transformed_data_only_transform_input():
911
model = gp.generate_example_model(ExampleModel.ANTICLINE, compute_model=True)
1012
print(model.structural_frame)
1113

@@ -33,6 +35,41 @@ def test_plot_transformed_data():
3335
'arrow_size': .01
3436
}
3537
)
38+
39+
40+
def test_plot_transformed_data_including_grid_transform():
41+
model = gp.generate_example_model(ExampleModel.ANTICLINE, compute_model=False)
42+
43+
# Calculate point_y_axis
44+
regular_grid = gp.data.grid.RegularGrid.from_corners_box(
45+
pivot=(200, 200),
46+
point_x_axis=(800,800),
47+
distance_point3=1000,
48+
zmin=model.extent[4],
49+
zmax=model.extent[5],
50+
resolution=np.array([50, 50, 50]),
51+
plot=True
52+
)
53+
54+
model.grid = gp.data.grid.Grid()
55+
model.grid.dense_grid = regular_grid
56+
57+
gp.compute_model(model)
58+
59+
60+
if PLOT:
61+
gpv = require_gempy_viewer()
62+
63+
gpv.plot_3d(
64+
model,
65+
image=False,
66+
transformed_data=True,
67+
show_boundaries=True,
68+
show_lith=True,
69+
kwargs_plot_data={
70+
'arrow_size': .01
71+
}
72+
)
3673

3774

3875
def test_transformed_data():

0 commit comments

Comments
 (0)