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
use crate::plot::PlotContext;
//use itertools::Itertools;
use plotly::{
color::NamedColor,
common::{Marker, MarkerSymbol}, //color::Rgba},
layout::MapboxStyle,
//scatter_mapbox::Fill,
ScatterMapbox,
};
use rinex::ionex::*;
pub fn plot_tec_map(
plot_ctx: &mut PlotContext,
_borders: ((f64, f64), (f64, f64)),
record: &Record,
) {
let _cmap = colorous::TURBO;
plot_ctx.add_world_map(MapboxStyle::OpenStreetMap, (32.5, -40.0), 1);
let mut grid_lat: Vec<f64> = Vec::new();
let mut grid_lon: Vec<f64> = Vec::new();
let mut tec_max = -f64::INFINITY;
for (e_index, (_e, (tec, _, _))) in record.iter().enumerate() {
for point in tec {
if e_index == 0 {
// grab grid definition
grid_lat.push(point.latitude.into());
grid_lon.push(point.longitude.into());
}
if point.value > tec_max {
tec_max = point.value;
}
}
}
let grid = ScatterMapbox::new(grid_lat, grid_lon)
.marker(
Marker::new()
.size(5)
.symbol(MarkerSymbol::Circle)
.color(NamedColor::Black)
.opacity(0.5),
)
.name("TEC Grid");
plot_ctx.add_trace(grid);
/*
* Build heat map,
* we have no means to plot several heat map (day course)
* at the moment, we just plot the 1st epoch
*/
/*
for (e_index, (e, (tec, _, _))) in record.iter().enumerate() {
if e_index == 0 {
// form the smallest area from that grid
for rows in
for i in 0..tec.len() / 4 {
println!("MAPS {}", i);
//for i in 0..maps.len() / 2 {
/*
let mut row1 = maps[0]
let mut row2 = maps[1]
if let Some(points12) = row1.next() {
if let Some(points34) = row2.next() {
// average TEC in that area
let tec = (points12[0].value + points12[1].value
+points34[0].value + points34[1].value ) / 4.0;
let color = cmap.eval_continuous(tec / tec_max);
let area = ScatterMapbox::new(
vec![points12[0].latitude, points12[1].latitude, points34[0].latitude, points34[1].latitude],
vec![points12[0].longitude, points12[1].longitude, points34[0].longitude, points34[1].longitude],
)
.opacity(0.5)
.fill(Fill::ToSelf)
.fill_color(Rgba::new(color.r, color.g, color.b, 0.9));
ctx.add_trace(area);
println!("YES");
}
}*/
}
} else {
break ; // we need animations for that
}
}*/
}