Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b3e2c62d0 | ||
|
|
cadcbb1756 | ||
|
|
b9c6db6f65 |
@@ -274,10 +274,10 @@ def position_with_ref(msg, lat_ref, lon_ref):
|
||||
(float, float): (latitude, longitude) of the aircraft
|
||||
"""
|
||||
if 5 <= typecode(msg) <= 8:
|
||||
return airborne_position_with_ref(msg, lat_ref, lon_ref)
|
||||
return surface_position_with_ref(msg, lat_ref, lon_ref)
|
||||
|
||||
elif 9 <= typecode(msg) <= 18:
|
||||
return surface_position_with_ref(msg, lat_ref, lon_ref)
|
||||
return airborne_position_with_ref(msg, lat_ref, lon_ref)
|
||||
|
||||
else:
|
||||
raise RuntimeError("incorrect or inconsistant message types")
|
||||
@@ -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)
|
||||
|
||||
2
setup.py
2
setup.py
@@ -23,7 +23,7 @@ setup(
|
||||
# Versions should comply with PEP440. For a discussion on single-sourcing
|
||||
# the version across setup.py and the project code, see
|
||||
# https://packaging.python.org/en/latest/single_source_version.html
|
||||
version='1.0.7',
|
||||
version='1.0.8',
|
||||
|
||||
description='Python Mode-S Decoder',
|
||||
long_description=long_description,
|
||||
|
||||
@@ -22,6 +22,13 @@ def test_adsb_position():
|
||||
assert pos == (49.81755, 6.08442)
|
||||
|
||||
|
||||
def test_adsb_position_with_ref():
|
||||
pos = adsb.position_with_ref("8D40058B58C901375147EFD09357", 49.0, 6.0)
|
||||
assert pos == (49.82410, 6.06785)
|
||||
pos = adsb.position_with_ref("8FC8200A3AB8F5F893096B000000", -43.5, 172.5)
|
||||
assert pos == (-43.48564, 172.53942)
|
||||
|
||||
|
||||
def test_adsb_airborne_position_with_ref():
|
||||
pos = adsb.airborne_position_with_ref("8D40058B58C901375147EFD09357",
|
||||
49.0, 6.0)
|
||||
@@ -32,9 +39,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():
|
||||
|
||||
Reference in New Issue
Block a user