Skip to main content

A library to read RINEX files

Project description

rnx: RINEX File Reader

A Python library to read RINEX files.

This library is designed to read version 2.11 RINEX navigation ('N') and observation ('O') files, specifically for GPS ('G') and mixed ('M') system data.

Reading Data

First import the library:

import rnx

To read a RINEX file, call the read function passing the name of the navigation or observation file:

nav = rnx.read("ohdt0710.22n")
obs = rnx.read("ohdt0710.22o")

The type of file (navigation or observation) is determined automatically by the first line of the file contents, not by the extension. You can also read both a navigation file and its corresponding observation file in one command:

nav, obs = rnx.read("ohdt0710.22n", "ohdt0710.22o")

This has the added benefit of mapping the ephemeris data from the navigation object to the corresponding moments in time and space vehicles of the observation object. It creates a new attribute in the observation object called ephs.

Navigation Objects

The navigation object (nav in the above examples) has three main attributes: the array of times of clock t_oc in GPS week seconds, the array of PRN numbers for all GPS space vehicles found in the navigation file, and the matrix of ephemerides ephs corresponding to each pairing of time and PRN. The relationship of these three attributes can be visualized as follows:

        .-------------------.
        |    |    |    |    | prns
        '-------------------'
.----.  .-------------------.
|    |  |    |    |    |    |
|----|  |----|----|----|----|
|    |  |    |    |    |    |
|----|  |----|----|----|----|
|    |  |    |    |    |    |
'----'  '-------------------'
t_oc                          ephs

Not all elements of the ephs matrix are populated. In such cases, the value of that element of the matrix is None.

Suppose we wish to get the time of clock, the PRN number, and the ephemeris for the third space vehicle at the first moment in time. Then we would write

t = nav.t_oc[0]
prn = nav.prns[2]
eph = nav.ephs[0, 2]

Then, each ephemeris parameter is an attribute of eph. As an example, if we wanted the square root of the orbit semi-major axis radius, we would do

eph.sqrtA

The complete set of attributes of eph are listed in the EphG class.

The navigation object has an additional property which stores the date and time stamp of the beginning of the GPS week corresponding to the first record in the file: ts_bow. So, if we wanted to get the timestamp of the kth moment in time, we would do

ts = nav.ts_bow + datetime.timedelta(seconds=nav.t_oc[k])

Observation Objects

The observation object (obs in the opening examples) is organized in a manner similar to navigation object. The arrays of receiver times t in GPS week seconds and receiver clock offsets T_os have as many elements as there are rows in the observation matrices. The arrays of space vehicle names svs, system letters sys, and space vehicle numbers prns have as many elements as there are columns in the observation matrices:

              .-------------------.
              |    |    |    |    | sys
              :===================:
              |    |    |    |    | prns
              :===================:
              |    |    |    |    | svs
              '-------------------'
.----..----.  .-------------------.
|    ||    |  |    |    |    |    |
|----||----|  |----|----|----|----|
|    ||    |  |    |    |    |    |
|----||----|  |----|----|----|----|
|    ||    |  |    |    |    |    |
'----''----'  '-------------------'
t      T_os                         C1, L2, D5, wf1, ephs, etc.

The sys array stores the space vehicle's GNSS system letter (like 'G' for GPS or 'R' for GLONASS). The prns array stores the space vehicle's PRN number (like 1 through 32 for GPS). The svs array is the concatenation of the system letter and the PRN number (like "G05"). You can find the column index of a space vehicle by name with the sv_ind dictionary:

j = obs.sv_ind["G05"]

Suppose we wish to get the receiver time, the PRN number, the GNSS system letter, and the L1 C/A pseudorange for the fifth space vehicle at the third moment in time. Then we would write

t = obs.t[2]
prn = obs.prns[4]
sys = obs.sys[4]
C1 = obs.C1[2, 4]

A RINEX observation file does not necessarily hold every possible type of observation. The types are labeled with a letter and a frequency band number. The possible band numbers are 1, 2, 5, 6, 7, and 8. The possible letters are

Letter Meaning Units
'C' C/A pseudorange m
'P' P(Y) pseudorange m
'L' Carrier phase cycles
'D' Doppler frequency Hz
'S' Signal strength dB-Hz

(The units of signal strength are, in fact, receiver-dependent and might not be dB-Hz.) So, to access the C/A pseudorange from the L1 frequency of the jth space vehicle at the kth moment in time, we would write

rho = obs.C1[k, j]

Observation types which are nowhere defined within the RINEX file will still exist as attributes of the observation object but will have a value of None.

To see if a space vehicle has any observation data at a given moment in time, we can use the is_vis matrix:

obs.is_vis[k, j]

This is a matrix of Boolean values (True or False). Very similar to this, the vis_prn matrix is NaN wherever is_vis is False and is equal to the PRN of the space vehicle wherever is_vis is True. So, we could plot the visibility of space vehicles by PRN with

import matplotlib.pyplot as plt
plt.plot(obs.t, obs.vis_prn)

Like with the navigation object, we can get the timestamp of the kth moment in time by

ts = obs.ts_bow + datetime.timedelta(seconds=obs.t[k])

When a navigation file is read in the same command as an observation file, the observation object will get an additional attribute called ephs. So, to get the C1 pseudorange and corresponding ephemeris for space vehicle j at time k, we would write

C1 = obs.C1[k, j]
eph = obs.ephs[k, j]

Additional attributes are described in the Obs class.

Finding Data

Some sites from which RINEX files can be downloaded for free are

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rnx-1.1.3.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

rnx-1.1.3-py3-none-any.whl (46.0 kB view details)

Uploaded Python 3

File details

Details for the file rnx-1.1.3.tar.gz.

File metadata

  • Download URL: rnx-1.1.3.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for rnx-1.1.3.tar.gz
Algorithm Hash digest
SHA256 29e728ac9d1256a10bbd3c7d7b0b8adc73420c0685561476c26a312991d8660c
MD5 b55c89a055a35c09a4f8098999ea4cd2
BLAKE2b-256 70de7f539f2a2aac51533f4e75acf4dae873c4216abc58218a43c889eb481236

See more details on using hashes here.

File details

Details for the file rnx-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: rnx-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 46.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for rnx-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7d6416a9987b1839af950d0f1a725142946bfe9a2a6f1d4f37a8d6ea9d1217f3
MD5 75f43cf6cd421ea0327a055b616eccac
BLAKE2b-256 aba4b9bf42979343765cf2cb7cd6d34050bff07585e7fde159a7461dbdd98c63

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page