rinex_nav module

Parses Rinex .n files.

Loads rinex navigation files into a NavData object. Loading time can be sped up significantly by passing in the “satellites” parameter which in turn gets passed into the georinex library used to parse the rinex file.

Rinex files can be downloaded with the load_ephemeris function in the utils/ephemeris_downloader.py file.

class rinex_nav.RinexNav(input_paths, satellites=None, verbose=False)[source]

Bases: NavData

Class to parse Rinex navigation files containing SV parameters.

Loads rinex navigation files into a NavData object. Loading time can be sped up significantly by passing in the “satellites” parameter which in turn gets passed into the georinex library used to parse the rinex file.

Inherits from NavData().

iono_params

Dictionary of the ionosphere correction terms of the form {gps_millis_at_day_start : {gnss_id : iono_array}} where gps_millis_at_day_start is the time (in gps_millis) for the beginning of the day corresponding to the ionosphere correction parameters in iono_array.

Type:

dict

verbose

If true, prints debugging statements.

Type:

bool

Rinex specific loading and preprocessing

Parameters:
  • input_paths (string or path-like or list of paths) – Path to measurement Rinex file(s).

  • satellites (List) – List of satellite IDs as a string, for example [‘G01’,’E11’, ‘R06’]. Defaults to None which returns get_ephemeris for all satellites.

_get_ephemeris_dataframe(rinex_path, constellations=None)[source]

Load/download ephemeris files and process into DataFrame

Parameters:
  • rinex_path (string or path-like) – Filepath to rinex file

  • constellations (set) – Set of satellites {“ConstIDSVID”}

Returns:

  • data (pd.DataFrame) – Parsed ephemeris DataFrame

  • data_header (dict) – Header information from Rinex file.

static _iono_corr_key()[source]

Correlations between satellite name and iono param name.

Returns:

iono_corr_key – String names for ionospheric correction parameters within the rinex navigation file.

Return type:

list

get_iono_params(rinex_header, constellations=None)[source]

Gets ionosphere parameters from RINEX file header for calculation of ionosphere delay.

There are different possible ways of the header containing parameters for ionosphere delay parameters. This function tries different keys to extract the pertinent parameters.

Parameters:
  • rinex_header (dict) – Dictionary containing RINEX file header information

  • constellations (list) – List of strings indicating which constellations ionosphere correction parameters are required for. Set to None by default, in which case the function gets all available parameters.

Returns:

iono_params – Dictionary of the form {gnss_id : iono_array}, where the shape of the array containing the ionospheric corrections.

Return type:

dict

load_leapseconds(rinex_header)[source]

Read leapseconds from Rinex file

Parameters:

rinex_header (dict) – Header information from Rinex file.

Returns:

leap_seconds – Leap seconds read from file, return np.nan if not found.

Return type:

int

postprocess()[source]

Rinex specific post processing.

This function breaks the input sv row containing the standard gnss_sv_id data into gnss_id and sv_id rows and also renames sv to gnss_sv_id to match the standard nomenclature.

preprocess(rinex_paths, satellites)[source]

Combine Rinex files and create pandas frame if necessary.

Also loads the ionospheric correction parameters from the Rinex file header and stores them in a dictionary while loading the pandas dataframe.

Parameters:
  • rinex_paths (string or path-like or list of paths) – Path to measurement Rinex file(s).

  • satellites (List) – List of satellite IDs as a string, for example [‘G01’,’E11’, ‘R06’]. Defaults to None which returns get_ephemeris for all satellites.

Returns:

data – Combined rinex data from all files.

Return type:

pd.DataFrame

rinex_nav._compute_eccentric_anomaly(gps_week, gps_tow, ephem, tol=1e-05, max_iter=10)[source]

Compute the eccentric anomaly from ephemeris parameters.

This function extracts relevant parameters from the broadcast navigation ephemerides and then solves the equation f(E) = M - E + e * sin(E) = 0 using the Newton-Raphson method.

In the above equation M is the corrected mean anomaly, e is the orbit eccentricity and E is the eccentric anomaly, which is unknown.

Parameters:
  • gps_week (int) – Week of GPS calendar corresponding to time of clock.

  • gps_tow (np.ndarray) – GPS time of the week at which positions are required [s].

  • ephem (gnss_lib_py.navdata.navdata.NavData) – NavData instance containing ephemeris parameters of satellites for which states are required.

  • tol (float) – Tolerance for convergence of the Newton-Raphson.

  • max_iter (int) – Maximum number of iterations for Newton-Raphson.

Returns:

ecc_anom – Eccentric Anomaly of GNSS satellite orbits.

Return type:

np.ndarray

rinex_nav._estimate_sv_clock_corr(gps_millis, ephem)[source]

Calculate the modelled satellite clock delay

Parameters:
  • gps_millis (int) – Time at which measurements are needed, measured in milliseconds since start of GPS epoch [ms].

  • ephem (gnss_lib_py.navdata.navdata.NavData) – Satellite ephemeris parameters for measurement SVs.

Returns:

  • clock_corr (np.ndarray) – Satellite clock corrections containing all terms [m].

  • corr_polynomial (np.ndarray) – Polynomial clock perturbation terms [m].

  • clock_relativistic (np.ndarray) – Relativistic clock correction terms [m].

rinex_nav.get_time_cropped_rinex(gps_millis, satellites=None, ephemeris_directory='/home/docs/checkouts/readthedocs.org/user_builds/gnss-lib-py/checkouts/latest/docs/source/data/ephemeris', verbose=False)[source]

Add SV states using Rinex file.

Provides broadcast ephemeris for specific satellites at a specific timestep add_sv_states_rinex returns the most recent broadcast ephemeris for the provided list of satellites that was broadcast BEFORE the provided timestamp. For example GPS daily ephemeris files contain data at a two hour frequency, so if the timestamp provided is 5am, then add_sv_states_rinex will return the 4am data but not 6am. If provided a timestamp between midnight and 2am then the ephemeris from around midnight (might be the day before) will be provided. If no list of satellites is provided, then add_sv_states_rinex will return data for all satellites.

When multiple observations are provided for the same satellite and same timestep, will only return the first instance. This is applicable when requesting ephemeris for multi-GNSS for the current day. Same-day multi GNSS data is pulled from same day. For same-day multi-GNSS from https://igs.org/data/ which often has multiple observations.

Parameters:
  • gps_millis (float) – Ephemeris data is returned for the timestamp day and includes all broadcast ephemeris whose broadcast timestamps happen before the given timestamp variable. Timezone should be added manually and is interpreted as UTC if not added.

  • satellites (List) – List of satellite IDs as a string, for example [‘G01’,’E11’, ‘R06’]. Defaults to None which returns get_ephemeris for all satellites.

  • ephemeris_directory (string or path-like) – Directory where ephemeris files are downloaded if necessary.

  • verbose (bool) – Prints extra debugging statements.

Returns:

rinex_data – ephemeris entries corresponding to timestamp

Return type:

gnss_lib_py.navdata.navdata.NavData

Notes

The Galileo week GALWeek is identical to the GPS Week GPSWeek. See http://acc.igs.org/misc/rinex304.pdf page A26