Skip to content

Commit

Permalink
Fix #333
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderJuestel committed Jul 20, 2024
1 parent c682bb9 commit 3bd4087
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions gemgis/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,15 +1617,15 @@ def create_depth_maps_from_gempy(geo_model,
.. versionadded:: 1.0.x
.. versionchanged:: 1.1.8
.. versionchanged:: 1.2
Ensure compatibility with GemPy>=3
Example
_______
>>> # Loading Libraries and creating depth map
>>> import gemgis as gg
>>> dict_sand1 = gg.visualization.create_depth_maps(geo_model=geo_model, surfaces='Sand1')
>>> dict_sand1 = gg.visualization.create_depth_maps_from_gempy(geo_model=geo_model, surfaces='Sand1')
>>> dict_sand1
{'Sand1': [PolyData (0x2dd0f46c820)
N Cells: 4174
Expand Down Expand Up @@ -1714,13 +1714,20 @@ def create_depth_maps_from_gempy(geo_model,
surfaces_poly = {}

for index in list_indices:
surf = pv.PolyData(geo_model.solutions.raw_arrays.vertices[index],
np.insert(geo_model.solutions.raw_arrays.edges[index], 0, 3, axis=1).ravel())

# Append depth to PolyData
surf['Depth [m]'] = geo_model.solutions.raw_arrays.vertices[index][:, 2]
# Extracting vertices
vertices = geo_model.input_transform.apply_inverse(geo_model.solutions.raw_arrays.vertices[index])

# Store mesh, depth values and color values in dict
# Extracting faces
faces = np.insert(geo_model.solutions.raw_arrays.edges[index], 0, 3, axis=1).ravel()

# Creating PolyData from vertices and faces
surf = pv.PolyData(vertices, faces)

# Appending depth to PolyData
surf['Depth [m]'] = geo_model.input_transform.apply_inverse(geo_model.solutions.raw_arrays.vertices[index])[:, 2]

# Storing mesh, depth values and color values in dict
surfaces_poly[list_surfaces[index]] = [surf, geo_model.structural_frame.elements_colors[index]]

return surfaces_poly
Expand Down

0 comments on commit 3bd4087

Please sign in to comment.