forked from Shadab442/dqn-leo-handover-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtle_loader.py
More file actions
24 lines (17 loc) · 717 Bytes
/
tle_loader.py
File metadata and controls
24 lines (17 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-
"""
Created on Sat May 6 20:17:48 2023
@author: shada
"""
import urllib.request
from pyorbital.orbital import Orbital
class TLE_Loader:
def __init__(self):
url = 'https://celestrak.org/NORAD/elements/gp.php?GROUP=starlink&FORMAT=tle'
urllib.request.urlretrieve(url, 'tle.txt')
# read the TLE data and create a list of Orbital objects for all LEO satellites
with open('tle.txt') as f:
tle_lines = f.readlines()
self.tles = [tle_lines[i] for i in range(0, len(tle_lines), 3)]
def load_leo_satellites(self):
return [Orbital(satellite,tle_file='tle.txt') for satellite in self.tles]