Skip to main content

A library to read RINEX files

Project description

rnx

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 and 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 event flag, 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.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

rnx-1.1.2-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rnx-1.1.2.tar.gz
Algorithm Hash digest
SHA256 676f7552de7005954d283c8757e69006c1fda51f65a63e4608577da861068064
MD5 1782c63bab580bd0f3ac834df7e8acb8
BLAKE2b-256 6cb0ba11e009c0e45a6a1d0e4154c95ca423df0500ba95521da2a59016ab7be8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rnx-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 396d868039ddc64c7f7ac514455cf77e3d2e2232e16cad18bf0d746ab2830305
MD5 99f852aa482b5af343a64a986ca66ec7
BLAKE2b-256 1d4693a772b9fc8fdbe724bf7d670f9e0ddd4dcf5144a188ff4ab42c1620ccb8

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