Skip to content

Commit

Permalink
Fixed typo in src/ephemeris doc. Removed si feature from default. Cha…
Browse files Browse the repository at this point in the history
…nged SI Statevector parsing to make clippy pedantic happy
  • Loading branch information
NiklasVousten committed Oct 20, 2023
1 parent 4f6c96b commit ea3e971
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ env_logger = "0.9.0"
tokio = { version = "1.20.1", features = ["macros", "rt-multi-thread"] }

[features]
si = ["dep:uom"]
default= ["si"]
si = ["dep:uom"]
2 changes: 1 addition & 1 deletion src/ephemeris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::utilities::{take_expecting, take_or_empty};
/// | RR | Range-rate; radial velocity wrt coord. center | km/sec |
#[derive(Debug, PartialEq)]
pub struct EphemerisVectorItem {
/// Position int km of the moving body relative to the Sun
/// Position in km of the moving body relative to the Sun
///
/// [x, y, z]
pub position: [f32; 3],
Expand Down
20 changes: 6 additions & 14 deletions src/si/ephemeris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,11 @@ impl<'a, Input: Iterator<Item = &'a str>> Iterator for EphemerisVectorParser<'a,
let line = take_expecting(line, " Z =").unwrap();
let (z, _) = take_or_empty(line, 22);

let x_km = x.trim().parse::<f32>().unwrap();
let y_km = y.trim().parse::<f32>().unwrap();
let z_km = z.trim().parse::<f32>().unwrap();

self.state = EphemerisVectorParserState::Position {
position: [
Length::new::<length::kilometer>(x_km),
Length::new::<length::kilometer>(y_km),
Length::new::<length::kilometer>(z_km),
Length::new::<length::kilometer>(x.trim().parse::<f32>().unwrap()),
Length::new::<length::kilometer>(y.trim().parse::<f32>().unwrap()),
Length::new::<length::kilometer>(z.trim().parse::<f32>().unwrap()),
],
};
}
Expand All @@ -238,16 +234,12 @@ impl<'a, Input: Iterator<Item = &'a str>> Iterator for EphemerisVectorParser<'a,
let line = take_expecting(line, " VZ=").unwrap();
let (vz, _) = take_or_empty(line, 22);

let vx_kms = vx.trim().parse::<f32>().unwrap();
let vy_kms = vy.trim().parse::<f32>().unwrap();
let vz_kms = vz.trim().parse::<f32>().unwrap();

self.state = EphemerisVectorParserState::Complete {
position,
velocity: [
Velocity::new::<velocity::kilometer_per_second>(vx_kms),
Velocity::new::<velocity::kilometer_per_second>(vy_kms),
Velocity::new::<velocity::kilometer_per_second>(vz_kms),
Velocity::new::<velocity::kilometer_per_second>(vx.trim().parse::<f32>().unwrap()),
Velocity::new::<velocity::kilometer_per_second>(vy.trim().parse::<f32>().unwrap()),
Velocity::new::<velocity::kilometer_per_second>(vz.trim().parse::<f32>().unwrap()),
],
};
}
Expand Down

0 comments on commit ea3e971

Please sign in to comment.