Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #30

Closed
tve opened this issue Apr 27, 2022 · 1 comment
Closed

IndexError: list index out of range #30

tve opened this issue Apr 27, 2022 · 1 comment

Comments

@tve
Copy link

tve commented Apr 27, 2022

Traceback (most recent call last):
  File "/home/tve/Projects/Navigation/gopro-overlay/bin/gopro-dashboard.py", line 106, in <module>
    timeseries = gpx_timeseries.clip_to(gopro_timeseries)
  File "/home/Projects/Navigation/gopro-overlay/bin/../gopro_overlay/timeseries.py", line 164, in cl
ip_to
    return self.clip_to_datetimes(other.min, other.max)
  File "/home/Projects/Navigation/gopro-overlay/bin/../gopro_overlay/timeseries.py", line 150, in cl
ip_to_datetimes
    if self.dates[index_max] < dt_max and index_max < len(self.dates) - 1:

fix:

diff --git a/gopro_overlay/timeseries.py b/gopro_overlay/timeseries.py
index c563e7b..a8935a9 100644
--- a/gopro_overlay/timeseries.py
+++ b/gopro_overlay/timeseries.py
@@ -147,7 +147,7 @@ class Timeseries:
         if self.dates[index_min] > dt_min and index_min > 0:
             index_min = index_min - 1

-        if self.dates[index_max] < dt_max and index_max < len(self.dates) - 1:
+        if index_max < len(self.dates) - 1 and self.dates[index_max] < dt_max:
             index_max = index_max + 1

         dates = self.dates[index_min:index_max + 1]
@time4tea
Copy link
Owner

Ah. Good spot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants