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 time scale interpretation #162

Merged
merged 16 commits into from
Sep 19, 2023
94 changes: 47 additions & 47 deletions rinex-cli/src/plot/record/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,15 @@ fn plot_nav_data(rinex: &Rinex, sp3: Option<&SP3>, plot_ctx: &mut PlotContext) {
},
)
.collect();
let trace = build_chart_epoch_axis(
&format!("{}(x)", sv),
Mode::LinesMarkers,
epochs.clone(),
x_km,
)
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
let trace =
build_chart_epoch_axis(&format!("{}(x)", sv), Mode::Markers, epochs.clone(), x_km)
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);

let y_km: Vec<_> = rinex
Expand All @@ -209,20 +205,16 @@ fn plot_nav_data(rinex: &Rinex, sp3: Option<&SP3>, plot_ctx: &mut PlotContext) {
)
.collect();

let trace = build_chart_epoch_axis(
&format!("{}(y)", sv),
Mode::LinesMarkers,
epochs.clone(),
y_km,
)
.y_axis("y2")
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
let trace =
build_chart_epoch_axis(&format!("{}(y)", sv), Mode::Markers, epochs.clone(), y_km)
.y_axis("y2")
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
/*
* add SP3 (x, y) positions, if available
Expand Down Expand Up @@ -252,15 +244,19 @@ fn plot_nav_data(rinex: &Rinex, sp3: Option<&SP3>, plot_ctx: &mut PlotContext) {
},
)
.collect();
let trace =
build_chart_epoch_axis(&format!("{}(sp3_x)", sv), Mode::Markers, epochs.clone(), x)
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
let trace = build_chart_epoch_axis(
&format!("{}(sp3_x)", sv),
Mode::LinesMarkers,
epochs.clone(),
x,
)
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
let y: Vec<f64> = sp3
.sv_position()
Expand All @@ -274,16 +270,20 @@ fn plot_nav_data(rinex: &Rinex, sp3: Option<&SP3>, plot_ctx: &mut PlotContext) {
},
)
.collect();
let trace =
build_chart_epoch_axis(&format!("{}(sp3_y)", sv), Mode::Markers, epochs.clone(), y)
.y_axis("y2")
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
let trace = build_chart_epoch_axis(
&format!("{}(sp3_y)", sv),
Mode::LinesMarkers,
epochs.clone(),
y,
)
.y_axis("y2")
.visible({
if sv_index == 0 {
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
}
}
Expand Down Expand Up @@ -317,7 +317,7 @@ fn plot_nav_data(rinex: &Rinex, sp3: Option<&SP3>, plot_ctx: &mut PlotContext) {
},
)
.collect();
let trace = build_chart_epoch_axis(&format!("{}(z)", sv), Mode::LinesMarkers, epochs, z_km)
let trace = build_chart_epoch_axis(&format!("{}(z)", sv), Mode::Markers, epochs, z_km)
.visible({
if sv_index == 0 {
Visible::True
Expand Down
22 changes: 9 additions & 13 deletions rinex-cli/src/plot/record/sp3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,15 @@ pub fn plot_residual_ephemeris(ctx: &QcContext, plot_ctx: &mut PlotContext) {
}
}
}
let trace = build_chart_epoch_axis(
&format!("|{}_err|", sv),
Mode::LinesMarkers,
epochs,
residuals,
)
.visible({
if sv_index < 4 {
Visible::True
} else {
Visible::LegendOnly
}
});
let trace =
build_chart_epoch_axis(&format!("|{}_err|", sv), Mode::Markers, epochs, residuals)
.visible({
if sv_index < 4 {
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
}
}
4 changes: 2 additions & 2 deletions rinex/src/clocks/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum Error {
#[error("unknown data code \"{0}\"")]
UnknownDataCode(String),
#[error("failed to parse epoch")]
EpochError(#[from] epoch::Error),
EpochParsingError(#[from] epoch::ParsingError),
#[error("failed to parse # of data fields")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("failed to parse data payload")]
Expand Down Expand Up @@ -187,7 +187,7 @@ pub(crate) fn parse_epoch(
+2+1 // m
+11; // s
let (epoch, rem) = rem.split_at(offset);
let (epoch, _) = epoch::parse(epoch.trim())?;
let (epoch, _) = epoch::parse_utc(epoch.trim())?;

// nb of data fields
let (n, _) = rem.split_at(4);
Expand Down
14 changes: 13 additions & 1 deletion rinex/src/constellation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,20 @@ impl Constellation {
Err(ParsingError::Unrecognized(code.to_string()))
}
}
/// Converts self into time scale
pub fn to_timescale(&self) -> Option<TimeScale> {
match self {
Self::GPS | Self::QZSS => Some(TimeScale::GPST),
Self::Galileo => Some(TimeScale::GST),
Self::BeiDou => Some(TimeScale::BDT),
Self::Geo | Self::SBAS(_) => Some(TimeScale::GPST),
// this is wrong but we can't do better
Self::Glonass | Self::IRNSS => Some(TimeScale::UTC),
_ => None,
}
}
/// Converts self to 1 letter code (RINEX standard code)
pub fn to_1_letter_code(&self) -> &str {
pub(crate) fn to_1_letter_code(&self) -> &str {
match self {
Self::GPS => "G",
Self::Glonass => "R",
Expand Down
Loading
Loading