-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_yuma.py
46 lines (34 loc) · 1.41 KB
/
read_yuma.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 24 10:42:44 2022
@author: Maciek
"""
import numpy as np
def read_yuma(almanac_file):
'''
Reading and parsing YUMA asci format
INPUT:
Almanac: YUMA format
OUTPUT:
almanac_data - type list of list [strings value], number of lists is equal to number of satellite
one list contain satellites according to the order:
['SV ID', 'Health', 'Eccentricity', 'Time of Applicability(s)', 'Inclination(rad)',
'Rate of Right Ascen(r/s)', 'SQRT(A) (m 1/2)', 'Right Ascen at Week(rad)',
'Argument of Perigee(rad)', 'Mean Anom(rad)', 'Af0(s)', 'Af1(s/s)', 'Week no']
'''
if almanac_file:
alm = open(almanac_file)
alm_lines = alm.readlines()
all_sat = []
for idx, value in enumerate(alm_lines):
# print(idx, value)
if value[0:3]=='ID:':
one_sat_block = alm_lines[idx:idx+13]
one_sat = []
for line in one_sat_block:
data = line.split(':')
one_sat.append(float(data[1].strip()))
all_sat.append(one_sat)
alm.close()
all_sat = np.array(all_sat)
return (all_sat)