Skip to content

Commit d575c9a

Browse files
committed
Review of docstrings in file
1 parent 1e7f0aa commit d575c9a

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

geoapps_utils/utils/transformations.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def apply_rotation(operator: np.ndarray, points: np.ndarray) -> np.ndarray:
2222
:param operator: Rotation matrix of shape (3, 3) or (n, 3, 3) where n is the number of
2323
points.
2424
:param points: Array of shape (n, 3) representing the x, y, z coordinates to be rotated.
25+
26+
:returns: Rotated coordinates of same shape as input.
2527
"""
2628

2729
if operator.shape[0] == points.shape[1]:
@@ -126,7 +128,13 @@ def cartesian_to_spherical(points: np.ndarray) -> np.ndarray:
126128

127129

128130
def ccw_east_to_cw_north(azimuth: np.ndarray) -> np.ndarray:
129-
"""Convert counterclockwise azimuth from east to clockwise from north."""
131+
"""
132+
Convert counterclockwise azimuth from east to clockwise from north.
133+
134+
:param azimuth: Array of azimuth angles in radians counterclockwise from east.
135+
136+
:returns: Array of azimuth angles in radians clockwise from north.
137+
"""
130138
return (((5 * np.pi) / 2) - azimuth) % (2 * np.pi)
131139

132140

@@ -152,7 +160,13 @@ def compute_normals(surface: Surface) -> np.ndarray:
152160

153161

154162
def inclination_to_dip(inclination: np.ndarray) -> np.ndarray:
155-
"""Convert inclination from positive z-axis to dip from horizon."""
163+
"""
164+
Convert inclination from positive z-axis to dip from horizon.
165+
166+
:param inclination: Array of inclination angles in radians from positive z-axis.
167+
168+
:returns: Array of dip angles in radians from horizon.
169+
"""
156170
return inclination - (np.pi / 2)
157171

158172

@@ -169,6 +183,8 @@ def rotate_points(
169183
:param rotations: List of rotation matrices to apply to the points. These must
170184
be in the form of scipy sparse matrices (csr_matrix) produced by the
171185
x_rotation_matrix(), y_rotation_matrix(), and z_rotation_matrix() functions.
186+
187+
:returns: Rotated coordinates of same shape as input.
172188
"""
173189

174190
out = points.copy() - origin
@@ -177,7 +193,9 @@ def rotate_points(
177193
return out + origin
178194

179195

180-
def rotate_xyz(xyz: np.ndarray, center: list, theta: float, phi: float = 0.0):
196+
def rotate_xyz(
197+
xyz: np.ndarray, center: list, theta: float, phi: float = 0.0
198+
) -> np.ndarray:
181199
"""
182200
Rotate points counterclockwise around the x then z axes, about a center point.
183201
@@ -187,6 +205,8 @@ def rotate_xyz(xyz: np.ndarray, center: list, theta: float, phi: float = 0.0):
187205
as viewed from above.
188206
:param phi: Angle of rotation in couterclockwise degrees around x-axis
189207
as viewed from the east.
208+
209+
:returns: Rotated coordinates of same shape as input.
190210
"""
191211
return2d = False
192212
locs = xyz.copy()
@@ -246,6 +266,8 @@ def x_rotation_matrix(angle: np.ndarray | float) -> ssp.csr_matrix:
246266
247267
:param angle: Array of angles in radians for counterclockwise rotation
248268
about the x-axis.
269+
270+
:returns: Rotation matrix as a scipy sparse matrix.
249271
"""
250272

251273
if isinstance(angle, np.ndarray):
@@ -276,6 +298,8 @@ def y_rotation_matrix(angle: np.ndarray | float) -> ssp.csr_matrix:
276298
277299
:param angle: Array of angles in radians for counterclockwise rotation
278300
about the y-axis.
301+
302+
:returns: Rotation matrix as a scipy sparse matrix.
279303
"""
280304

281305
if isinstance(angle, np.ndarray):
@@ -306,6 +330,8 @@ def z_rotation_matrix(angle: np.ndarray | float) -> ssp.csr_matrix:
306330
307331
:param angle: Array of angles in radians for counterclockwise rotation
308332
about the z-axis.
333+
334+
:returns: Rotation matrix as a scipy sparse matrix.
309335
"""
310336

311337
if isinstance(angle, np.ndarray):

0 commit comments

Comments
 (0)