Skip to content

Commit 5ff9689

Browse files
authored
Merge pull request #187 from paulmadejong/master
bds44.py temperature fixes
2 parents 6401a39 + 3d0c07f commit 5ff9689

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/pyModeS/decoder/bds/bds44.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ def is44(msg: str) -> bool:
4646
if vw is not None and vw > 250:
4747
return False
4848

49-
temp, temp2 = temp44(msg)
50-
if min(temp, temp2) > 60 or max(temp, temp2) < -80:
49+
temp = temp44(msg)
50+
if temp > 60 or temp < -80:
51+
return False
52+
53+
# If all values are zero, the message was likely not MRAR
54+
if vw is not None and vw == 0 and dw is not None and dw == 0 and temp is not None and temp == 0:
55+
return False
56+
57+
if vw is None and dw is None and temp is None:
5158
return False
5259

5360
return True
@@ -82,9 +89,7 @@ def temp44(msg: str) -> Tuple[float, float]:
8289
msg (str): 28 hexdigits string
8390
8491
Returns:
85-
float, float: temperature and alternative temperature in Celsius degree.
86-
Note: Two values returns due to what seems to be an inconsistency
87-
error in ICAO 9871 (2008) Appendix A-67.
92+
float: temperature in Celsius degree.
8893
8994
"""
9095
d = common.hex2bin(common.data(msg))
@@ -97,9 +102,7 @@ def temp44(msg: str) -> Tuple[float, float]:
97102

98103
temp = value * 0.25 # celsius
99104

100-
temp_alternative = value * 0.125 # celsius
101-
102-
return temp, temp_alternative
105+
return temp
103106

104107

105108
def p44(msg: str) -> Optional[int]:

0 commit comments

Comments
 (0)