midgard.parsers._parser_rinex
Basic functionality for parsing Rinex files
Description:
This module contains functions and classes for parsing Rinex files.
This file defines the general structure shared by most types of Rinex files, including header information. More specific format details are implemented in subclasses. When calling the parser, you should call the apropriate parser for a given Rinex format.
RinexHeader
RinexHeader(marker:str, fields:Dict[str, Tuple[int, int]], parser:Callable[[Dict[str, str]], Dict[str, Any]])
A convenience class for defining how a Rinex header is parsed
Args:
marker
: Marker of header (as defined in columns 60 and onward).fields
: Dictionary with field names as keys, tuple of start- and end-columns as value.parser
: Function that will parse the fields.
RinexParser
RinexParser(file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger:Union[Callable[[str], NoneType], NoneType]=<built-in function print>, strict:bool=False) -> None
An abstract base class that has basic methods for parsing a datafile
This class provides functionality for reading Rinex header data. You should inherit from this one,
and at least implement parse_epochs
.
RinexParser.get_rinex_version()
get_rinex_version(self) -> str
Get version of Rinex file
RinexParser.name (str)
name = 'Rinex'
RinexParser.parse_approx_position()
parse_approx_position(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse station coordinates defined in RINEX header to instance variable data
RinexParser.parse_comment()
parse_comment(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse comment lines in RINEX header to instance variable header['comment']
RinexParser.parse_data_lines()
parse_data_lines(self, lines, epoch_info)
RinexParser.parse_epoch_line()
parse_epoch_line(self, line)
RinexParser.parse_float()
parse_float(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse float entries of RINEX header to instance variable header
RinexParser.parse_glonass_code_phase_bias()
parse_glonass_code_phase_bias(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse GLONASS phase correction in RINEX header to instance variable header['glonass_bias']
self.header['glonass_bias'] = {
RinexParser.parse_glonass_slot()
parse_glonass_slot(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse GLONASS slot and frequency numbers given in RINEX header to instance variable header['glonass_slot']
self.header['glonass_slot'] = {
RinexParser.parse_integer()
parse_integer(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse integer entries of RINEX header to instance variable header
RinexParser.parse_leap_seconds()
parse_leap_seconds(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse entries of RINEX header LEAP SECONDS
to instance variable header
self.header['leap_seconds'] = { 'leap_seconds':
RinexParser.parse_phase_shift()
parse_phase_shift(self, fields:Dict[str, str], cache:List[Dict[str, str]]) -> Dict[str, Any]
Parse entries of RINEX header SYS / PHASE SHIFT
to instance variable header
self.header['phase_shift'] = { <sat_sys>: { <obs_type>: { corr: <correction>,
sat: <[satellite list]>}}}
Example of phase_shift
header entry:
self.header['phase_shift'] = {'G': {'L1C': {'corr': '0.00000',
'sat': ['G01', 'G02', 'G03', ...]},
'L1W': {'corr': '0.00000',
'sat': []}},
'R': {'L1C': {'corr': '0.00000',
'sat': ['R01', 'R02', 'R07', 'R08']}}}
TODO: Maybe better to add information to header['obstypes']?
RinexParser.parse_scale_factor()
parse_scale_factor(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse entries of RINEX header SYS / SCALE FACTOR
to instance variable header
RinexParser.parse_string()
parse_string(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse string entries of RINEX header to instance variable 'header'
RinexParser.parse_sys_dcbs_applied()
parse_sys_dcbs_applied(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse entries of RINEX header SYS / DCBS APPLIED
to instance variable header
self.header['dcbs_applied'] = {
RinexParser.parse_sys_obs_types()
parse_sys_obs_types(self, fields:Dict[str, str], cache:List[Dict[str, str]]) -> Dict[str, Any]
Parse observation types given in RINEX header to instance variable header['obstypes']
and data
The data dictionaries obs
, cycle_slip
and signal_strength
are initialized based on the given observation
type in the RINEX header.
self.header['obstypes'] = { <sat_sys>: [<ordered list with given observation types>]}
RinexParser.parse_sys_pcvs_applied()
parse_sys_pcvs_applied(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse entries of RINEX header SYS / PCVS APPLIED
to instance variable header
self.header['pcvs_applied'] = {
RinexParser.parse_time_of_first_obs()
parse_time_of_first_obs(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse time of first observation given in RINEX header to instance variable header
RinexParser.parse_time_of_last_obs()
parse_time_of_last_obs(self, fields:Dict[str, str]) -> Dict[str, Any]
Parse time of last observation given in RINEX header to instance variable header
RinexParser.read_data()
read_data(self) -> None
Read data from the data file
RinexParser.read_epochs()
read_epochs(self, fid) -> None
Read data from Rinex file
Add data to self.data
RinexParser.read_header()
read_header(self, fid) -> None
Read header from the rinex file
Add header information to self.header
parser_cache()
parser_cache(func:Callable[[_ForwardRef('RinexParser'), Dict[str, str], List[Dict[str, str]]], Dict[str, Any]]) -> Callable[[_ForwardRef('RinexParser'), Dict[str, str]], Dict[str, Any]]
Decorator for adding a cache to parser functions