@@ -33,15 +33,14 @@ def lookup_country(icao: int) -> str:
3333# FlightID AND/OR ICAO HEX address.
3434def dolphin (flight : str = None , affil : str = None ) -> str :
3535 """
36- Classify an aircraft as USCG Dolphin, or not.
37- What, are you afraid of water?
38- """
39- # MH-65D Dolphins out of Air Station SF use older ADS-B, but luckily have
40- # a similar "flight" name.
41- # For example:
42- # * C6540 / AE2682 https://globe.adsbexchange.com/?icao=ae2682
43- # * C6604 / AE26BB https://globe.adsbexchange.com/?icao=ae26bb
36+ Classify an aircraft as USCG Dolphin.
37+
38+ MH-65D Dolphins out of Air Station SF use older ADS-B, but luckily have a similar "flight" name.
4439
40+ For example:
41+ * C6540 / AE2682 https://globe.adsbexchange.com/?icao=ae2682
42+ * C6604 / AE26BB https://globe.adsbexchange.com/?icao=ae26bb
43+ """
4544 if flight and len (flight ) >= 3 and flight [:2 ] in ["C6" , b"C6" ]:
4645 if affil and affil in ["M" , b"M" ]:
4746 return True
@@ -55,7 +54,7 @@ def adsb_to_cot_type(icao: typing.Union[str, int], category: typing.Union[str, N
5554 ADS-B DO-260B or GDL90 Emitter Category & Flight ID.
5655 """
5756 affil = "C" # Affiliation, default = Civilian
58- attitude = "u" # Attitude
57+ attitude = "u" # Attitude, default = unknown
5958
6059 # TODO: If the adsbx has a leading underscore and registry "_N1234A" then that means they are calculating the
6160 # registration with no Flight ID field transmited
@@ -161,30 +160,30 @@ def get_icao_range(range_type: str = "CIV") -> list:
161160 return list (filter (lambda x : f"-{ range_type } " in x , aircot .DEFAULT_HEX_RANGES ))
162161
163162
164- def icao_in_range (icao_int , range_type : str = "CIV" ) -> bool :
163+ def icao_in_known_range (icao_int , range_type : str = "CIV" ) -> bool :
165164 """Determines if the given ICAO is within a known 'friendly' ICAO Range."""
166165 for idx in get_icao_range (range_type ):
167166 if aircot .DEFAULT_HEX_RANGES [idx ]["start" ] <= icao_int <= aircot .DEFAULT_HEX_RANGES [idx ]["end" ]:
168167 return True
169168
170169
171- def set_friendly_mil (icao_int : int , affil : str = "" , attitude : str = ". " ) -> tuple :
170+ def set_friendly_mil (icao : int , attitude : str = "u " , affil : str = "" ) -> tuple :
172171 """Sets Affiliation and Attitude for 'friendly' Military ICAOs."""
173- if icao_in_range (icao_int , "MIL" ):
174- attitude = "f"
172+ if icao_in_known_range (icao , "MIL" ):
175173 affil = "M"
174+ attitude = "f"
176175 return affil , attitude
177176
178177
179- def set_neutral_civ (icao : int , affil : str = "" , attitude : str = ". " ) -> tuple :
178+ def set_neutral_civ (icao : int , attitude : str = "u " , affil : str = "" ) -> tuple :
180179 """Sets Affiliation and Attitude for known 'neutral' Civilian ICAOs."""
181- if icao_in_range (icao ):
182- attitude = "n"
180+ if icao_in_known_range (icao ):
183181 affil = "C"
182+ attitude = "n"
184183 return affil , attitude
185184
186185
187- def is_known_country_icao (icao : int , attitude : str = ". " ):
186+ def is_known_country_icao (icao : int , attitude : str = "u " ):
188187 if lookup_country (icao ):
189188 attitude = "n"
190189 return attitude
@@ -201,7 +200,7 @@ def is_civ(icao: int) -> str:
201200 return True
202201
203202
204- def is_tw (icao : int , attitude : str = ". " ) -> str :
203+ def is_tw (icao : int , attitude : str = "u " ) -> str :
205204 tw_start = 0x899000
206205 tw_end = 0x8993FF
207206 if tw_start <= icao <= tw_end :
@@ -280,7 +279,6 @@ def icao_int_to_hex(addr) -> str:
280279
281280
282281
283-
284282def read_known_craft (csv_file : str ) -> list :
285283 """Reads the FILTER_CSV file into a `list`"""
286284 all_rows = []
0 commit comments