Skip to content

Commit 7b52024

Browse files
authored
Merge pull request #41 from AndreHauschild/devel
Use CODE MGEX products
2 parents 712e6a8 + 9c594ca commit 7b52024

File tree

9 files changed

+164
-100
lines changed

9 files changed

+164
-100
lines changed

data/igs_files.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ brdc ftp://gdc.cddis.eosdis.nasa.gov/pub/gnss/data/daily/2023/brdc/BRD400DLR_S_
1313
brdc ftp://gdc.cddis.eosdis.nasa.gov/pub/gnss/data/daily/2023/brdc/BRD400DLR_S_20232230000_01D_MN.rnx.gz
1414
brdc ftp://gdc.cddis.eosdis.nasa.gov/pub/gnss/data/daily/2023/brdc/BRD400DLR_S_20231890000_01D_MN.rnx.gz
1515

16-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0OPSFIN_20250460000_01D_05M_ORB.SP3.gz
17-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0OPSFIN_20250460000_01D_30S_CLK.CLK.gz
18-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0OPSFIN_20250460000_01D_01D_OSB.BIA.gz
16+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0MGXFIN_20250460000_01D_05M_ORB.SP3.gz
17+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0MGXFIN_20250460000_01D_30S_CLK.CLK.gz
18+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2353/COD0MGXFIN_20250460000_01D_01D_OSB.BIA.gz
1919

20-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0OPSFIN_20232230000_01D_01D_OSB.BIA.gz
21-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0OPSFIN_20232230000_01D_05M_ORB.SP3.gz
22-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0OPSFIN_20232230000_01D_30S_CLK.CLK.gz
20+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0MGXFIN_20232230000_01D_01D_OSB.BIA.gz
21+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0MGXFIN_20232230000_01D_05M_ORB.SP3.gz
22+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2274/COD0MGXFIN_20232230000_01D_30S_CLK.CLK.gz
2323

24-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0OPSFIN_20231890000_01D_01D_OSB.BIA.gz
25-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0OPSFIN_20231890000_01D_05M_ORB.SP3.gz
26-
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0OPSFIN_20231890000_01D_30S_CLK.CLK.gz
24+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0MGXFIN_20231890000_01D_01D_OSB.BIA.gz
25+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0MGXFIN_20231890000_01D_05M_ORB.SP3.gz
26+
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2269/COD0MGXFIN_20231890000_01D_30S_CLK.CLK.gz
2727

2828
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2176/COD0MGXFIN_20212650000_01D_01D_OSB.BIA.gz
2929
igs ftp://gdc.cddis.eosdis.nasa.gov/pub/gps/products/2176/COD0MGXFIN_20212650000_01D_05M_ORB.SP3.gz

samples/ssr2sp3.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
from cssrlib.peph import atxdec
2121
from cssrlib.peph import peph, peph_t, apc2com
2222
from cssrlib.cssrlib import sCSSRTYPE as sc
23-
from cssrlib.cssrlib import cssr
23+
#from cssrlib.cssrlib import cssr
2424
from cssrlib.cssr_bds import cssr_bds
2525
from cssrlib.cssr_has import cssr_has
26+
from cssrlib.cssr_mdc import cssr_mdc
2627
from cssrlib.rinex import rnxdec
2728

2829

@@ -94,14 +95,14 @@ def write_bsx(bsxfile, ac, data):
9495
f.write(line+'\n')
9596

9697

97-
def file2time(year, fileName):
98+
def file2time(fileName):
9899
"""
99100
Convert hourly SBF filename to epoch
100101
"""
101102

102-
doy = os.path.basename(fileName).split('_')[0]
103-
hour = ord(doy[3])-ord('a')
104-
doy = int(doy[0:3])
103+
year = int(os.path.dirname(fileName).split('/')[-1][3:7])
104+
doy = int(os.path.dirname(fileName).split('/')[-1][8:11])
105+
hour = ord(os.path.basename(fileName)[3])-ord('a')
105106
time = epoch2time([year, 1, 1, hour, 0, 0])
106107

