summaryrefslogtreecommitdiff
path: root/iss/predictions.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2020-09-21 23:29:10 +0300
committerYuval Adam <_@yuv.al>2020-09-21 23:29:10 +0300
commitd25708b978b50c905b062eb8ba3970e48ae276e8 (patch)
treecabb9f355cf557939147c32670d42f024aa816b8 /iss/predictions.py
parent3526314e0af5331ac25435d93ab225c37c6e62dc (diff)
Split server and prediction files
Diffstat (limited to 'iss/predictions.py')
-rw-r--r--iss/predictions.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/iss/predictions.py b/iss/predictions.py
new file mode 100644
index 0000000..fa4aeff
--- /dev/null
+++ b/iss/predictions.py
@@ -0,0 +1,23 @@
+from skyfield.api import Topos, load
+
+TEL_AVIV = Topos('32.0853 N', '34.7817 E')
+ISS = "ISS (ZARYA)"
+
+def init_stations():
+ stations_url = 'http://celestrak.com/NORAD/elements/stations.txt'
+ return load.tle_file(stations_url)
+
+def get_predictions(location=TEL_AVIV, satellite_name=ISS):
+ satellites = init_stations()
+ by_name = {sat.name: sat for sat in satellites}
+ satellite = by_name[satellite_name]
+
+ ts = load.timescale()
+ t0 = ts.now()
+ t1 = ts.utc(2020, 9, 30)
+
+ t, events = satellite.find_events(location, t0, t1, altitude_degrees=60.0)
+ for ti, event in zip(t, events):
+ name = ('rise above 30°', 'culminate', 'set below 30°')[event]
+ print(ti)
+ print(ti.utc_strftime('%Y %b %d %H:%M:%S'), name)