geospace-code / georinex

Python RINEX 2 / 3 NAV / OBS / sp3 reader & batch convert to HDF5 with C-like speed
MIT License
216 stars 89 forks source link

Problem reading a RINEX v2 OBS file #97

Open warrickball opened 1 year ago

warrickball commented 1 year ago

I'm having various issues reading this RINEX v2 OBS file with either the latest PyPI release (1.16.1) or the development version, which I just cloned. The offending file is

ftp://ftp.sonel.org/gps/data/2022/015/abmf0150.22d.Z

I've tried loading the file after different amounts of separate decompression but nothing has worked. First, I can't load the file directly:

$ wget ftp://ftp.sonel.org/gps/data/2022/015/abmf0150.22d.Z
$ python3 -m georinex.read abmf0150.22d.Z 
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/read/__main__.py", line 62, in <module>
    data = gr.load(
           ^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 67, in load
    return rinexobs(
           ^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 217, in rinexobs
    obs = rinexobs2(
          ^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 44, in rinexobs2
    o = rinexsystem2(
        ^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 125, in rinexsystem2
    times = _num_times(fn, Nextra, tlim, verbose)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 336, in _num_times
    t = obstime2(fn, verbose=verbose)  # < 10 ms for 24 hour 15 second cadence
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 509, in obstime2
    _skip(f, ln, hdr["Nl_sv"])
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 523, in _skip
    sv = _getsvind(f, ln)
         ^^^^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 469, in _getsvind
    sv = _getSVlist(f.readline(), min(12, n), sv)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 485, in _getSVlist
    if s[0] == " ":
       ~^^^
IndexError: string index out of range

I tried decompressing the file myself first.

$ gunzip abmf0150.22d.Z
$ python3 -m georinex.read abmf0150.22d
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/read/__main__.py", line 62, in <module>
    data = gr.load(
           ^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 67, in load
    return rinexobs(
           ^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 217, in rinexobs
    obs = rinexobs2(
          ^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 44, in rinexobs2
    o = rinexsystem2(
        ^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 252, in rinexsystem2
    data[i, j, isv] = darr[:, k]
    ~~~~^^^^^^^^^^^
IndexError: index 37 is out of bounds for axis 2 with size 36

Finally, I tried running crx2rnx on it myself.

$ crx2rnx abmf0150.22d
$ python3 -m georinex.read abmf0150.22o
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/read/__main__.py", line 62, in <module>
    data = gr.load(
           ^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 67, in load
    return rinexobs(
           ^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/base.py", line 217, in rinexobs
    obs = rinexobs2(
          ^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 44, in rinexobs2
    o = rinexsystem2(
        ^^^^^^^^^^^^^
  File "/home/wball/work/test_georinex/dev_venv/georinex/src/georinex/obs2.py", line 252, in rinexsystem2
    data[i, j, isv] = darr[:, k]
    ~~~~^^^^^^^^^^^
IndexError: index 37 is out of bounds for axis 2 with size 36

These errors are all the same when I use the latest release. It also makes no difference if I use the -strict flag. I'll note that I've been happily reading other RINEX v2 files without an issue. This is the first of about 20 that's caused a problem

This is Python 3.11 on Fedora 37. Here's the full (but reasonably short) list of packages installed in the venv:

$ python3 -m pip freeze
-e git+ssh://git@github.com/geospace-code/georinex.git@c689a5a6bc2ffb68bc055f150f1da1b6bab12812#egg=georinex
hatanaka==2.8.0
importlib-resources==5.12.0
ncompress==1.0.0
numpy==1.24.2
packaging==23.0
pandas==1.5.3
python-dateutil==2.8.2
pytz==2022.7.1
six==1.16.0
xarray==2023.2.0
ogunjosam commented 1 year ago

@warrickball , I am currently having the same issue. Were you able to solve the problem?