Skip to content

Commit f82abf2

Browse files
committed
Adjustments in stack-mapping for more flexible handling of faults
1 parent c926296 commit f82abf2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

gempy/API/map_stack_to_surfaces_API.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def map_stack_to_surfaces(gempy_model: GeoModel, mapping_object: Union[dict[str, list[str]] | dict[str, tuple]],
10-
set_series: bool = True, remove_unused_series=True) -> StructuralFrame:
10+
set_series: bool = True, remove_unused_series=True, series_data: list = None) -> StructuralFrame:
1111
"""
1212
Map stack (series) to surfaces by reorganizing elements between groups in a GeoModel's structural frame.
1313
@@ -20,21 +20,29 @@ def map_stack_to_surfaces(gempy_model: GeoModel, mapping_object: Union[dict[str,
2020
mapping_object (Union[dict[str, list[str]] | dict[str, tuple]]): Dictionary mapping group names to element names.
2121
set_series (bool, optional): If True, creates new series for groups not present in the GeoModel. Defaults to True.
2222
remove_unused_series (bool, optional): If True, removes groups without any elements. Defaults to True.
23+
series_data (list, optional): List of series data from JSON containing structural relations. Defaults to None.
2324
2425
Returns:
2526
StructuralFrame: The updated StructuralFrame object.
2627
"""
2728
structural_groups: list[StructuralGroup] = gempy_model.structural_frame.structural_groups
2829

2930
for index, (group_name, elements) in enumerate(mapping_object.items()):
30-
3131
# region Create new series if needed
3232
group_already_exists = any(group.name == group_name for group in structural_groups)
3333
if set_series and not group_already_exists:
34+
# Get structural relation from series_data if available
35+
structural_relation = StackRelationType.ERODE # Default value
36+
if series_data:
37+
for series in series_data:
38+
if series['name'] == group_name:
39+
structural_relation = StackRelationType[series['structural_relation']]
40+
break
41+
3442
new_group = StructuralGroup(
3543
name=group_name,
3644
elements=[],
37-
structural_relation=StackRelationType.ERODE
45+
structural_relation=structural_relation
3846
)
3947
structural_groups.insert(index, new_group)
4048
# endregion

0 commit comments

Comments
 (0)