Add LUF to ionosonde data API & chart

This commit is contained in:
Ian Renton
2026-05-21 20:09:11 +01:00
parent d655354d05
commit c38be5b588
13 changed files with 67 additions and 39 deletions

View File

@@ -389,11 +389,12 @@ function renderIonosondeData() {
const station = ionosondeData[ursi];
if (!station) return;
// Set up some styles, matching the k-index chart. We use Bootstrap's "primary" and "danger" colours not for any
// real reason but just to get a suitable blue and red that match the other colours Spothole uses
// Set up some styles, matching the k-index chart. We use Bootstrap's "primary", "danger", and "success" colours
// not for any real reason but just to get a suitable blue, red, and green that match the other colours Spothole uses
const style = getComputedStyle(document.documentElement);
const fof2Color = style.getPropertyValue('--bs-primary').trim();
const mufColor = style.getPropertyValue('--bs-danger').trim();
const mufColor = style.getPropertyValue('--bs-success').trim();
const lufColor = style.getPropertyValue('--bs-danger').trim();
const textColor = style.getPropertyValue('--bs-body-color').trim() || '#666';
const gridColor = style.getPropertyValue('--bs-border-color').trim() || 'rgba(128,128,128,0.3)';
@@ -407,7 +408,8 @@ function renderIonosondeData() {
const fof2Entries = toSeries(station.fof2);
const mufEntries = toSeries(station.muf);
const allTs = [...fof2Entries, ...mufEntries].map(e => e.ts);
const lufEntries = toSeries(station.luf);
const allTs = [...fof2Entries, ...mufEntries, ...lufEntries].map(e => e.ts);
if (allTs.length === 0) {
$('#ionosonde-latest').html('<div class="alert alert-warning mt-2 mb-0 py-2">No data available for this station.</div>');
$('#ionosonde-chart').hide();
@@ -418,6 +420,7 @@ function renderIonosondeData() {
// Populate latest values summary (visible on all screen sizes)
const latestFof2 = fof2Entries.length ? fof2Entries[fof2Entries.length - 1].val : null;
const latestMuf = mufEntries.length ? mufEntries[mufEntries.length - 1].val : null;
const latestLuf = lufEntries.length ? lufEntries[lufEntries.length - 1].val : null;
const minTs = allTs.length ? Math.min(...allTs) : null;
const maxTs = allTs.length ? Math.max(...allTs) : null;
let latestTimeStr = '';
@@ -429,9 +432,11 @@ function renderIonosondeData() {
? '<div class="alert alert-warning mt-2 mb-0 py-2">Data is more than 12 hours old!</div>'
: '';
$('#ionosonde-latest').html(
'<div class="row align-items-center me-0">' +
'<div class="col-12 py-2 text-muted">Latest values as of ' + latestTimeStr + '</div></div>' +
'<div class="row border-bottom align-items-center me-0">' +
'<div class="col-12 col-md-6 py-2 text-muted">Latest values as of ' + latestTimeStr + '</div>' +
'<div class="col-12 col-md-2 py-2">foF2: <strong>' + (latestFof2 !== null ? latestFof2.toFixed(2) + ' MHz' : 'N/A') + '</strong></div>' +
'<div class="col-12 col-md-4 py-2">LUF: <strong>' + (latestLuf !== null ? latestLuf.toFixed(2) + ' MHz' : 'N/A') + '</strong></div>' +
'<div class="col-12 col-md-4 py-2">foF2: <strong>' + (latestFof2 !== null ? latestFof2.toFixed(2) + ' MHz' : 'N/A') + '</strong></div>' +
'<div class="col-12 col-md-4 py-2">MUF (3000 km): <strong>' + (latestMuf !== null ? latestMuf.toFixed(2) + ' MHz' : 'N/A') + '</strong></div>' +
'</div>' +
staleWarning +
@@ -546,6 +551,14 @@ function renderIonosondeData() {
type: 'line',
data: {
datasets: [
{
label: 'LUF',
data: lufEntries.map(e => ({x: e.ts, y: e.val})),
borderColor: lufColor,
backgroundColor: 'transparent',
pointRadius: 0,
tension: 0.2,
},
{
label: 'foF2',
data: fof2Entries.map(e => ({x: e.ts, y: e.val})),