1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Navigation record plotting
use crate::plot::{build_chart_epoch_axis, PlotContext};
use plotly::common::{Mode, Visible};
use rinex::prelude::*;
use rinex_qc::QcContext;
pub fn plot_navigation(ctx: &QcContext, plot_context: &mut PlotContext) {
/*
* one plot (2 Y axes) for both Clock biases
* and clock drift
*/
plot_context.add_cartesian2d_2y_plot("Sv Clock Bias", "Clock Bias [s]", "Clock Drift [s/s]");
/*
* NB: this does not produce anything to this day,
* even when invoked on primary OBS
* because we're only plotting the rinex.clock_data() iterator
*/
plot_nav_data(&ctx.primary_data(), plot_context);
if let Some(nav) = &ctx.navigation_data() {
plot_nav_data(nav, plot_context);
}
}
fn plot_nav_data(rinex: &Rinex, plot_ctx: &mut PlotContext) {
let epochs: Vec<_> = rinex.epoch().collect();
for (sv_index, sv) in rinex.sv().enumerate() {
let sv_clock: Vec<_> = rinex
.sv_clock()
.filter_map(
|(_epoch, (svnn, (clk, _, _)))| {
if svnn == sv {
Some(clk)
} else {
None
}
},
)
.collect();
let sv_drift: Vec<_> = rinex
.sv_clock()
.filter_map(
|(_epoch, (svnn, (_, drift, _)))| {
if svnn == sv {
Some(drift)
} else {
None
}
},
)
.collect();
let trace = build_chart_epoch_axis(
&format!("{}(clk)", sv),
Mode::LinesMarkers,
epochs.clone(),
sv_clock,
)
.web_gl_mode(true)
.visible({
if sv_index == 0 {
/*
* Clock data differs too much,
* looks better if we only present one by default
*/
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
let trace = build_chart_epoch_axis(
&format!("{}(drift)", sv),
Mode::LinesMarkers,
epochs.clone(),
sv_drift,
)
.web_gl_mode(true)
.y_axis("y2")
.visible({
if sv_index == 0 {
/*
* Clock data differs too much,
* looks better if we only present one by default
*/
Visible::True
} else {
Visible::LegendOnly
}
});
plot_ctx.add_trace(trace);
}
trace!("navigation data plot");
}