diff options
| author | Yuval Adam <_@yuv.al> | 2020-09-23 18:12:56 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2020-09-23 18:12:56 +0300 |
| commit | aeb4181bc9687b7c7e387abe9c8c467e84865ac0 (patch) | |
| tree | f3ca869f97b29df6c878533eb3a97856aea2e6df | |
| parent | 52cab1db5ceda420110339c7de27173ffbdbe19c (diff) | |
Implement get_location_topos
| -rw-r--r-- | iss/predictions.py | 7 | ||||
| -rw-r--r-- | iss/tests/test_predictions.py | 10 |
2 files changed, 15 insertions, 2 deletions
diff --git a/iss/predictions.py b/iss/predictions.py index 1f34a19..ac28cea 100644 --- a/iss/predictions.py +++ b/iss/predictions.py @@ -21,10 +21,13 @@ class Predictions(object): t1 = ts.ut1_jd(t0.ut1 + days) return t0, t1 - def get_predictions(self, location=TEL_AVIV, satellite_name=ISS): + def get_location_topos(self): + return Topos(latitude_degrees=self.lat, longitude_degrees=self.lng) + + def get_predictions(self, location=TEL_AVIV): satellites = self.init_stations() by_name = {sat.name: sat for sat in satellites} - satellite = by_name[satellite_name] + satellite = by_name[self.satellite] t0, t1 = self.get_next_days_timescale() diff --git a/iss/tests/test_predictions.py b/iss/tests/test_predictions.py index 541b2d8..daa2bf4 100644 --- a/iss/tests/test_predictions.py +++ b/iss/tests/test_predictions.py @@ -1,3 +1,5 @@ +from skyfield.api import Topos + from ..predictions import Predictions @@ -7,3 +9,11 @@ def test_get_timescales(): t0, t1 = p.get_next_days_timescale(days=days) delta = t1.ut1 - t0.ut1 assert delta == days + + +def test_get_location(): + p = Predictions(lat=32.0853, lng=34.7817) + tlv = Topos("32.0853 N", "34.7817 E") + topos = p.get_location_topos() + assert topos.latitude.degrees == tlv.latitude.degrees + assert topos.longitude.degrees == tlv.longitude.degrees |
