summaryrefslogtreecommitdiff
path: root/iss/predictions.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2020-09-24 21:54:20 +0300
committerYuval Adam <_@yuv.al>2020-09-24 21:54:20 +0300
commit5225a7263341308c3ec7429f8275afb34134a831 (patch)
tree915439a4f2087ed03aec4655ee1ab19a1cbac8c3 /iss/predictions.py
parentdf526f8cf7fa4233e97b925b40daf51d4924cb18 (diff)
Fix test data from static TLE file
Diffstat (limited to 'iss/predictions.py')
-rw-r--r--iss/predictions.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/iss/predictions.py b/iss/predictions.py
index 3c05ef2..9f5023d 100644
--- a/iss/predictions.py
+++ b/iss/predictions.py
@@ -3,11 +3,21 @@ from skyfield.api import Topos, load
from .utils import chunks
-class Predictions(object):
- ISS = "ISS (ZARYA)"
+ISS = "ISS (ZARYA)"
+STATIONS_URL = "http://celestrak.com/NORAD/elements/stations.txt"
+
+class Predictions(object):
def __init__(
- self, lat, lng, altitude=30.0, tz="UTC", satellite=ISS, start=None, days=10
+ self,
+ lat,
+ lng,
+ altitude=30.0,
+ tz="UTC",
+ satellite=ISS,
+ start=None,
+ days=10,
+ tle_file=None,
):
self.lat = lat
self.lng = lng
@@ -16,10 +26,10 @@ class Predictions(object):
self.satellite = satellite
self.start = start
self.days = days
+ self.tle_file = tle_file.resolve().as_posix() if tle_file else STATIONS_URL
def init_stations(self):
- stations_url = "http://celestrak.com/NORAD/elements/stations.txt"
- return load.tle_file(stations_url)
+ return load.tle_file(self.tle_file)
def get_next_days(self):
ts = load.timescale()