7
7
8
8
9
9
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 :
11
11
"""
12
12
Map stack (series) to surfaces by reorganizing elements between groups in a GeoModel's structural frame.
13
13
@@ -20,21 +20,29 @@ def map_stack_to_surfaces(gempy_model: GeoModel, mapping_object: Union[dict[str,
20
20
mapping_object (Union[dict[str, list[str]] | dict[str, tuple]]): Dictionary mapping group names to element names.
21
21
set_series (bool, optional): If True, creates new series for groups not present in the GeoModel. Defaults to True.
22
22
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.
23
24
24
25
Returns:
25
26
StructuralFrame: The updated StructuralFrame object.
26
27
"""
27
28
structural_groups : list [StructuralGroup ] = gempy_model .structural_frame .structural_groups
28
29
29
30
for index , (group_name , elements ) in enumerate (mapping_object .items ()):
30
-
31
31
# region Create new series if needed
32
32
group_already_exists = any (group .name == group_name for group in structural_groups )
33
33
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
+
34
42
new_group = StructuralGroup (
35
43
name = group_name ,
36
44
elements = [],
37
- structural_relation = StackRelationType . ERODE
45
+ structural_relation = structural_relation
38
46
)
39
47
structural_groups .insert (index , new_group )
40
48
# endregion
0 commit comments