107108
return timeadd(time, (doy-1)*86400)
@@ -117,27 +118,21 @@ def file2time(year, fileName):
117118
if len(sys_argv) > 1:
118119
ssrfiles = sys_argv[1:]
119120
else:
120-
ssrfiles = ['../data/doy2023-189/gale6_189e.txt', ]
121+
ssrfiles = ['../data/doy2025-046/046r_gale6.txt', ]
121122

122123
# Start time
123124
#
124-
if "_189e" in ssrfiles[0]:
125-
time = epoch2time([2023, 7, 8, 4, 0, 0])
126-
else:
127-
time = file2time(2023, ssrfiles[0])
128-
"""
129-
print("ERROR: unknown epoch!")
130-
sys_exit(1)
131-
"""
125+
time = file2time(ssrfiles[0])
132126

133127
ep = time2epoch(time)
128+
134129
year = ep[0]
135130
hour = ep[3]
136131
doy = int(time2doy(time))
137132

138133
if "qzsl6" in ssrfiles[0]:
139134

140-
name = 'QZS0CLSOPS'
135+
name = 'QZS0MDCOPS'
141136
step = "10S"
142137

143138
dtype = [('wn', 'int'), ('tow', 'int'), ('prn', 'int'),
@@ -219,8 +214,7 @@ def file2time(year, fileName):
219214
file_gm = baseDirName+'Galileo-HAS-SIS-ICD_1.0_Annex_B_Reed_Solomon_Generator_Matrix.txt'
220215
gMat = np.genfromtxt(file_gm, dtype="u1", delimiter=",")
221216
elif 'qzsl6' in ssrfiles[0]:
222-
cs = cssr()
223-
cs.cssrmode = sc.QZS_MADOCA
217+
cs = cssr_mdc()
224218
elif "bdsb2b" in ssrfiles[0]:
225219
cs = cssr_bds()
226220
else:
@@ -412,7 +406,11 @@ def file2time(year, fileName):
412406

413407
# Convert to CoM using ANTEX PCO corrections
414408
#
415-
rs[0, :] += apc2com(nav, sat, time, rs[0, :], sig0, k=0)
409+
pco = apc2com(nav, sat, time, rs[0, :], sig0, k=0)
410+
if pco is None:
411+
continue
412+
413+
rs[0, :] += pco
416414

417415
for i in range(3):
418416
peph.pos[sat-1, i] = rs[0, i]

samples/test_eph.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,48 @@
22
import cartopy.crs as ccrs
33
import numpy as np
44
from cssrlib.rinex import rnxdec
5-
from cssrlib.gnss import Nav, epoch2time, prn2sat, uGNSS, sat2prn,\
5+
from cssrlib.gnss import Nav, epoch2time, prn2sat, uGNSS, sat2prn, \
66
timeadd, ecef2pos
7-
from cssrlib.ephemeris import findeph, eph2pos
7+
from cssrlib.ephemeris import findeph, eph2pos, geph2pos
88

99
rnx_ver = 4
1010

1111
if rnx_ver == 3: # RINEX 3
12-
navfile = '../data/doy2021-078/30340780.21q'
13-
t0 = epoch2time([2021, 3, 19, 0, 0, 0])
12+
navfile = '../data/brdc/BRDC00IGS_R_20231890000_01D_MN.rnx'
13+
t0 = epoch2time([2023, 7, 8, 0, 0, 0])
1414
sys_ref = uGNSS.QZS
1515
prn_ref = 194
1616
mode_ref = 0 # 0: LNAV, 1: CNAV, 2: CNAV2
1717
elif rnx_ver == 4: # RINEX 4
1818
navfile = '../data/brdc/BRD400DLR_S_20231890000_01D_MN.rnx'
19-
t0 = epoch2time([2023, 7, 8, 4, 0, 0])
20-
sys_ref = uGNSS.BDS
21-
prn_ref = 35
22-
mode_ref = 1 # 0: LNAV, 1: CNAV, 2: CNAV2
19+
t0 = epoch2time([2023, 7, 8, 0, 0, 0])
20+
sys_ref = uGNSS.GLO
21+
prn_ref = 7
22+
mode_ref = 0 # 0: LNAV, 1: CNAV, 2: CNAV2
2323

2424
dec = rnxdec()
2525
nav = dec.decode_nav(navfile, Nav())
2626

27-
n = 24*3600//300
27+
step = 300
28+
n = 24*3600//step
2829
flg_plot = True
2930

3031

3132
if True:
3233
t = t0
3334
sat = prn2sat(sys_ref, prn_ref)
34-
eph = findeph(nav.eph, t, sat, mode=mode_ref)
35+
if sys_ref == uGNSS.GLO:
36+
eph = findeph(nav.geph, t, sat, mode=mode_ref)
37+
else:
38+
eph = findeph(nav.eph, t, sat, mode=mode_ref)
3539
if eph is not None:
36-
rs, vs, dts = eph2pos(t, eph, True)
40+
if sys_ref == uGNSS.GLO:
41+
rs, vs, dts = geph2pos(t, eph, True)
42+
else:
43+
rs, vs, dts = eph2pos(t, eph, True)
3744

3845
if flg_plot:
46+
3947
lon0 = 135
4048
plt.figure(figsize=(6, 6))
4149
ax = plt.axes(projection=ccrs.Orthographic(central_longitude=lon0,
@@ -51,11 +59,22 @@
5159
sys, prn = sat2prn(sat)
5260
if sys != sys_ref:
5361
continue
62+
"""
63+
if prn != prn_ref:
64+
continue
65+
"""
5466
for i in range(n):
55-
t = timeadd(t0, i*300)
67+
t = timeadd(t0, i*step)
68+
if sys_ref == uGNSS.GLO:
69+
eph = findeph(nav.geph, t, sat, mode=mode_ref)
70+
else:
71+
eph = findeph(nav.eph, t, sat, mode=mode_ref)
5672
if eph is None:
5773
continue
58-
rs, dts = eph2pos(t, eph)
74+
if sys_ref == uGNSS.GLO:
75+
rs, dts = geph2pos(t, eph)
76+
else:
77+
rs, dts = eph2pos(t, eph)
5978
pos[i, :] = ecef2pos(rs)
6079
pos[i, 0] = np.rad2deg(pos[i, 0])
6180
pos[i, 1] = np.rad2deg(pos[i, 1])

samples/test_pntpos.py

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,71 @@
77
from sys import stdout
88

99
from cssrlib.rinex import rnxdec
10-
from cssrlib.gnss import ecef2pos, timediff, ecef2enu
11-
from cssrlib.gnss import rSigRnx, epoch2time, Nav, time2str
10+
from cssrlib.gnss import Nav, rSigRnx, ecef2pos, ecef2enu
11+
from cssrlib.gnss import epoch2time, time2doy, time2str, timediff
1212
from cssrlib.pntpos import stdpos
1313

14-
if False:
15-
xyz_ref = [-3962108.673, 3381309.574, 3668678.638]
16-
navfile = '../data/doy2021-078/SEPT078M.21P'
17-
obsfile = '../data/doy2021-078/SEPT078M.21O'
14+
# Start epoch and number of epochs
15+
#
16+
dataset = 3
17+
18+
if dataset == 0: # SETP078M.21O
1819
ep = [2021, 3, 19, 12, 0, 0]
19-
else:
20-
xyz_ref = [-3962108.6726, 3381309.4719, 3668678.6264]
20+
xyz_ref = [-3962108.6617, 3381309.5232, 3668678.6410]
21+
elif dataset == 1: # SETP1890.23O
22+
ep = [2023, 7, 8, 4, 0, 0]
23+
xyz_ref = [-3962108.7063, 3381309.5703, 3668678.6690]
24+
elif dataset == 2: # SETP223Z.23O
2125
ep = [2023, 8, 11, 21, 0, 0]
22-
navfile = '../data/brdc/BRD400DLR_S_20232230000_01D_MN.rnx'
23-
# navfile = '../data/brdc/BRDC00IGS_R_20232230000_01D_MN.rnx'
24-
# navfile = '../data/doy2023-223/NAV223.23p'
25-
# obsfile = '../data/doy2023-223/SEPT223Z.23O' # MOSAIC-CLAS
26-
obsfile = '../data/doy2023-223/SEPT223Y.23O' # PolaRX5
27-
28-
pos_ref = ecef2pos(xyz_ref)
29-
nep = 360
26+
xyz_ref = [-3962108.7063, 3381309.5703, 3668678.6690]
27+
elif dataset == 3: # 046r_rnx.obs
28+
ep = [2025, 2, 15, 17, 0, 0]
29+
xyz_ref = [-3962108.6819, 3381309.5707, 3668678.6750]
30+
else:
31+
print("ERROR: no RINEX data set selected!")
32+
exit(1)
3033

3134
time = epoch2time(ep)
35+
year = ep[0]
36+
doy = int(time2doy(time))
37+
38+
nep = 900*4
39+
40+
bdir = '../data/doy{:04d}-{:03d}/'.format(year, doy)
41+
42+
if dataset == 0:
43+
let = chr(ord('A')+ep[3])
44+
navfile = bdir+'SEPT{:03d}{}.{:02d}P'.format(doy, let, year % 2000)
45+
obsfile = bdir+'SEPT{:03d}{}.{:02d}O'.format(doy, let, year % 2000)
46+
if dataset == 1:
47+
let = '0'
48+
navfile = bdir+'SEPT{:03d}{}.{:02d}P'.format(doy, let, year % 2000)
49+
obsfile = bdir+'SEPT{:03d}{}.{:02d}O'.format(doy, let, year % 2000)
50+
elif dataset == 2:
51+
# let = 'Z' # MOSAIC-CLAS
52+
let = 'Y' # PolaRX5
53+
navfile = '../data/brdc/' + \
54+
'BRD400DLR_S_{:04d}{:03d}0000_01D_MN.rnx'.format(year, doy)
55+
obsfile = bdir+'SEPT{:03d}{}.{:02d}O'.format(doy, let, year % 2000)
56+
else:
57+
let = chr(ord('a')+ep[3])
58+
navfile = bdir+'{:03d}{}_rnx.nav'.format(doy, let)
59+
obsfile = bdir+'{:03d}{}_rnx.obs'.format(doy, let)
60+
61+
pos_ref = ecef2pos(xyz_ref)
3262

3363
# Define signals to be processed
3464
#
35-
sigs = [rSigRnx("GC1C"), rSigRnx("EC1C"), rSigRnx("JC1C"),
36-
rSigRnx("GL1C"), rSigRnx("EL1C"), rSigRnx("JL1C"),
37-
rSigRnx("GS1C"), rSigRnx("ES1C"), rSigRnx("JS1C")]
38-
39-
# sigs = [rSigRnx("GC1C"), rSigRnx("GL1C"), rSigRnx("GS1C")]
65+
gnss = "GEJ"
66+
sigs = []
67+
if 'G' in gnss:
68+
sigs.extend([rSigRnx("GC1C"), rSigRnx("GL1C"), rSigRnx("GS1C")])
69+
if 'E' in gnss:
70+
sigs.extend([rSigRnx("EC1C"), rSigRnx("EL1C"), rSigRnx("ES1C")])
71+
if 'C' in gnss:
72+
sigs.extend([rSigRnx("CC2I"), rSigRnx("CL2I"), rSigRnx("CS2I")])
73+
if 'J' in gnss:
74+
sigs.extend([rSigRnx("JC1C"), rSigRnx("JL1C"), rSigRnx("JS1C")])
4075

4176
rnx = rnxdec()
4277
rnx.setSignals(sigs)
@@ -108,8 +143,19 @@
108143
if obs.t.time == 0:
109144
break
110145

146+
# Send line-break to stdout
147+
#
148+
stdout.write('\n')
149+
150+
# Close RINEX observation file
151+
#
111152
rnx.fobs.close()
112153

154+
# Close output file
155+
#
156+
if nav.fout is not None:
157+
nav.fout.close()
158+
113159

114160
fig_type = 1
115161
ylim_h = 2.0

samples/test_pntpos2.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020

2121
# Define signals to be processed
2222
#
23-
sigs = [rSigRnx("GC1C"), rSigRnx("EC1C"),
24-
rSigRnx("GL1C"), rSigRnx("EL1C"),
25-
rSigRnx("GS1C"), rSigRnx("ES1C")]
23+
gnss = "GE"
24+
sigs = []
25+
if 'G' in gnss:
26+
sigs.extend([rSigRnx("GC1C"), rSigRnx("GL1C"), rSigRnx("GS1C")])
27+
if 'E' in gnss:
28+
sigs.extend([rSigRnx("EC1C"), rSigRnx("EL1C"), rSigRnx("ES1C")])
29+
if 'C' in gnss:
30+
sigs.extend([rSigRnx("CC2I"), rSigRnx("CL2I"), rSigRnx("CS2I")])
31+
if 'J' in gnss:
32+
sigs.extend([rSigRnx("JC1C"), rSigRnx("JL1C"), rSigRnx("JS1C")])
2633

2734
rnx = rnxdec()
2835
rnx.setSignals(sigs)

samples/test_pppigs.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import matplotlib.pyplot as plt
66
import matplotlib.dates as md
77
import numpy as np
8-
from os.path import exists
98
from sys import exit as sys_exit
109
from sys import stdout
1110

@@ -67,7 +66,7 @@
6766
navfile = bdir+'{:03d}{}_rnx.nav'.format(doy, let)
6867
obsfile = bdir+'{:03d}{}_rnx.obs'.format(doy, let)
6968

70-
ac = 'COD0OPSFIN'
69+
ac = 'COD0MGXFIN'
7170

7271
orbfile = '../data/igs/{}_{:4d}{:03d}0000_01D_05M_ORB.SP3'\
7372
.format(ac, year, doy)
@@ -78,17 +77,6 @@
7877
bsxfile = '../data/igs/{}_{:4d}{:03d}0000_01D_01D_OSB.BIA'\
7978
.format(ac, year, doy)
8079

81-
if not exists(clkfile):
82-
orbfile = orbfile.replace('COD0OPSFIN', 'COD0OPSRAP')
83-
clkfile = clkfile.replace('COD0OPSFIN', 'COD0OPSRAP')
84-
bsxfile = bsxfile.replace('COD0OPSFIN', 'COD0OPSRAP')
85-
if not exists(clkfile):
86-
orbfile = orbfile.replace('COD0OPSRAP', 'COD0MGXFIN')
87-
clkfile = clkfile.replace('COD0OPSRAP', 'COD0MGXFIN')
88-
bsxfile = bsxfile.replace('COD0OPSRAP', 'COD0MGXFIN')
89-
if not exists(orbfile):
90-
orbfile = orbfile.replace('_05M_', '_15M_')
91-
9280
# Define signals to be processed
9381
#
9482
gnss = "GE"
@@ -168,10 +156,10 @@
168156
#
169157
ppp = pppos(nav, rnx.pos, 'test_pppigs.log')
170158
nav.ephopt = 4 # IGS
171-
nav.armode = 3
159+
nav.armode = 3 # 1: continuous, 3: fix-and-hold
160+
nav.thresar = 2.0
172161

173162
nav.elmin = np.deg2rad(10.0)
174-
nav.thresar = 2.0
175163

176164
# Get equipment information
177165
#

0 commit comments

Comments
 (0)