Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty constellation case (old RINEX format) #231

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 41 additions & 18 deletions rinex/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,24 +442,47 @@ impl Header {
let (vers, rem) = line.split_at(20);
let (type_str, rem) = rem.split_at(20);
let (constell_str, _) = rem.split_at(20);
rinex_type = Type::from_str(type_str.trim())?;
if type_str.contains("GLONASS") {
// old GLONASS NAV : no constellation field
constellation = Some(Constellation::Glonass);
} else if type_str.contains("GPS NAV DATA") {
constellation = Some(Constellation::GPS);
} else if type_str.contains("IRNSS NAV DATA") {
constellation = Some(Constellation::IRNSS);
} else if type_str.contains("GNSS NAV DATA") {
constellation = Some(Constellation::Mixed);
} else if type_str.contains("METEOROLOGICAL DATA") {
// these files are not tied to a constellation system,
// therefore, do not have this field
} else {
// regular files
if let Ok(constell) = Constellation::from_str(constell_str.trim()) {
constellation = Some(constell);
}

let type_str = type_str.trim();
let constell_str = constell_str.trim();

// File type identification
rinex_type = Type::from_str(type_str)?;

// Constellation identification
match rinex_type {
Type::NavigationData => {
if type_str.contains("GLONASS") {
// old GLONASS NAV : no constellation field
constellation = Some(Constellation::Glonass);
} else if type_str.contains("GPS NAV DATA") {
constellation = Some(Constellation::GPS);
} else if type_str.contains("IRNSS NAV DATA") {
constellation = Some(Constellation::IRNSS);
} else if type_str.contains("GNSS NAV DATA") {
constellation = Some(Constellation::Mixed);
} else if type_str.eq("NAVIGATION DATA") {
if constell_str.is_empty() {
// old GPS NAVIGATION DATA
constellation = Some(Constellation::GPS);
} else {
// Modern NAVIGATION DATA
if let Ok(c) = Constellation::from_str(constell_str) {
constellation = Some(c);
}
}
}
},
Type::MeteoData => {
// no constellation associated to it
},
_ => {
// any other
// regular files
if let Ok(c) = Constellation::from_str(constell_str) {
constellation = Some(c);
}
},
}
/*
* Parse version descriptor
Expand Down
Loading