Skip to content

Commit 519954e

Browse files
committed
[ENH] Add grouping option to structural elements initialization
Introduce a `group_by` parameter with `Literal` typing in `structural_elements_from_borehole_set` for flexible grouping. Also, add dotenv initialization in the example script to manage environment variables.
1 parent 55686b7 commit 519954e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gempy/API/initialization_API.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import warnings
2-
from typing import Union, Hashable
2+
from typing import Union, Hashable, Literal
33

44
import numpy as np
55
from numpy import ndarray
@@ -104,7 +104,9 @@ def create_geomodel(
104104

105105
def structural_elements_from_borehole_set(
106106
borehole_set: "subsurface.core.geological_formats.BoreholeSet",
107-
elements_dict: dict) -> list[StructuralElement]:
107+
elements_dict: dict,
108+
group_by: Literal['component lith', 'lith_ids'] = 'lith_ids'
109+
) -> list[StructuralElement]:
108110
"""Creates a list of StructuralElements from a BoreholeSet.
109111
110112
Args:
@@ -123,7 +125,7 @@ def structural_elements_from_borehole_set(
123125
borehole_set: ss.core.geological_formats.BoreholeSet
124126

125127
elements = []
126-
component_lith: dict[Hashable, np.ndarray] = borehole_set.get_bottom_coords_for_each_lith()
128+
component_lith: dict[Hashable, np.ndarray] = borehole_set.get_bottom_coords_for_each_lith(group_by=group_by)
127129

128130
for name, properties in elements_dict.items():
129131
top_coordinates = component_lith.get(properties['id'])

0 commit comments

Comments
 (0)