Skip to content

Commit

Permalink
Improve error handling in observation file decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
rtklibexplorer committed May 22, 2022
1 parent 42f1981 commit 9d3fc0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/rinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,16 @@ def decode_obs(self, nav, maxepoch):
obs_ = line[16*i+4:16*i+17].strip()
if obs_ == '' or self.sigid[sys][i] == 0:
continue
try:
obsval = float(obs_)
except:
obsval = 0
f = i // (self.nsig[sys] // self.nband[sys])
if f >= gn.MAX_NFREQ:
print('Obs file too complex, please use RTKCONV to remove unused signals')
raise SystemExit
if self.typeid[sys][i] == 0: # code
obs.P[n, f] = float(obs_)
obs.P[n, f] = obsval
Pstd = line[16*i+18]
obs.Pstd[n, f] = int(Pstd) if Pstd != " " else 0
elif self.typeid[sys][i] == 1: # carrier
Expand All @@ -293,9 +300,9 @@ def decode_obs(self, nav, maxepoch):
Lstd = line[16*i+18]
obs.Lstd[n, f] = int(Lstd) if Lstd != " " else 0
elif self.typeid[sys][i] == 2: # C/No
obs.S[n, f] = float(obs_)
obs.S[n, f] = obsval
elif self.typeid[sys][i] == 3: # Doppler
obs.D[n, f] = float(obs_)
obs.D[n, f] = obsval
n += 1
obs.P = obs.P[:n, :]
obs.L = obs.L[:n, :]
Expand Down
2 changes: 1 addition & 1 deletion src/rtkpos.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def relpos(nav, obsr, obsb, sol):
nav.ns = len(ix)

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

0 comments on commit 9d3fc0a

Please sign in to comment.