From 54e0aba90bad576720c80d516b852baa82dd9ba1 Mon Sep 17 00:00:00 2001 From: ngowans Date: Fri, 26 Mar 2021 13:34:20 +1100 Subject: [PATCH 1/2] remove unused function imports --- geodepy/transform.py | 1 - 1 file changed, 1 deletion(-) diff --git a/geodepy/transform.py b/geodepy/transform.py index f60d65e..2dfc0af 100644 --- a/geodepy/transform.py +++ b/geodepy/transform.py @@ -269,4 +269,3 @@ def ntv2_2d(ntv2_grid, lat, lon, forward_tf=True, method='bicubic'): tf_lon = lon + shifts[1] / 3600 return tf_lat, tf_lon - From 55e92c9703d14a666888c62b8f3053c1149e1384 Mon Sep 17 00:00:00 2001 From: nicgowans Date: Fri, 4 Nov 2022 10:43:44 +1100 Subject: [PATCH 2/2] introduce float comparison and test case for float coincident coordinates in def vincinv() --- geodepy/geodesy.py | 3 ++- geodepy/tests/test_geodesy.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/geodepy/geodesy.py b/geodepy/geodesy.py index 2c630bf..b20b891 100644 --- a/geodepy/geodesy.py +++ b/geodepy/geodesy.py @@ -180,7 +180,8 @@ def vincinv(lat1, lon1, lat2, lon2, ellipsoid=grs80): lon2 = angular_typecheck(lon2) # Exit if the two input points are the same - if lat1 == lat2 and lon1 == lon2: + tolerance = 0.0000000001 + if abs(lat1 - lat2) < tolerance and abs(lon1 - lon2) < tolerance: return 0, 0, 0 # Equation numbering is from the GDA2020 Tech Manual v1.0 diff --git a/geodepy/tests/test_geodesy.py b/geodepy/tests/test_geodesy.py index 12016a3..20e0ef6 100644 --- a/geodepy/tests/test_geodesy.py +++ b/geodepy/tests/test_geodesy.py @@ -77,6 +77,12 @@ def test_vincinv(self): test2 = vincinv(lat1, lon1, lat1, lon1) self.assertEqual(test2, (0, 0, 0)) + # Test coincident coordinates (within float precision) + pl1 = (-30.645230675, 152.996285475) + pl2 = (-30.645230674999997, 152.996285475) + test3 = vincinv(pl1[0], pl1[1], pl2[0], pl2[1]) + self.assertEqual(test3, (0, 0, 0)) + # Test DMSAngle Input ell_dist, azimuth1to2, azimuth2to1 = vincinv(lat1_DMS, lon1_DMS, lat2_DMS, lon2_DMS)