Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Python RINEX 2/3 NAV/OBS reader that is very fast

Project description

image image image image image Maintainability PyPi Download stats

PyRinex

RINEX 3 and RINEX 2 reader in Python -- reads NAV and OBS GPS RINEX data into xarray.Dataset for easy use in analysis and plotting. This gives remarkable speed vs. legacy iterative methods, and allows for HPC / out-of-core operations on massive amounts of GNSS data.

Writes to NetCDF4 (subset of HDF5), with zlib compression. This is a couple order of magnitude speedup in reading/converting RINEX data and allows filtering/processing of gigantic files too large to fit into RAM.

Another key advantage of PyRinex is the Xarray base class, that allows all the database-like indexing power of Pandas to be unleashed.

PyRinex works in Python >= 3.6.

Install

python -m pip install -e .

Usage

The simplest command-line use is through the top-level ReadRinex.py script.

  • Read RINEX3 or RINEX 2 Obs or Nav file: python ReadRinex.py myrinex.XXx
  • Read NetCDF converted RINEX data: python ReadRinex.py myrinex.nc

You can also of course use the package as a python imported module as in the following examples. Each example assumes you have first done:

import pyrinex as pr

read Rinex

This convenience function reads any possible Rinex 2/3 OBS/NAV or .nc file:

obs,nav = pr.readrinex('tests/demo.10o')

read Obs

If you desire to specifically read a RINEX 2 or 3 OBS file:

obs = pr.rinexobs('tests/demo_MO.rnx')

This returns an xarray.Dataset of data within the .XXo observation file.

NaN is used as a filler value, so the commands typically end with .dropna(dim='time',how='all') to eliminate the non-observable data vs time. As per pg. 15-20 of RINEX 3.03 specification, only certain fields are valid for particular satellite systems. Not every receiver receives every type of GNSS system. Most Android devices in the Americas receive at least GPS and GLONASS.

Index OBS data

assume the OBS data from a file is loaded in variable obs.

Select satellite(s) (here, G13) by

obs.sel(sv='G13').dropna(dim='time',how='all')

Pick any parameter (say, L1) across all satellites and time (or index via .sel() by time and/or satellite too) by:

obs['L1'].dropna(dim='time',how='all')

Indexing only a particular satellite system (here, Galileo) using Boolean indexing.

import pyrinex as pr
obs = pr.rinexobs('myfile.o', use='E')

would load only Galileo data by the parameter E. ReadRinex.py allow this to be specified as the -use command line parameter.

If however you want to do this after loading all the data anyway, you can make a Boolean indexer

Eind = obs.sv.to_index().str.startswith('E')  # returns a simple Numpy boolean 1-D array
Edata = obs.isel(sv=Eind)  # any combination of other indices at same time or before/after also possible

Plot OBS data

Plot for all satellites L1C:

from matplotlib.pyplot import figure, show
ax = figure().gca()
ax.plot(obs.time, obs['L1C'])
show()

Suppose L1C psuedorange plot is desired for G13:

obs['L1C'].sel(sv='G13').dropna(dim='time',how='all').plot()

read Nav

If you desire to specifically read a RINEX 2 or 3 NAV file:

nav = pr.rinexnav('tests/demo_MN.rnx')

This returns an xarray.Dataset of the data within the RINEX 3 or RINEX 2 Navigation file. Indexed by time x quantity

Index NAV data

assume the NAV data from a file is loaded in variable nav. Select satellite(s) (here, G13) by

nav.sel(sv='G13')

Pick any parameter (say, M0) across all satellites and time (or index by that first) by:

nav['M0']

Notes

RINEX 3.03 specification

RINEX OBS reader algorithm

  1. read overall OBS header (so we know what to expect in the rest of the OBS file)
  2. fill the xarray.Dataset with the data by reading in blocks -- another key difference from other programs out there, instead of reading character by character, I ingest a whole time step of text at once, helping keep the processing closer to CPU cache making it much faster.

Data

For capable Android devices, you can log RINEX 3 using the built-in GPS receiver.

Here is a lot of RINEX 3 data to work with:

Project details


Release history Release notifications

This version
History Node

1.3.0.post2

History Node

1.3.0.post1

History Node

1.3.0.post0

History Node

1.3.0

History Node

1.2.10

History Node

1.2.9

History Node

1.2.8

History Node

1.2.7

History Node

1.2.6

History Node

1.2.5

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyrinex-1.3.0.post2-py3-none-any.whl (15.3 kB) Copy SHA256 hash SHA256 Wheel py3 Jun 5, 2018
pyrinex-1.3.0.post2.tar.gz (12.5 kB) Copy SHA256 hash SHA256 Source None Jun 5, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page