From 5225a7263341308c3ec7429f8275afb34134a831 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Thu, 24 Sep 2020 21:54:20 +0300 Subject: Fix test data from static TLE file --- .gitignore | 1 + iss/predictions.py | 20 +++-- iss/tests/data/stations.txt | 201 ++++++++++++++++++++++++++++++++++++++++++ iss/tests/test_predictions.py | 28 ++++-- 4 files changed, 238 insertions(+), 12 deletions(-) create mode 100644 iss/tests/data/stations.txt diff --git a/.gitignore b/.gitignore index 1c24b6e..2ff2d1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc __pycache__ stations.txt +!iss/tests/data/stations.txt 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() diff --git a/iss/tests/data/stations.txt b/iss/tests/data/stations.txt new file mode 100644 index 0000000..a02aa2c --- /dev/null +++ b/iss/tests/data/stations.txt @@ -0,0 +1,201 @@ +ISS (ZARYA) +1 25544U 98067A 20268.38302949 -.00000284 00000-0 29810-5 0 9996 +2 25544 51.6429 217.6155 0001685 99.1844 43.7718 15.48778094247399 +KESTREL EYE IIM (KE2M) +1 42982U 98067NE 20267.95968266 .00020056 00000-0 15033-3 0 9991 +2 42982 51.6326 137.5426 0003681 115.5534 244.5846 15.72623989166569 +DELLINGR (RBLE) +1 43021U 98067NJ 20267.08014144 .00016978 00000-0 12397-3 0 9995 +2 43021 51.6344 139.9965 0001993 103.7177 256.4044 15.73384070162221 +UBAKUSAT +1 43467U 98067NQ 20267.06130774 .00046640 00000-0 23124-3 0 9994 +2 43467 51.6329 137.4207 0001866 137.5538 222.5609 15.81510931135525 +CUBERRT +1 43546U 98067NU 20267.37041305 .00019111 00000-0 10879-3 0 9993 +2 43546 51.6314 137.2822 0001944 128.4800 231.6376 15.79001484125689 +TEMPEST-D +1 43547U 98067NV 20267.22486490 .00006187 00000-0 70338-4 0 9992 +2 43547 51.6354 177.8221 0005365 69.5928 290.5642 15.63823635124811 +RAINCUBE +1 43548U 98067NW 20267.10563719 .00049359 00000-0 25485-3 0 9990 +2 43548 51.6290 145.9395 0004137 127.3245 232.8134 15.80596056125673 +HALOSAT +1 43549U 98067NX 20267.11306202 .00047046 00000-0 26001-3 0 9990 +2 43549 51.6332 147.6236 0004275 128.7315 231.4069 15.79118873125217 +ENDUROSAT ONE +1 43551U 98067NZ 20267.04822319 .00200495 27499-4 42953-3 0 9995 +2 43551 51.6266 127.3407 0004191 198.6816 161.4040 15.98139138125882 +EQUISAT +1 43552U 98067PA 20267.13361195 .00045010 00000-0 23442-3 0 9993 +2 43552 51.6292 144.7514 0004811 130.7042 229.4379 15.80443416125621 +RADSAT-G +1 43553U 98067PB 20267.94233335 .00028050 00000-0 20574-3 0 9995 +2 43553 51.6391 153.4884 0005229 111.4189 248.7368 15.72903351125634 +1998-067PC +1 43554U 98067PC 20267.12355795 .00921444 55269-3 65403-3 0 9990 +2 43554 51.6188 120.1206 0008385 252.6074 107.4026 16.15466098125525 +AEROCUBE 12A +1 43556U 18046C 20267.48219868 .00000809 00000-0 39681-4 0 9993 +2 43556 51.6435 354.4503 0007640 288.3269 71.6880 15.30068965122387 +AEROCUBE 12B +1 43557U 18046D 20267.49675495 .00000648 00000-0 34518-4 0 9992 +2 43557 51.6438 355.2818 0007706 287.8950 72.1190 15.29756159122324 +LEMUR-2-VU +1 43558U 18046E 20267.49057965 .00002511 00000-0 93278-4 0 9998 +2 43558 51.6426 350.1195 0006952 292.6949 67.3297 15.31474795122430 +LEMUR-2-ALEXANDER +1 43559U 18046F 20267.51085593 .00003409 00000-0 12182-3 0 9991 +2 43559 51.6420 349.5210 0006906 291.9836 68.0411 15.31610429122220 +LEMUR-2-YUASA +1 43560U 18046G 20267.51402285 .00003438 00000-0 12352-3 0 9995 +2 43560 51.6421 350.2706 0007199 305.7016 54.3295 15.31406320122435 +LEMUR-2-TOMHENDERSON +1 43561U 18046H 20268.39105693 .00002084 00000-0 80167-4 0 9992 +2 43561 51.6421 346.3702 0007245 308.7832 51.2501 15.31165395122125 +SIRIUSSAT-1 +1 43595U 98067PG 20268.20046696 .00047706 00000-0 23108-3 0 9998 +2 43595 51.6254 141.1597 0003554 134.7735 225.2613 15.81998869120611 +SIRIUSSAT-2 +1 43596U 98067PH 20267.70040077 .00048919 00000-0 23860-3 0 9992 +2 43596 51.6265 144.6455 0003656 141.5755 218.5599 15.81838501120520 +1998-067PN +1 43638U 98067PN 20267.21816045 .00012470 00000-0 12414-3 0 9997 +2 43638 51.6348 176.2481 0002582 73.8745 286.2534 15.66127923111985 +1998-067PP +1 43639U 98067PP 20267.98466280 .00033745 00000-0 24843-3 0 9991 +2 43639 51.6334 159.5781 0003581 83.7969 276.3437 15.72721066112287 +STARS-ME +1 43640U 98067PQ 20267.45080403 .00015136 00000-0 13737-3 0 9998 +2 43640 51.6334 170.2399 0004153 63.8931 296.2492 15.68231823112091 +ISS DEB (SEDA-AP) +1 43870U 98067PU 20267.29480923 .00003528 00000-0 51813-4 0 9996 +2 43870 51.6366 195.5948 0004709 59.5838 300.5619 15.58499644 99906 +CATSAT-2 +1 44029U 98067PV 20267.79686373 .00022752 00000-0 20088-3 0 9994 +2 44029 51.6374 176.4643 0004377 109.9826 250.1642 15.68579190 93940 +DELPHINI +1 44030U 98067PW 20267.99417936 .00033335 00000-0 27472-3 0 9998 +2 44030 51.6320 173.1114 0004626 108.6810 251.4689 15.70028650 93977 +UNITE +1 44031U 98067PX 20267.50671666 .00010957 00000-0 12369-3 0 9992 +2 44031 51.6367 187.2426 0003884 91.9152 268.2287 15.63062254 93744 +CATSAT-1 +1 44033U 98067PZ 20267.92423981 .00031324 00000-0 27416-3 0 9995 +2 44033 51.6376 175.8238 0004438 107.1357 253.0127 15.68598781 93876 +ISS DEB +1 44303U 98067QA 20267.88307450 .00004943 00000-0 79247-4 0 9999 +2 44303 51.6403 207.8783 0004903 344.0834 16.0002 15.55043501 75079 +ISS DEB +1 44304U 98067QB 20268.19138804 .00039413 00000-0 39192-3 0 9994 +2 44304 51.6369 191.1604 0002428 350.8272 9.2678 15.65322021 75339 +ISS DEB +1 44305U 98067QC 20268.07221849 .00049951 00000-0 41836-3 0 9990 +2 44305 51.6324 185.6736 0003481 74.9587 285.1796 15.69453048 75398 +ISS DEB +1 44306U 98067QD 20267.57789205 .00004557 00000-0 73357-4 0 9997 +2 44306 51.6391 209.5238 0006063 337.3879 22.6844 15.55144334 75034 +RAAVANA-1 +1 44329U 98067QE 20267.09160207 .00012109 00000-0 15438-3 0 9991 +2 44329 51.6388 204.0477 0005677 22.0807 338.0429 15.59743310 72234 +UGUISU +1 44330U 98067QF 20267.23825704 .00012236 00000-0 15654-3 0 9990 +2 44330 51.6362 203.4989 0005569 22.0219 338.1012 15.59639700 72232 +NEPALISAT-1 +1 44331U 98067QG 20267.27522229 .00011835 00000-0 15093-3 0 9992 +2 44331 51.6361 202.9983 0005658 25.1766 334.9502 15.59761562 72252 +SPOOQY-1 +1 44332U 98067QH 20268.31086195 .00015950 00000-0 20193-3 0 9995 +2 44332 51.6369 197.9212 0004874 33.8561 326.2742 15.59655990 72377 +RED-EYE 1 (PINOT) +1 44364U 98067QJ 20267.88928112 .00005158 00000-0 82770-4 0 9994 +2 44364 51.6404 208.6511 0006413 338.8227 21.2497 15.54908638 70655 +IOD-1 GEMS +1 44385U 98067QK 20267.09014511 .00024448 00000-0 26585-3 0 9993 +2 44385 51.6382 200.3357 0001410 22.4860 337.6196 15.63310595 69748 +SWIATOWID +1 44426U 98067QL 20267.81641966 .00023201 00000-0 23789-3 0 9998 +2 44426 51.6393 195.1836 0001696 30.3412 69.7688 15.64842515 69894 +KRAKSAT +1 44427U 98067QM 20267.83471707 .00007061 00000-0 10150-3 0 9999 +2 44427 51.6416 205.0969 0002105 349.5755 108.0854 15.57293485 69801 +VCC A +1 44428U 98067QN 20267.12643018 .00011029 00000-0 14513-3 0 9994 +2 44428 51.6390 205.8283 0002192 13.5447 346.5604 15.59016549 69732 +ENTRYSAT +1 44429U 98067QP 20268.04724564 .00018345 00000-0 22435-3 0 9993 +2 44429 51.6370 199.1865 0001701 20.9767 339.1296 15.60459588 69904 +VCC C +1 44430U 98067QQ 20267.03622483 .00019195 00000-0 21979-3 0 9996 +2 44430 51.6368 202.1906 0002046 43.2288 316.8867 15.62145452 68597 +VCC B +1 44431U 98067QR 20267.12289720 .00011303 00000-0 14818-3 0 9997 +2 44431 51.6374 205.7780 0002312 11.6939 348.4107 15.59087751 69673 +ISS DEB +1 44788U 98067QT 20267.14485829 .00019193 00000-0 25262-3 0 9992 +2 44788 51.6391 212.6599 0004679 23.3264 336.7940 15.58470803 48610 +ISS DEB +1 44789U 98067QU 20267.32924432 .00016481 00000-0 22228-3 0 9997 +2 44789 51.6388 212.4170 0005733 19.6087 340.5125 15.57934779 48628 +RWASAT-1 +1 44790U 98067QV 20267.79678838 -.00000485 00000-0 00000+0 0 9994 +2 44790 51.6430 213.8407 0010068 24.0411 59.8028 15.53720571 47916 +AQT-D +1 44791U 98067QW 20267.88622751 .00007082 00000-0 11593-3 0 9990 +2 44791 51.6421 213.8974 0006762 4.6032 355.5020 15.53679335 47925 +NARSSCUBE-1 +1 44792U 98067QX 20267.55761933 .00009048 00000-0 13918-3 0 9998 +2 44792 51.6394 213.9190 0005481 28.9363 331.1931 15.55021062 47896 +STPSAT-4 +1 45043U 98067QY 20267.35918080 .00003495 00000-0 67940-4 0 9998 +2 45043 51.6411 221.5797 0005886 17.8615 342.2580 15.50543531 37011 +HARP +1 45256U 98067QZ 20267.79450426 .00006388 00000-0 11163-3 0 9996 +2 45256 51.6415 217.7560 0007269 10.0077 350.1056 15.52023588 33772 +1998-067RA +1 45257U 98067RA 20268.31429176 .00007496 00000-0 13016-3 0 9994 +2 45257 51.6406 215.2178 0008080 14.6616 345.4606 15.51904242 33853 +PHOENIX +1 45258U 98067RB 20267.88412579 .00005895 00000-0 10504-3 0 9995 +2 45258 51.6407 217.5856 0005877 355.8639 4.2301 15.51634401 33757 +1998-067RC +1 45259U 98067RC 20267.56376208 .00007716 00000-0 13060-3 0 9993 +2 45259 51.6404 218.4550 0007261 11.9454 348.1707 15.52585523 33740 +CRYOCUBE +1 45260U 98067RD 20267.41616238 .00007759 00000-0 13078-3 0 9995 +2 45260 51.6404 218.9706 0008024 9.7530 350.3614 15.52692109 33738 +AZTECHSAT-1 +1 45261U 98067RE 20267.89248603 .00011606 00000-0 18778-3 0 9993 +2 45261 51.6401 216.1518 0007691 13.4920 346.6275 15.53283079 33803 +RADSAT-U +1 45262U 98067RF 20267.59742191 .00005890 00000-0 10368-3 0 9997 +2 45262 51.6413 218.6888 0007485 44.6952 315.4640 15.51982255 33750 +QARMAN +1 45263U 98067RG 20267.58958160 .00007946 00000-0 13524-3 0 9993 +2 45263 51.6403 218.6254 0007208 8.6962 351.4151 15.52382658 33772 +SORTIE +1 45264U 98067RH 20267.80060211 .00003828 00000-0 72150-4 0 9996 +2 45264 51.6415 218.5397 0007778 16.0393 344.0842 15.51140833 33766 +ICS-EF (ISS DEB) +1 45265U 98067RJ 20267.90410582 .00002682 00000-0 54723-4 0 9991 +2 45265 51.6415 219.2148 0005709 19.1631 340.9572 15.50133823 33440 +SOYUZ-MS 16 +1 45476U 20023A 20267.41567050 .00001718 00000-0 39590-4 0 9995 +2 45476 51.6436 222.3966 0001436 98.6522 47.1481 15.48789843 25884 +PROGRESS-MS 14 +1 45595U 20026A 20267.41567050 .00001718 00000-0 39590-4 0 9990 +2 45595 51.6436 222.3966 0001436 98.6522 47.1481 15.48789843 23468 +G-SAT +1 45597U 98067RK 20267.89217040 .00007120 00000-0 12581-3 0 9998 +2 45597 51.6414 218.3998 0005935 68.4756 291.6866 15.51508705 23146 +QUETZAL-1 +1 45598U 98067RL 20268.17064560 .00009203 00000-0 16074-3 0 9993 +2 45598 51.6413 217.2566 0003911 90.4656 269.6781 15.51438655 23115 +RED-EYE 2 (MERLOT) +1 45800U 98067RM 20267.80427837 .00003120 00000-0 62350-4 0 9999 +2 45800 51.6421 220.0537 0001944 59.5028 300.6153 15.50120378 15280 +RED-EYE 3 (CABERNET) +1 45809U 98067RN 20267.86993442 .00004307 00000-0 82982-4 0 9995 +2 45809 51.6417 219.7424 0002093 49.2344 310.8826 15.50143203 14277 +PROGRESS-MS 15 +1 45937U 20050A 20267.41567050 .00001718 00000-0 39590-4 0 9997 +2 45937 51.6436 222.3966 0001436 98.6522 47.1481 15.48789843 9585 diff --git a/iss/tests/test_predictions.py b/iss/tests/test_predictions.py index 27fc667..4c55f5b 100644 --- a/iss/tests/test_predictions.py +++ b/iss/tests/test_predictions.py @@ -1,7 +1,11 @@ +from pathlib import Path from skyfield.api import Topos from ..predictions import Predictions +DATA_DIR = Path(__file__).parent / "data" +STATIONS = DATA_DIR / "stations.txt" + def test_get_timescales(): days = 5 @@ -29,15 +33,25 @@ def test_get_location(): def test_get_predictions(): start = 2459117.245895914 - p = Predictions(lat=32.0853, lng=34.7817, tz="Asia/Jerusalem", start=start) + p = Predictions( + lat=32.0853, lng=34.7817, tz="Asia/Jerusalem", start=start, tle_file=STATIONS + ) preds = p.get_predictions() - assert len(preds) == 17 + assert len(preds) == 16 assert preds[0] == [ - "2020-09-24T21:31:09Z", - "2020-09-24T21:32:35Z", - "2020-09-24T21:34:02Z", + "2020-09-24T21:31:31Z", + "2020-09-24T21:32:57Z", + "2020-09-24T21:34:24Z", ] - p = Predictions(lat=32.0853, lng=34.7817, tz="Asia/Jerusalem", start=start, days=5) + p = Predictions( + lat=32.0853, + lng=34.7817, + tz="Asia/Jerusalem", + altitude=0, + start=start, + days=5, + tle_file=STATIONS, + ) preds = p.get_predictions() - assert len(preds) == 8 + assert len(preds) == 39 -- cgit v1.3.1