gnssrefl.rinpy module

exception gnssrefl.rinpy.RinexError

Bases: Exception

gnssrefl.rinpy.collapse_rinex3_obs(obsdata, obstypes)

Collapse RINEX 3 three-char observable names to RINEX 2 two-char band names.

For each constellation and band, merges all matching candidate observables in priority order: highest-priority non-NaN value wins at each (epoch, sat) cell. This mirrors gfzrnx behavior where e.g. S1C and S1X both map to S1, with S1C preferred when available.

Parameters:
  • obsdata (dict) – Separated observation data as returned by separateobservables().

  • obstypes (dict) – Observable types per constellation as returned by processrinexfile().

Returns:

  • new_obsdata (dict) – Remapped observation data with two-char keys.

  • new_obstypes (dict) – Remapped observable type lists with two-char names.

gnssrefl.rinpy.get_favourite_obs_dict()

Parse myfavoriteobs() into a priority dict for collapsing RINEX 3 obs.

Returns dict like {‘G’: {‘S1’: [‘S1C’, ‘S1X’], ‘S2’: [‘S2X’, ‘S2L’]}, …} Bare two-char names (e.g. ‘S1’ in Galileo) are kept as-is and will match any three-char observable starting with that prefix.

gnssrefl.rinpy.getrinexversion(filename)

Scan the file for RINEX version number.

Parameters:

filename (str) – Filename of the rinex file

Returns:

version – Version number.

Return type:

str

gnssrefl.rinpy.loadrinexfromnpz(npzfile)

Load data previously stored in npz-format

Parameters:

npzfile (str) – Path to the stored data.

Returns:

observationdata, satlists, prntoidx, obstypes, header, obstimes – Data in the same format as returned by processrinexfile

Return type:

dict

gnssrefl.rinpy.mergerinexfiles(filelist, savefile=None)

Process several rinexfiles and merges them into one file.

Can be used to for example merge several rinexfiles from the same day to a single file. All files must be from the same receiver and have the same version. No guarantees are given if files are from different receivers.

!!! Currently only functional for RINEX3. !!!

Parameters:
  • filename (str) – Filename of the rinex file

  • savefile (str, optional) – Name of file to save data to. If supplied the data is saved to a compressed npz file.

Returns:

  • observationdata (dict) – Dict with a nobs x nsats x nobstypes nd-array for each satellite constellation containing the measurements. The keys of the dict correspond to the systemletter as used in RINEX files (G for GPS, R for GLONASS, etc).

    nobs is the number of observations in the RINEX data, nsats the number of visible satellites for the particular system during the whole measurement period, and nobstypes is the number of different properties recorded.

  • satlists (dict) – Dict containing the full list of visible satellites during the whole measurement period for each satellite constellation.

  • prntoidx (dict) – Dict which for each constellation contains a dict which translates the PRN number into the index of the satellite in the observationdata array.

  • obstypes (dict) – Dict containing the observables recorded for each satellite constellation.

  • header (dict) – Dict containing the header information from the first RINEX file.

  • obstimes (list[datetime.datetime]) – List of time of measurement for each measurement epoch.

gnssrefl.rinpy.processrinexfile(filename, savefile=None)

Process a RINEX file into python format

Parameters:
  • filename (str) – Filename of the rinex file

  • savefile (str, optional) – Name of file to save data to. If supplied the data is saved to a compressed npz file.

Returns:

  • observationdata (dict) – Dict with a nobs x nsats x nobstypes nd-array for each satellite constellation containing the measurements. The keys of the dict correspond to the systemletter as used in RINEX files (G for GPS, R for GLONASS, etc).

    nobs is the number of observations in the RINEX data, nsats the number of visible satellites for the particular system during the whole measurement period, and nobstypes is the number of different properties recorded.

  • satlists (dict) – Dict containing the full list of visible satellites during the whole measurement period for each satellite constellation.

  • prntoidx (dict) – Dict which for each constellation contains a dict which translates the PRN number into the index of the satellite in the observationdata array.

  • obstypes (dict) – Dict containing the observables recorded for each satellite constellation.

  • header (dict) – Dict containing the header information from the RINEX file.

  • obstimes (list[datetime.datetime]) – List of time of measurement for each measurement epoch.

gnssrefl.rinpy.readheader(lines, rinexversion)
gnssrefl.rinpy.saverinextonpz(savefile, observationdata, satlists, prntoidx, obstypes, header, obstimes)

Save data to numpy’s npz format.

Parameters:
  • savefile (str) – Path to where to save the data.

  • observationdata (dict) – Data as returned from processrinexfile

  • satlists (dict) – Data as returned from processrinexfile

  • prntoidx (dict) – Data as returned from processrinexfile

  • obstypes (dict) – Data as returned from processrinexfile

  • header (dict) – Data as returned from processrinexfile

  • obstimes (dict) – Data as returned from processrinexfile

See also

processrinexfile

gnssrefl.rinpy.separateobservables(observationdata, obstypes)
Parameters:
  • observationdata (dict) – Data dict as returned by processrinexfile, or loadrinexfromnpz.

  • obstypes (dict) – Dict with observation types for each system as returned by processrinexfile, or loadrinexfromnpz.

Returns:

separatedobservationdata – Dict for each system where the data for each observable is separated into its own dict. I.e. to access the P1 data for GPS from a RINEX2 file it is only necessary to write separatedobservationdata[‘G’][‘C1’].

Return type:

dict