Skip to content

Commit

Permalink
BUGFIX OBS2 with > 10 measurement types
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 13, 2018
1 parent 9e2b504 commit fcfc11a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions georinex/obs2.py
Expand Up @@ -147,19 +147,21 @@ def obsheader2(f: TextIO,
return obsheader2(f)

header: Dict[str, Any] = {}
Nobs = 0
Nobs = 0 # not None due to type checking

for l in f:
if "END OF HEADER" in l:
break

h = l[60:80].strip()
c = l[:60]
# %% measurement types
if '# / TYPES OF OBSERV' in h:
if Nobs == 0:
Nobs = int(c[:6])
c = c[6:].split()

c = c[6:].split() # NOT within "if Nobs"
# %%
if h not in header: # Header label
header[h] = c # string with info
else: # concatenate
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = georinex
version = 1.6.0.1
version = 1.6.0.2
author = Michael Hirsch, Ph.D.
description = Python RINEX 2/3 NAV/OBS reader with speed and simplicity.
url = https://github.com/scivision/georinex
Expand Down
Binary file added tests/ab430140.18o.zip
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/test_obs2.py
Expand Up @@ -11,6 +11,22 @@
R = Path(__file__).parent


def test_meas_continuation():
"""
tests OBS2 files with more than 10 types of observations
"""
fn = R/'ab430140.18o.zip'
obs = gr.load(fn)

assert len(obs.data_vars) == 20
for v in ['L1', 'L2', 'C1', 'P2', 'P1', 'S1', 'S2', 'C2', 'L5', 'C5', 'S5',
'L6', 'C6', 'S6', 'L7', 'C7', 'S7', 'L8', 'C8', 'S8']:
assert v in obs

times = obs.time.values.astype('datetime64[us]').astype(datetime)
assert times.size == 9


def test_meas():
"""
test specifying specific measurements (usually only a few of the thirty or so are needed)
Expand Down

0 comments on commit fcfc11a

Please sign in to comment.