Skip to content

Commit

Permalink
Update dump1090-json_pub_sub.py
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Nov 27, 2024
1 parent b35dc54 commit 88c6501
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dump1090-json/dump1090-json_pub_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _process_response(self) -> None:
data = data[~pd.isna(data.lat)]
data = data.fillna(0.0)
data["request_time"] = request_time
data["on_ground"] = 0
data["on_ground"] = False
data["timestamp"] = float(response["now"]) - data.seen_pos
if "geom_rate" in data.columns:
data['geom_rate'] = data['geom_rate'].astype(float) / 60 * 0.3048
Expand All @@ -131,20 +131,21 @@ def _process_response(self) -> None:
data.loc[data['alt_baro'] == 'ground', 'alt_geom'] = self.ground_level / 0.3048
data['alt_geom'] = data['alt_geom'].astype(float) * 0.3048
if "alt_baro" in data.columns:
data.loc[data['alt_baro'] == 'ground', 'on_ground'] = 1
data["on_ground"] = data['alt_baro'] == 'ground'
#data.loc[data['alt_baro'] == 'ground', 'on_ground'] = True
data.loc[data['alt_baro'] == 'ground', 'alt_baro'] = self.ground_level / 0.3048
data['alt_baro'] = data['alt_baro'].astype(float) * 0.3048
if "gs" in data.columns:
data['gs'] = data['gs'].astype(float) * 0.5144444
if "squawk" in data.columns:
data["squawk"] = data["squawk"].astype(str)
data["on_ground"] = data["on_ground"].astype(int)
data["on_ground"] = data["on_ground"].astype(bool)
# TODO: Add in barometric offset to get geometric altitude for those aircraft that do not report it
# tmp = data.loc[data.alt_geom!=0,'hex'][0]
# baro_offset = data.loc[data.hex==tmp,'alt_geom'] - data.loc[data.hex==tmp,'alt_baro']
# print(list(baro_offset)[0])
# data.alt_geom = data.alt_baro+baro_offset
logging.debug(f"Processed data from response: {data}")
logging.info(f"Processed data from response: {data}")

# Process data from the response
self._process_data(data)
Expand Down

0 comments on commit 88c6501

Please sign in to comment.