Skip to content

Commit

Permalink
Fix crash caused by libastro error
Browse files Browse the repository at this point in the history
Handle libastro error: 'that satellite seems to stay always below your horizon'
  • Loading branch information
pkrasicki committed Sep 16, 2020
1 parent bfaa037 commit 6508263
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ def predict_passes(tle_array, lon, lat, num_days):
satellite = ephem.readtle(tle_array[0], tle_array[1], tle_array[2])

while(True):
arr = observer.next_pass(satellite)
arr = []

# fix for crash from libastro error: 'that satellite seems to stay always below your horizon'
# TODO: investigate why it happens
try:
arr = observer.next_pass(satellite)
except:
return {}

pass_obj = {
"startDate": to_datetime(arr[0]),
# "startAzimuth": arr[1],
Expand Down

0 comments on commit 6508263

Please sign in to comment.