Skip to content

Parsing

The parsing module is the entry point for data ingestion in PyTECGg. It leverages a high-performance Rust backend to handle the heavy lifting of reading RINEX files, ensuring that even large multi-constellation observation files are processed with minimal latency. By delegating the parsing logic to Rust and returning native Polars DataFrames, PyTECGg avoids the common bottlenecks of Python-based RINEX readers. The module automatically handles:

  • Format detection: support for standard .rnx, Hatanaka-compressed .crx, and gz-ipped .gz files.
  • Metadata extraction: retrieval of the receiver ECEF position and RINEX version.
  • Epochs: returned as written in the file, with the UTC time zone attached but no time-scale shift. Observation epochs stay on the GPST grid; navigation epochs stay in each constellation's own time (e.g. UTC for GLONASS). Satellite position computation handles the conversion (see Satellites & Geometry).

API Reference

read_rinex_obs(path)

Parses a RINEX observation file and returns the extracted observation data as a Polars DataFrame.

Parameters:

Name Type Description Default
path str or Path

Path to the RINEX observation file (.rnx, .crx, or .gz).

required

Returns:

Type Description
tuple
  • pl.DataFrame: DataFrame with columns 'epoch', 'sv', 'observable', 'value'
  • tuple[float, float, float]: Receiver's position in ECEF coordinates (meters)
  • str: RINEX version

read_rinex_nav(path)

Parses a RINEX navigation file into a dictionary of DataFrames.

Parameters:

Name Type Description Default
path str or Path

Path to the RINEX navigation file.

required

Returns:

Type Description
dict[str, DataFrame]

Dictionary keyed by constellation (e.g., 'GPS'), containing DataFrames with 'epoch' as datetime[μs, UTC], orbital parameters and 'leap_seconds' from the file header (null if the header has none).

read_rinex_nav_header(path)

Read a few selected fields from a RINEX nav file header.

The compiled parser does not surface the header. This pure-Python scan reads only the lines up to END OF HEADER and extracts:

  • leap_seconds : int or None Value of the LEAP SECONDS header field (UTC -> GPST offset). None if the field is absent.

Parameters:

Name Type Description Default
path str or Path

Path to the RINEX navigation file (.rnx, .nav, or .gz).

required

Returns:

Type Description
dict

Header fields. Currently {"leap_seconds": int | None}.