Skip to content

Commit 1c40619

Browse files
authored
Merge pull request #553 from glostis/docstring-formatting
Improve formatting of docstrings in geod.py
2 parents 632c398 + ac5fcbf commit 1c40619

File tree

1 file changed

+77
-23
lines changed

1 file changed

+77
-23
lines changed

pyproj/geod.py

+77-23
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,34 @@ def __init__(self, initstring=None, **kwargs):
197197

198198
def fwd(self, lons, lats, az, dist, radians=False):
199199
"""
200-
forward transformation - Returns longitudes, latitudes and back
201-
azimuths of terminus points given longitudes (lons) and
202-
latitudes (lats) of initial points, plus forward azimuths (az)
203-
and distances (dist).
200+
Forward transformation
204201
205-
Works with numpy and regular python array objects, python
206-
sequences and scalars.
202+
Determine longitudes, latitudes and back azimuths of terminus
203+
points given longitudes and latitudes of initial points,
204+
plus forward azimuths and distances.
207205
208-
if radians=True, lons/lats and azimuths are radians instead of
209-
degrees. Distances are in meters.
206+
Parameters
207+
----------
208+
lons: array, :class:`numpy.ndarray`, list, tuple, or scalar
209+
Longitude(s) of initial point(s)
210+
lats: array, :class:`numpy.ndarray`, list, tuple, or scalar
211+
Latitude(s) of initial point(s)
212+
az: array, :class:`numpy.ndarray`, list, tuple, or scalar
213+
Forward azimuth(s)
214+
dist: array, :class:`numpy.ndarray`, list, tuple, or scalar
215+
Distance(s) between initial and terminus point(s)
216+
in meters
217+
radians: bool, optional
218+
If True, the input data is assumed to be in radians.
219+
220+
Returns
221+
-------
222+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
223+
Longitude(s) of terminus point(s)
224+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
225+
Latitude(s) of terminus point(s)
226+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
227+
Back azimuth(s)
210228
"""
211229
# process inputs, making copies that support buffer API.
212230
inx, xisfloat, xislist, xistuple = _copytobuffer(lons)
@@ -222,15 +240,33 @@ def fwd(self, lons, lats, az, dist, radians=False):
222240

223241
def inv(self, lons1, lats1, lons2, lats2, radians=False):
224242
"""
225-
inverse transformation - Returns forward and back azimuths, plus
226-
distances between initial points (specified by lons1, lats1) and
227-
terminus points (specified by lons2, lats2).
243+
Inverse transformation
228244
229-
Works with numpy and regular python array objects, python
230-
sequences and scalars.
245+
Determine forward and back azimuths, plus distances
246+
between initial points and terminus points.
247+
248+
Parameters
249+
----------
250+
lons1: array, :class:`numpy.ndarray`, list, tuple, or scalar
251+
Longitude(s) of initial point(s)
252+
lats1: array, :class:`numpy.ndarray`, list, tuple, or scalar
253+
Latitude(s) of initial point(s)
254+
lons2: array, :class:`numpy.ndarray`, list, tuple, or scalar
255+
Longitude(s) of terminus point(s)
256+
lats2: array, :class:`numpy.ndarray`, list, tuple, or scalar
257+
Latitude(s) of terminus point(s)
258+
radians: bool, optional
259+
If True, the input data is assumed to be in radians.
231260
232-
if radians=True, lons/lats and azimuths are radians instead of
233-
degrees. Distances are in meters.
261+
Returns
262+
-------
263+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
264+
Forward azimuth(s)
265+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
266+
Back azimuth(s)
267+
array, :class:`numpy.ndarray`, list, tuple, or scalar:
268+
Distance(s) between initial and terminus point(s)
269+
in meters
234270
"""
235271
# process inputs, making copies that support buffer API.
236272
inx, xisfloat, xislist, xistuple = _copytobuffer(lons1)
@@ -246,13 +282,10 @@ def inv(self, lons1, lats1, lons2, lats2, radians=False):
246282

247283
def npts(self, lon1, lat1, lon2, lat2, npts, radians=False):
248284
"""
249-
Given a single initial point and terminus point (specified by
250-
python floats lon1,lat1 and lon2,lat2), returns a list of
251-
longitude/latitude pairs describing npts equally spaced
252-
intermediate points along the geodesic between the initial and
253-
terminus points.
254-
255-
if radians=True, lons/lats are radians instead of degrees.
285+
Given a single initial point and terminus point, returns
286+
a list of longitude/latitude pairs describing npts equally
287+
spaced intermediate points along the geodesic between the
288+
initial and terminus points.
256289
257290
Example usage:
258291
@@ -297,6 +330,27 @@ def npts(self, lon1, lat1, lon2, lat2, npts, radians=False):
297330
'47.136 -109.100'
298331
'46.805 -114.051'
299332
'46.262 -118.924'
333+
334+
Parameters
335+
----------
336+
lon1: float
337+
Longitude of the initial point
338+
lat1: float
339+
Latitude of the initial point
340+
lon2: float
341+
Longitude of the terminus point
342+
lat2: float
343+
Latitude of the terminus point
344+
npts: int
345+
Number of points to be returned
346+
radians: bool, optional
347+
If True, the input data is assumed to be in radians.
348+
349+
Returns
350+
-------
351+
list of tuples:
352+
list of (lon, lat) points along the geodesic
353+
between the initial and terminus points.
300354
"""
301355
lons, lats = super()._npts(lon1, lat1, lon2, lat2, npts, radians=radians)
302356
return list(zip(lons, lats))
@@ -508,7 +562,7 @@ def geometry_area_perimeter(self, geometry, radians=False):
508562
radians: bool, optional
509563
If True, the input data is assumed to be in radians.
510564
511-
Returns
565+
Returns
512566
-------
513567
(float, float):
514568
The geodesic area (meters^2) and permimeter (meters) of the polygon.

0 commit comments

Comments
 (0)