feat: weather graphs

This commit is contained in:
Mark
2026-06-04 12:06:22 +02:00
commit 0f7d3a2a83
14 changed files with 25296 additions and 0 deletions

52
src/data.rs Normal file
View File

@@ -0,0 +1,52 @@
use std::collections::BTreeMap;
use crate::dwd::{DwdCache, DwdStation};
pub struct Data {
pub dwd_cache: DwdCache,
pub dwd_stations: BTreeMap<(String, usize), DwdStation>,
pub dwd_stations_pos_range: (f64, f64, f64, f64, f64, f64),
}
impl Data {
pub fn new() -> Self {
let dwd_stations = crate::dwd::load_stations();
let dwd_stations_pos_range = (
dwd_stations
.values()
.map(|v| v.pos.0)
.min_by(|a, b| a.total_cmp(b))
.unwrap(),
dwd_stations
.values()
.map(|v| v.pos.0)
.max_by(|a, b| a.total_cmp(b))
.unwrap(),
dwd_stations
.values()
.map(|v| v.pos.1)
.min_by(|a, b| a.total_cmp(b))
.unwrap(),
dwd_stations
.values()
.map(|v| v.pos.1)
.max_by(|a, b| a.total_cmp(b))
.unwrap(),
dwd_stations
.values()
.map(|v| v.pos.2)
.min_by(|a, b| a.total_cmp(b))
.unwrap(),
dwd_stations
.values()
.map(|v| v.pos.2)
.max_by(|a, b| a.total_cmp(b))
.unwrap(),
);
Self {
dwd_cache: DwdCache::default(),
dwd_stations,
dwd_stations_pos_range,
}
}
}