![]() |
Ginan
|
Implementation of RINEX file format processing and observation handling. More...
Implementation of RINEX file format processing and observation handling.
This file implements comprehensive RINEX (Receiver Independent Exchange Format) file processing capabilities including:
The implementation follows SOLID principles with single-responsibility functions and a staging pattern for robust data processing.
Functions | |
FileType | CLK__ () |
FileType | RNX__ () |
void | setstr (char *dst, const char *src, int n) |
Set string without trailing spaces. | |
void | decodeObsH (std::istream &inputStream, string &line, double ver, E_TimeSys &tsys, map< E_Sys, map< int, CodeType > > &sysCodeTypes, Navigation &nav, RinexStation &rnxRec) |
Decode RINEX observation file header. | |
void | decodeNavH (string &line, E_Sys sys, Navigation &nav) |
Decode RINEX navigation file header. | |
void | decodeGnavH (string &line, Navigation &nav) |
Decode GLONASS navigation file header. | |
void | decodeHnavH (string &line, Navigation &nav) |
Decode SBAS/Geostationary navigation file header. | |
int | readRnxH (std::istream &inputStream, double &ver, char &type, E_Sys &sys, E_TimeSys &tsys, map< E_Sys, map< int, CodeType > > &sysCodeTypes, Navigation &nav, RinexStation &rnxRec) |
Read RINEX file header section. | |
int | decodeObsEpoch (std::istream &inputStream, string &line, double ver, E_TimeSys tsys, GTime &time, int &flag, vector< SatSys > &sats) |
Decode observation epoch header information. | |
int | decodeObsDataRinex2 (std::istream &inputStream, string &line, map< E_Sys, map< int, CodeType > > &sysCodeTypes, GObs &obs, SatSys &v2SatSys, RinexStation &rnxRec) |
Decode RINEX 2 observation data. | |
int | decodeObsDataRinex3 (std::istream &inputStream, string &line, map< E_Sys, map< int, CodeType > > &sysCodeTypes, GObs &obs, RinexStation &rnxRec) |
Decode RINEX 3 observation data. | |
int | decodeObsData (std::istream &inputStream, string &line, double ver, map< E_Sys, map< int, CodeType > > &sysCodeTypes, GObs &obs, SatSys &v2SatSys, RinexStation &rnxRec) |
Decode obs data (dispatcher function) | |
int | readRnxObsB (std::istream &inputStream, double ver, E_TimeSys tsys, map< E_Sys, map< int, CodeType > > &sysCodeTypes, int &flag, ObsList &obsList, RinexStation &rnxRec) |
Read RINEX observation data body section. | |
int | readRnxObs (std::istream &inputStream, double ver, E_TimeSys tsys, map< E_Sys, map< int, CodeType > > &sysCodeTypes, ObsList &obsList, RinexStation &rnxRec) |
Read complete RINEX observation file. | |
int | decodeEph (double ver, SatSys Sat, GTime toc, vector< double > &data, Eph &eph) |
Decode GPS/Galileo/QZS/BeiDou ephemeris parameters. | |
int | decodeGeph (double ver, SatSys Sat, GTime toc, vector< double > &data, Geph &geph) |
Decode GLONASS ephemeris parameters. | |
int | decodeSeph (double ver, SatSys Sat, GTime toc, vector< double > &data, Seph &seph) |
Decode SBAS/geostationary satellite ephemeris. | |
int | decodeCeph (double ver, SatSys Sat, E_NavMsgType type, GTime toc, vector< double > &data, Ceph &ceph) |
Decode CNVX (Civil Navigation) ephemeris parameters. | |
int | decodeSto (double ver, SatSys Sat, E_NavMsgType type, GTime toc, vector< double > &data, STO &sto) |
Decode System Time Offset (STO) message. | |
int | decodeEop (double ver, SatSys Sat, E_NavMsgType type, GTime toc, vector< double > &data, EOP &eop) |
Decode Earth Orientation Parameters (EOP) message. | |
int | decodeIon (double ver, SatSys Sat, E_NavMsgType type, GTime toc, vector< double > &data, ION &ion) |
Decode ionospheric parameters (ION) message. | |
int | readRnxNavB (std::istream &inputStream, double ver, E_Sys sys, E_EphType &type, Eph &eph, Geph &geph, Seph &seph, Ceph &ceph, STO &sto, EOP &eop, ION &ion) |
Read RINEX navigation data body section. | |
int | readRnxNav (std::istream &inputStream, double ver, E_Sys sys, Navigation &nav) |
Read complete RINEX navigation file. | |
int | readRnxClk (std::istream &inputStream, double ver, Navigation &nav) |
Read RINEX clock file. | |
int | readRnx (std::istream &inputStream, char &type, ObsList &obsList, Navigation &nav, RinexStation &rnxRec, double &ver, E_Sys &sys, E_TimeSys &tsys, map< E_Sys, map< int, CodeType > > &sysCodeTypes) |
Read and parse complete RINEX file. | |
ObservationValues | parseObservationValues (char *buff, int position) |
Parse observation values from RINEX formatted text. | |
void | assignObservationValue (RawSig &signal, char observationType, double value, double lli) |
Assign parsed values to appropriate RawSig fields. | |
void | stageObservation (ObservationStaging &staging, char obsType, E_ObsCode obsCode, E_FType frequency, double value, double lli) |
Stage observation for later processing and validation. | |
void | stagePhaseObservation (ObservationStaging &staging, char obsType, const vector< E_ObsCode > &priorityCodes, E_FType frequency, double value, double lli) |
Stage phase observation with priority resolution support. | |
void | commitStagedObservations (const ObservationStaging &staging, GObs &obs, const map< E_ObsCode2, E_ObsCode > &codeMap) |
Commit staged observations with phase priority resolution. | |
bool | validateStagedObservations (const ObservationStaging &staging, const SatSys &satellite) |
Validate staged observations before committing Single Responsibility: Quality assurance for staged data. | |
void | resolveObservationConflicts (ObservationStaging &staging) |
Advanced validation and conflict resolution for staged observations Single Responsibility: Data quality assurance and conflict handling. | |
ValidationReport | validateStagedObservationsDetailed (ObservationStaging &staging, const SatSys &satellite) |
Enhanced validation with detailed statistics Single Responsibility: Comprehensive data quality assessment. | |
void assignObservationValue | ( | RawSig & | signal, |
char | observationType, | ||
double | value, | ||
double | lli ) |
Assign parsed values to appropriate RawSig fields.
Assign parsed observation value to appropriate signal field.
Routes observation values to the correct field in a RawSig structure based on the observation type character. Implements type-safe assignment with validation to prevent data corruption.
Observation type mapping:
signal | Reference to RawSig structure to modify |
observationType | Single character observation type identifier |
value | Numerical observation value to assign |
lli | Loss of Lock Indicator (only used for phase observations) |
FileType CLK__ | ( | ) |
void commitStagedObservations | ( | const ObservationStaging & | staging, |
GObs & | obs, | ||
const map< E_ObsCode2, E_ObsCode > & | codeMap ) |
Commit staged observations with phase priority resolution.
Commit all staged observations to final structure.
Processes all staged observations and transfers them to the final GObs structure. Implements sophisticated two-pass algorithm for phase observation priority resolution:
Pass 1: Commit code observations and track available codes
Pass 2: Resolve and commit phase observations
staging | Container of staged observations to process |
obs | Reference to output GObs structure to populate |
codeMap | RINEX 2->3 code conversion map (for reference, not used in current impl) |
int decodeCeph | ( | double | ver, |
SatSys | Sat, | ||
E_NavMsgType | type, | ||
GTime | toc, | ||
vector< double > & | data, | ||
Ceph & | ceph ) |
Decode CNVX (Civil Navigation) ephemeris parameters.
Processes ephemeris data from civil navigation messages for modernized GNSS signals with enhanced accuracy and integrity.
ver | RINEX version number |
Sat | Satellite identifier |
type | Navigation message type |
toc | Time of clock reference epoch |
data | Vector of CNVX navigation parameters |
ceph | Output CNVX ephemeris structure |
ver | RINEX version |
Sat | Satellite ID |
type | Navigation message type |
toc | Time of clock |
data | Data to decode |
ceph | CNVX ephemeris |
int decodeEop | ( | double | ver, |
SatSys | Sat, | ||
E_NavMsgType | type, | ||
GTime | toc, | ||
vector< double > & | data, | ||
EOP & | eop ) |
Decode Earth Orientation Parameters (EOP) message.
Processes Earth orientation parameters for precise coordinate transformations.
ver | RINEX version number |
Sat | Reference satellite system |
type | Navigation message type |
toc | Reference time epoch |
data | Vector of EOP parameters |
eop | Output Earth orientation parameters |
Decode GPS/Galileo/QZS/BeiDou ephemeris parameters.
Parses Keplerian orbital elements from RINEX navigation data and converts to standardized ephemeris structure.
ver | RINEX version number |
Sat | Satellite system identifier |
toc | Time of clock reference epoch |
data | Vector of decoded navigation parameters |
eph | Output ephemeris structure |
Decode GLONASS ephemeris parameters.
Parses GLONASS navigation message parameters using FDMA orbital representation with position/velocity state vectors.
ver | RINEX version number |
Sat | GLONASS satellite identifier |
toc | Time of clock reference epoch |
data | Vector of GLONASS navigation parameters |
geph | Output GLONASS ephemeris structure |
ver | RINEX version |
Sat | Satellite ID |
toc | Time of clock |
data | Data to decode |
geph | Glonass ephemeris |
void decodeGnavH | ( | string & | line, |
Navigation & | nav ) |
Decode GLONASS navigation file header.
Processes header lines specific to GLONASS navigation files, including system time corrections and GLONASS-specific parameters.
line | Header line to decode |
nav | Navigation data structure to populate |
void decodeHnavH | ( | string & | line, |
Navigation & | nav ) |
Decode SBAS/Geostationary navigation file header.
Processes header lines specific to SBAS and geostationary satellite navigation files with unique orbital parameters.
line | Header line to decode |
nav | Navigation data structure to populate |
int decodeIon | ( | double | ver, |
SatSys | Sat, | ||
E_NavMsgType | type, | ||
GTime | toc, | ||
vector< double > & | data, | ||
ION & | ion ) |
Decode ionospheric parameters (ION) message.
Processes ionospheric delay model parameters for single-frequency correction.
ver | RINEX version number |
Sat | Reference satellite system |
type | Navigation message type |
toc | Reference time epoch |
data | Vector of ionospheric model parameters |
ion | Output ionospheric parameters |
void decodeNavH | ( | string & | line, |
E_Sys | sys, | ||
Navigation & | nav ) |
Decode RINEX navigation file header.
Parses header lines from RINEX navigation files, extracting ionospheric parameters, time system corrections, and other auxiliary navigation data.
line | Header line to decode |
sys | GNSS system identifier (GPS, GLO, GAL, BDS, etc.) |
nav | Navigation data structure to populate |
line | Line to decode |
sys | GNSS system |
nav | Navigation data |
int decodeObsData | ( | std::istream & | inputStream, |
string & | line, | ||
double | ver, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
GObs & | obs, | ||
SatSys & | v2SatSys, | ||
RinexStation & | rnxRec ) |
Decode obs data (dispatcher function)
int decodeObsDataRinex2 | ( | std::istream & | inputStream, |
string & | line, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
GObs & | obs, | ||
SatSys & | v2SatSys, | ||
RinexStation & | rnxRec ) |
Decode RINEX 2 observation data.
Decode RINEX 2.x observation data from input stream.
int decodeObsDataRinex3 | ( | std::istream & | inputStream, |
string & | line, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
GObs & | obs, | ||
RinexStation & | rnxRec ) |
Decode RINEX 3 observation data.
Decode RINEX 3.x observation data from input stream.
int decodeObsEpoch | ( | std::istream & | inputStream, |
string & | line, | ||
double | ver, | ||
E_TimeSys | tsys, | ||
GTime & | time, | ||
int & | flag, | ||
vector< SatSys > & | sats ) |
Decode observation epoch header information.
Parses epoch header lines to extract time stamps, epoch flags, and satellite lists. Handles both RINEX 2.x and 3.x epoch formats.
inputStream | Input stream for reading continuation lines |
line | Current epoch header line |
ver | RINEX version number |
tsys | Time system for time stamp interpretation |
time | Output time stamp for this epoch |
flag | Output epoch flag (0=OK, 1=power failure, etc.) |
sats | Output vector of satellites in this epoch |
void decodeObsH | ( | std::istream & | inputStream, |
string & | line, | ||
double | ver, | ||
E_TimeSys & | tsys, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
Navigation & | nav, | ||
RinexStation & | rnxRec ) |
Decode RINEX observation file header.
Parses header lines from RINEX observation files, extracting station information, observation types, antenna details, and system-specific configurations.
inputStream | Input stream containing RINEX header data |
line | Current header line being processed |
ver | RINEX version number (2.x or 3.x) |
tsys | Time system used in file (GPS, UTC, etc.) |
sysCodeTypes | Output map of observation code types by system |
nav | Navigation data structure (for ionospheric parameters) |
rnxRec | Output structure for station information and metadata |
Decode SBAS/geostationary satellite ephemeris.
Parses ephemeris parameters for SBAS satellites using simplified geostationary orbital models.
ver | RINEX version number |
Sat | SBAS satellite identifier |
toc | Time of clock reference epoch |
data | Vector of SBAS navigation parameters |
seph | Output SBAS ephemeris structure |
int decodeSto | ( | double | ver, |
SatSys | Sat, | ||
E_NavMsgType | type, | ||
GTime | toc, | ||
vector< double > & | data, | ||
STO & | sto ) |
Decode System Time Offset (STO) message.
Processes system time offset parameters for inter-system time conversions.
ver | RINEX version number |
Sat | Reference satellite system |
type | Navigation message type |
toc | Reference time epoch |
data | Vector of STO parameters |
sto | Output system time offset structure |
ObservationValues parseObservationValues | ( | char * | buff, |
int | position ) |
Parse observation values from RINEX formatted text.
Parse observation values from RINEX formatted text buffer.
Extracts numerical observation value and Loss of Lock Indicator from a RINEX formatted line at the specified position. Includes comprehensive bounds checking and error handling for malformed input data.
RINEX observation format:
buff | Character buffer containing RINEX observation line |
position | Starting position in buffer (0-based index) |
int readRnx | ( | std::istream & | inputStream, |
char & | type, | ||
ObsList & | obsList, | ||
Navigation & | nav, | ||
RinexStation & | rnxRec, | ||
double & | ver, | ||
E_Sys & | sys, | ||
E_TimeSys & | tsys, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes ) |
Read and parse complete RINEX file.
Main entry point for RINEX file processing. Automatically detects file type (observation, navigation, etc.) and version, then dispatches to appropriate processing functions.
inputStream | Input stream containing RINEX file data |
type | Output parameter for detected file type ('O', 'N', 'G', etc.) |
obsList | Output list of parsed observations |
nav | Output navigation data structure |
rnxRec | Output station information and metadata |
ver | Output RINEX version number |
sys | Output primary GNSS system |
tsys | Output time system used in file |
sysCodeTypes | Output observation code type mappings by system |
int readRnxClk | ( | std::istream & | inputStream, |
double | ver, | ||
Navigation & | nav ) |
Read RINEX clock file.
Processes RINEX clock files containing high-precision satellite and station clock corrections.
inputStream | Input stream containing clock file data |
ver | RINEX version number |
nav | Navigation data structure for clock corrections |
int readRnxH | ( | std::istream & | inputStream, |
double & | ver, | ||
char & | type, | ||
E_Sys & | sys, | ||
E_TimeSys & | tsys, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
Navigation & | nav, | ||
RinexStation & | rnxRec ) |
Read RINEX file header section.
Reads and parses the complete header section with automatic file type and version detection.
inputStream | Input stream containing RINEX file data |
ver | Output RINEX version number |
type | Output file type character ('O', 'N', 'G', etc.) |
sys | Output primary GNSS system |
tsys | Output time system |
sysCodeTypes | Output observation code type mappings |
nav | Navigation data structure |
rnxRec | Station information structure |
int readRnxNav | ( | std::istream & | inputStream, |
double | ver, | ||
E_Sys | sys, | ||
Navigation & | nav ) |
Read complete RINEX navigation file.
Processes complete navigation files including GPS, GLONASS, Galileo, BeiDou, and mixed-constellation files.
inputStream | Input stream containing navigation file |
ver | RINEX version number |
sys | Primary GNSS system |
nav | Output navigation data structure |
inputStream | Input stream to read |
ver | RINEX version |
sys | Satellite system |
nav | Navigation object |
int readRnxNavB | ( | std::istream & | inputStream, |
double | ver, | ||
E_Sys | sys, | ||
E_EphType & | type, | ||
Eph & | eph, | ||
Geph & | geph, | ||
Seph & | seph, | ||
Ceph & | ceph, | ||
STO & | sto, | ||
EOP & | eop, | ||
ION & | ion ) |
Read RINEX navigation data body section.
Parses navigation file data section with automatic message type detection and dispatching to appropriate decoders.
inputStream | Input stream containing navigation data |
ver | RINEX version number |
sys | Primary GNSS system |
type | Output ephemeris type detected |
eph | Output GPS/GAL/QZS/BDS ephemeris |
geph | Output GLONASS ephemeris |
seph | Output SBAS ephemeris |
ceph | Output CNVX ephemeris |
sto | Output system time offset |
eop | Output Earth orientation parameters |
ion | Output ionospheric parameters |
inputStream | Input stream to read |
ver | RINEX version |
sys | Satellite system |
type | Ephemeris type (output) |
eph | GPS Ephemeris |
geph | Glonass ephemeris |
seph | Geo ephemeris |
ceph | CNVX ephemeris |
sto | System time offset data |
eop | EOP data |
ion | Ionosphere data |
int readRnxObs | ( | std::istream & | inputStream, |
double | ver, | ||
E_TimeSys | tsys, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
ObsList & | obsList, | ||
RinexStation & | rnxRec ) |
Read complete RINEX observation file.
Main entry point for processing RINEX observation files with header and data section coordination.
inputStream | Input stream containing complete observation file |
ver | RINEX version number |
tsys | Time system used in file |
sysCodeTypes | Observation code type mappings |
obsList | Output list of all parsed observations |
rnxRec | Station information and metadata |
int readRnxObsB | ( | std::istream & | inputStream, |
double | ver, | ||
E_TimeSys | tsys, | ||
map< E_Sys, map< int, CodeType > > & | sysCodeTypes, | ||
int & | flag, | ||
ObsList & | obsList, | ||
RinexStation & | rnxRec ) |
Read RINEX observation data body section.
Processes observation epochs and individual satellite observations with data validation and error recovery.
inputStream | Input stream containing observation data |
ver | RINEX version number |
tsys | Time system |
sysCodeTypes | Observation code type mappings |
flag | Output epoch flag from last processed epoch |
obsList | Output list of parsed observations |
rnxRec | Station information and configuration |
void resolveObservationConflicts | ( | ObservationStaging & | staging | ) |
Advanced validation and conflict resolution for staged observations Single Responsibility: Data quality assurance and conflict handling.
Resolve conflicts in staged observations.
FileType RNX__ | ( | ) |
void setstr | ( | char * | dst, |
const char * | src, | ||
int | n ) |
Set string without trailing spaces.
Copies source string to destination buffer while removing trailing spaces. Ensures proper null termination and prevents buffer overflow.
dst | Destination character buffer |
src | Source string to copy |
n | Maximum number of characters to copy |
void stageObservation | ( | ObservationStaging & | staging, |
char | obsType, | ||
E_ObsCode | obsCode, | ||
E_FType | frequency, | ||
double | value, | ||
double | lli ) |
Stage observation for later processing and validation.
Stage regular observation for deferred processing.
Adds an observation to the staging area with complete metadata for later processing. Used for observations that can be immediately resolved without requiring priority-based selection logic.
The staging pattern provides several benefits:
staging | Reference to staging container map |
obsType | Single character observation type ('C', 'L', 'P', 'D', 'S') |
obsCode | Resolved RINEX 3 observation code (e.g., L1C, C1W) |
frequency | Frequency type enumeration (F1, F2, F5, etc.) |
value | Numerical observation value |
lli | Loss of Lock Indicator (0-3) |
void stagePhaseObservation | ( | ObservationStaging & | staging, |
char | obsType, | ||
const vector< E_ObsCode > & | priorityCodes, | ||
E_FType | frequency, | ||
double | value, | ||
double | lli ) |
Stage phase observation with priority resolution support.
Stage phase observation with priority-based code resolution.
Stages a phase observation that requires priority-based code resolution. Unlike regular observations, phase observations in RINEX 2 can map to multiple possible RINEX 3 codes, requiring selection based on available code observations.
Priority resolution example:
staging | Reference to staging container map |
obsType | Single character observation type (typically 'L') |
priorityCodes | Vector of observation codes in priority order |
frequency | Frequency type enumeration |
value | Numerical phase observation value |
lli | Loss of Lock Indicator |
bool validateStagedObservations | ( | const ObservationStaging & | staging, |
const SatSys & | satellite ) |
Validate staged observations before committing Single Responsibility: Quality assurance for staged data.
Validate staged observations before commitment.
ValidationReport validateStagedObservationsDetailed | ( | ObservationStaging & | staging, |
const SatSys & | satellite ) |
Enhanced validation with detailed statistics Single Responsibility: Comprehensive data quality assessment.
Comprehensive validation with detailed reporting.