midgard.parsers
Framework for parsers
Description:
To add a new parser, simply create a new .py-file which defines a class
inheriting from parsers.Parser. The class needs to be decorated with the
midgard.dev.plugins.register decorator as follows:
from midgard.parsers import parser
from midgard.lib import plugins
@plugins.register
class MyNewParser(parser.Parser):
...
To use a parser, you will typically use the parse_file-function defined below
from midgard import parsers
my_new_parser = parsers.parse_file('my_new_parser', 'file_name.txt', ...)
my_data = my_new_parser.as_dict()
The name used in parse_file to call the parser is the name of the module
(file) containing the parser.
names()
Full name: midgard.parsers.names
Signature: () -> List[str]
List the names of the available parsers
Returns:
Names of the available parsers
parse_file()
Full name: midgard.parsers.parse_file
Signature: (parser_name:str, file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, timer_logger:Union[Callable[[str], NoneType], NoneType]=None, use_cache:bool=False, **parser_args:Any) -> midgard.parsers._parser.Parser
Use the given parser on a file and return parsed data
Specify parser_name and file_path to the file that should be parsed. The following parsers are available:
{doc_parser_names}
Data can be retrieved either as Dictionaries, Pandas DataFrames or Midgard Datasets by using one of the methods
as_dict, as_dataframe or as_dataset.
Example:
>>> df = parse_file('rinex2_obs', 'ande3160.16o').as_dataframe() # doctest: +SKIP
Args:
parser_name: Name of parserfile_path: Path to file that should be parsed.encoding: Encoding in file that is parsed.timer_logger: Logging function that will be used to log timing information.use_cache: Whether to use a cache to avoid parsing the same file several times.parser_args: Input arguments to the parser
Returns:
Parser: Parser with the parsed data
midgard.parsers._parser
Basic functionality for parsing datafiles, extended by individual parsers
Description:
This module contains functions and classes for parsing datafiles. It should typically be used by calling
parsers.parse_file:
Example:
from midgard import parsers
my_new_parser = parsers.parse_file('my_new_parser', 'file_name.txt', ...)
my_data = my_new_parser.as_dict()
Parser
Full name: midgard.parsers._parser.Parser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
An abstract base class that has basic methods for parsing a datafile
This class provides functionality for parsing a file. You should inherit from one of the specific parsers like for instance ChainParser, LineParser, SinexParser etc
Attributes:
file_path (Path): Path to the datafile that will be read. file_encoding (String): Encoding of the datafile. parser_name (String): Name of the parser (as needed to call parsers.parse_...). data_available (Boolean): Indicator of whether data are available. data (Dict): The (observation) data read from file. meta (Dict): Metainformation read from file.
Parser.as_dataframe()
Full name: midgard.parsers._parser.as_dataframe
Signature: (self, index:Union[str, List[str], NoneType]=None) -> pandas.core.frame.DataFrame
Return the parsed data as a Pandas DataFrame
This is a basic implementation, assuming the self.data-dictionary has
a simple structure. More advanced parsers may need to reimplement this
method.
Args:
index: Optional name of field to use as index. May also be a list of strings.
Returns:
Pandas DataFrame with the parsed data.
Parser.as_dataset()
Full name: midgard.parsers._parser.as_dataset
Signature: (self) -> NoReturn
Return the parsed data as a Midgard Dataset
This is a basic implementation, assuming the self.data-dictionary has
a simple structure. More advanced parsers may need to reimplement this
method.
Returns:
Dataset: The parsed data.
Parser.as_dict()
Full name: midgard.parsers._parser.as_dict
Signature: (self, include_meta:bool=False) -> Dict[str, Any]
Return the parsed data as a dictionary
This is a basic implementation, simply returning a copy of self.data. More advanced parsers may need to reimplement this method.
Args:
include_meta: Whether to include meta-data in the returned dictionary (default: False).
Returns:
Dictionary with the parsed data.
Parser.parse()
Full name: midgard.parsers._parser.parse
Signature: (self) -> 'Parser'
Parse data
This is a basic implementation that carries out the whole pipeline of reading and parsing datafiles including calculating secondary data.
Subclasses should typically implement (at least) the read_data-method.
Parser.postprocess_data()
Full name: midgard.parsers._parser.postprocess_data
Signature: (self) -> None
Do simple manipulations on the data after they are read
Simple manipulations of data may be performed in postprocessors after they are read. They should be kept simple so that a parser returns as true representation of the data file as possible. Advanced calculations may be done inside apriori classes or similar.
To add a postprocessor, define it in its own method, and override the
setup_postprocessors-method to return a list of all postprocessors.
Parser.read_data()
Full name: midgard.parsers._parser.read_data
Signature: (self) -> None
Read data from the data file
Data should be read from self.file_path and stored in the dictionary
self.data. A description of the data may be placed in the dictionary
self.meta. If data are not available for some reason,
self.data_available should be set to False.
Parser.setup_parser()
Full name: midgard.parsers._parser.setup_parser
Signature: (self) -> Any
Set up information needed for the parser
Parser.setup_postprocessors()
Full name: midgard.parsers._parser.setup_postprocessors
Signature: (self) -> List[Callable[[], NoneType]]
List postprocessors that should be called after parsing
Parser.update_dataset()
Full name: midgard.parsers._parser.update_dataset
Signature: (self, dset:Any) -> NoReturn
Update the given dataset with the parsed data
This is a basic implementation, assuming the self.data-dictionary has
a simple structure. More advanced parsers may need to reimplement this
method.
Args:
dset: The dataset to update with parsed data.
midgard.parsers._parser_chain
Basic functionality for parsing datafiles line by line
Description:
This module contains functions and classes for parsing datafiles.
Example:
from midgard import parsers
my_new_parser = parsers.parse_file('my_new_parser', 'file_name.txt', ...)
my_data = my_new_parser.as_dict()
ChainParser
Full name: midgard.parsers._parser_chain.ChainParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
An abstract base class that has basic methods for parsing a datafile
This class provides functionality for parsing a file with chained groups of information. You should inherit from
this one, and at least specify the necessary parameters in setup_parser.
ChainParser.parse_line()
Full name: midgard.parsers._parser_chain.parse_line
Signature: (self, line:str, cache:Dict[str, Any], parser:midgard.parsers._parser_chain.ParserDef) -> None
Parse line
A line is parsed by separating a line in fields. How the separation is done, is defined in the parser_def
entry of the ParserDef.
Args:
line: Line to be parsed.cache: Store temporary data.parser: Dictionary with defined parsers with the keys 'parser_def', 'label' and 'end_marker'.
ChainParser.read_data()
Full name: midgard.parsers._parser_chain.read_data
Signature: (self) -> None
Read data from a data file and parse the contents
ChainParser.setup_parser()
Full name: midgard.parsers._parser_chain.setup_parser
Signature: (self) -> Any
Set up information needed for the parser
Return an iterable of ParserDef's that describe the structure of the file that will be parsed
ParserDef
Full name: midgard.parsers._parser_chain.ParserDef
Signature: (end_marker:Callable[[str, int, str], bool], label:Callable[[str, int], Any], parser_def:Dict[Any, Dict[str, Any]], skip_line:Union[Callable[[str], bool], NoneType]=None, end_callback:Union[Callable[[Dict[str, Any]], NoneType], NoneType]=None)
A convenience class for defining the necessary fields of a parser
A single parser can read and parse one group of datalines, defined through the ParserDef by specifying how to parse each line (parser_def), how to identify each line (label), how to recognize the end of the group of lines (end_marker) and finally what (if anything) should be done after all lines in a group is read (end_callback).
The end_marker, label, skip_line and end_callback parameters should all be functions with the following signatures:
end_marker = func(line, line_num, next_line)
label = func(line, line_num)
skip_line = func(line)
end_callback = func(cache)
The parser definition parser_def includes the parser, field, strip and delimiter entries. The parser
entry points to the parser function and the field entry defines how to separate the line in fields. The separated
fields are saved either in a dictionary or in a list. In the last case the line is split on whitespace by
default. With the delimiter entry the default definition can be overwritten. Leading and trailing whitespace
characters are removed by default before a line is parsed. This default can be overwritten by defining the
characters, which should be removed with the 'strip' entry. The parser dictionary is defined like:
parser_def = { <label>: {'fields': <dict or list of fields>,
'parser': <parser function>,
'delimiter': <optional delimiter for splitting line>,
'strip': <optional characters to be removed from beginning and end of line>
}}
Args:
end_marker: A function returning True for the last line in a group.label: A function returning a label used in the parser_def.parser_def: A dict with 'parser' and 'fields' defining the parser.skip_line: A function returning True if the line should be skipped.end_callback: A function called after reading all lines in a group.
midgard.parsers._parser_line
Basic functionality for parsing datafiles line by line using Numpy
Description:
This module contains functions and classes for parsing datafiles.
Example:
from midgard import parsers
my_new_parser = parsers.parse_file('my_new_parser', 'file_name.txt', ...)
my_data = my_new_parser.as_dict()
LineParser
Full name: midgard.parsers._parser_line.LineParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
An abstract base class that has basic methods for parsing a datafile
This class provides functionality for using numpy to parse a file line by line. You should inherit from this one,
and at least specify the necessary parameters in setup_parser.
LineParser.read_data()
Full name: midgard.parsers._parser_line.read_data
Signature: (self) -> None
Read data from the data file
Uses the np.genfromtxt-function to parse the file. Any necessary
parameters should be set by setup_parser. Override
self.structure_data if the self.data-dictionary needs to be
structured in a particular way.
LineParser.setup_parser()
Full name: midgard.parsers._parser_line.setup_parser
Signature: (self) -> Any
Set up information needed for the parser
This method should return a dictionary which contains all parameters needed by np.genfromtxt to do the actual parsing.
LineParser.structure_data()
Full name: midgard.parsers._parser_line.structure_data
Signature: (self) -> None
Structure raw array data into the self.data dictionary
This simple implementation creates a dictionary with one item per column in the array. Override this method for more complex use cases.
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
Full name: midgard.parsers._parser_rinex.RinexHeader
Signature: (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
Full name: midgard.parsers._parser_rinex.RinexParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, 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_type()
Full name: midgard.parsers._parser_rinex.get_rinex_version_type
Signature: (self) -> Dict[str, str]
Get version and type of Rinex file
RinexParser.name (str)
name = 'Rinex'
RinexParser.parse_approx_position()
Full name: midgard.parsers._parser_rinex.parse_approx_position
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse station coordinates defined in RINEX header to instance variable data
RinexParser.parse_comment()
Full name: midgard.parsers._parser_rinex.parse_comment
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse comment lines in RINEX header to instance variable header['comment']
RinexParser.parse_data_lines()
Full name: midgard.parsers._parser_rinex.parse_data_lines
Signature: (self, lines, epoch_info)
RinexParser.parse_epoch_line()
Full name: midgard.parsers._parser_rinex.parse_epoch_line
Signature: (self, line)
RinexParser.parse_float()
Full name: midgard.parsers._parser_rinex.parse_float
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse float entries of RINEX header to instance variable header
RinexParser.parse_glonass_code_phase_bias()
Full name: midgard.parsers._parser_rinex.parse_glonass_code_phase_bias
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_glonass_slot
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_integer
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse integer entries of RINEX header to instance variable header
RinexParser.parse_leap_seconds()
Full name: midgard.parsers._parser_rinex.parse_leap_seconds
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_phase_shift
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_scale_factor
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse entries of RINEX header SYS / SCALE FACTOR to instance variable header
RinexParser.parse_string()
Full name: midgard.parsers._parser_rinex.parse_string
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse string entries of RINEX header to instance variable 'header'
RinexParser.parse_sys_dcbs_applied()
Full name: midgard.parsers._parser_rinex.parse_sys_dcbs_applied
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_sys_obs_types
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_sys_pcvs_applied
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_time_of_first_obs
Signature: (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()
Full name: midgard.parsers._parser_rinex.parse_time_of_last_obs
Signature: (self, fields:Dict[str, str]) -> Dict[str, Any]
Parse time of last observation given in RINEX header to instance variable header
RinexParser.read_data()
Full name: midgard.parsers._parser_rinex.read_data
Signature: (self) -> None
Read data from the data file
RinexParser.read_epochs()
Full name: midgard.parsers._parser_rinex.read_epochs
Signature: (self, fid) -> None
Read data from Rinex file
Add data to self.data
RinexParser.read_header()
Full name: midgard.parsers._parser_rinex.read_header
Signature: (self, fid) -> None
Read header from the rinex file
Add header information to self.header
RinexParser.structure_data()
Full name: midgard.parsers._parser_rinex.structure_data
Signature: (self) -> None
Convert lists of data to numpy arrays
parser_cache()
Full name: midgard.parsers._parser_rinex.parser_cache
Signature: (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
midgard.parsers._parser_sinex
Basic functionality for parsing Sinex datafiles
Description:
This module contains functions and classes for parsing Sinex datafiles.
References:
- SINEX Format: https://www.iers.org/IERS/EN/Organization/AnalysisCoordinator/SinexFormat/sinex.html
SinexBlock
Full name: midgard.parsers._parser_sinex.SinexBlock
Signature: (marker:str, fields:Tuple[midgard.parsers._parser_sinex.SinexField, ...], parser:Callable[[<built-in function array>, Tuple[str, ...]], Dict[str, Any]])
A convenience class for defining a Sinex block
Args:
marker: Sinex marker denoting the block.fields: Fields in Sinex block.parser: Function used to parse the data.
SinexField
Full name: midgard.parsers._parser_sinex.SinexField
Signature: (name:str, start_col:int, dtype:Union[str, NoneType], converter:Union[str, NoneType]=None)
A convenience class for defining the fields in a Sinex block
Args:
name: Name of field.start_col: Starting column of field (First column is 0)dtype: String, using numpy notation, defining type of field, use None to ignore field.converter: Optional, name of converter to apply to field data.
SinexParser
Full name: midgard.parsers._parser_sinex.SinexParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, header:bool=True) -> None
An abstract base class that has basic methods for parsing a Sinex file
This class provides functionality for parsing a sinex file with chained
groups of information. You should inherit from this one, and at least
specify which Sinex blocks you are interested in by implementing
setup_parser, as well as implement methods that parse each block if
needed.
SinexParser.as_dataframe()
Full name: midgard.parsers._parser_sinex.as_dataframe
Signature: (self, index:Union[str, List[str], NoneType]=None, marker:Union[str, NoneType]=None) -> pandas.core.frame.DataFrame
Return the parsed data as a Pandas DataFrame
This is a basic implementation, assuming the self.data-dictionary has
a simple structure. More advanced parsers may need to reimplement this
method.
Args:
marker: Only return data from this marker in the DataFrame.index: Name of field to use as index. May also be a list of strings.
Returns:
Pandas DataFrame with the parsed data.
SinexParser.parse_bias_epochs()
Full name: midgard.parsers._parser_sinex.parse_bias_epochs
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_blocks()
Full name: midgard.parsers._parser_sinex.parse_blocks
Signature: (self, fid:Iterable[bytes]) -> None
Parse contents of Sinex blocks
Contents of Sinex blocks are stored as separate numpy-arrays in self._sinex
Args:
fid: Pointer to file being read.
SinexParser.parse_file_comment()
Full name: midgard.parsers._parser_sinex.parse_file_comment
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_file_reference()
Full name: midgard.parsers._parser_sinex.parse_file_reference
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_header_line()
Full name: midgard.parsers._parser_sinex.parse_header_line
Signature: (self, header_line:bytes) -> None
Parse header of Sinex file
Header information is stored in self.meta.
Args:
header_line: First line of Sinex file.
SinexParser.parse_input_acknowledgements()
Full name: midgard.parsers._parser_sinex.parse_input_acknowledgements
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_input_files()
Full name: midgard.parsers._parser_sinex.parse_input_files
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_input_history()
Full name: midgard.parsers._parser_sinex.parse_input_history
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_lines()
Full name: midgard.parsers._parser_sinex.parse_lines
Signature: (self, lines:List[bytes], fields:Tuple[midgard.parsers._parser_sinex.SinexField, ...]) -> <built-in function array>
Parse lines in a Sinex file
Args:
lines: Lines to parse.fields: Definition of sinex fields in lines.
Returns:
Data contained in lines.
SinexParser.parse_nutation_data()
Full name: midgard.parsers._parser_sinex.parse_nutation_data
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_precession_data()
Full name: midgard.parsers._parser_sinex.parse_precession_data
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_satellite_id()
Full name: midgard.parsers._parser_sinex.parse_satellite_id
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_satellite_phase_center()
Full name: midgard.parsers._parser_sinex.parse_satellite_phase_center
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_antenna()
Full name: midgard.parsers._parser_sinex.parse_site_antenna
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_data()
Full name: midgard.parsers._parser_sinex.parse_site_data
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_eccentricity()
Full name: midgard.parsers._parser_sinex.parse_site_eccentricity
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_gal_phase_center()
Full name: midgard.parsers._parser_sinex.parse_site_gal_phase_center
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_gps_phase_center()
Full name: midgard.parsers._parser_sinex.parse_site_gps_phase_center
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_id()
Full name: midgard.parsers._parser_sinex.parse_site_id
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_site_receiver()
Full name: midgard.parsers._parser_sinex.parse_site_receiver
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_solution_apriori()
Full name: midgard.parsers._parser_sinex.parse_solution_apriori
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_solution_epochs()
Full name: midgard.parsers._parser_sinex.parse_solution_epochs
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_solution_estimate()
Full name: midgard.parsers._parser_sinex.parse_solution_estimate
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_solution_matrix_apriori()
Full name: midgard.parsers._parser_sinex.parse_solution_matrix_apriori
Signature: (self:'SinexParser', data:<built-in function array>, lower_upper:str, type:str='') -> Dict[str, Any]
Parser for SOLUTION/MATRIX_APRIORI data
Converts the input data to a symmetric matrix and adds it to self.data['SOLUTION/MATRIX_APRIORI'].
The NEQ-Matrix Row/Column Number correspond to the Estimated Parameters Index in the SOLUTION/ESTIMATE block. Missing elements in the matrix are assumed to be zero (0); consequently, zero elements may be omitted to reduce the size of this block.
Args:
data: Input data, raw data for SOLUTION/MATRIX_APRIORI block.lower_upper: Either 'L' or 'U', indicating whether the matrix is given in lower or upper form.type: Information about the type of matrix, optional.
Returns:
Dictionary with symmetric matrix as a numpy array.
SinexParser.parse_solution_matrix_estimate()
Full name: midgard.parsers._parser_sinex.parse_solution_matrix_estimate
Signature: (self:'SinexParser', data:<built-in function array>, lower_upper:str, type:str='') -> Dict[str, Any]
Parser for SOLUTION/MATRIX_ESTIMATE data
Converts the input data to a symmetric matrix and adds it to self.data['SOLUTION/MATRIX_ESTIMATE'].
The NEQ-Matrix Row/Column Number correspond to the Estimated Parameters Index in the SOLUTION/ESTIMATE block. Missing elements in the matrix are assumed to be zero (0); consequently, zero elements may be omitted to reduce the size of this block.
Args:
data: Input data, raw data for SOLUTION/MATRIX_ESTIMATE block.lower_upper: Either 'L' or 'U', indicating whether the matrix is given in lower or upper form.type: Information about the type of matrix, optional.
Returns:
Dictionary with symmetric matrix as a numpy array.
SinexParser.parse_solution_normal_equation_matrix()
Full name: midgard.parsers._parser_sinex.parse_solution_normal_equation_matrix
Signature: (self:'SinexParser', data:<built-in function array>, lower_upper:str, type:str='') -> Dict[str, Any]
Parser for SOLUTION/NORMAL_EQUATION_MATRIX data
Converts the input data to a symmetric matrix and adds it to self.data['SOLUTION/NORMAL_EQUATION_MATRIX'].
The NEQ-Matrix Row/Column Number correspond to the Estimated Parameters Index in the SOLUTION/ESTIMATE block. Missing elements in the matrix are assumed to be zero (0); consequently, zero elements may be omitted to reduce the size of this block.
Args:
data: Input data, raw data for SOLUTION/NORMAL_EQUATION_MATRIX block.lower_upper: Either 'L' or 'U', indicating whether the matrix is given in lower or upper form.type: Information about the type of matrix, optional.
Returns:
Dictionary with symmetric matrix as a numpy array.
SinexParser.parse_solution_normal_equation_vector()
Full name: midgard.parsers._parser_sinex.parse_solution_normal_equation_vector
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_solution_statistics()
Full name: midgard.parsers._parser_sinex.parse_solution_statistics
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.parse_source_id()
Full name: midgard.parsers._parser_sinex.parse_source_id
Signature: (self:'SinexParser', data:<built-in function array>, *params:str) -> Dict[str, Any]
Simple parser for Sinex data
Converts the input data to a dictionary of numpy arrays and returns it in order to add it to self.data['{marker}']. Ignores any block title parameters.
Args:
data: Input data, raw data for the block.params: Tuple of strings with parameters given after the marker at the start of the block.
Returns:
Dictionary with each column in the Sinex file as a numpy array.
SinexParser.read_data()
Full name: midgard.parsers._parser_sinex.read_data
Signature: (self) -> None
Read data from a Sinex file and parse the contents
First the whole Sinex file is read and the requested blocks are stored in self._sinex. After the file has been read, a parser is called on each block so that self.data is properly populated.
SinexParser.setup_parser()
Full name: midgard.parsers._parser_sinex.setup_parser
Signature: (self) -> Any
Set up information needed for the parser
Each individual Sinex-parser should at least implement this method.
If the order the blocks are parsed is not important, the information should be returned as a set for optimal performance. If the parsing order is important, a tuple of SinexBlock-objects may be returned instead.
Returns:
Iterable of blocks in the Sinex file that should be parsed.
parsing_factory()
Full name: midgard.parsers._parser_sinex.parsing_factory
Signature: () -> Callable[..., Dict[str, Any]]
Create a default parsing function for a Sinex block
The default parsing function returns a dictionary containing all fields of the block as separated arrays. This will be stored in self.data['{marker}'] with the {marker} of the current block.
Returns:
Simple parsing function for one Sinex block.
parsing_matrix_factory()
Full name: midgard.parsers._parser_sinex.parsing_matrix_factory
Signature: (marker:str, size_marker:str) -> Callable[..., Dict[str, Any]]
Create a parsing function for parsing a matrix within a Sinex block
The default parsing function converts data to a symmetric matrix and stores
it inside self.data[marker].
The size of the matrix is set to equal the number of parameters in the
size_marker-block. If that block is not parsed/found. The size is set to
the last given row index. If some zero elements in the matrix are omitted
this might be wrong.
Args:
marker: Marker of Sinex block.size_marker: Marker of a different Sinex block indicating the size of the matrix.
Returns:
Simple parsing function for one Sinex block.
midgard.parsers.anubis
A parser for reading Anubis xtr-files
AnubisXtrParser
Full name: midgard.parsers.anubis.AnubisXtrParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading Anubis XTR files
AnubisXtrParser.read_data()
Full name: midgard.parsers.anubis.read_data
Signature: (self) -> None
Read data and store in .data dictionary
midgard.parsers.bcecmp_sisre
A parser for reading DLR BCEcmp Software SISRE output files
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='bcecmp_sisre', file_path='BCEcmp_GAL_FNAV_E1E5A_com_2018_032.OUT')
data = p.as_dict()
Description:
Reads data from files in the BCEcmp Software output file format. The BCEcmp Software is developed and used by DLR.
BcecmpParser
Full name: midgard.parsers.bcecmp_sisre.BcecmpParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading DLR BCEcmp Software output files.
The following data are available after reading BCEcmp Software output file:
| Key | Description |
|---|---|
| age_min | age of ephemeris in [min] |
| clk_diff_sys | Satellite clock correction difference in [m] |
| dalong_track | Along-track orbit difference in [m] |
| dcross_track | Cross-track orbit difference in [m] |
| dradial | Radial orbit difference in [m] |
| dradial_wul | Worst-user-location (wul) SISRE? |
| satellite | Satellite PRN number together with GNSS identifier (e.g. G07) |
| sisre | Signal-in-space range error [m] |
| time | Observation time |
| used_iodc | GPS: IODC (Clock issue of data indicates changes (set equal to IODE)) |
| QZSS: IODC | |
| used_iode | Ephemeris issue of data indicates changes to the broadcast ephemeris: |
| - GPS: Ephemeris issue of data (IODE), which is set equal to IODC | |
| - Galileo: Issue of Data of the NAV batch (IODnav) | |
| - QZSS: Ephemeris issue of data (IODE) | |
| - BeiDou: Age of Data Ephemeris (AODE) | |
| - IRNSS: Issue of Data, Ephemeris and Clock (IODEC) |
and meta-data:
| Key | Description |
|---|---|
| __data_path__ | File path |
| __parser_name__ | Parser name |
BcecmpParser.setup_parser()
Full name: midgard.parsers.bcecmp_sisre.setup_parser
Signature: (self) -> Iterable[midgard.parsers._parser_chain.ParserDef]
Parsers defined for reading BCEcmp Software output file line by line.
BcecmpParser.setup_postprocessors()
Full name: midgard.parsers.bcecmp_sisre.setup_postprocessors
Signature: (self) -> List[Callable[[], NoneType]]
List steps necessary for postprocessing
midgard.parsers.galileo_constellation_html
A parser for reading Galileo constellation info from a web page
See https://www.gsc-europa.eu/system-status/Constellation-Information for an example
GalileoConstellationHTMLParser
Full name: midgard.parsers.galileo_constellation_html.GalileoConstellationHTMLParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger:Union[Callable[[str], NoneType], NoneType]=<built-in function print>, url:Union[str, NoneType]=None) -> None
A parser for reading Galileo constellation info from a web page
See https://www.gsc-europa.eu/system-status/Constellation-Information for an example
GalileoConstellationHTMLParser.URL (str)
URL = 'https://www.gsc-europa.eu/system-status/Constellation-Information'
GalileoConstellationHTMLParser.download_html()
Full name: midgard.parsers.galileo_constellation_html.download_html
Signature: (self, url:Union[str, NoneType]=None) -> None
Download html file from url
TODO: Move this to files/url.py
Args:
url: URL to download from, if None use self.URL instead.
GalileoConstellationHTMLParser.read_data()
Full name: midgard.parsers.galileo_constellation_html.read_data
Signature: (self) -> None
Read tables from the HTML file
The satellite table is placed in self.data, while the NAGU events are placed in self.meta["events"].
GalileoConstellationHTMLParser.satellite_id()
Full name: midgard.parsers.galileo_constellation_html.satellite_id
Signature: (self, sat_id:str) -> Dict[str, Any]
Get satellite info from satellite vehicle ID
Args:
sat_id: ID of satellite, for example E01.
Returns:
Dictionary with satellite info.
GalileoConstellationHTMLParser.satellite_name()
Full name: midgard.parsers.galileo_constellation_html.satellite_name
Signature: (self, sat_name:str) -> Dict[str, Any]
Get satellite info from name
Args:
sat_name: Name of satellite, for example GSAT0101.
Returns:
Dictionary with satellite info.
midgard.parsers.gipsy_tdp
A parser for reading NASA JPL Gipsy time dependent parameter (TDP) file
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='gipsy_tdp', file_path='final.tdp')
data = p.as_dict()
Description:
Reads data from files in Gipsy time dependent parameter (TDP) format.
GipsyTdpParser
Full name: midgard.parsers.gipsy_tdp.GipsyTdpParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading Gipsy time dependent parameter (TDP) file
Following data are available after reading Gipsy TDP output file:
| Key | Description |
|---|---|
| apriori_value | Nominal value. This field contains the last value used by the model. |
| name | Parameter name. |
| sigma | The sigma associated with the value of the parameter. A negative value indicates it |
| should be used for interpolation by the file reader read_time_variation in | |
| $GOA/libsrc/time_variation. If no sigmas are computed by the smapper, a 1.0 will be | |
| placed here. | |
| time_past_j2000 | Time given in GPS seconds past J2000. |
| value | Accumulated value of the parameter at time and includes any nominal, or iterative |
| correction. This is the only entry used by the model. |
and meta-data:
| Key | Description |
|---|---|
| __data_path__ | File path |
| __parser_name__ | Parser name |
GipsyTdpParser.setup_parser()
Full name: midgard.parsers.gipsy_tdp.setup_parser
Signature: (self) -> Dict[str, Any]
Set up information needed for the parser
This should return a dictionary with all parameters needed by np.genfromtxt to do the actual parsing.
TODO: Station name should be separated from parameter name.
Returns:
Dict: Parameters needed by np.genfromtxt to parse the input file.
midgard.parsers.gnss_antex
A parser for reading ANTEX format 1.4 data
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='gnss_antex', file_path='igs14.atx')
data = p.as_dict()
Description:
Reads data from files in the GNSS Antenna Exchange (ANTEX) file format version 1.4 (see :cite:antex).
AntexParser
Full name: midgard.parsers.gnss_antex.AntexParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading ANTEX file
The parser reads GNSS ANTEX format 1.4 (see :cite:antex).
The 'data' attribute is a dictionary with GNSS satellite PRN or receiver antenna as key. The GNSS satellite antenna corrections are time dependent and saved with "valid from" datetime object entry. The dictionary looks like:
dout = { <prn> : { <valid from>: { cospar_id: <value>,
sat_code: <value>,
sat_type: <value>,
valid_until: <value>,
azimuth: <list with azimuth values>,
elevation: <list with elevation values>,
<frequency>: { azi: [<list with azimuth-elevation dependent corrections>],
neu: [north, east, up],
noazi: [<list with elevation dependent corrections>] }}},
<receiver antenna> : { azimuth: <list with azimuth values>,
elevation: <list with elevation values>,
<frequency>: { azi: [<array with azimuth-elevation dependent corrections>],
neu: [north, east, up],
noazi: [<list with elevation dependent corrections>] }}}
with following entries:
| Value | Type | Description |
|---|---|---|
| azi | numpy.ndarray | Array with azimuth-elevation dependent antenna correction in [mm] with |
| the shape: number of azimuth values x number of elevation values. | ||
| azimuth | numpy.ndarray | List with azimuth values in [rad] corresponding to antenna corrections |
given in azi. |
||
| cospar_id | str | COSPAR ID |
| orbit, xxx -> sequential satellite number for that year, a -> alpha | ||
| numeric sequence number within a launch | ||
| elevation | numpy.ndarray | List with elevation values in [rad] corresponding to antenna |
corrections given in azi or noazi. |
||
| str | Frequency identifier (e.g. G01 - GPS L1) | |
| neu | list | North, East and Up eccentricities in [m]. The eccentricities of the |
| mean antenna phase center is given relative to the antenna reference | ||
| point (ARP) for receiver antennas or to the center of mass of the | ||
| satellite in X-, Y- and Z-direction. | ||
| noazi | numpy.ndarray | List with elevation dependent (non-azimuth-dependent) antenna |
| correction in [mm]. | ||
| str | Satellite code e.g. GPS PRN, GLONASS slot or Galileo SVID number | |
| str | Receiver antenna name together with radome code | |
| sat_code | str | Satellite code e.g. GPS SVN, GLONASS number or Galileo GSAT number |
| sat_type | str | Satellite type (e.g. BLOCK IIA) |
| valid_from | datetime.datetime | Start of validity period of satellite in GPS time |
| valid_until | datetime.datetime | End of validity period of satellite in GPS time |
The 'meta' attribute is a dictionary with following entries:
| Value | Type | Description |
|---|---|---|
| comment | list | Header commments given in list line by line |
| pcv_type | str | Phase center variation type |
| ref_antenna | str | Reference antenna type for relative antenna |
| ref_serial_num | str | Serial number of the reference antenna |
| sat_sys | str | Satellite system |
| version | str | Format version |
Attributes:
data: (dict), Contains the (observation) data read from file.data_available: (bool), Indicator of whether data are available.file_path: (pathlib.Path), File path.parser_name: (str), Parser name.meta: (dict), Contains metainformation read from file.
AntexParser.parse_comment()
Full name: midgard.parsers.gnss_antex.parse_comment
Signature: (self, line:Dict[str, str], _:Dict[str, Any]) -> None
Parse comment lines in ANTEX header.
AntexParser.parse_correction()
Full name: midgard.parsers.gnss_antex.parse_correction
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse antenna corrections entries of ANTEX antenna section.
AntexParser.parse_default_meta()
Full name: midgard.parsers.gnss_antex.parse_default_meta
Signature: (self, line:Dict[str, str], _:Dict[str, Any]) -> None
Add the contents of line to meta
Args:
line: Dict containing the fields of a line.
AntexParser.parse_num_of_frequencies()
Full name: midgard.parsers.gnss_antex.parse_num_of_frequencies
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse '# OF FREQUENCIES' entry of ANTEX antenna section.
AntexParser.parse_section_float()
Full name: midgard.parsers.gnss_antex.parse_section_float
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse float entries of ANTEX header.
AntexParser.parse_section_string()
Full name: midgard.parsers.gnss_antex.parse_section_string
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse string entries of ANTEX header.
AntexParser.parse_string()
Full name: midgard.parsers.gnss_antex.parse_string
Signature: (self, line:Dict[str, str], _:Dict[str, Any]) -> None
Parse string entries of ANTEX header.
AntexParser.parse_valid_from()
Full name: midgard.parsers.gnss_antex.parse_valid_from
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse 'VALID FROM' entries of ANTEX antenna section.
AntexParser.parse_valid_until()
Full name: midgard.parsers.gnss_antex.parse_valid_until
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Parse 'VALID UNTIL' entries of ANTEX antenna section.
AntexParser.save_correction()
Full name: midgard.parsers.gnss_antex.save_correction
Signature: (self, line:Dict[str, str], cache:Dict[str, Any]) -> None
Save antenna correction in data structures.
The antenna corrections are saved after reading of corrections for one frequency. Antenna correction data are saved in following data structure, whereby satellite antenna corrections are time dependent:
self.data = { <prn> : { <valid from>: { cospar_id: <value>,
sat_code: <value>,
sat_type: <value>,
valid_until: <value>,
azimuth: <list with azimuth values>,
elevation: <list with elevation values>,
<frequency>: { azi: [<list with azimuth-elevation dependent corrections>],
neu: [north, east, up],
noazi: [<list with elevation dependent corrections>] }}},
<receiver antenna> : { azimuth: <list with azimuth values>,
elevation: <list with elevation values>,
<frequency>: { azi: [<array with azimuth-elevation dependent corrections>],
neu: [north, east, up],
noazi: [<list with elevation dependent corrections>] }}
}
AntexParser.setup_parser()
Full name: midgard.parsers.gnss_antex.setup_parser
Signature: (self) -> Iterable[midgard.parsers._parser_chain.ParserDef]
Parsers defined for reading ANTEX file line by line.
First the ANTEX header information are read and afterwards the ANTEX corrections.
midgard.parsers.gnss_sinex_igs
A parser for reading data from igs.snx file based on IGS sitelog files in SINEX format
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='gnss_sinex_igs', file_path='igs.snx')
data = p.as_dict()
Description:
Reads station information (e.g. approximated station coordinates, receiver and antenna type, station eccentricities, ...) igs.snx file in SINEX format.
IgsSnxParser
Full name: midgard.parsers.gnss_sinex_igs.IgsSnxParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, header:bool=True) -> None
A parser for reading data from igs.snx file based on IGS sitelog files in SINEX format
site - Site dictionary, whereby keys are the site identifiers and values are a site entry dictionary with the keys 'site_antenna', 'site_eccentricity', 'site_id' and 'site_receiver'. The site dictionary has following strucuture:
self.site[site] = { 'site_antenna': [], # SITE/ANTENNA SINEX block information
'site_eccentricity': [], # SITE/ECCENTRICITY block information
'site_id': {}, # SITE/ID block information
'site_receiver': [], # SITE/RECEIVER block information }
with the site entry dictionary entries
site_antenna[ii] = { 'point_code': point_code,
'soln': soln,
'obs_code': obs_code,
'start_time': start_time,
'end_time': end_time,
'antenna_type': antenna_type,
'radome_type': radome_type,
'serial_number': serial_number }
site_eccentricity[ii] = { 'point_code': point_code,
'soln': soln,
'obs_code': obs_code,
'start_time': start_time,
'end_time': end_time,
'reference_system': reference_system,
'vector_1': vector_1,
'vector_2': vector_2,
'vector_3': vector_3,
'vector_type': UNE }
site_id = { 'point_code': point_code,
'domes': domes,
'marker': marker,
'obs_code': obs_code,
'description': description,
'approx_lon': approx_lon,
'approx_lat': approx_lat,
'approx_height': approx_height }
site_receiver[ii] = { 'point_code': point_code,
'soln': soln,
'obs_code': obs_code,
'start_time': start_time,
'end_time': end_time,
'receiver_type': receiver_type,
'serial_number': serial_number,
'firmware': firmware }
The counter 'ii' ranges from 0 to n and depends on how many antenna type, receiver type and
antenna monument changes were done at each site. Note also, that time entries (e.g. start_time,
end_time) are given in Modified Julian Date. If the time is defined as 00:000:00000 in the SINEX
file, then the value is saved as 'None' in the Sinex class.
IgsSnxParser.parse_site_antenna()
Full name: midgard.parsers.gnss_sinex_igs.parse_site_antenna
Signature: (self, data)
Parse SITE/ANTENNA SINEX block
IgsSnxParser.parse_site_eccentricity()
Full name: midgard.parsers.gnss_sinex_igs.parse_site_eccentricity
Signature: (self, data)
Parse SITE/ECCENTRICITY SINEX block
IgsSnxParser.parse_site_id()
Full name: midgard.parsers.gnss_sinex_igs.parse_site_id
Signature: (self, data)
Parse SITE/ID SINEX block
IgsSnxParser.parse_site_receiver()
Full name: midgard.parsers.gnss_sinex_igs.parse_site_receiver
Signature: (self, data)
Parse SITE/RECEIVER SINEX block
IgsSnxParser.setup_parser()
Full name: midgard.parsers.gnss_sinex_igs.setup_parser
Signature: (self)
midgard.parsers.rinex2_nav_header
RINEX navigation header classes for file format version 2.xx
Rinex2NavHeaderMixin
Full name: midgard.parsers.rinex2_nav_header.Rinex2NavHeaderMixin
Signature: ()
A mixin defining which RINEX navigation headers are mandatory and optional in RINEX version 2.xx
Rinex2NavHeaderParser
Full name: midgard.parsers.rinex2_nav_header.Rinex2NavHeaderParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading just the RINEX version 2.xx navigation header
The data in the rinex file will not be parsed.
Rinex2NavHeaderParser.name (str)
name = 'Rinex'
Rinex2NavHeaderParser.read_epochs()
Full name: midgard.parsers.rinex2_nav_header.read_epochs
Signature: (self, fid) -> None
Do not read data from Rinex file
Skip reading of data.
midgard.parsers.rinex2_obs_header
RINEX observation header classes for file format version 3.xx
Rinex2ObsHeaderMixin
Full name: midgard.parsers.rinex2_obs_header.Rinex2ObsHeaderMixin
Signature: ()
A mixin defining which RINEX observation headers are mandatory and optional in RINEX version 2.xx
Rinex2ObsHeaderParser
Full name: midgard.parsers.rinex2_obs_header.Rinex2ObsHeaderParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading just the RINEX version 2.xx observation header
The data in the rinex file will not be parsed.
Rinex2ObsHeaderParser.name (str)
name = 'Rinex'
Rinex2ObsHeaderParser.read_epochs()
Full name: midgard.parsers.rinex2_obs_header.read_epochs
Signature: (self, fid) -> None
Do not read data from Rinex file
Skip reading of data.
midgard.parsers.rinex3_clk
A parser for reading RINEX clock files with version 3.xx
Rinex3ClkParser
Full name: midgard.parsers.rinex3_clk.Rinex3ClkParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading RINEX clock files with version 3.xx
Rinex3ClkParser.name (str)
name = 'Rinex'
midgard.parsers.rinex3_clk_header
RINEX clock header classes for file format version 3.xx
Rinex3ClkHeaderMixin
Full name: midgard.parsers.rinex3_clk_header.Rinex3ClkHeaderMixin
Signature: ()
A mixin defining which RINEX clock headers are mandatory and optional in RINEX version 3.xx
Rinex3ClkHeaderParser
Full name: midgard.parsers.rinex3_clk_header.Rinex3ClkHeaderParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading just the RINEX version 3.xx clock header
The data in the rinex file will not be parsed.
Rinex3ClkHeaderParser.name (str)
name = 'Rinex'
Rinex3ClkHeaderParser.read_epochs()
Full name: midgard.parsers.rinex3_clk_header.read_epochs
Signature: (self, fid) -> None
Do not read data from Rinex file
Skip reading of data.
midgard.parsers.rinex3_nav_header
RINEX navigation header classes for file format version 3.xx
Rinex3NavHeaderMixin
Full name: midgard.parsers.rinex3_nav_header.Rinex3NavHeaderMixin
Signature: ()
A mixin defining which RINEX navigation headers are mandatory and optional in RINEX version 3.xx
Rinex3NavHeaderParser
Full name: midgard.parsers.rinex3_nav_header.Rinex3NavHeaderParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading just the RINEX version 3.xx navigation header
The data in the rinex file will not be parsed.
Rinex3NavHeaderParser.name (str)
name = 'Rinex'
Rinex3NavHeaderParser.read_epochs()
Full name: midgard.parsers.rinex3_nav_header.read_epochs
Signature: (self, fid) -> None
Do not read data from Rinex file
Skip reading of data.
midgard.parsers.rinex3_obs_header
RINEX observation header classes for file format version 3.xx
Rinex3ObsHeaderMixin
Full name: midgard.parsers.rinex3_obs_header.Rinex3ObsHeaderMixin
Signature: ()
A mixin defining which RINEX observation headers are mandatory and optional in RINEX version 3.xx
Rinex3ObsHeaderParser
Full name: midgard.parsers.rinex3_obs_header.Rinex3ObsHeaderParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading just the RINEX version 3.xx observation header
The data in the rinex file will not be parsed.
Rinex3ObsHeaderParser.name (str)
name = 'Rinex'
Rinex3ObsHeaderParser.read_epochs()
Full name: midgard.parsers.rinex3_obs_header.read_epochs
Signature: (self, fid) -> None
Do not read data from Rinex file
Skip reading of data.
midgard.parsers.terrapos_position
A parser for reading Terrapos position output file
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='terrapos_position', file_path='Gal_C1X_brdc_land_30sec_24hrs_FNAV-file.txt')
data = p.as_dict()
Description:
Reads data from files in Terrapos position output format.
TerraposPositionParser
Full name: midgard.parsers.terrapos_position.TerraposPositionParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading Terrapos position output file
Following data are available after reading Terrapos position file:
| Key | Description |
|---|---|
| gpsweek | GPS week |
| gpssec | Seconds of GPS week |
| head | Head in [deg] |
| height | Ellipsoidal height in [m] |
| lat | Latitude in [deg] |
| lon | Longitude in [deg] |
| num_sat | Number of satellites |
| pdop | Position Dilution of Precision (PDOP) |
| pitch | Pitch in [deg] |
| reliability_east | East position external reliability in [m] #TODO: Is that correct? |
| reliability_height | Height position external reliability in [m] #TODO: Is that correct? |
| reliability_north | North position external reliability in [m] #TODO: Is that correct? |
| roll | Roll in [deg] |
| sigma_east | Standard deviation of East position in [m] #TODO: Is that correct? |
| sigma_height | Standard deviation of Height position in [m] #TODO: Is that correct? |
| sigma_north | Standard deviation of North position in [m] #TODO: Is that correct? |
and meta-data:
| Key | Description |
|---|---|
| __data_path__ | File path |
| __parser_name__ | Parser name |
TerraposPositionParser.setup_parser()
Full name: midgard.parsers.terrapos_position.setup_parser
Signature: (self) -> Dict[str, Any]
Set up information needed for the parser
This should return a dictionary with all parameters needed by np.genfromtxt to do the actual parsing.
Returns:
Dict: Parameters needed by np.genfromtxt to parse the input file.
midgard.parsers.terrapos_residual
A parser for reading Terrapos residual file
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='terrapos_residual', file_path='PPP-residuals.txt')
data = p.as_dict()
Description:
Reads data from files in Terrapos residual format.
TerraposResidualParser
Full name: midgard.parsers.terrapos_residual.TerraposResidualParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading Terrapos residual file
Following data are available after reading Terrapos residual file:
| Parameter | Description |
|---|---|
| azimuth | Azimuth of satellites in [deg] |
| elevation | Elevation of satellites in [deg] |
| gpsweek | GPS week |
| gpssec | Seconds of GPS week |
| residual_code | Code (pseudorange) residuals in [m] |
| residual_doppler | Doppler residuals in [m] |
| residual_phase | Carrier-phase residuals in [m] |
| satellite | Satellite PRN number together with GNSS identifier (e.g. G07) |
| system | GNSS identifier |
and meta-data:
| Key | Description |
|---|---|
| __data_path__ | File path |
| __parser_name__ | Parser name |
TerraposResidualParser.setup_parser()
Full name: midgard.parsers.terrapos_residual.setup_parser
Signature: (self) -> Dict[str, Any]
Set up information needed for the parser
This should return a dictionary with all parameters needed by np.genfromtxt to do the actual parsing.
Returns:
Dict: Parameters needed by np.genfromtxt to parse the input file.
TerraposResidualParser.setup_postprocessors()
Full name: midgard.parsers.terrapos_residual.setup_postprocessors
Signature: (self) -> List[Callable[[], NoneType]]
List steps necessary for postprocessing
midgard.parsers.timeseries_env
A parser for reading timeseries files in ENV format
Example:
from midgard import parsers
p = parsers.parse_file(parser_name='timeseries_env', file_path='stas.env')
data = p.as_dict()
Description:
Reads data from files timeseries files in ENV (east, north, vertical) format
TimeseriesEnvParser
Full name: midgard.parsers.timeseries_env.TimeseriesEnvParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading timeseries files in ENV format
Following data are available after reading timeseries ENV file:
| Key | Description |
|---|---|
| date | Date in format yyMMMdd (e.g. 18MAY10). |
| year | Date in unit year. |
| east | East coordinate in [mm]. |
| east_sigma | Standard devication of east coordinate in [mm]. |
| north | North coordinate in [mm]. |
| north_sigma | Standard devication of north coordinate in [mm]. |
| vertical | Vertical coordinate in [mm]. |
| vertical_sigma | Standard devication of vertical coordinate in [mm]. |
and meta-data:
| Key | Description |
|---|---|
| __data_path__ | File path |
| __params__ | np.genfromtxt parameters |
| __parser_name__ | Parser name |
TimeseriesEnvParser.as_dataset()
Full name: midgard.parsers.timeseries_env.as_dataset
Signature: (self, ref_pos)
TimeseriesEnvParser.setup_parser()
Full name: midgard.parsers.timeseries_env.setup_parser
Signature: (self) -> Dict[str, Any]
Set up information needed for the parser
This should return a dictionary with all parameters needed by np.genfromtxt to do the actual parsing.
Returns:
Dict: Parameters needed by np.genfromtxt to parse the input file.
midgard.parsers.vlbi_source_names
A parser for reading IVS source names translation table
VlbiSourceNamesParser
Full name: midgard.parsers.vlbi_source_names.VlbiSourceNamesParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None) -> None
A parser for reading IVS source names translation table
See https://vlbi.gsfc.nasa.gov/output for an example of a IVS source name file
VlbiSourceNamesParser.setup_parser()
Full name: midgard.parsers.vlbi_source_names.setup_parser
Signature: (self) -> Dict[str, Any]
Set up information needed for the parser
This should return a dictionary with all parameters needed by np.genfromtxt to do the actual parsing.
Returns:
Parameters needed by np.genfromtxt to parse the input file.
VlbiSourceNamesParser.structure_data()
Full name: midgard.parsers.vlbi_source_names.structure_data
Signature: (self) -> None
Structure raw array data into the self.data dictionary
Using the IVS name as key.
midgard.parsers.wip_rinex
A parser for reading Rinex files
rinex()
Full name: midgard.parsers.wip_rinex.rinex
Signature: (**parser_args:Any) -> midgard.parsers._parser_rinex.RinexParser
Dispatch to correct subclass based on Rinex file type
midgard.parsers.wip_rinex2_nav
A parser for reading RINEX navigation files with version 2.xx
Rinex2NavParser
Full name: midgard.parsers.wip_rinex2_nav.Rinex2NavParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading RINEX navigation files with version 2.xx
Rinex2NavParser.name (str)
name = 'Rinex'
midgard.parsers.wip_rinex2_obs
A parser for reading RINEX observation files with version 2.xx
Rinex2ObsParser
Full name: midgard.parsers.wip_rinex2_obs.Rinex2ObsParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading RINEX observation files with version 2.xx
Rinex2ObsParser.name (str)
name = 'Rinex'
midgard.parsers.wip_rinex3_nav
A parser for reading RINEX navigation files with version 3.xx
Rinex3NavParser
Full name: midgard.parsers.wip_rinex3_nav.Rinex3NavParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading RINEX navigation files with version 3.xx
Rinex3NavParser.name (str)
name = 'Rinex'
midgard.parsers.wip_rinex3_obs
A parser for reading RINEX observation files with version 3.xx
Rinex3ObsParser
Full name: midgard.parsers.wip_rinex3_obs.Rinex3ObsParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
A parser for reading RINEX observation files with version 3.xx
Rinex3ObsParser.EPOCH_FIELDS (dict)
EPOCH_FIELDS = {'identifier': (0, 1), 'year': (2, 6), 'month': (7, 9), 'day': (10, 12), 'hour': (13, 15), 'minute': (16, 18), 'second': (19, 21), 'frac_sec': (21, 29), 'epoch_flag': (30, 32), 'num_data_lines': (33, 35)}
Rinex3ObsParser.as_dataframe()
Full name: midgard.parsers.wip_rinex3_obs.as_dataframe
Signature: (self, system:str, index:Union[str, List[str], NoneType]=None) -> pandas.core.frame.DataFrame
Return the parsed data as a Pandas DataFrame
This is a basic implementation, assuming the self.data-dictionary has
a simple structure. More advanced parsers may need to reimplement this
method.
Args:
sys: Which system to create a datafrom for.index: Optional name of field to use as index. May also be a list of strings.
Returns:
Pandas DataFrame with the parsed data.
Rinex3ObsParser.name (str)
name = 'Rinex'
Rinex3ObsParser.parse_data_lines()
Full name: midgard.parsers.wip_rinex3_obs.parse_data_lines
Signature: (self, lines, epoch_info) -> Dict[str, Any]
Read one section of data lines
Rinex3ObsParser.parse_epoch_line()
Full name: midgard.parsers.wip_rinex3_obs.parse_epoch_line
Signature: (self, line) -> Dict[str, Any]
Read data from Rinex file
Add data to self.data
midgard.parsers.wip_rinex_clk
A parser for reading Rinex navigation files
RinexClkParser
Full name: midgard.parsers.wip_rinex_clk.RinexClkParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
Class for defining common methods for RINEX clock parsers.
RinexClkParser.name (str)
name = 'Rinex'
rinex_clk()
Full name: midgard.parsers.wip_rinex_clk.rinex_clk
Signature: (**parser_args:Any) -> midgard.parsers._parser_rinex.RinexParser
Dispatch to correct subclass based on version in Rinex file
midgard.parsers.wip_rinex_nav
A parser for reading Rinex navigation files
RinexNavParser
Full name: midgard.parsers.wip_rinex_nav.RinexNavParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
Class for defining common methods for RINEX navigation parsers.
RinexNavParser.name (str)
name = 'Rinex'
rinex_nav()
Full name: midgard.parsers.wip_rinex_nav.rinex_nav
Signature: (**parser_args:Any) -> midgard.parsers._parser_rinex.RinexParser
Dispatch to correct subclass based on version in Rinex file
midgard.parsers.wip_rinex_obs
A parser for reading Rinex observation files
RinexObsParser
Full name: midgard.parsers.wip_rinex_obs.RinexObsParser
Signature: (file_path:Union[str, pathlib.Path], encoding:Union[str, NoneType]=None, logger=<built-in function print>, sampling_rate:Union[int, NoneType]=None, strict:bool=False) -> None
Class for defining common methods for RINEX observation parsers.
RinexObsParser.name (str)
name = 'Rinex'
rinex_obs()
Full name: midgard.parsers.wip_rinex_obs.rinex_obs
Signature: (**parser_args:Any) -> midgard.parsers._parser_rinex.RinexParser
Dispatch to correct subclass based on version in Rinex file