Skip to content

Commit 33442f4

Browse files
committed
Added docstrings
1 parent 33ef765 commit 33442f4

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

uxarray/grid/intersections.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,16 @@ def constant_lat_intersections_face_bounds(lat, face_bounds_lat):
134134
constant latitude.
135135
136136
This function checks whether the specified latitude, `lat`, in degrees lies within
137-
the latitude bounds of grid faces, defined by `face_min_lat_rad` and `face_max_lat_rad`,
137+
the latitude bounds of grid faces, defined by `face_bounds_lat_min` and `face_bounds_lat_max`,
138138
which are given in radians. The function returns the indices of the faces where the
139139
latitude is within these bounds.
140140
141141
Parameters
142142
----------
143143
lat : float
144144
The latitude in degrees for which to find intersecting faces.
145-
TODO:
145+
face_bounds_lat : numpy.ndarray
146+
The latitude bounds for the face, in radians
146147
147148
Returns
148149
-------
@@ -164,15 +165,16 @@ def constant_lon_intersections_face_bounds(lon, face_bounds_lon):
164165
constant longitude.
165166
166167
This function checks whether the specified longitude, `lon`, in degrees lies within
167-
the longitude bounds of grid faces, defined by `face_min_lon_rad` and `face_max_lon_rad`,
168+
the longitude bounds of grid faces, defined by `face_bounds_lon_min` and `face_bounds_lon_max`,
168169
which are given in radians. The function returns the indices of the faces where the
169170
longitude is within these bounds.
170171
171172
Parameters
172173
----------
173174
lon : float
174175
The longitude in degrees for which to find intersecting faces.
175-
TODO:
176+
face_bounds_lon : numpy.ndarray
177+
The latitude bounds for the face, in radians
176178
177179
Returns
178180
-------
@@ -201,6 +203,23 @@ def constant_lon_intersections_face_bounds(lon, face_bounds_lon):
201203

202204

203205
def _gca_gca_intersection_cartesian(gca_a_xyz, gca_b_xyz):
206+
"""Testing function for 'gca_gca_intersection' which converts xyz to the proper coordinates to use for
207+
`gca_gca_intersection`. This function is not optimized and shouldn't be used for anything but testing.
208+
209+
Parameters
210+
----------
211+
gca_a_xyz : numpy.ndarray
212+
The first arc check for intersection, shape [2, 3]
213+
gca_b_xyz : numpy.ndarray
214+
The second arc to check for intersection, shape [2, 3]
215+
216+
Returns
217+
-------
218+
numpy.ndarray
219+
Returns the result of `gca_gca_intersection`, which is an array of points where the two arcs intersect. Returns
220+
an empty if the arcs do not intersect anywhere
221+
222+
"""
204223
gca_a_xyz = np.asarray(gca_a_xyz)
205224
gca_b_xyz = np.asarray(gca_b_xyz)
206225

@@ -229,6 +248,25 @@ def _gca_gca_intersection_cartesian(gca_a_xyz, gca_b_xyz):
229248

230249
@njit(cache=True)
231250
def gca_gca_intersection(gca_a_xyz, gca_a_lonlat, gca_b_xyz, gca_b_lonlat):
251+
"""Returns the intersections points of two arcs. If the arcs do not intersect, returns an empty array.
252+
253+
Parameters
254+
----------
255+
gca_a_xyz : numpy.ndarray
256+
The first arc check for intersection in cartesian coordinates, shape [2, 3]
257+
gca_a_lonlat : numpy.ndarray
258+
The first arc check for intersection in spherical coordinates, shape [2, 2]
259+
gca_b_xyz : numpy.ndarray
260+
The second arc to check for intersection in cartesian coordinates, shape [2, 3]
261+
gca_b_lonlat : numpy.ndarray
262+
The second arc check for intersection in spherical coordinates, shape [2, 2]
263+
264+
Returns
265+
-------
266+
numpy.ndarray
267+
Returns an array of points where the two arcs intersect. Returns an empty if the arcs do not intersect anywhere
268+
269+
"""
232270
if gca_a_xyz.shape[1] != 3 or gca_b_xyz.shape[1] != 3:
233271
raise ValueError("The two GCAs must be in the cartesian [x, y, z] format")
234272

0 commit comments

Comments
 (0)