Stanford-NavLab / gnss_lib_py

Modular Python tool for parsing, analyzing, and visualizing Global Navigation Satellite Systems (GNSS) data and state estimates
MIT License
116 stars 28 forks source link

Rinex reader #129

Closed MrBourriz closed 10 months ago

MrBourriz commented 11 months ago

RinexObs doesn't read all versions of Rinex

betaBison commented 11 months ago

What specific type of Rinex files are you hoping to read? Can you possibly post the rinex header in this issue?

We currently support Rinex observation files and are adding compatibility for Rinex navigation files with pull requests #127 and #130. We will support Rinex versions 2 & 3 but we are not currently planning on offering rinex version 4 compatibility.

Pull requests #127 and #130 will also include an ephemeris downloader function that can also help download the correct Rinex files for a NavData class.

I will comment again on this issue after those pull requests are merged in and point you to the appropriate tutorials.

MrBourriz commented 11 months ago

Rinex version 3 Thanks

kanhereashwin commented 11 months ago

Hi, Rinex version 3 should already be supported by the RinexObs class. Can you specify what inputs you're providing the function and what error message is being output? The more information the better and full stack trace would be great, if you could provide it.

betaBison commented 11 months ago

If the issue was reading Rinex navigation files, then in gnss-lib-py version 0.2.0, Rinex navigation version 3 files can be read with RinexNav() and there is now a RinexNav tutorial on our documentation website.

MrBourriz commented 11 months ago

Thanks of your answer, sorry for the confusion the rinex observation file was version 2


IndexError Traceback (most recent call last) Cell In[30], line 1 ----> 1 rover=glp.RinexObs('C:/Users/bourriz/GNSS-Correction-RTKLIB-master/UIS_PosPac_HyspexNav_processing/Result/Rover/merged_observation.obs')

File ~\anaconda3\envs\drone\Lib\site-packages\gnss_lib_py\parsers\rinex_obs.py:47, in RinexObs.init(self, input_path) 35 def init(self, input_path): 36 """Loading Rinex observation files into a NavData based class. 37 38 Should input path to .yyo file. (...) 44 45 """ ---> 47 obs_file = gr.load(input_path).to_dataframe() 48 obs_header = gr.rinexheader(input_path) 49 obs_measure_types = obs_header['fields']

File ~\AppData\Roaming\Python\Python311\site-packages\georinex\base.py:67, in load(rinexfn, out, use, tlim, useindicators, meas, verbose, overwrite, fast, interval) 65 return rinexnav(rinexfn, outfn, use=use, tlim=tlim, overwrite=overwrite) 66 elif info["rinextype"] == "obs": ---> 67 return rinexobs( 68 rinexfn, 69 outfn, 70 use=use, 71 tlim=tlim, 72 useindicators=useindicators, 73 meas=meas, 74 verbose=verbose, 75 overwrite=overwrite, 76 fast=fast, 77 interval=interval, 78 ) 80 assert isinstance(rinexfn, Path) 82 if info["rinextype"] == "sp3":

File ~\AppData\Roaming\Python\Python311\site-packages\georinex\base.py:217, in rinexobs(fn, outfn, use, group, tlim, useindicators, meas, verbose, overwrite, fast, interval) 214 info = rinexinfo(fn) 216 if int(info["version"]) in (1, 2): --> 217 obs = rinexobs2( 218 fn, 219 use, 220 tlim=tlim, 221 useindicators=useindicators, 222 meas=meas, 223 verbose=verbose, 224 fast=fast, 225 interval=interval, 226 ) 227 elif int(info["version"]) == 3: 228 obs = rinexobs3( 229 fn, 230 use, (...) 236 interval=interval, 237 )

File ~\AppData\Roaming\Python\Python311\site-packages\georinex\obs2.py:42, in rinexobs2(fn, use, tlim, useindicators, meas, verbose, fast, interval) 40 attrs: dict[str, T.Any] = {} 41 for u in use: ---> 42 o = rinexsystem2( 43 fn, 44 system=u, 45 tlim=tlim, 46 useindicators=useindicators, 47 meas=meas, 48 verbose=verbose, 49 fast=fast, 50 interval=interval, 51 ) 52 if len(o.variables) > 0: 53 attrs = o.attrs

File ~\AppData\Roaming\Python\Python311\site-packages\georinex\obs2.py:249, in rinexsystem2(fn, system, tlim, useindicators, meas, verbose, fast, interval) 247 data[i 3 + 2, j, isv] = darr[:, k 3 + 2] 248 else: --> 249 data[i, j, isv] = darr[:, k] 250 # %% output gathering 251 data = data[:, : times.size, :] # trims down for unneeded preallocated

IndexError: index 43 is out of bounds for axis 2 with size 3

kanhereashwin commented 11 months ago

This seems to be an issue on the georinex side, with their loader. To help us debug it, could you please try the following things:

  1. Try loading one of the unit test Rinex v3 files from data/unit_test/rinex/obs with RinexObs and see if it is causing any issues?
  2. Can you share the Rinex file that you're trying to load via a GitHub Gist (https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists)? I will try to load it on my side and see if I can better understand the issue

As a note, I have previously experienced that if the Rinex .o file has been edited or created manually, georinex can have issues loading it because the file might be internally inconsistent

MrBourriz commented 10 months ago

Ah okay, I understand now, the rinex file that I have is kinda edited with TEQC