Skip to content

Commit 1dfa2ff

Browse files
committed
- log file name changed.
- RINEX output includes nav/obs only for enabled GNSSs.
1 parent df88705 commit 1dfa2ff

File tree

4 files changed

+500
-343
lines changed

4 files changed

+500
-343
lines changed

receiver/decode_jps.py

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class jps(rcvDec):
127127
[1, 6, 2, 4, 3, 0], [1, 1, 4, 2, 3, 1], [1, 6, 2, 3, 3, 1],
128128
[0, 0, 0, 0, 3, 1]]
129129

130-
sys_t = {
130+
gnss2sys_t = {
131131
GNSS.GPS: uGNSS.GPS, GNSS.GLO: uGNSS.GLO, GNSS.GAL: uGNSS.GAL,
132132
GNSS.BDS: uGNSS.BDS, GNSS.QZS: uGNSS.QZS, GNSS.SBS: uGNSS.SBS,
133133
GNSS.IRN: uGNSS.IRN, GNSS.GLO_C: uGNSS.GLO,
@@ -352,13 +352,15 @@ def decode_obs(self):
352352
else:
353353
prn = self.prn[k]
354354

355-
sys = self.sys_t[self.sys[k]]
355+
sys = self.gnss2sys_t[self.sys[k]]
356356
if sys not in self.sig_tab.keys():
357357
continue
358358
if sys == uGNSS.GLO and prn == 255:
359359
continue
360360
if sys == uGNSS.SBS and self.prn[k] > 156:
361361
continue
362+
if sys == uGNSS.IRN:
363+
pass
362364
sat = prn2sat(sys, prn)
363365
if sat in obs.sat:
364366
jn = obs.sat.index(sat)
@@ -398,11 +400,15 @@ def decode_obs(self):
398400
obs.D[np.isnan(obs.D)] = 0
399401
obs.S[np.isnan(obs.S)] = 0
400402

403+
obs.sat = np.array(obs.sat, dtype=int)
401404
obs.sort()
402405

403406
return obs
404407

405408
def decode_nd(self, buff, sys=uGNSS.GPS):
409+
if sys not in self.sys_t:
410+
return 0
411+
406412
prn, time_, type_, len_ = st.unpack_from('<BLBB', buff, 5)
407413
sat = prn2sat(sys, prn)
408414
if self.monlevel >= 2:
@@ -544,15 +550,14 @@ def decode(self, buff, len_, sys=[], prn=[]):
544550
if self.monlevel > 1:
545551
print("[xd] prn={:d} tow={:d} type={:d} len={:d}".
546552
format(prn, time_, type_, len_))
547-
if self.week >= 0:
548-
if self.flg_qzsl6:
549-
if self.prn_ref > 0 and prn != self.prn_ref:
550-
return
551-
msg_l6 = buff[12:12+len_]
552-
self.fh_qzsl6.write(
553-
"{:4d}\t{:6d}\t{:3d}\t{:1d}\t{:3d}\t{:s}\n".
554-
format(self.week, time_, prn, type_, len_,
555-
hexlify(msg_l6).decode()))
553+
if self.week >= 0 and self.flg_qzsl6:
554+
if self.prn_ref > 0 and prn != self.prn_ref:
555+
return
556+
msg_l6 = buff[12:12+len_]
557+
self.fh_qzsl6.write(
558+
"{:4d}\t{:6d}\t{:3d}\t{:1d}\t{:3d}\t{:s}\n".
559+
format(self.week, time_, prn, type_, len_,
560+
hexlify(msg_l6).decode()))
556561

557562
# errCorr = st.unpack_from('<B', buff, 12+len_)
558563
elif head == 'cd': # BeiDou Navigation data
@@ -575,6 +580,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
575580
return
576581

577582
if self.flg_rnxnav:
583+
if uGNSS.BDS not in self.sys_t:
584+
return 0
578585
eph = None
579586
if ch == 0: # B1 (D1/D2)
580587
if D2 == 0:
@@ -593,8 +600,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
593600

594601
if ch == 6 and self.flg_bdsb2b and prn >= 59: # B2b: BDS PPP
595602
self.fh_bdsb2b.write(
596-
"{:4d}\t{:6d}\t{:3d}\t{:1d}\t{:3d}\t{:s}\n".
597-
format(self.week, time_, prn, type_, len_*4,
603+
"{:4d}\t{:6d}\t{:3d}\t{:3d}\t{:s}\n".
604+
format(self.week, time_, prn, len_*4,
598605
hexlify(b).decode()))
599606

600607
elif head == 'gd': # GPS Navigation data
@@ -608,6 +615,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
608615
b = bytes(np.array(msg, dtype='uint32'))
609616

610617
if self.flg_rnxnav:
618+
if uGNSS.IRN not in self.sys_t:
619+
return 0
611620
eph = None
612621
if type_ == 0:
613622
eph = self.rn.decode_irn_lnav(self.week, time_, sat, b)
@@ -650,6 +659,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
650659
bs.pack_into('u2', buff, 25*k, (d >> 23) & 0x3)
651660

652661
if self.flg_rnxnav and type_ == 0:
662+
if uGNSS.GLO not in self.sys_t:
663+
return 0
653664
geph = self.rn.decode_glo_fdma(
654665
self.week, self.tow, sat, buff, fcn)
655666

@@ -667,6 +678,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
667678
b = bytes(np.array(msg, dtype='uint32'))
668679

669680
if self.flg_rnxnav:
681+
if uGNSS.GLO not in self.sys_t:
682+
return 0
670683
geph = None
671684
if type_ == 0: # L1OC
672685
geph = self.rn.decode_glo_l1oc(self.week, self.tow, sat, b)
@@ -701,6 +714,8 @@ def decode(self, buff, len_, sys=[], prn=[]):
701714
if type_ == 0 or type_ == 2: # INAV
702715
b = buff[12:]
703716
if self.flg_rnxnav:
717+
if uGNSS.GAL not in self.sys_t:
718+
return 0
704719
eph = self.rn.decode_gal_inav(
705720
self.week, time_, sat, type_, b)
706721
if eph is not None:
@@ -713,20 +728,22 @@ def decode(self, buff, len_, sys=[], prn=[]):
713728
elif type_ == 1: # FNAV
714729
b = buff[12:]
715730
if self.flg_rnxnav:
731+
if uGNSS.GAL not in self.sys_t:
732+
return 0
716733
eph = self.rn.decode_gal_fnav(
717734
self.week, time_, sat, type_, b)
718735
if eph is not None:
719736
self.re.rnx_nav_body(eph, self.fh_rnxnav)
720737
if self.flg_galfnav and self.week >= 0:
721738
self.fh_galfnav.write(
722-
"{:4d}\t{:6d}\t{:3d}\t{:1d}\t{:3d}\t{:s}\n"
723-
.format(self.week, time_, prn, type_, len_,
739+
"{:4d}\t{:6d}\t{:3d}\t{:3d}\t{:s}\n"
740+
.format(self.week, time_, prn, len_,
724741
hexlify(b).decode()))
725742
elif type_ == 6: # CNAV
726743
if self.flg_gale6 and self.week >= 0:
727744
self.fh_gale6.write(
728-
"{:4d}\t{:6d}\t{:3d}\t{:1d}\t{:3d}\t{:s}\n"
729-
.format(self.week, time_, prn, type_, len_,
745+
"{:4d}\t{:6d}\t{:3d}\t{:3d}\t{:s}\n"
746+
.format(self.week, time_, prn, len_,
730747
hexlify(buff[12:]).decode()))
731748

732749
elif head == 'WD': # SBAS Navigation data
@@ -859,7 +876,7 @@ def decode(self, buff, len_, sys=[], prn=[]):
859876
nsat = (len_-6)//8
860877
pr_ = np.array(st.unpack_from('d'*nsat, buff, 5))
861878
if self.navic_work_around:
862-
pr_[pr_ < 0 & (np.array(self.sys) == GNSS.IRN)] = np.nan
879+
pr_[((pr_ < 0) | (pr_ > 0.2)) & (np.array(self.sys) == GNSS.IRN)] = np.nan
863880
if head[1] == 'X': # [RX]
864881
self.PR_REF[:nsat] = pr_
865882
else:
@@ -871,7 +888,7 @@ def decode(self, buff, len_, sys=[], prn=[]):
871888
nsat = (len_-6)//8
872889
cp_ = np.array(st.unpack_from('d'*nsat, buff, 5))
873890
if self.navic_work_around:
874-
cp_[cp_ < 0 & (np.array(self.sys) == GNSS.IRN)] = np.nan
891+
cp_[((cp_ < 0) | (cp_ > 1.0)) & (np.array(self.sys) == GNSS.IRN)] = np.nan
875892
self.cp[:nsat, ch] = cp_
876893

877894
elif head[0] == 'c' and head[1] in self.ch_t.keys():
@@ -955,7 +972,7 @@ def decode(f, opt, args):
955972

956973
bdir, fname = os.path.split(f)
957974

958-
prefix = fname[4:].removesuffix('.jps')+'_'
975+
prefix = fname.removesuffix('.jps')
959976
prefix = str(Path(bdir) / prefix) if bdir else prefix
960977
jpsdec = jps(opt=opt, prefix=prefix, gnss_t=args.gnss)
961978
jpsdec.monlevel = 1
@@ -1005,8 +1022,8 @@ def main():
10051022
parser.add_argument("--antenna", default='unknown',
10061023
help="Antenna type [unknown]")
10071024

1008-
parser.add_argument("-g", "--gnss", default='GRECIJ',
1009-
help="GNSS [GRECIJ]")
1025+
parser.add_argument("-g", "--gnss", default='GRECJ',
1026+
help="GNSS [GRECJ]")
10101027

10111028
parser.add_argument("-j", "--jobs", default=int(mp.cpu_count() / 2),
10121029
type=int, help='Max. number of parallel processes')
@@ -1025,7 +1042,7 @@ def main():
10251042

10261043
opt.flg_gale6 = True
10271044
opt.flg_galinav = True
1028-
opt.flg_galfnav = True
1045+
opt.flg_galfnav = False
10291046

10301047
opt.flg_qzsl6 = True
10311048

@@ -1038,6 +1055,9 @@ def main():
10381055

10391056
opt.useL1CB = args.useL1CB
10401057

1058+
#args.inpFileName = "../data/doy2026-038/jav3038a.jps"
1059+
#decode(args.inpFileName, opt, args)
1060+
10411061
# Start processing pool
10421062
#
10431063
with mp.Pool(processes=args.jobs) as pool:

0 commit comments

Comments
 (0)