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.py | |
| parent | 3526314e0af5331ac25435d93ab225c37c6e62dc (diff) | |
Split server and prediction files
Diffstat (limited to 'iss.py')
| -rw-r--r-- | iss.py | 33 |
1 files changed, 0 insertions, 33 deletions
@@ -1,33 +0,0 @@ -from fastapi import FastAPI -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) - - - -app = FastAPI() - - -@app.get("/") -async def root(): - return {"message": "Hello World"} |
