Skip to content

Commit 9d3fc0a

Browse files
Improve error handling in observation file decoding
1 parent 42f1981 commit 9d3fc0a

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/rinex.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,16 @@ def decode_obs(self, nav, maxepoch):
281281
obs_ = line[16*i+4:16*i+17].strip()
282282
if obs_ == '' or self.sigid[sys][i] == 0:
283283
continue
284+
try:
285+
obsval = float(obs_)
286+
except:
287+
obsval = 0
284288
f = i // (self.nsig[sys] // self.nband[sys])
289+
if f >= gn.MAX_NFREQ:
290+
print('Obs file too complex, please use RTKCONV to remove unused signals')
291+
raise SystemExit
285292
if self.typeid[sys][i] == 0: # code
286-
obs.P[n, f] = float(obs_)
293+
obs.P[n, f] = obsval
287294
Pstd = line[16*i+18]
288295
obs.Pstd[n, f] = int(Pstd) if Pstd != " " else 0
289296
elif self.typeid[sys][i] == 1: # carrier
@@ -293,9 +300,9 @@ def decode_obs(self, nav, maxepoch):
293300
Lstd = line[16*i+18]
294301
obs.Lstd[n, f] = int(Lstd) if Lstd != " " else 0
295302
elif self.typeid[sys][i] == 2: # C/No
296-
obs.S[n, f] = float(obs_)
303+
obs.S[n, f] = obsval
297304
elif self.typeid[sys][i] == 3: # Doppler
298-
obs.D[n, f] = float(obs_)
305+
obs.D[n, f] = obsval
299306
n += 1
300307
obs.P = obs.P[:n, :]
301308
obs.L = obs.L[:n, :]

src/rtkpos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ def relpos(nav, obsr, obsb, sol):
948948
nav.ns = len(ix)
949949

950950
# resolve integer ambiguities
951-
if nav.armode > 0:
951+
if nav.armode > 0 and stat != gn.SOLQ_NONE:
952952
nb, xa = manage_amb_LAMBDA(nav, sats, stat, posvar)
953953
if nb > 0:
954954
yu, eu, el = zdres(nav, obsr, rs, dts, svh, var, xa[0:3], 1)

0 commit comments

Comments
 (0)