@@ -9,6 +9,7 @@ def import_test ():
9
9
10
10
11
11
class SatelliteData :
12
+ """ Takes Celestrak satellite group and data directory path + Optional force download and max amount of days before downloading again."""
12
13
def __init__ (self , sat_group :str , data_path :str , force_dl = False , max_days = 7.0 ):
13
14
self .data_path = data_path
14
15
self .csv_path = self .getkeps (sat_group , force_dl , max_days )
@@ -17,19 +18,11 @@ def __init__ (self, sat_group:str, data_path:str, force_dl=False, max_days=7.0):
17
18
18
19
# Imports satinfo.txt and grabs additionally added satellite information.
19
20
def __addinfo__ (self , d_dir , csv_path ):
20
- """Imports Satellite information via the satinfo.txt in the /data directory
21
- Returns->list [ {
22
- "Name" : Satellite Name,
23
- "NORAD" : NORAD ID,
24
- "Uplink" : Uplink Frequency,
25
- "Downlink" : Downlink Frequency,
26
- "Mode" : Transmitter Mode } ], ...
27
- """
28
21
sat_info = []
29
- with open (path .join (d_dir ,'satinfo.txt' ), "rt" , encoding = " utf-8" ) as info :
22
+ with open (path .join (d_dir ,'satinfo.txt' ), 'rt' , encoding = ' utf-8' ) as info :
30
23
info_list = info .read ().split ("\n " )
31
24
col = "NORAD_CAT_ID"
32
- with open (csv_path , mode = 'r' , newline = '' ) as f :
25
+ with open (csv_path , mode = 'r' , newline = '' , encoding = 'utf-8' ) as f :
33
26
csv_data = DictReader (f )
34
27
for row in csv_data :
35
28
for nfo in info_list :
@@ -60,8 +53,6 @@ def getkeps(self, sat_group:str, force_dl:bool, max_days:float):
60
53
if not load .exists (file_path ) or load .days_old (file_path ) >= max_days or force_dl :
61
54
if force_dl : print ("Downloading..." )
62
55
load .download (url , filename = file_path )
63
- with load .open (file_path , mode = 'r' ) as f :
64
- kep_data = list (DictReader (f ))
65
56
return file_path
66
57
67
58
print (f"{ self .data_path } does not exist." )
0 commit comments