From 256cfa3de97549ad229c6fcb6b3d19c6b1b09530 Mon Sep 17 00:00:00 2001 From: MigueldelaVarga Date: Tue, 5 Aug 2025 13:53:13 +0200 Subject: [PATCH] [ENH] Add optional Transform input to `meshes_to_subsurface` Updated the `meshes_to_subsurface` method to support an optional `Transform` input, applying inverse transformations to vertex data when provided. --- gempy_engine/core/data/raw_arrays_solution.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gempy_engine/core/data/raw_arrays_solution.py b/gempy_engine/core/data/raw_arrays_solution.py index 02a995e..c72878d 100644 --- a/gempy_engine/core/data/raw_arrays_solution.py +++ b/gempy_engine/core/data/raw_arrays_solution.py @@ -4,6 +4,7 @@ import numpy as np +from .transforms import Transform from ..backend_tensor import BackendTensor from .interp_output import InterpOutput from .dual_contouring_mesh import DualContouringMesh @@ -112,7 +113,7 @@ def _set_scalar_field_at_surface_points(self, octree_output: OctreeLevel): self.scalar_field_at_surface_points = temp_list - def meshes_to_subsurface(self): + def meshes_to_subsurface(self, input_transform: Transform | None = None): ss = require_subsurface() pd = require_pandas() @@ -129,9 +130,13 @@ def meshes_to_subsurface(self): concatenated_id_array = np.concatenate(vertex_id_array) concatenated_cell_id_array = np.concatenate(cell_id_array) + + all_vertex = np.concatenate(vertex) + if input_transform: + all_vertex = input_transform.apply_inverse(all_vertex) meshes: ss.UnstructuredData = ss.UnstructuredData.from_array( - vertex=np.concatenate(vertex), + vertex=all_vertex, cells=np.concatenate(simplex_list), vertex_attr=pd.DataFrame({'id': concatenated_id_array}), cells_attr=pd.DataFrame({'id': concatenated_cell_id_array})