diff options
| author | Yuval Adam <_@yuv.al> | 2020-09-21 23:29:10 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2020-09-21 23:29:10 +0300 |
| commit | d25708b978b50c905b062eb8ba3970e48ae276e8 (patch) | |
| tree | cabb9f355cf557939147c32670d42f024aa816b8 /iss | |
| parent | 3526314e0af5331ac25435d93ab225c37c6e62dc (diff) | |
Split server and prediction files
Diffstat (limited to 'iss')
| -rw-r--r-- | iss/__init__.py | 0 | ||||
| -rw-r--r-- | iss/predictions.py | 23 | ||||
| -rw-r--r-- | iss/server.py | 8 |
3 files changed, 31 insertions, 0 deletions
diff --git a/iss/__init__.py b/iss/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/iss/__init__.py 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) diff --git a/iss/server.py b/iss/server.py new file mode 100644 index 0000000..ee60be1 --- /dev/null +++ b/iss/server.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +async def root(): + return {"message": "Hello World"} |
