mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d655354d05 | ||
|
|
a7a45190cb | ||
|
|
6058eb5053 | ||
|
|
3e7d2c2bc2 | ||
|
|
0edd844db3 | ||
|
|
64a7b27887 | ||
|
|
2026b46113 | ||
|
|
363735a235 |
@@ -40,7 +40,7 @@ class HTTPAlertProvider(AlertProvider):
|
|||||||
try:
|
try:
|
||||||
# Request data from API
|
# Request data from API
|
||||||
logging.debug("Polling " + self.name + " alert API...")
|
logging.debug("Polling " + self.name + " alert API...")
|
||||||
http_response = requests.get(self._url, headers=HTTP_HEADERS)
|
http_response = requests.get(self._url, headers=HTTP_HEADERS, timeout=(5, 30))
|
||||||
# Pass off to the subclass for processing
|
# Pass off to the subclass for processing
|
||||||
new_alerts = self._http_response_to_alerts(http_response)
|
new_alerts = self._http_response_to_alerts(http_response)
|
||||||
# Submit the new alerts for processing. There might not be any alerts for the less popular programs.
|
# Submit the new alerts for processing. There might not be any alerts for the less popular programs.
|
||||||
|
|||||||
@@ -183,6 +183,10 @@ solar-condition-providers:
|
|||||||
class: "NOAA3dayForecast"
|
class: "NOAA3dayForecast"
|
||||||
name: "NOAA 3-day Forecast"
|
name: "NOAA 3-day Forecast"
|
||||||
enabled: true
|
enabled: true
|
||||||
|
-
|
||||||
|
class: "GIROIonosonde"
|
||||||
|
name: "GIRO Ionosonde Data"
|
||||||
|
enabled: true
|
||||||
|
|
||||||
# Port to open the local web server on
|
# Port to open the local web server on
|
||||||
web-server-port: 8080
|
web-server-port: 8080
|
||||||
|
|||||||
+15
-18
@@ -70,27 +70,24 @@ def populate_sig_ref_info(sig_ref):
|
|||||||
elif sig.upper() == "WWFF":
|
elif sig.upper() == "WWFF":
|
||||||
wwff_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://wwff.co/wwff-data/wwff_directory.csv",
|
wwff_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://wwff.co/wwff-data/wwff_directory.csv",
|
||||||
headers=HTTP_HEADERS)
|
headers=HTTP_HEADERS)
|
||||||
wwff_dr = csv.DictReader(wwff_csv_data.content.decode().splitlines())
|
wwff_index = {row["reference"]: row for row in csv.DictReader(wwff_csv_data.content.decode().splitlines())}
|
||||||
for row in wwff_dr:
|
row = wwff_index.get(ref_id)
|
||||||
if row["reference"] == ref_id:
|
if row:
|
||||||
sig_ref.name = row["name"] if "name" in row else None
|
sig_ref.name = row["name"] if "name" in row else None
|
||||||
sig_ref.url = "https://wwff.co/directory/?showRef=" + ref_id
|
sig_ref.url = "https://wwff.co/directory/?showRef=" + ref_id
|
||||||
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row and row["iaruLocator"] != "-" else None
|
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row and row["iaruLocator"] != "-" else None
|
||||||
sig_ref.latitude = float(row["latitude"]) if "latitude" in row and row["latitude"] != "-" else None
|
sig_ref.latitude = float(row["latitude"]) if "latitude" in row and row["latitude"] != "-" else None
|
||||||
sig_ref.longitude = float(row["longitude"]) if "longitude" in row and row[
|
sig_ref.longitude = float(row["longitude"]) if "longitude" in row and row["longitude"] != "-" else None
|
||||||
"longitude"] != "-" else None
|
|
||||||
break
|
|
||||||
elif sig.upper() == "SIOTA":
|
elif sig.upper() == "SIOTA":
|
||||||
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
||||||
headers=HTTP_HEADERS)
|
headers=HTTP_HEADERS)
|
||||||
siota_dr = csv.DictReader(siota_csv_data.content.decode().splitlines())
|
siota_index = {row["SILO_CODE"]: row for row in csv.DictReader(siota_csv_data.content.decode().splitlines())}
|
||||||
for row in siota_dr:
|
row = siota_index.get(ref_id)
|
||||||
if row["SILO_CODE"] == ref_id:
|
if row:
|
||||||
sig_ref.name = row["NAME"] if "NAME" in row else None
|
sig_ref.name = row["NAME"] if "NAME" in row else None
|
||||||
sig_ref.grid = row["LOCATOR"] if "LOCATOR" in row else None
|
sig_ref.grid = row["LOCATOR"] if "LOCATOR" in row else None
|
||||||
sig_ref.latitude = float(row["LAT"]) if "LAT" in row else None
|
sig_ref.latitude = float(row["LAT"]) if "LAT" in row else None
|
||||||
sig_ref.longitude = float(row["LNG"]) if "LNG" in row else None
|
sig_ref.longitude = float(row["LNG"]) if "LNG" in row else None
|
||||||
break
|
|
||||||
elif sig.upper() == "WOTA":
|
elif sig.upper() == "WOTA":
|
||||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.wota.org.uk/mapping/data/summits.json",
|
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.wota.org.uk/mapping/data/summits.json",
|
||||||
headers=HTTP_HEADERS).json()
|
headers=HTTP_HEADERS).json()
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ class SolarConditions:
|
|||||||
blackout_forecast_r1r2: dict = None
|
blackout_forecast_r1r2: dict = None
|
||||||
# NOAA Radio Blackout (R3 or greater) probability forecast, keyed by UNIX timestamp of start of day UTC
|
# NOAA Radio Blackout (R3 or greater) probability forecast, keyed by UNIX timestamp of start of day UTC
|
||||||
blackout_forecast_r3_or_greater: dict = None
|
blackout_forecast_r3_or_greater: dict = None
|
||||||
|
# Ionosonde measurements from LGDC, dict keyed by URSI code, values are dicts with keys: ursi, name, fof2, muf
|
||||||
|
ionosonde_data: dict = None
|
||||||
|
|
||||||
# Derived values (populated by infer_descriptions())
|
# Derived values (populated by infer_descriptions())
|
||||||
# HF radio blackout risk description, derived from xray
|
# HF radio blackout risk description, derived from xray
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
AA343,"Almaty, Kazakhstan"
|
||||||
|
AL945,"Alpena, United States"
|
||||||
|
AT138,"Athens, Greece"
|
||||||
|
AU930,"Austin, United States"
|
||||||
|
BR52P,"Brisbane, Australia"
|
||||||
|
BVJ03,"Boa Vista, Brazil"
|
||||||
|
CAJ2M,"Cachoeira Paulista, Brazil"
|
||||||
|
CB53N,"Canberra, Australia"
|
||||||
|
CGK21,"Campo Grande, Brazil"
|
||||||
|
DB049,"Dourbes, Belgium"
|
||||||
|
DW41K,"Darwin, Australia"
|
||||||
|
EA036,"El Arenosillo, Spain"
|
||||||
|
EB040,"Roquetes, Spain"
|
||||||
|
EG931,"Eglin Air Force Base, United States"
|
||||||
|
FF051,"Fairford, United Kingdom"
|
||||||
|
GA762,"Gakona, United States"
|
||||||
|
GM037,"Gibilmanna, Italy"
|
||||||
|
GR13L,"Grahamstown, South Africa"
|
||||||
|
HE13N,"Hermanus, South Africa"
|
||||||
|
HO54K,"Hobart, Australia"
|
||||||
|
IC437,"I-Cheon, South Korea"
|
||||||
|
IF843,"Idaho National Laboratory, United States"
|
||||||
|
JI91J,"Jicamarca, Peru"
|
||||||
|
JR055,"Juliusruh, Germany"
|
||||||
|
LAA38,"Lajes Terceira Island, Portugal"
|
||||||
|
LL721,"Lualualei, United States"
|
||||||
|
LM42B,"Learmonth, Australia"
|
||||||
|
LV12P,"Louisvale, South Africa"
|
||||||
|
MHJ45,"Millstone Hill, United States"
|
||||||
|
ML10L,"Malindi, Kenya"
|
||||||
|
NI135,"Nicosia, Cyprus"
|
||||||
|
NI63_,"Norfolk, Australia"
|
||||||
|
PA836,"Portt Arguello, United States"
|
||||||
|
PE43K,"Perth, Australia"
|
||||||
|
PF765,"Poker Flat, United States"
|
||||||
|
PQ052,"Pruhonice, Czechia"
|
||||||
|
RO041,"Rome, Italy"
|
||||||
|
SAA0K,"Saoluis, Brazil"
|
||||||
|
SO148,"Sopron, Hungary"
|
||||||
|
TR169,"Tromso, Norway"
|
||||||
|
TV51R,"Townsville, Australia"
|
||||||
|
VT139,"San Vito, Italy"
|
||||||
|
@@ -41,8 +41,7 @@ class APISpotHandler(tornado.web.RequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Reject if format not json
|
# Reject if format not json
|
||||||
if 'Content-Type' not in self.request.headers or self.request.headers.get(
|
if not self.request.headers.get('Content-Type', '').startswith("application/json"):
|
||||||
'Content-Type') != "application/json":
|
|
||||||
self.set_status(415)
|
self.set_status(415)
|
||||||
self.write(
|
self.write(
|
||||||
json.dumps("Error - request Content-Type must be application/json", default=serialize_everything))
|
json.dumps("Error - request Content-Type must be application/json", default=serialize_everything))
|
||||||
@@ -139,7 +138,7 @@ class APISpotHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
self.set_header("Content-Type", "application/json")
|
self.set_header("Content-Type", "application/json")
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class APIAlertsHandler(tornado.web.RequestHandler):
|
|||||||
self.set_status(400)
|
self.set_status(400)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
self.set_header("Content-Type", "application/json")
|
self.set_header("Content-Type", "application/json")
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class APILookupCallHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
|
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
@@ -119,7 +119,7 @@ class APILookupSIGRefHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
|
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
@@ -177,7 +177,7 @@ class APILookupGridHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
|
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class APISpotsHandler(tornado.web.RequestHandler):
|
|||||||
self.set_status(400)
|
self.set_status(400)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
self.write(json.dumps("Error - " + str(e), default=serialize_everything))
|
self.write(json.dumps("Error - an internal server error occurred.", default=serialize_everything))
|
||||||
self.set_status(500)
|
self.set_status(500)
|
||||||
self.set_header("Cache-Control", "no-store")
|
self.set_header("Cache-Control", "no-store")
|
||||||
self.set_header("Content-Type", "application/json")
|
self.set_header("Content-Type", "application/json")
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ from core.prometheus_metrics_handler import page_requests_counter
|
|||||||
class PageTemplateHandler(tornado.web.RequestHandler):
|
class PageTemplateHandler(tornado.web.RequestHandler):
|
||||||
"""Handler for all HTML pages generated from templates"""
|
"""Handler for all HTML pages generated from templates"""
|
||||||
|
|
||||||
def initialize(self, template_name, web_server_metrics, has_hamqsl=False, has_noaa_forecast=False):
|
def initialize(self, template_name, web_server_metrics, has_hamqsl=False, has_noaa_forecast=False, has_giro_ionosonde=False):
|
||||||
self._template_name = template_name
|
self._template_name = template_name
|
||||||
self._web_server_metrics = web_server_metrics
|
self._web_server_metrics = web_server_metrics
|
||||||
self._has_hamqsl = has_hamqsl
|
self._has_hamqsl = has_hamqsl
|
||||||
self._has_noaa_forecast = has_noaa_forecast
|
self._has_noaa_forecast = has_noaa_forecast
|
||||||
|
self._has_giro_ionosonde = has_giro_ionosonde
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
# Metrics
|
# Metrics
|
||||||
@@ -27,4 +28,5 @@ class PageTemplateHandler(tornado.web.RequestHandler):
|
|||||||
# Load named template, and provide variables used in templates
|
# Load named template, and provide variables used in templates
|
||||||
self.render(self._template_name + ".html", software_version=SOFTWARE_VERSION, allow_spotting=ALLOW_SPOTTING,
|
self.render(self._template_name + ".html", software_version=SOFTWARE_VERSION, allow_spotting=ALLOW_SPOTTING,
|
||||||
web_ui_options=WEB_UI_OPTIONS, baseurl=BASE_URL, current_path=self.request.path,
|
web_ui_options=WEB_UI_OPTIONS, baseurl=BASE_URL, current_path=self.request.path,
|
||||||
has_hamqsl=self._has_hamqsl, has_noaa_forecast=self._has_noaa_forecast)
|
has_hamqsl=self._has_hamqsl, has_noaa_forecast=self._has_noaa_forecast,
|
||||||
|
has_giro_ionosonde=self._has_giro_ionosonde)
|
||||||
+2
-1
@@ -57,8 +57,9 @@ class WebServer:
|
|||||||
provider_classes = [type(p).__name__ for p in self._solar_condition_providers if p.enabled]
|
provider_classes = [type(p).__name__ for p in self._solar_condition_providers if p.enabled]
|
||||||
has_hamqsl = "HamQSL" in provider_classes
|
has_hamqsl = "HamQSL" in provider_classes
|
||||||
has_noaa_forecast = "NOAA3dayForecast" in provider_classes
|
has_noaa_forecast = "NOAA3dayForecast" in provider_classes
|
||||||
|
has_giro_ionosonde = "GIROIonosonde" in provider_classes
|
||||||
page_opts = {"web_server_metrics": self.web_server_metrics, "has_hamqsl": has_hamqsl,
|
page_opts = {"web_server_metrics": self.web_server_metrics, "has_hamqsl": has_hamqsl,
|
||||||
"has_noaa_forecast": has_noaa_forecast}
|
"has_noaa_forecast": has_noaa_forecast, "has_giro_ionosonde": has_giro_ionosonde}
|
||||||
|
|
||||||
app = tornado.web.Application([
|
app = tornado.web.Application([
|
||||||
# Routes for API calls
|
# Routes for API calls
|
||||||
|
|||||||
@@ -0,0 +1,130 @@
|
|||||||
|
import csv
|
||||||
|
import logging
|
||||||
|
from datetime import datetime, timezone, timedelta
|
||||||
|
from threading import Thread, Event
|
||||||
|
|
||||||
|
import pytz
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from core.constants import HTTP_HEADERS
|
||||||
|
from solarconditionsproviders.solar_conditions_provider import SolarConditionsProvider
|
||||||
|
|
||||||
|
POLL_INTERVAL = 3600 # 1 hour
|
||||||
|
STATIONS_INDEX = "datafiles/didbase-stations.csv"
|
||||||
|
LGDC_URL = "https://lgdc.uml.edu/common/DIDBGetValues"
|
||||||
|
HISTORY_HOURS = 24
|
||||||
|
|
||||||
|
|
||||||
|
class GIROIonosonde(SolarConditionsProvider):
|
||||||
|
"""Solar conditions provider using ionosonde data from the GIRO Data Center.
|
||||||
|
Queries foF2 and MUF measurements for all stations in datafiles/didbase-stations.csv."""
|
||||||
|
|
||||||
|
def __init__(self, provider_config):
|
||||||
|
super().__init__(provider_config)
|
||||||
|
self._stations = self._load_stations()
|
||||||
|
self._thread = None
|
||||||
|
self._stop_event = Event()
|
||||||
|
|
||||||
|
def _load_stations(self):
|
||||||
|
"""Load the CSV file containing the list of URSIs and Station Names for currently active ionosondes."""
|
||||||
|
|
||||||
|
stations = []
|
||||||
|
with open(STATIONS_INDEX, newline='') as f:
|
||||||
|
for row in csv.reader(f):
|
||||||
|
if len(row) >= 2:
|
||||||
|
stations.append({"ursi": row[0].strip(), "name": row[1].strip()})
|
||||||
|
return stations
|
||||||
|
|
||||||
|
def setup(self, solar_conditions, solar_conditions_cache):
|
||||||
|
"""Prepopulate the ionosonde_data map with known URSI and station names, so that the API exposes this structure
|
||||||
|
even before we actually have any data in it."""
|
||||||
|
|
||||||
|
super().setup(solar_conditions, solar_conditions_cache)
|
||||||
|
self.update_data({"ionosonde_data": {
|
||||||
|
s["ursi"]: {"ursi": s["ursi"], "name": s["name"], "fof2": None, "muf": None}
|
||||||
|
for s in self._stations
|
||||||
|
}})
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
logging.info(f"Set up query of GIRO ionosonde data API every {POLL_INTERVAL} seconds.")
|
||||||
|
self._thread = Thread(target=self._run, daemon=True)
|
||||||
|
self._thread.start()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self._stop_event.set()
|
||||||
|
|
||||||
|
def _run(self):
|
||||||
|
while True:
|
||||||
|
self._poll()
|
||||||
|
if self._stop_event.wait(timeout=POLL_INTERVAL):
|
||||||
|
break
|
||||||
|
|
||||||
|
def _poll(self):
|
||||||
|
try:
|
||||||
|
logging.debug(f"Polling GIRO ionosonde data...")
|
||||||
|
now = datetime.now(timezone.utc)
|
||||||
|
from_time = now - timedelta(hours=HISTORY_HOURS)
|
||||||
|
ionosonde_data = dict(self._solar_conditions.ionosonde_data or {})
|
||||||
|
updated_count = 0
|
||||||
|
|
||||||
|
for station in self._stations:
|
||||||
|
if self._stop_event.is_set():
|
||||||
|
break
|
||||||
|
ursi = station["ursi"]
|
||||||
|
name = station["name"]
|
||||||
|
try:
|
||||||
|
fof2, muf = self._fetch_station_data(ursi, from_time, now)
|
||||||
|
if fof2 and muf:
|
||||||
|
ionosonde_data[ursi] = {"ursi": ursi, "name": name, "fof2": fof2, "muf": muf}
|
||||||
|
updated_count += 1
|
||||||
|
except Exception:
|
||||||
|
logging.warning(f"Could not fetch ionosonde data for {ursi} ({name})")
|
||||||
|
|
||||||
|
self.update_data({"ionosonde_data": ionosonde_data})
|
||||||
|
self.status = "OK"
|
||||||
|
self.last_update_time = datetime.now(pytz.UTC)
|
||||||
|
logging.debug(f"Updated ionosonde data for {updated_count} stations.")
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
self.status = "Error"
|
||||||
|
logging.exception(f"Exception in GIRO Ionosonde data provider")
|
||||||
|
self._stop_event.wait(timeout=1)
|
||||||
|
|
||||||
|
def _fetch_station_data(self, ursi, from_time, to_time):
|
||||||
|
"""Fetch foF2 and MUF readings for a station. Returns (fof2_dict, muf_dict) keyed by UNIX timestamp."""
|
||||||
|
|
||||||
|
from_str = from_time.strftime("%Y.%m.%d+%H:%M:%S")
|
||||||
|
to_str = to_time.strftime("%Y.%m.%d+%H:%M:%S")
|
||||||
|
url = f"{LGDC_URL}?ursiCode={ursi}&charName=foF2,MUFD&DMUF=3000&fromDate={from_str}&toDate={to_str}"
|
||||||
|
response = requests.get(url, headers=HTTP_HEADERS, timeout=(5, 15))
|
||||||
|
if response.status_code != 200:
|
||||||
|
return None, None
|
||||||
|
return self._parse_all(response.text)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_all(text):
|
||||||
|
"""Parse web server response and return (fof2_dict, muf_dict) keyed by UNIX timestamp."""
|
||||||
|
|
||||||
|
fof2_data = {}
|
||||||
|
muf_data = {}
|
||||||
|
for line in text.splitlines():
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
# Data rows have the following format: timestamp CS foF2 QD MUFD QD
|
||||||
|
parts = line.split()
|
||||||
|
if len(parts) >= 5:
|
||||||
|
try:
|
||||||
|
# Python 3.8 TZ parsing fudge
|
||||||
|
ts = datetime.fromisoformat(parts[0].replace('Z', '+00:00')).timestamp()
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
fof2_data[ts] = float(parts[2])
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
muf_data[ts] = float(parts[4])
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
return fof2_data, muf_data
|
||||||
@@ -38,7 +38,7 @@ class HTTPSolarConditionsProvider(SolarConditionsProvider):
|
|||||||
def _poll(self):
|
def _poll(self):
|
||||||
try:
|
try:
|
||||||
logging.debug("Polling " + self.name + " solar conditions API...")
|
logging.debug("Polling " + self.name + " solar conditions API...")
|
||||||
http_response = requests.get(self._url, headers=HTTP_HEADERS)
|
http_response = requests.get(self._url, headers=HTTP_HEADERS, timeout=(5, 30))
|
||||||
new_data = self._http_response_to_solar_conditions(http_response)
|
new_data = self._http_response_to_solar_conditions(http_response)
|
||||||
self.update_data(new_data)
|
self.update_data(new_data)
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ class SolarConditionsProvider:
|
|||||||
self.status = "Not Started" if self.enabled else "Disabled"
|
self.status = "Not Started" if self.enabled else "Disabled"
|
||||||
self._solar_conditions = None
|
self._solar_conditions = None
|
||||||
|
|
||||||
def setup(self, solar_conditions):
|
def setup(self, solar_conditions, solar_conditions_cache):
|
||||||
"""Set up the provider, giving it the solar conditions dict to update"""
|
"""Set up the provider, giving it the solar conditions object and its backing cache"""
|
||||||
|
|
||||||
self._solar_conditions = solar_conditions
|
self._solar_conditions = solar_conditions
|
||||||
|
self._solar_conditions_cache = solar_conditions_cache
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Start the provider. This should return immediately after spawning threads to access the remote resources"""
|
"""Start the provider. This should return immediately after spawning threads to access the remote resources"""
|
||||||
@@ -39,3 +40,4 @@ class SolarConditionsProvider:
|
|||||||
if hasattr(self._solar_conditions, key):
|
if hasattr(self._solar_conditions, key):
|
||||||
setattr(self._solar_conditions, key, value)
|
setattr(self._solar_conditions, key, value)
|
||||||
self._solar_conditions.infer_descriptions()
|
self._solar_conditions.infer_descriptions()
|
||||||
|
self._solar_conditions_cache['solar_conditions'] = self._solar_conditions
|
||||||
|
|||||||
+4
-2
@@ -18,7 +18,8 @@ from server.webserver import WebServer
|
|||||||
# Globals
|
# Globals
|
||||||
spots = Cache('cache/spots_cache')
|
spots = Cache('cache/spots_cache')
|
||||||
alerts = Cache('cache/alerts_cache')
|
alerts = Cache('cache/alerts_cache')
|
||||||
solar_conditions = SolarConditions()
|
solar_conditions_cache = Cache('cache/solar_conditions_cache')
|
||||||
|
solar_conditions = solar_conditions_cache.get('solar_conditions', SolarConditions())
|
||||||
web_server = None
|
web_server = None
|
||||||
status_data = {}
|
status_data = {}
|
||||||
spot_providers = []
|
spot_providers = []
|
||||||
@@ -48,6 +49,7 @@ def shutdown(sig, frame):
|
|||||||
lookup_helper.stop()
|
lookup_helper.stop()
|
||||||
spots.close()
|
spots.close()
|
||||||
alerts.close()
|
alerts.close()
|
||||||
|
solar_conditions_cache.close()
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
@@ -120,7 +122,7 @@ if __name__ == '__main__':
|
|||||||
for entry in config.get("solar-condition-providers", []):
|
for entry in config.get("solar-condition-providers", []):
|
||||||
solar_condition_providers.append(get_solar_conditions_provider_from_config(entry))
|
solar_condition_providers.append(get_solar_conditions_provider_from_config(entry))
|
||||||
for p in solar_condition_providers:
|
for p in solar_condition_providers:
|
||||||
p.setup(solar_conditions=solar_conditions)
|
p.setup(solar_conditions=solar_conditions, solar_conditions_cache=solar_conditions_cache)
|
||||||
if p.enabled:
|
if p.enabled:
|
||||||
p.start()
|
p.start()
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class HEMA(HTTPSpotProvider):
|
|||||||
new_spots = []
|
new_spots = []
|
||||||
# OK, if the spot seed actually changed, now we make the real request for data.
|
# OK, if the spot seed actually changed, now we make the real request for data.
|
||||||
if spot_seed_changed:
|
if spot_seed_changed:
|
||||||
source_data = requests.get(self.SPOTS_URL, headers=HTTP_HEADERS)
|
source_data = requests.get(self.SPOTS_URL, headers=HTTP_HEADERS, timeout=(5, 30))
|
||||||
source_data_items = source_data.text.split("=")
|
source_data_items = source_data.text.split("=")
|
||||||
# Iterate through source data items.
|
# Iterate through source data items.
|
||||||
for source_spot in source_data_items:
|
for source_spot in source_data_items:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class HTTPSpotProvider(SpotProvider):
|
|||||||
try:
|
try:
|
||||||
# Request data from API
|
# Request data from API
|
||||||
logging.debug("Polling " + self.name + " spot API...")
|
logging.debug("Polling " + self.name + " spot API...")
|
||||||
http_response = requests.get(self._url, headers=HTTP_HEADERS)
|
http_response = requests.get(self._url, headers=HTTP_HEADERS, timeout=(5, 30))
|
||||||
# Pass off to the subclass for processing
|
# Pass off to the subclass for processing
|
||||||
new_spots = self._http_response_to_spots(http_response)
|
new_spots = self._http_response_to_spots(http_response)
|
||||||
# Submit the new spots for processing. There might not be any spots for the less popular programs.
|
# Submit the new spots for processing. There might not be any spots for the less popular programs.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class SOTA(HTTPSpotProvider):
|
|||||||
new_spots = []
|
new_spots = []
|
||||||
# OK, if the epoch actually changed, now we make the real request for data.
|
# OK, if the epoch actually changed, now we make the real request for data.
|
||||||
if epoch_changed:
|
if epoch_changed:
|
||||||
source_data = requests.get(self.SPOTS_URL, headers=HTTP_HEADERS).json()
|
source_data = requests.get(self.SPOTS_URL, headers=HTTP_HEADERS, timeout=(5, 30)).json()
|
||||||
# Iterate through source data
|
# Iterate through source data
|
||||||
for source_spot in source_data:
|
for source_spot in source_data:
|
||||||
# Convert to our spot format
|
# Convert to our spot format
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<h4 class="mt-4">What data sources are supported?</h4>
|
<h4 class="mt-4">What data sources are supported?</h4>
|
||||||
<p>Spothole can retrieve spots from: <a href="https://www.dxcluster.info/telnet/">Telnet-based DX clusters</a>, the <a href="https://www.reversebeacon.net/">Reverse Beacon Network (RBN)</a>, the <a href="https://www.aprs-is.net/">APRS Internet Service (APRS-IS)</a>, <a href="https://pota.app">POTA</a>, <a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a href="https://www.cqgma.org/">GMA</a>, <a href="https://wwbota.net/">WWBOTA</a>, <a href="http://www.hema.org.uk/">HEMA</a>, <a href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a href="https://ontheair.nz">ZLOTA</a>, <a href="https://www.wota.org.uk/">WOTA</a>, <a href="https://llota.app">LLOTA</a>, <a href="https://wwtota.com">WWTOTA</a>, <a href="https://tilesontheair.com/">Tiles on the Air</a>, the <a href="https://ukpacketradio.network/">UK Packet Repeater Network</a>, and any site based on the <a href="https://github.com/nischu/xOTA">xOTA software by nischu</a>.</p>
|
<p>Spothole can retrieve spots from: <a href="https://www.dxcluster.info/telnet/">Telnet-based DX clusters</a>, the <a href="https://www.reversebeacon.net/">Reverse Beacon Network (RBN)</a>, the <a href="https://www.aprs-is.net/">APRS Internet Service (APRS-IS)</a>, <a href="https://pota.app">POTA</a>, <a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a href="https://www.cqgma.org/">GMA</a>, <a href="https://wwbota.net/">WWBOTA</a>, <a href="http://www.hema.org.uk/">HEMA</a>, <a href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a href="https://ontheair.nz">ZLOTA</a>, <a href="https://www.wota.org.uk/">WOTA</a>, <a href="https://llota.app">LLOTA</a>, <a href="https://wwtota.com">WWTOTA</a>, <a href="https://tilesontheair.com/">Tiles on the Air</a>, the <a href="https://ukpacketradio.network/">UK Packet Repeater Network</a>, and any site based on the <a href="https://github.com/nischu/xOTA">xOTA software by nischu</a>.</p>
|
||||||
<p>Spothole can retrieve alerts from: <a href="https://www.ng3k.com/">NG3K</a>, <a href="https://pota.app">POTA</a>, <a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a href="https://www.wota.org.uk/">WOTA</a> and <a href="https://www.beachesontheair.com/">BOTA</a>.</p>
|
<p>Spothole can retrieve alerts from: <a href="https://www.ng3k.com/">NG3K</a>, <a href="https://pota.app">POTA</a>, <a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a href="https://www.wota.org.uk/">WOTA</a> and <a href="https://www.beachesontheair.com/">BOTA</a>.</p>
|
||||||
<p>Spothole can retrieve solar and propagation condition data from <a href="https://www.hamqsl.com">HamQSL</a>.</p>
|
<p>Spothole can retrieve solar and propagation condition data from <a href="https://www.hamqsl.com">HamQSL</a>, the <a href="https://www.swpc.noaa.gov/">NOAA Space Weather Prediction Center</a> and the <a href="https://giro.uml.edu/">Lowell GIRO Data Center</a>.</p>
|
||||||
<p>Spothole can also perform lookups for callsign data on behalf of the user from <a href="https://qrz.com">QRZ.com</a> and <a href="https://hamqth.com">HamQTH</a>.</p>
|
<p>Spothole can also perform lookups for callsign data on behalf of the user from <a href="https://qrz.com">QRZ.com</a> and <a href="https://hamqth.com">HamQTH</a>.</p>
|
||||||
<p>Note that the server owner has not necessarily enabled all these data sources. In particular it is common to disable RBN, to avoid the server being swamped with FT8 traffic, and to disable APRS-IS and UK Packet Net so that the server only displays stations where there is likely to be an operator physically present for a QSO.</p>
|
<p>Note that the server owner has not necessarily enabled all these data sources. In particular it is common to disable RBN, to avoid the server being swamped with FT8 traffic, and to disable APRS-IS and UK Packet Net so that the server only displays stations where there is likely to be an operator physically present for a QSO.</p>
|
||||||
<p>Between the various data sources, the following Special Interest Groups (SIGs) are supported: Parks on the Air (POTA), Summits on the Air (SOTA), Worldwide Flora & Fauna (WWFF), Global Mountain Activity (GMA), Worldwide Bunkers on the Air (WWBOTA), HuMPs Excluding Marilyns Award (HEMA), Islands on the Air (IOTA), Mills on the Air (MOTA), the Amateur Radio Lighthouse Socirty (ARLHS), International Lighthouse Lightship Weekend (ILLW), Silos on the Air (SIOTA), World Castles Award (WCA), New Zealand on the Air (ZLOTA), Keith Roget Memorial National Parks Award (KRMNPA), Wainwrights on the Air (WOTA), Beaches on the Air (BOTA), Lagos y Lagunas On the Air (LLOTA), Towers on the Air (WWTOTA), Tiles on the Air, Worked All Britain (WAB), Worked All Ireland (WAI), and Toilets on the Air (TOTA).</p>
|
<p>Between the various data sources, the following Special Interest Groups (SIGs) are supported: Parks on the Air (POTA), Summits on the Air (SOTA), Worldwide Flora & Fauna (WWFF), Global Mountain Activity (GMA), Worldwide Bunkers on the Air (WWBOTA), HuMPs Excluding Marilyns Award (HEMA), Islands on the Air (IOTA), Mills on the Air (MOTA), the Amateur Radio Lighthouse Socirty (ARLHS), International Lighthouse Lightship Weekend (ILLW), Silos on the Air (SIOTA), World Castles Award (WCA), New Zealand on the Air (ZLOTA), Keith Roget Memorial National Parks Award (KRMNPA), Wainwrights on the Air (WOTA), Beaches on the Air (BOTA), Lagos y Lagunas On the Air (LLOTA), Towers on the Air (WWTOTA), Tiles on the Air, Worked All Britain (WAB), Worked All Ireland (WAI), and Toilets on the Air (TOTA).</p>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<p>This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.</p>
|
<p>This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-about").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-about").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/add-spot.js?v=1778343015"></script>
|
<script src="/js/add-spot.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-add-spot").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-add-spot").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -70,8 +70,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/alerts.js?v=1778343015"></script>
|
<script src="/js/alerts.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-alerts").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-alerts").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -76,9 +76,9 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1778343015"></script>
|
<script src="/js/spotsbandsandmap.js?v=1778927183"></script>
|
||||||
<script src="/js/bands.js?v=1778343015"></script>
|
<script src="/js/bands.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-bands").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-bands").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
+13
-7
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<title>Spothole</title>
|
<title>Spothole</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/css/style.css?v=1778343015" type="text/css">
|
<link rel="stylesheet" href="/css/style.css?v=1778927183" type="text/css">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
||||||
<link href="/fa/css/fontawesome.min.css" rel="stylesheet" />
|
<link href="/fa/css/fontawesome.min.css" rel="stylesheet" />
|
||||||
@@ -39,16 +39,22 @@
|
|||||||
|
|
||||||
<link rel="manifest" href="manifest.webmanifest">
|
<link rel="manifest" href="manifest.webmanifest">
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"
|
||||||
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js"></script>
|
integrity="sha384-1H217gwSVyLSIfaLxHbE7dRb3v4mYCKbpQvzx0cegeju1MVsGrX5xXxAvs/HgeFs"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js"
|
||||||
|
integrity="sha384-N1xdnJwBzqfCpEDxEeSQzv4NPVPViBQq2NLbzth3YA1pLvR9mtf+TV5g6O+KLkPY"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
|
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/tinycolor2@1.6.0/cjs/tinycolor.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tinycolor2@1.6.0/cjs/tinycolor.min.js"
|
||||||
|
integrity="sha384-L1eE4eD41kpBIWe2I0eHy+GnEUC4RIpcvibVW2JCminuPlTl+2Bc528iPdVMg5Dn"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script src="https://misc.ianrenton.com/jsutils/utils.js?v=1778343015"></script>
|
<script src="https://misc.ianrenton.com/jsutils/utils.js?v=1778927183"></script>
|
||||||
<script src="https://misc.ianrenton.com/jsutils/ui-ham.js?v=1778343015"></script>
|
<script src="https://misc.ianrenton.com/jsutils/ui-ham.js?v=1778927183"></script>
|
||||||
<script src="https://misc.ianrenton.com/jsutils/geo.js?v=1778343015"></script>
|
<script src="https://misc.ianrenton.com/jsutils/geo.js?v=1778927183"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
<label for="hamqth-enabled" class="form-check-label">Use data from HamQTH</label>
|
<label for="hamqth-enabled" class="form-check-label">Use data from HamQTH</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<input type="text" class="storeable-text form-control form-control-sm" id="hamqth-username" placeholder="Username (Callsign)" onchange="saveSettings();" autocomplete="username">
|
<input type="text" class="storeable-text form-control" id="hamqth-username" placeholder="Username (Callsign)" onchange="saveSettings();" autocomplete="username">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<input type="password" class="password-field form-control form-control-sm" id="hamqth-password" placeholder="Password" data-remember-checkbox="hamqth-remember-password" onchange="saveSettings();" autocomplete="current-password">
|
<input type="password" class="password-field form-control" id="hamqth-password" placeholder="Password" data-remember-checkbox="hamqth-remember-password" onchange="saveSettings();" autocomplete="current-password">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" class="storeable-checkbox form-check-input" id="hamqth-remember-password" onchange="saveSettings();">
|
<input type="checkbox" class="storeable-checkbox form-check-input" id="hamqth-remember-password" onchange="saveSettings();">
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
<label for="qrz-enabled" class="form-check-label">Use data from QRZ.com</label>
|
<label for="qrz-enabled" class="form-check-label">Use data from QRZ.com</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<input type="text" class="storeable-text form-control form-control-sm" id="qrz-username" placeholder="Username (Callsign)" onchange="saveSettings();" autocomplete="username">
|
<input type="text" class="storeable-text form-control" id="qrz-username" placeholder="Username (Callsign)" onchange="saveSettings();" autocomplete="username">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<input type="password" class="password-field form-control form-control-sm" id="qrz-password" placeholder="Password" data-remember-checkbox="qrz-remember-password" onchange="saveSettings();" autocomplete="current-password">
|
<input type="password" class="password-field form-control" id="qrz-password" placeholder="Password" data-remember-checkbox="qrz-remember-password" onchange="saveSettings();" autocomplete="current-password">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" class="storeable-checkbox form-check-input" id="qrz-remember-password" onchange="saveSettings();">
|
<input type="checkbox" class="storeable-checkbox form-check-input" id="qrz-remember-password" onchange="saveSettings();">
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
{% if has_noaa_forecast %}
|
{% if has_noaa_forecast %}
|
||||||
<div class="card mt-5">
|
<div class="card mt-5">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Forecast
|
Solar Weather Forecast
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
@@ -173,6 +173,25 @@
|
|||||||
</div>
|
</div>
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
|
{% if has_giro_ionosonde %}
|
||||||
|
<div class="card mt-5">
|
||||||
|
<div class="card-header">
|
||||||
|
Ionosonde Data
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="ionosonde-station" class="form-label">Ionosonde station:</label>
|
||||||
|
<select id="ionosonde-station" class="form-select storeable-select d-inline-block ms-2"
|
||||||
|
style="width: auto;" oninput="ionosondeStationChanged();">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div id="ionosonde-latest" class="mb-3"></div>
|
||||||
|
<canvas id="ionosonde-chart" class="mt-3 mb-3 hideonmobile"></canvas>
|
||||||
|
<div class="form-text mt-2">Data from the <a href="https://lgdc.uml.edu/">Lowell GIRO Data Center</a>.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% end %}
|
||||||
|
|
||||||
<div class="card mt-5">
|
<div class="card mt-5">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
DX Opportunities
|
DX Opportunities
|
||||||
@@ -230,8 +249,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.9/dist/chart.umd.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.9/dist/chart.umd.min.js"></script>
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/conditions.js?v=1778343015"></script>
|
<script src="/js/conditions.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-conditions").addClass("active");
|
$("#nav-link-conditions").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+4
-3
@@ -79,6 +79,7 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-extra-markers@1.2.2/dist/css/leaflet.extra-markers.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-extra-markers@1.2.2/dist/css/leaflet.extra-markers.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/overlapping-marker-spiderfier-leaflet/dist/oms.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/leaflet-providers@2.0.0/leaflet-providers.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/leaflet-providers@2.0.0/leaflet-providers.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/leaflet-extra-markers@1.2.2/src/assets/js/leaflet.extra-markers.min.js" type="module"></script>
|
<script src="https://cdn.jsdelivr.net/npm/leaflet-extra-markers@1.2.2/src/assets/js/leaflet.extra-markers.min.js" type="module"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/leaflet.geodesic"></script>
|
<script src="https://cdn.jsdelivr.net/npm/leaflet.geodesic"></script>
|
||||||
@@ -93,9 +94,9 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1778343015"></script>
|
<script src="/js/spotsbandsandmap.js?v=1778927183"></script>
|
||||||
<script src="/js/map.js?v=1778343015"></script>
|
<script src="/js/map.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-map").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-map").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -104,9 +104,9 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1778343015"></script>
|
<script src="/js/spotsbandsandmap.js?v=1778927183"></script>
|
||||||
<script src="/js/spots.js?v=1778343015"></script>
|
<script src="/js/spots.js?v=1778927183"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -59,8 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=1778343015"></script>
|
<script src="/js/common.js?v=1778927183"></script>
|
||||||
<script src="/js/status.js?v=1778343015"></script>
|
<script src="/js/status.js?v=1778927183"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() { $("#nav-link-status").addClass("active"); }); <!-- highlight active page in nav -->
|
$(document).ready(function() { $("#nav-link-status").addClass("active"); }); <!-- highlight active page in nav -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ info:
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 1.4
|
||||||
|
|
||||||
|
* `/solar` response now includes `ionosonde_data`, which contains ionosonde station measurements (foF2 and MUF) sourced from the GIRO Data Center.
|
||||||
|
|
||||||
### 1.3
|
### 1.3
|
||||||
|
|
||||||
* `/spots`, `/spots/stream`, `/alerts`, `/alerts/stream`, and `/lookup/call` now accept optional QRZ.com and HamQTH credentials as query parameters. When supplied, returned data is enriched with operator name, home location etc. from those services.
|
* `/spots`, `/spots/stream`, `/alerts`, `/alerts/stream`, and `/lookup/call` now accept optional QRZ.com and HamQTH credentials as query parameters. When supplied, returned data is enriched with operator name, home location etc. from those services.
|
||||||
@@ -1683,6 +1687,45 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
description: Electron flux impact description, derived from electron flux level.
|
description: Electron flux impact description, derived from electron flux level.
|
||||||
example: "No impact"
|
example: "No impact"
|
||||||
|
ionosonde_data:
|
||||||
|
type: object
|
||||||
|
nullable: true
|
||||||
|
description: >
|
||||||
|
Ionosonde measurements from the GIRO Data Center, keyed by URSI station code. All known stations are
|
||||||
|
included, but not all of them may contain data.
|
||||||
|
additionalProperties:
|
||||||
|
$ref: '#/components/schemas/IonosondeStation'
|
||||||
|
|
||||||
|
IonosondeStation:
|
||||||
|
type: object
|
||||||
|
description: Ionosonde measurement data for a single station, covering approximately the last 24 hours.
|
||||||
|
properties:
|
||||||
|
ursi:
|
||||||
|
type: string
|
||||||
|
description: URSI code identifying the ionosonde station.
|
||||||
|
example: DB049
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Human-readable name of the ionosonde station.
|
||||||
|
example: Dourbes
|
||||||
|
fof2:
|
||||||
|
type: object
|
||||||
|
nullable: true
|
||||||
|
description: F2 layer critical frequency (foF2) measurements in MHz, keyed by UNIX timestamp (UTC seconds since epoch) of each measurement. Can be null if there is no data.
|
||||||
|
additionalProperties:
|
||||||
|
type: number
|
||||||
|
example:
|
||||||
|
"1747267201.0": 7.45
|
||||||
|
"1747267501.0": 7.50
|
||||||
|
muf:
|
||||||
|
type: object
|
||||||
|
nullable: true
|
||||||
|
description: Maximum Usable Frequency (MUF) for a 3000 km path in MHz, keyed by UNIX timestamp (UTC seconds since epoch) of each measurement. Can be null if there is no data.
|
||||||
|
additionalProperties:
|
||||||
|
type: number
|
||||||
|
example:
|
||||||
|
"1747267201.0": 21.66
|
||||||
|
"1747267501.0": 21.80
|
||||||
|
|
||||||
SolarConditionsProviderStatus:
|
SolarConditionsProviderStatus:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
@@ -103,7 +103,11 @@ function addSpot() {
|
|||||||
|
|
||||||
// Show an "add spot" error.
|
// Show an "add spot" error.
|
||||||
function showAddSpotError(text) {
|
function showAddSpotError(text) {
|
||||||
$("#result-bad").html("<div class='alert alert-danger alert-dismissible fade show mb-0 mt-4' role='alert'><i class='fa-solid fa-triangle-exclamation'></i> " + text + "<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div>");
|
var div = $("<div class='alert alert-danger alert-dismissible fade show mb-0 mt-4' role='alert'></div>");
|
||||||
|
div.append("<i class='fa-solid fa-triangle-exclamation'></i> ");
|
||||||
|
div.append(document.createTextNode(text));
|
||||||
|
div.append("<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>");
|
||||||
|
$("#result-bad").empty().append(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force callsign and mode capitalisation
|
// Force callsign and mode capitalisation
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ var alerts = []
|
|||||||
|
|
||||||
// Load alerts and populate the table.
|
// Load alerts and populate the table.
|
||||||
function loadAlerts() {
|
function loadAlerts() {
|
||||||
$.getJSON('/api/v1/alerts' + buildQueryString(), function(jsonData) {
|
$.getJSON('/api/v1/alerts' + buildQueryString(false), function(jsonData) {
|
||||||
// Store last updated time
|
// Store last updated time
|
||||||
lastUpdateTime = moment.utc();
|
lastUpdateTime = moment.utc();
|
||||||
updateRefreshDisplay();
|
updateRefreshDisplay();
|
||||||
@@ -18,7 +18,7 @@ function loadAlerts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build a query string for the API, based on the filters that the user has selected.
|
// Build a query string for the API, based on the filters that the user has selected.
|
||||||
function buildQueryString() {
|
function buildQueryString(includeCredentials) {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
["dx_continent", "source"].forEach(fn => {
|
["dx_continent", "source"].forEach(fn => {
|
||||||
if (!allFilterOptionsSelected(fn)) {
|
if (!allFilterOptionsSelected(fn)) {
|
||||||
@@ -33,7 +33,9 @@ function buildQueryString() {
|
|||||||
if ($("#dxpeditions_skip_max_duration_check")[0].checked) {
|
if ($("#dxpeditions_skip_max_duration_check")[0].checked) {
|
||||||
str = str + "&dxpeditions_skip_max_duration_check=true";
|
str = str + "&dxpeditions_skip_max_duration_check=true";
|
||||||
}
|
}
|
||||||
str = str + getCredentialQueryString();
|
if (includeCredentials) {
|
||||||
|
str = str + getCredentialQueryString();
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,9 +221,9 @@ function addAlertRowsToTable(tbody, alerts) {
|
|||||||
var items = []
|
var items = []
|
||||||
for (var i = 0; i < a["sig_refs"].length; i++) {
|
for (var i = 0; i < a["sig_refs"].length; i++) {
|
||||||
if (a["sig_refs"][i]["url"] != null) {
|
if (a["sig_refs"][i]["url"] != null) {
|
||||||
items[i] = `<a href='${a["sig_refs"][i]["url"]}' title='${a["sig_refs"][i]["name"]}' target='_new' class='sig-ref-link'>${a["sig_refs"][i]["id"]}</a>`
|
items[i] = `<a href='${encodeURI(a["sig_refs"][i]["url"])}' title='${escapeHtml(a["sig_refs"][i]["name"])}' target='_new' class='sig-ref-link'>${escapeHtml(a["sig_refs"][i]["id"])}</a>`
|
||||||
} else {
|
} else {
|
||||||
items[i] = `${a["sig_refs"][i]["id"]}`
|
items[i] = `${escapeHtml(a["sig_refs"][i]["id"])}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sig_refs = items.join(", ");
|
sig_refs = items.join(", ");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ BAND_COLUMN_SPOT_DIV_HEIGHT_PX = BAND_COLUMN_FONT_SIZE * 1.6;
|
|||||||
|
|
||||||
// Load spots and populate the bands display.
|
// Load spots and populate the bands display.
|
||||||
function loadSpots() {
|
function loadSpots() {
|
||||||
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
|
$.getJSON('/api/v1/spots' + buildQueryString(false), function(jsonData) {
|
||||||
// Store last updated time
|
// Store last updated time
|
||||||
lastUpdateTime = moment.utc();
|
lastUpdateTime = moment.utc();
|
||||||
updateRefreshDisplay();
|
updateRefreshDisplay();
|
||||||
@@ -24,7 +24,7 @@ function loadSpots() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build a query string for the API, based on the filters that the user has selected.
|
// Build a query string for the API, based on the filters that the user has selected.
|
||||||
function buildQueryString() {
|
function buildQueryString(includeCredentials) {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
||||||
if (!allFilterOptionsSelected(fn)) {
|
if (!allFilterOptionsSelected(fn)) {
|
||||||
@@ -34,7 +34,9 @@ function buildQueryString() {
|
|||||||
str = str + "max_age=" + $("#max-spot-age option:selected").val();
|
str = str + "max_age=" + $("#max-spot-age option:selected").val();
|
||||||
// Additional filters for the bands view: No dupes, no QRT
|
// Additional filters for the bands view: No dupes, no QRT
|
||||||
str = str + "&dedupe=true&allow_qrt=false";
|
str = str + "&dedupe=true&allow_qrt=false";
|
||||||
str = str + getCredentialQueryString();
|
if (includeCredentials) {
|
||||||
|
str = str + getCredentialQueryString();
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+239
-1
@@ -1,8 +1,12 @@
|
|||||||
// Cache for the full dxstats API response, so we can reload on the fly if the user changes the value of their continent
|
// Cache for the full dxstats API response, so we can reload on the fly if the user changes the value of their continent
|
||||||
// in the select box
|
// in the select box
|
||||||
let dxStatsData = null;
|
let dxStatsData = null;
|
||||||
// Forecast chart
|
// Kp forecast chart
|
||||||
let kpChart = null;
|
let kpChart = null;
|
||||||
|
// Cache for ionosonde data from the API
|
||||||
|
let ionosondeData = null;
|
||||||
|
// Ionosonde foF2/MUF chart
|
||||||
|
let ionosondeChart = null;
|
||||||
|
|
||||||
// Load solar conditions
|
// Load solar conditions
|
||||||
function loadSolarConditions() {
|
function loadSolarConditions() {
|
||||||
@@ -109,6 +113,14 @@ function loadSolarConditions() {
|
|||||||
electronFlux <= 100 ? 'bg-success-subtle' : electronFlux <= 1000 ? 'bg-warning-subtle' : 'bg-danger-subtle');
|
electronFlux <= 100 ? 'bg-success-subtle' : electronFlux <= 1000 ? 'bg-warning-subtle' : 'bg-danger-subtle');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ionosonde
|
||||||
|
|
||||||
|
if (jsonData.ionosonde_data && Object.keys(jsonData.ionosonde_data).length > 0) {
|
||||||
|
ionosondeData = jsonData.ionosonde_data;
|
||||||
|
populateIonosondeDropdown(ionosondeData);
|
||||||
|
renderIonosondeData();
|
||||||
|
}
|
||||||
|
|
||||||
// Forecast
|
// Forecast
|
||||||
|
|
||||||
renderKIndexForecast(jsonData.k_index_forecast);
|
renderKIndexForecast(jsonData.k_index_forecast);
|
||||||
@@ -348,6 +360,232 @@ function renderBlackoutForecast(r1r2Data, r3Data) {
|
|||||||
.append(makeRow('R3 or greater', e => e.r3));
|
.append(makeRow('R3 or greater', e => e.r3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Populate the ionosonde station dropdown and restore any saved selection
|
||||||
|
function populateIonosondeDropdown(data) {
|
||||||
|
const select = $('#ionosonde-station');
|
||||||
|
const savedUrsi = localStorage.getItem('#ionosonde-station:value');
|
||||||
|
const savedValue = savedUrsi ? JSON.parse(savedUrsi) : null;
|
||||||
|
select.empty();
|
||||||
|
// Sort by station name rather than URSI because station name is what's displayed, and any out-of-order names might
|
||||||
|
// confuse the user
|
||||||
|
Object.values(data).sort((a, b) => a.name.localeCompare(b.name)).forEach(function (station) {
|
||||||
|
select.append($('<option>', {value: station.ursi, text: station.name}));
|
||||||
|
});
|
||||||
|
// Select one by default if the user's localStorage has an existing selection for this
|
||||||
|
if (savedValue && select.find('option[value="' + savedValue + '"]').length) {
|
||||||
|
select.val(savedValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the foF2/MUF data and line chart for the currently selected station
|
||||||
|
function renderIonosondeData() {
|
||||||
|
// First make sure that we have some data, that a station entry is selected in the drop-down box, and that the
|
||||||
|
// data contains an entry for that station. If not, this represents an odd state (over and above just "no data for
|
||||||
|
// this station", so bail out at this point. The user will have to reselect something from the list, or wait until
|
||||||
|
// the API is behaving itself again.
|
||||||
|
if (!ionosondeData) return;
|
||||||
|
const ursi = $('#ionosonde-station').val();
|
||||||
|
if (!ursi) return;
|
||||||
|
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
|
||||||
|
const style = getComputedStyle(document.documentElement);
|
||||||
|
const fof2Color = style.getPropertyValue('--bs-primary').trim();
|
||||||
|
const mufColor = 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)';
|
||||||
|
|
||||||
|
// Utility function to convert the dict of timestamp-to-value into just a value array in timestamp key order
|
||||||
|
function toSeries(dict) {
|
||||||
|
if (!dict) return [];
|
||||||
|
return Object.entries(dict)
|
||||||
|
.map(([tsStr, val]) => ({ts: parseFloat(tsStr), val}))
|
||||||
|
.sort((a, b) => a.ts - b.ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fof2Entries = toSeries(station.fof2);
|
||||||
|
const mufEntries = toSeries(station.muf);
|
||||||
|
const allTs = [...fof2Entries, ...mufEntries].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();
|
||||||
|
if (ionosondeChart) { ionosondeChart.destroy(); ionosondeChart = null; }
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 minTs = allTs.length ? Math.min(...allTs) : null;
|
||||||
|
const maxTs = allTs.length ? Math.max(...allTs) : null;
|
||||||
|
let latestTimeStr = '';
|
||||||
|
if (maxTs != null) {
|
||||||
|
const latestDate = moment.utc(maxTs * 1000);
|
||||||
|
latestTimeStr = latestDate.format('DD MMM YYYY HH:mm [UTC]') + ' (' + latestDate.fromNow() + ')';
|
||||||
|
}
|
||||||
|
const staleWarning = (maxTs !== null && (Date.now() / 1000 - maxTs) > 12 * 3600)
|
||||||
|
? '<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 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">MUF (3000 km): <strong>' + (latestMuf !== null ? latestMuf.toFixed(2) + ' MHz' : 'N/A') + '</strong></div>' +
|
||||||
|
'</div>' +
|
||||||
|
staleWarning +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ionosondeChart) {
|
||||||
|
ionosondeChart.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute tick positions at 3-hour UTC boundaries so midnight always lands on a tick, which triggers the date being
|
||||||
|
// printed, and in general looks nicer than arbitrary ticks based on min & max timestamp
|
||||||
|
const tickStep = 3 * 3600;
|
||||||
|
const tickValues = [];
|
||||||
|
tickValues.push(minTs);
|
||||||
|
for (let t = Math.ceil(minTs / tickStep) * tickStep; t <= maxTs; t += tickStep) {
|
||||||
|
tickValues.push(t);
|
||||||
|
}
|
||||||
|
tickValues.push(maxTs);
|
||||||
|
|
||||||
|
// Build time axis
|
||||||
|
const timeAxis = {
|
||||||
|
type: 'linear',
|
||||||
|
min: minTs,
|
||||||
|
max: maxTs,
|
||||||
|
title: {display: true, text: 'Time (UTC)', color: textColor},
|
||||||
|
afterBuildTicks(axis) {
|
||||||
|
axis.ticks = tickValues.map(v => ({value: v}));
|
||||||
|
},
|
||||||
|
ticks: {
|
||||||
|
color: textColor,
|
||||||
|
maxRotation: 45,
|
||||||
|
minRotation: 0,
|
||||||
|
callback(value) {
|
||||||
|
// Use the same type of display as in the k-index chart, where the labels on the axis are just HH:mm
|
||||||
|
// unless that's 00:00, in which case add the short date as well.
|
||||||
|
const dt = new Date(value * 1000);
|
||||||
|
const h = dt.getUTCHours();
|
||||||
|
const m = dt.getUTCMinutes();
|
||||||
|
const timeStr = String(h).padStart(2, '0') + ':' + String(m).padStart(2, '0');
|
||||||
|
if (h === 0 && m === 0) {
|
||||||
|
return [timeStr, dt.toLocaleDateString('en-GB', {day: '2-digit', month: 'short', timeZone: 'UTC'})];
|
||||||
|
}
|
||||||
|
return timeStr;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
grid: {color: gridColor},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build frequency axis. This is pretty normal except there's no grid, because we draw extra horizontal lines for
|
||||||
|
// the amateur radio bands which function as grid lines for the frequency axis.
|
||||||
|
const freqAxis = {
|
||||||
|
min: 0,
|
||||||
|
title: {display: true, text: 'Frequency (MHz)', color: textColor},
|
||||||
|
ticks: {color: textColor},
|
||||||
|
grid: {display: false},
|
||||||
|
};
|
||||||
|
|
||||||
|
// List of ham bands for drawing horizontal lines
|
||||||
|
const AMATEUR_BANDS = [
|
||||||
|
{label: '160m', freq: 1.8},
|
||||||
|
{label: '80m', freq: 3.5},
|
||||||
|
{label: '60m', freq: 5.3515},
|
||||||
|
{label: '40m', freq: 7.0},
|
||||||
|
{label: '30m', freq: 10.1},
|
||||||
|
{label: '20m', freq: 14.0},
|
||||||
|
{label: '17m', freq: 18.068},
|
||||||
|
{label: '15m', freq: 21.0},
|
||||||
|
{label: '12m', freq: 24.89},
|
||||||
|
{label: '10m', freq: 28.0},
|
||||||
|
];
|
||||||
|
|
||||||
|
// Build the horizontal lines for each ham band, including a label on the right-hand side.
|
||||||
|
const bandLinesPlugin = {
|
||||||
|
id: 'bandLines',
|
||||||
|
beforeDatasetsDraw(chart) {
|
||||||
|
const {ctx, chartArea, scales} = chart;
|
||||||
|
if (!scales.y) return;
|
||||||
|
ctx.save();
|
||||||
|
ctx.strokeStyle = gridColor;
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
ctx.setLineDash([]);
|
||||||
|
// Add an extra vertical line for 30MHz, which should correspond to the top of the chart and avoid having
|
||||||
|
// no top "border" gridline
|
||||||
|
const y30 = scales.y.getPixelForValue(30);
|
||||||
|
if (y30 >= chartArea.top && y30 <= chartArea.bottom) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(chartArea.left, y30);
|
||||||
|
ctx.lineTo(chartArea.right, y30);
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
ctx.font = '10px sans-serif';
|
||||||
|
ctx.fillStyle = textColor;
|
||||||
|
// Add the ham band "grid lines"
|
||||||
|
AMATEUR_BANDS.forEach(({label, freq}) => {
|
||||||
|
const y = scales.y.getPixelForValue(freq);
|
||||||
|
if (y < chartArea.top || y > chartArea.bottom) return;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(chartArea.left, y);
|
||||||
|
ctx.lineTo(chartArea.right, y);
|
||||||
|
ctx.stroke();
|
||||||
|
ctx.textAlign = 'right';
|
||||||
|
ctx.textBaseline = 'bottom';
|
||||||
|
ctx.fillText(label, chartArea.right - 4, y - 2);
|
||||||
|
});
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the chart itself
|
||||||
|
ionosondeChart = new Chart(document.getElementById('ionosonde-chart'), {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: 'foF2',
|
||||||
|
data: fof2Entries.map(e => ({x: e.ts, y: e.val})),
|
||||||
|
borderColor: fof2Color,
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
pointRadius: 0,
|
||||||
|
tension: 0.2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'MUF (3000 km)',
|
||||||
|
data: mufEntries.map(e => ({x: e.ts, y: e.val})),
|
||||||
|
borderColor: mufColor,
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
pointRadius: 0,
|
||||||
|
tension: 0.2,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
aspectRatio: 3,
|
||||||
|
plugins: {
|
||||||
|
legend: {display: true, labels: {color: textColor, usePointStyle: true, pointStyle: 'line'}},
|
||||||
|
tooltip: {enabled: false}
|
||||||
|
},
|
||||||
|
scales: {x: timeAxis, y: freqAxis},
|
||||||
|
},
|
||||||
|
plugins: [bandLinesPlugin],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Chart canvas is normally hidden until we get here with some definitely good data. Now we have that so show it
|
||||||
|
$('#ionosonde-chart').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the ionosonde station select changes
|
||||||
|
function ionosondeStationChanged() {
|
||||||
|
saveSettings();
|
||||||
|
renderIonosondeData();
|
||||||
|
}
|
||||||
|
|
||||||
// Render the DX stats table for the currently selected DE continent
|
// Render the DX stats table for the currently selected DE continent
|
||||||
function renderDxStats() {
|
function renderDxStats() {
|
||||||
if (!dxStatsData) {
|
if (!dxStatsData) {
|
||||||
|
|||||||
+15
-4
@@ -15,6 +15,7 @@ const WAB_WAI_GRID_COLOR_DARK = 'rgba(60, 60, 120, 1.0)';
|
|||||||
var backgroundTileLayer;
|
var backgroundTileLayer;
|
||||||
var markersLayer;
|
var markersLayer;
|
||||||
var geodesicsLayer;
|
var geodesicsLayer;
|
||||||
|
var oms;
|
||||||
var terminator;
|
var terminator;
|
||||||
var maidenheadGrid;
|
var maidenheadGrid;
|
||||||
var cqZones;
|
var cqZones;
|
||||||
@@ -27,7 +28,7 @@ var firstLoad = true;
|
|||||||
|
|
||||||
// Load spots and populate the map.
|
// Load spots and populate the map.
|
||||||
function loadSpots() {
|
function loadSpots() {
|
||||||
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
|
$.getJSON('/api/v1/spots' + buildQueryString(true), function(jsonData) {
|
||||||
// Store data
|
// Store data
|
||||||
spots = jsonData;
|
spots = jsonData;
|
||||||
// Update map
|
// Update map
|
||||||
@@ -39,7 +40,7 @@ function loadSpots() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build a query string for the API, based on the filters that the user has selected.
|
// Build a query string for the API, based on the filters that the user has selected.
|
||||||
function buildQueryString() {
|
function buildQueryString(includeCredentials) {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
||||||
if (!allFilterOptionsSelected(fn)) {
|
if (!allFilterOptionsSelected(fn)) {
|
||||||
@@ -48,8 +49,10 @@ function buildQueryString() {
|
|||||||
});
|
});
|
||||||
str = str + "max_age=" + $("#max-spot-age option:selected").val();
|
str = str + "max_age=" + $("#max-spot-age option:selected").val();
|
||||||
// Additional filters for the map view: No dupes, no QRT, only spots with good locations
|
// Additional filters for the map view: No dupes, no QRT, only spots with good locations
|
||||||
str = str + "&dedupe=true&allow_qrt=false&needs_good_location=true";
|
str = str + "&dedupe=true&allow_qrt=false";
|
||||||
str = str + getCredentialQueryString();
|
if (includeCredentials) {
|
||||||
|
str = str + getCredentialQueryString();
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,12 +61,14 @@ function updateMap() {
|
|||||||
// Clear existing content
|
// Clear existing content
|
||||||
markersLayer.clearLayers();
|
markersLayer.clearLayers();
|
||||||
geodesicsLayer.clearLayers();
|
geodesicsLayer.clearLayers();
|
||||||
|
oms.clearMarkers();
|
||||||
|
|
||||||
// Make new markers for all spots that match the filter
|
// Make new markers for all spots that match the filter
|
||||||
spots.forEach(function (s) {
|
spots.forEach(function (s) {
|
||||||
var m = L.marker([s["dx_latitude"], s["dx_longitude"]], {icon: getIcon(s)});
|
var m = L.marker([s["dx_latitude"], s["dx_longitude"]], {icon: getIcon(s)});
|
||||||
m.bindPopup(getTooltipText(s));
|
m.bindPopup(getTooltipText(s));
|
||||||
markersLayer.addLayer(m);
|
markersLayer.addLayer(m);
|
||||||
|
oms.addMarker(m);
|
||||||
|
|
||||||
// Create geodesics if required
|
// Create geodesics if required
|
||||||
if ($("#mapShowGeodesics")[0].checked && s["de_latitude"] != null && s["de_longitude"] != null) {
|
if ($("#mapShowGeodesics")[0].checked && s["de_latitude"] != null && s["de_longitude"] != null) {
|
||||||
@@ -414,6 +419,12 @@ function setUpMap() {
|
|||||||
markersLayer = new L.LayerGroup();
|
markersLayer = new L.LayerGroup();
|
||||||
markersLayer.addTo(map);
|
markersLayer.addTo(map);
|
||||||
|
|
||||||
|
// Set up spiderfy for overlapping markers
|
||||||
|
oms = new OverlappingMarkerSpiderfier(map, {keepSpiderfied: true});
|
||||||
|
oms.addListener('click', function(marker) {
|
||||||
|
marker.openPopup();
|
||||||
|
});
|
||||||
|
|
||||||
// Add geodesic layer
|
// Add geodesic layer
|
||||||
geodesicsLayer = new L.LayerGroup();
|
geodesicsLayer = new L.LayerGroup();
|
||||||
geodesicsLayer.addTo(map);
|
geodesicsLayer.addTo(map);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function loadSpots() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the new query
|
// Make the new query
|
||||||
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
|
$.getJSON('/api/v1/spots' + buildQueryString(false), function(jsonData) {
|
||||||
// Store data
|
// Store data
|
||||||
spots = jsonData;
|
spots = jsonData;
|
||||||
// Update table
|
// Update table
|
||||||
@@ -31,7 +31,7 @@ function startSSEConnection() {
|
|||||||
if (evtSource != null) {
|
if (evtSource != null) {
|
||||||
evtSource.close();
|
evtSource.close();
|
||||||
}
|
}
|
||||||
evtSource = new EventSource('/api/v1/spots/stream' + buildQueryString());
|
evtSource = new EventSource('/api/v1/spots/stream' + buildQueryString(true));
|
||||||
|
|
||||||
evtSource.onmessage = function(event) {
|
evtSource.onmessage = function(event) {
|
||||||
// Get the new spot
|
// Get the new spot
|
||||||
@@ -78,7 +78,7 @@ function startSSEConnection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build a query string for the API, based on the filters that the user has selected.
|
// Build a query string for the API, based on the filters that the user has selected.
|
||||||
function buildQueryString() {
|
function buildQueryString(includeCredentials) {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
||||||
if (!allFilterOptionsSelected(fn)) {
|
if (!allFilterOptionsSelected(fn)) {
|
||||||
@@ -89,7 +89,9 @@ function buildQueryString() {
|
|||||||
if ($("#search").val() != "") {
|
if ($("#search").val() != "") {
|
||||||
str = str + "&text_includes=" + encodeURIComponent($("#search").val());
|
str = str + "&text_includes=" + encodeURIComponent($("#search").val());
|
||||||
}
|
}
|
||||||
str = str + getCredentialQueryString();
|
if (includeCredentials) {
|
||||||
|
str = str + getCredentialQueryString();
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,9 +292,9 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
|||||||
var items = []
|
var items = []
|
||||||
for (var i = 0; i < s["sig_refs"].length; i++) {
|
for (var i = 0; i < s["sig_refs"].length; i++) {
|
||||||
if (s["sig_refs"][i]["url"] != null) {
|
if (s["sig_refs"][i]["url"] != null) {
|
||||||
items[i] = `<span style="white-space: nowrap;"><a href='${s["sig_refs"][i]["url"]}' title='${s["sig_refs"][i]["name"]}' target='_new' class='sig-ref-link'>${s["sig_refs"][i]["id"]}</a></span>`
|
items[i] = `<span style="white-space: nowrap;"><a href='${encodeURI(s["sig_refs"][i]["url"])}' title='${escapeHtml(s["sig_refs"][i]["name"])}' target='_new' class='sig-ref-link'>${escapeHtml(s["sig_refs"][i]["id"])}</a></span>`
|
||||||
} else {
|
} else {
|
||||||
items[i] = `<span style="white-space: nowrap;">${s["sig_refs"][i]["id"]}</span>`
|
items[i] = `<span style="white-space: nowrap;">${escapeHtml(s["sig_refs"][i]["id"])}</span>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sig_refs = items.join(", ");
|
sig_refs = items.join(", ");
|
||||||
|
|||||||
Reference in New Issue
Block a user