fix error in surface position with reference

This commit is contained in:
Junzi Sun 2016-11-10 13:45:36 +01:00
parent 220b8e9716
commit b9c6db6f65
2 changed files with 4 additions and 4 deletions

View File

@ -427,9 +427,9 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
ni = _cprNL(lat) - i
if ni > 0:
d_lon = 360.0 / ni
d_lon = 90.0 / ni
else:
d_lon = 360.0
d_lon = 90.0
m = util.floor(lon_ref / d_lon) \
+ util.floor(0.5 + ((lon_ref % d_lon) / d_lon) - cprlon)

View File

@ -32,9 +32,9 @@ def test_adsb_airborne_position_with_ref():
def test_adsb_surface_position_with_ref():
pos = adsb.surface_position_with_ref("8FC8200A3AB8F5F893096B22B4A8",
pos = adsb.surface_position_with_ref("8FC8200A3AB8F5F893096B000000",
-43.5, 172.5)
assert pos == (-43.48564, 175.87195)
assert pos == (-43.48564, 172.53942)
def test_adsb_surface_position():