Skip to content

Commit db10006

Browse files
committed
update sp3, clk parser docs
1 parent 7c2fc01 commit db10006

3 files changed

Lines changed: 19 additions & 32 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ results/*
2525

2626
# Ignore downloaded precise ephimerides files by default
2727
*.sp3
28+
*.SP3
2829
*.clk
30+
*.CLK
2931

3032
# Include unit test files for precise ephimerides
3133
!data/unit_test/*/*.sp3
34+
!data/unit_test/*/*.SP3
3235
!data/unit_test/*/*.clk
36+
!data/unit_test/*/*.CLK
3337

3438
# Ignore NMEA files by default
3539
*.nmea

gnss_lib_py/parsers/clk.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,13 @@ def __init__(self, input_path):
6565
with open(input_path, 'r', encoding="utf-8") as infile:
6666
clk = infile.readlines()
6767

68-
line = 0
69-
while True:
70-
if 'OF SOLN SATS' not in clk[line]:
71-
del clk[line]
72-
else:
73-
line +=1
74-
break
75-
76-
line = 0
77-
while True:
78-
if 'END OF HEADER' not in clk[line]:
79-
line +=1
80-
else:
81-
del clk[0:line+1]
82-
break
83-
8468
for clk_val in clk:
8569

86-
if len(clk_val) == 0 or clk_val[0:2]!='AS':
87-
continue
88-
8970
timelist_val = clk_val.split()
9071

72+
if len(timelist_val) == 0 or timelist_val[0] != 'AS':
73+
continue
74+
9175
gnss_sv_id = timelist_val[1]
9276

9377
curr_time = datetime(year = int(timelist_val[2]), \

notebooks/tutorials/parsers.ipynb

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,14 @@
498498
"outputs": [],
499499
"source": [
500500
"# download .sp3 data file\n",
501-
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/sp3/grg21553_short.sp3 --quiet -O \"grg21553_short.sp3\"\n",
501+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/sp3/COD0MGXFIN_20211180000_01D_05M_ORB.SP3 --quiet -O \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
502502
"# Specify .sp3 file path to extract precise ephemerides\n",
503-
"sp3_path = \"grg21553_short.sp3\"\n",
503+
"sp3_path = \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
504504
"\n",
505505
"# download .clk data file\n",
506-
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/clk/grg21553_short.clk --quiet -O \"grg21553_short.clk\"\n",
506+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/clk/COD0MGXFIN_20211180000_01D_30S_CLK.CLK --quiet -O \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\"\n",
507507
"# Specify .clk file path to extract precise ephemerides\n",
508-
"clk_path = \"grg21553_short.clk\""
508+
"clk_path = \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\""
509509
]
510510
},
511511
{
@@ -548,8 +548,8 @@
548548
"outputs": [],
549549
"source": [
550550
"# Update derived_data class with satellite information computed via precise ephemerides\n",
551-
"derived_gps_glonass = derived_data.where(\"gnss_id\",(\"gps\",\"glonass\"))\n",
552-
"derived_multi_gnss = glp.add_sv_states_sp3_and_clk(derived_gps_glonass, sp3_path, \\\n",
551+
"# derived_gps_glonass = derived_data.where(\"gnss_id\",(\"gps\",\"glonass\"))\n",
552+
"derived_multi_gnss = glp.add_sv_states_sp3_and_clk(derived_data, sp3_path, \\\n",
553553
" clk_path, verbose = False)"
554554
]
555555
},
@@ -562,13 +562,12 @@
562562
"source": [
563563
"# Check that all the desired fields related to satellite information have useful\n",
564564
"# information, and norm of computed satellite position matches the altitude of GNSS constellation\n",
565-
"sat_alt = np.linalg.norm(np.transpose([derived_multi_gnss[SV_KEYS[0]][0:2],\n",
566-
" derived_multi_gnss[SV_KEYS[1]][0:2], \n",
567-
" derived_multi_gnss[SV_KEYS[2]][0:2]]), axis=1)\n",
568-
"print('Distance of two satellites from the center of the Earth (expected around 26000000 m):', derived_multi_gnss[\"gnss_id\"][0:2], sat_alt)\n",
569-
"print(\"Extracted values for same satellites: \")\n",
570-
"for sv in SV_KEYS:\n",
571-
" print(sv, ':', derived_multi_gnss[sv][0:2])"
565+
"sat_alt = np.linalg.norm(derived_multi_gnss[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"],9:12],axis=0)\n",
566+
"print('Distance of two satellites from the center of the Earth (expected around 26000000 m)')\n",
567+
"print(\"Three GPS SVs calculated to be at:\", sat_alt,\"\\n\")\n",
568+
"\n",
569+
"print(\"Small section of calculated positions:\")\n",
570+
"print(derived_multi_gnss.copy(cols=[2,3,4,5],rows=[\"gnss_id\"]+SV_KEYS))"
572571
]
573572
},
574573
{

0 commit comments

Comments
 (0)