Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Sep 26, 2024
1 parent a42fca2 commit 19772a6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/traffic/core/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,7 @@ def query_ehs(
self,
data: Union[None, pd.DataFrame, "RawData"] = None,
failure_mode: str = "info",
**kwargs: Any,
) -> Flight:
"""Extends data with extra columns from EHS messages.
Expand Down Expand Up @@ -2779,7 +2780,9 @@ def fail_silent() -> Flight:
failure = failure_dict[failure_mode]

if data is None:
ext = opensky.extended(self.start, self.stop, icao24=self.icao24)
ext = opensky.extended(
self.start, self.stop, icao24=self.icao24, **kwargs
)
df = ext.data if ext is not None else None
else:
df = data if isinstance(data, pd.DataFrame) else data.data
Expand All @@ -2793,19 +2796,17 @@ def fail_silent() -> Flight:

timestamped_df = (
df.sort_values("mintime")
.assign(
timestamp=lambda df: pd.to_datetime(
df.mintime, unit="s", utc=True
)
)
.assign(timestamp=lambda df: df.mintime)
# TODO shouldn't be necessary after pyopensky 2.10
.convert_dtypes(dtype_backend="pyarrow")
)

referenced_df = (
timestamped_df.merge(
# TODO shouldn't be necessary after pyopensky 2.10
self.data.convert_dtypes(dtype_backend="pyarrow"),
self.data.convert_dtypes(dtype_backend="pyarrow").assign(
timestamp=lambda df: df.timestamp.astype("int64") * 1e-9
),
on="timestamp",
how="outer",
)
Expand All @@ -2829,7 +2830,7 @@ def fail_silent() -> Flight:

decoded = rs1090.decode(
referenced_df.rawmsg,
referenced_df.timestamp.astype("int64") * 1e-9,
referenced_df.timestamp.astype("int64"),
)

if len(decoded) == 0:
Expand Down

0 comments on commit 19772a6

Please sign in to comment.