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): def _cprNL(lat):
try: if lat == 0:
nz = 15 return 59
a = 1 - math.cos(math.pi / (2 * nz))
b = math.cos(math.pi / 180.0 * abs(lat)) ** 2 if lat == 87 or lat == -87:
nl = 2 * math.pi / (math.acos(1 - a/b)) return 2
NL = util.floor(nl)
return NL if lat > 87 or lat < -87:
except:
# happens when latitude is +/-90 degree
return 1 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): def altitude(msg):
"""Decode aircraft altitude """Decode aircraft altitude