Problem parsing Rinex Files

Hello,

I am new in the community and in using Orekit. I have decided to test Orekit with its Python wrappers to read some Rinex Observation files. The problem is that I have not been able to find a single tutorial explaining how to do that. I am quite new to python as well and I have never programmed in Java so when I am reading the API documentation I may have some problems understanding the overall documentation. Nevertheless I am a quick learner.

My particular problem is the following one. Say I want to read a file in a particular folder which is contained in path. How can I do that ? I know for instance that I will need to import the RinexLoad function, but afterwards I am not so sure of the steps. Can you help me please ?

Thanks in advance
Jordi

Hi @JordiS

Welcome to the Orekit forum!

I’m very far to be a python expert :sweat_smile: However, I can give you some help to perform what you want in Java (and then you can try to translate it in Python).

First, you can have a look on the GNSS orbit determination test in Orekit. Indeed, this test needs measurements from Rinex files to be performed. The loading of the files is done in two steps:

  • Looping of the wanted Rinex files (from line 323 to 340).
  • Reading of a Rinex file to extract the measurements (from line 1735 to 1817).

To read a Rinex file in a particular folder, you can also have a look on the test class of the Rinex loader. Tests are very useful in Orekit to understand the used of the different classes.

Rinex files are very difficult to understand and also to use. However, they are very used for GNSS applications. In that respect, adding a tutorial explaining how to load and use this file format can be a good enhancement. Can you open a feature request in our issue tracker of the Orekit tutorials project ?

Kind regards,
Bryan

Hi Bryan

Thanks for your feedback. The files that you mention have helped me a lot on how to use these functions in Java. Nevertheless I still have nevertheless problems in translating it into Python. Here is the code I am using:

import orekit
orekit.initVM()

from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir(‘path/to/rinex’)

from org.orektit.gnss import RinexLoader
import sys

fd = open(‘path/to/rinex’, ‘r’)

loader = RinexLoader(fd.read(),fd.name())

fd.close()

When I execute this, the error InvalidArgsError appears. According to the Orekit documentation and the files on your link, you need to give a stream and the name of the file. Any ideas ?

Thanks in advance

Kind regards
Jordi

Hello

I’ve found the solution to my problem. The following code works fine:

import orekit
orekit.initVM()

from java.io import File
from org.orekit.data import DataProvidersManager, DirectoryCrawler
from orekit import JArray

orekit_folder = ‘Rinex’
DM = DataProvidersManager.getInstance()
datafile = File(orekit_filename)

crawler = DirectoryCrawler(datafile)
DM.clearProviders
DM.addProvider(crawler)

stationFile = ‘test.20o’
from org.orekit.gnss import RinexLoader

loader = RinexLoader(stationFile)

obs = loader.getObservationDataSets()

Kind regards
Jordi