Last active
January 10, 2021 20:17
-
-
Save MaxPowerWasTaken/0b074517305cb070e355a389b4dd9b77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## CODE################################# | |
from skyfield.api import load as sky_load, wgs84 | |
from random import choice, sample | |
# load data | |
satellites2012 = sky_load.tle_file('data/TLE/tle2012.txt') | |
satellites2017 = sky_load.tle_file('data/TLE/tle2017.txt/tle2017.txt') # these don't get unzipped to consistent structures | |
# combine lists of satellite objects and get distinct set of satellite numbers | |
satellites = satellites2012 + satellites2017 | |
satnums = list(set([s.model.satnum for s in satellites])) | |
def utc_by_satnum(satnum, satellites=satellites): | |
sat = [s for s in satellites if s.model.satnum == satnum][choice(range(50))] | |
epoch = sat.epoch | |
utc = sat.epoch.utc_datetime() | |
return (f"TLE epoch: {epoch}, UTC: {utc}") | |
# Print N random pairs of corresponding (TLE-Epoch, UTC) values | |
N=10 | |
for satnum in sample(satnums, N): | |
print(utc_by_satnum(satnum)) | |
############ OUTPUT ######################################################## | |
TLE epoch: <Time tt=2455936.4582421184>, UTC: 2012-01-09 22:58:45.935028+00:00 | |
TLE epoch: <Time tt=2457794.919518671>, UTC: 2017-02-10 10:02:57.229156+00:00 | |
TLE epoch: <Time tt=2455954.8684860584>, UTC: 2012-01-28 08:49:31.011444+00:00 | |
TLE epoch: <Time tt=2455942.6236549285>, UTC: 2012-01-16 02:56:57.601837+00:00 | |
TLE epoch: <Time tt=2455947.4582049786>, UTC: 2012-01-20 22:58:42.726166+00:00 | |
TLE epoch: <Time tt=2457779.241353971>, UTC: 2017-01-25 17:46:23.799072+00:00 | |
TLE epoch: <Time tt=2455946.2645459184>, UTC: 2012-01-19 18:19:50.583374+00:00 | |
TLE epoch: <Time tt=2455953.2599401083>, UTC: 2012-01-26 18:13:12.641357+00:00 | |
TLE epoch: <Time tt=2456158.8830154524>, UTC: 2012-08-19 09:10:25.351105+00:00 | |
TLE epoch: <Time tt=2456176.2278877622>, UTC: 2012-09-05 17:27:02.318665+00:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment