Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Oct 30, 2024
1 parent a52cd05 commit c609cbc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/traffic/data/eurocontrol/ddr/so6.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ def at(self, time: Optional[timelike] = None) -> Position:
if time is None:
raise NotImplementedError()

time = to_datetime(time)
timearray = np.array([time.timestamp()])
timestamp = to_datetime(time)
timearray = np.array([timestamp.timestamp()])
res = self.interpolate(timearray)

return Position(
Expand All @@ -367,23 +367,23 @@ def between(
"""
start = to_datetime(start)
if isinstance(stop, timedelta):
stop = start + stop
stop_ts = start + stop
else:
stop = to_datetime(stop)
stop_ts = to_datetime(stop)

t = np.stack(list(self.timestamp))
index = np.where((start < t) & (t < stop))

new_data = np.stack(list(self.coords))[index]
time1: List[datetime] = [start, *t[index]]
time2: List[datetime] = [*t[index], stop]
time2: List[datetime] = [*t[index], stop_ts]

if start > t[0]:
new_data = np.vstack([self.at(start), new_data])
else:
time1, time2 = time1[1:], time2[1:]
if stop < t[-1]:
new_data = np.vstack([new_data, self.at(stop)])
new_data = np.vstack([new_data, self.at(stop_ts)])
else:
time1, time2 = time1[:-1], time2[:-1]

Expand Down

0 comments on commit c609cbc

Please sign in to comment.