Skip to content

Commit 84d4f7e

Browse files
authored
Merge pull request #929
Fixed add_orientations function (Issue 921)
2 parents 3bf56a9 + 53d6abb commit 84d4f7e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

gempy/modules/data_manipulation/manipulate_points.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ def add_orientations(geo_model: GeoModel,
9494
y: Sequence[float],
9595
z: Sequence[float],
9696
elements_names: Sequence[str],
97-
pole_vector: Optional[Sequence[np.ndarray]] = None,
98-
orientation: Optional[Sequence[np.ndarray]] = None,
97+
pole_vector: Optional[Union[Sequence[np.ndarray], np.ndarray]] = None,
98+
orientation: Optional[Union[Sequence[np.ndarray], np.ndarray]] = None,
9999
nugget: Optional[Sequence[float]] = None
100100
) -> StructuralFrame:
101101
"""Add orientation data to the geological model.
@@ -110,8 +110,8 @@ def add_orientations(geo_model: GeoModel,
110110
y (Sequence[float]): Sequence of y-coordinates for the orientation points.
111111
z (Sequence[float]): Sequence of z-coordinates for the orientation points.
112112
elements_names (Sequence[str]): Sequence of element names corresponding to each orientation point.
113-
pole_vector (Optional[Sequence[np.ndarray]]): Sequence of pole vectors for the orientation points.
114-
orientation (Optional[Sequence[np.ndarray]]): Sequence of orientation angles (azimuth, dip, polarity) for the orientation points.
113+
pole_vector (Optional[Union[Sequence[np.ndarray], np.ndarray]]): Sequence of pole vectors for each orientation point. If is np.ndarray, it should have shape (n, 3).
114+
orientation (Optional[Union[Sequence[np.ndarray], np.ndarray]]): Sequence of orientation angles for each orientation point. If is np.ndarray, it should have shape (n, 3).
115115
nugget (Optional[Sequence[float]]): Sequence of nugget values for each orientation point. If not provided,
116116
a default value will be used for all points.
117117
@@ -125,7 +125,8 @@ def add_orientations(geo_model: GeoModel,
125125
if pole_vector is None and orientation is None:
126126
raise ValueError("Either pole_vector or orientation must be provided.")
127127

128-
if orientation: # Convert orientation to pole_vector (or gradient)
128+
if orientation is not None:
129+
orientation = np.array(orientation)
129130
pole_vector = convert_orientation_to_pole_vector(
130131
azimuth=orientation[:, 0],
131132
dip=orientation[:, 1],

0 commit comments

Comments
 (0)