Repository: geospace-code/pymap3d

Issue:
loxodrome_inverse returns (circumference / 2 - actual distance) when lat1 == lat2 and lon1< lon2
`loxodrome_inverse()` returns (circumference / 2 - actual distance) when lat1 == lat2 and lon1< lon2.
It is clear from the following calculation results:

```python console
>>> from pymap3d.lox import loxodrome_inverse
>>> loxodrome_inverse(0,0, 0, 1.0, deg=True)
(19926188.85199597, 90.0)
>>> loxodrome_inverse(0,0, 0, 10.0, deg=True)
(18924313.434856508, 90.0)
>>> loxodrome_inverse(0,0, 0, 170.0, deg=True)
(1113194.9079327343, 90.0)
>>> loxodrome_inverse(0,0, 0, 180.0, deg=True)
(0.0, 90.0)
>>> loxodrome_inverse(0, 1.0, 0, 0, deg=True)
(111319.49079327357, 270.0)
>>> loxodrome_inverse(0, 170.0, 0, 0, deg=True)
(18924313.434856508, 270.0)
```

At first I thought it was an instability issue around the singularity, but it appears to be a logic error in the singularity-specific processing.
I have made a correction and will send you a PR after this.

Discussion:

Patch:
diff --git a/src/pymap3d/lox.py b/src/pymap3d/lox.py
index 4b205ee..26b220d 100644
--- a/src/pymap3d/lox.py
+++ b/src/pymap3d/lox.py
@@ -118,7 +118,7 @@ def loxodrome_inverse(
     -------
 
     lox_s : float
-        distance along loxodrome
+        distance along loxodrome (meters)
     az12 : float
         azimuth of loxodrome (degrees/radians)
 
@@ -287,7 +287,7 @@ def departure(lon1, lon2, lat, ell: Ellipsoid = None, deg: bool = True) -> float
     if deg:
         lon1, lon2, lat = radians(lon1), radians(lon2), radians(lat)
 
-    return rcurve.parallel(lat, ell=ell, deg=False) * ((lon2 - lon1) % pi)
+    return rcurve.parallel(lat, ell=ell, deg=False) * (abs(lon2 - lon1) % pi)
 
 
 def meanm(lat, lon, ell: Ellipsoid = None, deg: bool = True) -> tuple:


Test patch:
diff --git a/src/pymap3d/tests/test_rhumb.py b/src/pymap3d/tests/test_rhumb.py
index b63fa4b..d206a06 100755
--- a/src/pymap3d/tests/test_rhumb.py
+++ b/src/pymap3d/tests/test_rhumb.py
@@ -45,10 +45,10 @@ def test_departure(lon1, lon2, lat, dist):
     "lat1,lon1,lat2,lon2,arclen,az",
     [
         (40, -80, 65, -148, 5248666.20853187, 302.0056736),
-        (0, 0, 0, 90, 10018754.17, 90),
-        (0, 0, 0, -90, 10018754.17, 270),
-        (0, 90, 0, 0, 10018754.17, 270),
-        (0, -90, 0, 0, 10018754.17, 90),
+        (0, 0, 0, 1, 111319.49, 90),
+        (0, 0, 0, -1, 111319.49, 270),
+        (0, 1, 0, 0, 111319.49, 270),
+        (0, -1, 0, 0, 111319.49, 90),
         (1, 0, 0, 0, 110574.4, 180),
         (-1, 0, 0, 0, 110574.4, 0),
     ],