Skip to content

Commit

Permalink
Merge pull request #3 from Graidaris/dev
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
MarwinMarw authored Feb 12, 2021
2 parents dc12e97 + e87a8ec commit 70c4c6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
22 changes: 13 additions & 9 deletions RSP/parse_rinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,27 @@ def _next_line(rinex_file: TextIOWrapper) -> list:

def _extract_data(rinex_file: TextIOWrapper) -> dict:
ext_data = {}
nr_sat = 0
while True:
try:
str_data = []

for _ in range(8):
str_data.append(_next_line(rinex_file))

ex_data_l1 = _read_PRN_EPOCH_SV_CLK(str_data[0])

ext_data[str(ex_data_l1['PRN'])] = ex_data_l1
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_1(str_data[1]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_2(str_data[2]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_3(str_data[3]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_4(str_data[4]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_5(str_data[5]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_6(str_data[6]))
ext_data[str(ex_data_l1['PRN'])].update(_read_BROADCAST_ORBIT_7(str_data[7]))

ex_data_l1 = _read_PRN_EPOCH_SV_CLK(str_data[0])
key = f"{nr_sat}_{str(ex_data_l1['PRN'])}"
nr_sat += 1
ext_data[key] = ex_data_l1
ext_data[key].update(_read_BROADCAST_ORBIT_1(str_data[1]))
ext_data[key].update(_read_BROADCAST_ORBIT_2(str_data[2]))
ext_data[key].update(_read_BROADCAST_ORBIT_3(str_data[3]))
ext_data[key].update(_read_BROADCAST_ORBIT_4(str_data[4]))
ext_data[key].update(_read_BROADCAST_ORBIT_5(str_data[5]))
ext_data[key].update(_read_BROADCAST_ORBIT_6(str_data[6]))
ext_data[key].update(_read_BROADCAST_ORBIT_7(str_data[7]))

except EndOfFile:
print("End of file")
Expand Down
4 changes: 2 additions & 2 deletions RSP/satpos.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def calculate_satpos(sat_rinex: dict) -> tuple:
def calculate_positions(sat_data: dict) -> dict:
sat_pos = {}

for _, sat_rinex in sat_data.items():
for key, sat_rinex in sat_data.items():
xk, yk, zk = calculate_satpos(sat_rinex)

sat_pos[str(sat_rinex['PRN'])] = {
sat_pos[key] = {
'x': xk,
'y': yk,
'z': zk
Expand Down
6 changes: 3 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from RSP.parse_rinex import read_rinex
from RSP.satpos import calculate_positions
from RSP.satpos import calculate_satpos, calculate_positions


sat_data = read_rinex('./test/940779338I_1.17N')
sat_data = read_rinex('./test/gmez0380.21n')
sat_pos = calculate_positions(sat_data)
print(sat_pos)
print(sat_pos)

0 comments on commit 70c4c6a

Please sign in to comment.