Skip to content

Commit 9aa34c2

Browse files
authored
Make Ephemeris.format public (#378)
* Make Ephemeris.formattign public * Improve version API * IONEX: moved to separate lib --------- Signed-off-by: Guillaume W. Bres <[email protected]>
1 parent 667a548 commit 9aa34c2

File tree

3 files changed

+18
-37
lines changed

3 files changed

+18
-37
lines changed

src/header/parsing.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::{
77
hatanaka::CRINEX,
88
header::{DcbCompensation, Header, PcvCompensation},
99
leap::Leap,
10-
linspace::Linspace,
1110
marker::{GeodeticMarker, MarkerType},
1211
meteo::{HeaderFields as MeteoHeader, Sensor as MeteoSensor},
1312
navigation::{HeaderFields as NavigationHeader, IonosphereModel, KbModel, TimeOffset},
@@ -948,41 +947,6 @@ impl Header {
948947
.map_err(|_| ParsingError::DatetimeParsing)
949948
}
950949

951-
/*
952-
* Parse IONEX grid
953-
*/
954-
fn parse_grid(line: &str) -> Result<Linspace, ParsingError> {
955-
let mut start = 0.0_f64;
956-
let mut end = 0.0_f64;
957-
let mut spacing = 0.0_f64;
958-
for (index, item) in line.split_ascii_whitespace().enumerate() {
959-
let item = item.trim();
960-
match index {
961-
0 => {
962-
start = f64::from_str(item).or(Err(ParsingError::IonexGridSpecs))?;
963-
},
964-
1 => {
965-
end = f64::from_str(item).or(Err(ParsingError::IonexGridSpecs))?;
966-
},
967-
2 => {
968-
spacing = f64::from_str(item).or(Err(ParsingError::IonexGridSpecs))?;
969-
},
970-
_ => {},
971-
}
972-
}
973-
if spacing == 0.0 {
974-
// avoid linspace verification in this case
975-
Ok(Linspace {
976-
start,
977-
end,
978-
spacing,
979-
})
980-
} else {
981-
let grid = Linspace::new(start, end, spacing)?;
982-
Ok(grid)
983-
}
984-
}
985-
986950
/// Parse list of [Observable]s which applies to both METEO and OBS RINEX
987951
pub(crate) fn parse_v2_observables(
988952
line: &str,

src/navigation/ephemeris/formatting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::io::{BufWriter, Write};
1212

1313
impl Ephemeris {
1414
/// Formats [Ephemeris] according to RINEX standards
15-
pub(crate) fn format<W: Write>(
15+
pub fn format<W: Write>(
1616
&self,
1717
w: &mut BufWriter<W>,
1818
sv: SV,

src/version.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ impl Version {
107107
pub fn new(major: u8, minor: u8) -> Self {
108108
Self { major, minor }
109109
}
110+
111+
/// Builds desired major [Version] with minor = 0
112+
pub fn from_major(major: u8) -> Self {
113+
Self { major, minor: 0 }
114+
}
115+
116+
/// Copies and returns [Version] with updated major
117+
pub fn with_major(mut self, major: u8) -> Self {
118+
self.major = major;
119+
self
120+
}
121+
122+
/// Copies and returns [Version] with updated minor
123+
pub fn with_minor(mut self, minor: u8) -> Self {
124+
self.minor = minor;
125+
self
126+
}
110127
}
111128

112129
#[cfg(test)]

0 commit comments

Comments
 (0)