Skip to content

Commit

Permalink
working on ionex visualization
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume W. Bres <[email protected]>
  • Loading branch information
gwbres committed Sep 26, 2023
1 parent 6057711 commit 9805ac8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
1 change: 1 addition & 0 deletions rinex-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ thiserror = "1"
itertools = "0.11"
# plotly = "0.8.4"
plotly = { git = "https://github.com/gwbres/plotly", branch = "density-mapbox" }
# plotly = { path = "../../plotly-rs/plotly" }
map_3d = "0.1.5"
ndarray = "0.15"
colorous = "1.0"
Expand Down
1 change: 0 additions & 1 deletion rinex-cli/src/plot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ pub fn build_world_map(
.title(Title::new(title).font(Font::default()))
.drag_mode(DragMode::Zoom)
.margin(Margin::new().top(0).left(0).bottom(0).right(0))
.show_legend(show_legend)
.mapbox(
Mapbox::new()
.style(map_style)
Expand Down
54 changes: 32 additions & 22 deletions rinex-cli/src/plot/record/ionex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@
use crate::plot::PlotContext;
use plotly::{
color::NamedColor,
common::Font,
common::Title,
common::{Marker, MarkerSymbol}, //color::Rgba},
layout::MapboxStyle,
// AnimatedDensityMapbox,
DensityMapbox,
//scatter_mapbox::Fill,
ScatterMapbox,
};
use rinex::prelude::Epoch;
use rinex_qc::QcContext;
use std::collections::HashMap;

pub fn plot_tec_map(
ctx: &QcContext,
_borders: ((f64, f64), (f64, f64)),
plot_ctx: &mut PlotContext,
) {
let _cmap = colorous::TURBO;

let hover_text: Vec<String> = ctx.primary_data().epoch().map(|e| e.to_string()).collect();
/*
* TEC map visualization
* plotly-rs has no means to animate plots at the moment
Expand All @@ -42,32 +49,35 @@ pub fn plot_tec_map(
1,
);

let mut lat: Vec<f64> = Vec::new();
let mut lon: Vec<f64> = Vec::new();
let mut z: Vec<f64> = Vec::new();
let mut lat: HashMap<String, f64> = HashMap::new();
let mut lon: HashMap<String, f64> = HashMap::new();
let mut z: HashMap<String, f64> = HashMap::new();
for (tec_lat, tec_lon, _, tec) in content {
lat.push(tec_lat);
lon.push(tec_lon);
z.push(tec);
lat.insert(Epoch::default().to_string(), tec_lat);
lon.insert(Epoch::default().to_string(), tec_lon);
z.insert(Epoch::default().to_string(), tec);
}

/* plot the map grid */
let grid = ScatterMapbox::new(lat.clone(), lon.clone())
.marker(
Marker::new()
.size(3)
.symbol(MarkerSymbol::Circle)
.color(NamedColor::Black)
.opacity(0.5),
)
.name("grid");
plot_ctx.add_trace(grid);
//let grid = ScatterMapbox::new(lat.clone(), lon.clone())
// .marker(
// Marker::new()
// .size(3)
// .symbol(MarkerSymbol::Circle)
// .color(NamedColor::Black)
// .opacity(0.5),
// )
// .name("grid");
//plot_ctx.add_trace(grid);

let map = DensityMapbox::new(lat.clone(), lon.clone(), z)
.opacity(0.66)
.hover_text
.zauto(true)
.zoom(3);
plot_ctx.add_trace(map);
//let map = AnimatedDensityMapbox::new(lat.clone(), lon.clone(), z)
// .title("TEST")
// .name(epoch.to_string())
// .opacity(0.66)
// .hover_text_array(hover_text.clone())
// .zauto(true)
// //.animation_frame("test")
// .zoom(3);
//plot_ctx.add_trace(map);
}
}

0 comments on commit 9805ac8

Please sign in to comment.