Predict when the ISS will be visible

Introduction

Last time , looking at the functions of PyEphem, I wondered if I could predict the date and time when I could see the ISS. But what are the conditions under which the ISS can be seen?

I was worried about the physical positional relationship, and it was impossible to make it more difficult than I thought! It was a moment, but I think that I should think carefully and meet the following three conditions.

--The elevation angle of the ISS as seen by the observer is positive --The elevation angle of the sun as seen by the observer is negative ――ISS is not food

Try out

import ephem
import requests
import datetime
from math import degrees as deg

tle_url = 'https://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html'

loc = ('35.689922','139.692122',41) #Tokyo Metropolitan Government
home = ephem.Observer()
home.lat = loc[0]
home.lon = loc[1]
home.elevation = loc[2]
sun = ephem.Sun()

doc = requests.get(tle_url).text
lines = doc.split('\n')
for idx in range(len(lines)):
    if lines[idx].strip() == 'TWO LINE MEAN ELEMENT SET':
        iss = ephem.readtle(lines[idx+2], lines[idx+3], lines[idx+4])
        break

utcnow = datetime.datetime.utcnow().replace(second=0,microsecond=0)
utcnow += datetime.timedelta(days=0) #For confirmation
for after in range(0, 60*24*10, 1): #Prediction interval(m),Predicted interval(m)
    when = utcnow + datetime.timedelta(minutes=after)
    home.date = when
    sun.compute(home)
    alt_sun = deg(sun.alt)
    iss.compute(home)
    alt_iss = deg(iss.alt)
    az_iss = deg(iss.az)
    iss.compute(when)
    ecl = iss.eclipsed
    if alt_sun <= -4 and alt_iss >= 10 and not(ecl):
        jst = when+datetime.timedelta(hours=9)
        print('%s - %.2f %.2f' % (jst, alt_iss, az_iss))

Predicting the last 10 days,

2020-03-07 05:38:00 - 11.98 9.07
2020-03-07 05:39:00 - 12.73 27.92
2020-03-07 05:40:00 - 11.22 46.14
2020-03-09 05:38:00 - 12.83 338.71
2020-03-09 05:39:00 - 19.49 353.95
2020-03-09 05:40:00 - 25.41 19.47
2020-03-09 05:41:00 - 24.90 51.33

--About 3 minutes from 5:38 on March 7 (maximum 12.73 degrees) --About 4 minutes from 5:38 on March 9 (maximum 25.41 degrees)

Was predicted.

check the answer

Check the forecast site below.

https://spotthestation.nasa.gov/sightings/view.cfm?country=Japan&region=None&city=Fuchu#.XlcICsvng2x

Considering the position and the error of TLE update skipping, it seems to be almost correct. (The ISS elevation angle of 10 and the sun elevation angle of -4 were tuned according to NASA's predictions. Maybe it's not so low or bright.)

Now you won't miss the ISS anymore.

Recommended Posts

Predict when the ISS will be visible
When will mmap (2) files be updated? (3)
When will mmap (2) files be updated? (2)
When will mmap (2) files be updated? (1)
What to do when is not in the sudoers file.This incident will be reported.
When will the default arguments be bound in python? When variables are bound in closure lazy evaluation.
Python note: When the pip command cannot be used
Be careful when differentiating the eigenvectors of a matrix
Solution when the image cannot be displayed with tkinter [python]
Master the type in Python? (When should type check be done)
[Python] When are variables created? When will class instances be erased?
Linux delete command when only the folder cannot be deleted