minor update of cprNL function

This commit is contained in:
junzis 2016-07-08 17:53:42 +02:00
parent 5518816b32
commit 556e499064

View File

@ -228,17 +228,22 @@ def surface_position(msg0, msg1, t0, t1):
def _cprNL(lat):
try:
nz = 15
a = 1 - math.cos(math.pi / (2 * nz))
b = math.cos(math.pi / 180.0 * abs(lat)) ** 2
nl = 2 * math.pi / (math.acos(1 - a/b))
NL = util.floor(nl)
return NL
except:
# happens when latitude is +/-90 degree
if lat == 0:
return 59
if lat == 87 or lat == -87:
return 2
if lat > 87 or lat < -87:
return 1
nz = 15
a = 1 - math.cos(math.pi / (2 * nz))
b = math.cos(math.pi / 180.0 * abs(lat)) ** 2
nl = 2 * math.pi / (math.acos(1 - a/b))
NL = util.floor(nl)
return NL
def altitude(msg):
"""Decode aircraft altitude