Solar weather table #92

This commit is contained in:
Ian Renton
2026-03-29 09:00:59 +01:00
parent ed1f9e5b06
commit 5de5a7ffdf
13 changed files with 135 additions and 62 deletions

View File

@@ -6,9 +6,9 @@ from dataclasses import dataclass
# the first entry whose threshold the value meets or exceeds is used. # the first entry whose threshold the value meets or exceeds is used.
BLACKOUT_DESCRIPTIONS = { BLACKOUT_DESCRIPTIONS = {
"X": "Extreme HF radio blackout on entire sunlit side", "X": "Wide area HF radio blackout across sunlit side",
"M": "Wide area HF radio blackout on sunlit side", "M": "Occasional loss of HF communications on sunlit side",
"C": "Occasional loss of HF communications on sunlit side", "C": "Low absorption of HF signals on sunlit side",
"B": "No significant radio blackout", "B": "No significant radio blackout",
"A": "No impact", "A": "No impact",
} }

View File

@@ -94,11 +94,11 @@ class HamQSL(HTTPSolarConditionsProvider):
"aurora_latitude": float_val("latdegree"), "aurora_latitude": float_val("latdegree"),
"solar_wind": float_val("solarwind"), "solar_wind": float_val("solarwind"),
"magnetic_field": float_val("magneticfield"), "magnetic_field": float_val("magneticfield"),
"geomag_field": (lambda v: "Unsettled" if v == "Unsettld" else v)(text("geomagfield").title()) if text("geomagfield") else None, "geomag_field": (lambda v: "Unsettled" if v == "Unsettld" else v)(text("geomagfield").title()),
"geomag_noise": text("signalnoise"), "geomag_noise": text("signalnoise"),
"hf_conditions": hf_conditions, "hf_conditions": hf_conditions,
"vhf_conditions": { "vhf_conditions": {
"vhf_aurora_northern_hemi": vhf_map.get(("vhf-aurora", "northern_hemi")), "vhf_aurora_northern_hemi": vhf_map.get(("vhf-aurora", "northern_hemi")).title().replace("Lat Aur", "Latitude"),
"es_2m_europe": vhf_map.get(("E-Skip", "europe")), "es_2m_europe": vhf_map.get(("E-Skip", "europe")),
"es_4m_europe": vhf_map.get(("E-Skip", "europe_4m")), "es_4m_europe": vhf_map.get(("E-Skip", "europe_4m")),
"es_6m_europe": vhf_map.get(("E-Skip", "europe_6m")), "es_6m_europe": vhf_map.get(("E-Skip", "europe_6m")),

View File

@@ -22,42 +22,43 @@ class ParksNPeaks(HTTPSpotProvider):
def _http_response_to_spots(self, http_response): def _http_response_to_spots(self, http_response):
new_spots = [] new_spots = []
# Iterate through source data # Iterate through source data
for source_spot in http_response.json(): if http_response and http_response != "":
# Convert to our spot format for source_spot in http_response.json():
spot = Spot(source=self.name, # Convert to our spot format
source_id=source_spot["actID"], spot = Spot(source=self.name,
dx_call=source_spot["actCallsign"].upper(), source_id=source_spot["actID"],
de_call=source_spot["actSpoter"].upper() if source_spot["actSpoter"] != "" else None, dx_call=source_spot["actCallsign"].upper(),
# typo exists in API de_call=source_spot["actSpoter"].upper() if source_spot["actSpoter"] != "" else None,
freq=float(source_spot["actFreq"].replace(",", "")) * 1000000 if ( # typo exists in API
source_spot["actFreq"] != "") else None, freq=float(source_spot["actFreq"].replace(",", "")) * 1000000 if (
# Seen PNP spots with empty frequency, and with comma-separated thousands digits source_spot["actFreq"] != "") else None,
mode=source_spot["actMode"].upper(), # Seen PNP spots with empty frequency, and with comma-separated thousands digits
comment=source_spot["actComments"], mode=source_spot["actMode"].upper(),
time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace( comment=source_spot["actComments"],
tzinfo=pytz.UTC).timestamp()) time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace(
tzinfo=pytz.UTC).timestamp())
# Extract a de_call if it's in the comment but not in the "actSpoter" field # Extract a de_call if it's in the comment but not in the "actSpoter" field
m = re.search(r"\(de ([A-Za-z0-9]*)\)", spot.comment) m = re.search(r"\(de ([A-Za-z0-9]*)\)", spot.comment)
if not spot.de_call and m: if not spot.de_call and m:
spot.de_call = m.group(1) spot.de_call = m.group(1)
# Record SIG information. Sometimes we get a "SIG" of "QRP", which we ignore as it's not a programme with a # Record SIG information. Sometimes we get a "SIG" of "QRP", which we ignore as it's not a programme with a
# defined set of references # defined set of references
sig = source_spot["actClass"].upper() sig = source_spot["actClass"].upper()
sig_ref = source_spot["actSiteID"] sig_ref = source_spot["actSiteID"]
if sig and sig != "" and sig != "QRP" and sig_ref and sig_ref != "": if sig and sig != "" and sig != "QRP" and sig_ref and sig_ref != "":
spot.sig = sig spot.sig = sig
spot.sig_refs = [SIGRef(id=source_spot["actSiteID"], sig=source_spot["actClass"].upper())] spot.sig_refs = [SIGRef(id=source_spot["actSiteID"], sig=source_spot["actClass"].upper())]
# Free text location is not present in all spots, so only add it if it's set # Free text location is not present in all spots, so only add it if it's set
if "actLocation" in source_spot and source_spot["actLocation"] != "": if "actLocation" in source_spot and source_spot["actLocation"] != "":
spot.sig_refs[0].name = source_spot["actLocation"] spot.sig_refs[0].name = source_spot["actLocation"]
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before # Log a warning for the developer if PnP gives us an unknown programme we've never seen before
if sig not in ["POTA", "SOTA", "WWFF", "SIOTA", "ZLOTA", "KRMNPA"]: if sig not in ["POTA", "SOTA", "WWFF", "SIOTA", "ZLOTA", "KRMNPA"]:
logging.warning("PNP spot found with sig " + sig + ", developer needs to add support for this!") logging.warning("PNP spot found with sig " + sig + ", developer needs to add support for this!")
# Add new spot to the list # Add new spot to the list
new_spots.append(spot) new_spots.append(spot)
return new_spots return new_spots

View File

@@ -67,7 +67,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=1774769497"></script> <script src="/js/common.js?v=1774771259"></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 %}

View File

@@ -69,8 +69,8 @@
</div> </div>
<script src="/js/common.js?v=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/add-spot.js?v=1774769497"></script> <script src="/js/add-spot.js?v=1774771259"></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 %}

View File

@@ -56,8 +56,8 @@
</div> </div>
<script src="/js/common.js?v=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/alerts.js?v=1774769497"></script> <script src="/js/alerts.js?v=1774771259"></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 %}

View File

@@ -62,9 +62,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=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/spotsbandsandmap.js?v=1774769497"></script> <script src="/js/spotsbandsandmap.js?v=1774771259"></script>
<script src="/js/bands.js?v=1774769497"></script> <script src="/js/bands.js?v=1774771259"></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 %}

View File

@@ -46,10 +46,10 @@
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"></script>
<script src="https://misc.ianrenton.com/jsutils/utils.js?v=1774769497"></script> <script src="https://misc.ianrenton.com/jsutils/utils.js?v=1774771259"></script>
<script src="https://misc.ianrenton.com/jsutils/storage.js?v=1774769497"></script> <script src="https://misc.ianrenton.com/jsutils/storage.js?v=1774771259"></script>
<script src="https://misc.ianrenton.com/jsutils/ui-ham.js?v=1774769497"></script> <script src="https://misc.ianrenton.com/jsutils/ui-ham.js?v=1774771259"></script>
<script src="https://misc.ianrenton.com/jsutils/geo.js?v=1774769497"></script> <script src="https://misc.ianrenton.com/jsutils/geo.js?v=1774771259"></script>
</head> </head>
<body> <body>

View File

@@ -96,12 +96,49 @@
Solar Weather Solar Weather
</div> </div>
<div class="card-body"> <div class="card-body">
Coming soon! <div class="row border-bottom py-2 align-items-start">
<div class="col-12 col-md-2 fw-semibold">Solar Flux</div>
<div class="col-12 col-md-3">
<span class="me-3">SFI: <strong id="sw-sfi"></strong></span>
<span>Sunspots: <strong id="sw-sunspots"></strong></span>
</div>
<div class="col-12 col-md-7 text-muted" id="sw-band-conditions-desc"></div>
</div>
<div class="row border-bottom py-2 align-items-start">
<div class="col-12 col-md-2 fw-semibold">Geomagnetic</div>
<div class="col-12 col-md-3">
<span class="me-3">K: <strong id="sw-k-index"></strong></span>
<span class="me-3">A: <strong id="sw-a-index"></strong></span>
<span class="me-3"><strong>G</strong><strong id="sw-geomag-storm-scale"></strong></span>
<span>Noise: <strong id="sw-geomag-noise"></strong></span>
</div>
<div class="col-12 col-md-7 text-muted">
<span id="sw-geomag-field"></span><span class="mx-1 text-body-tertiary">, </span><span id="sw-geomag-storm-desc"></span>
</div>
</div>
<div class="row border-bottom py-2 align-items-start">
<div class="col-12 col-md-2 fw-semibold">X-ray Flux</div>
<div class="col-12 col-md-3"><strong id="sw-x-ray"></strong></div>
<div class="col-12 col-md-7 text-muted" id="sw-blackout-desc"></div>
</div>
<div class="row border-bottom py-2 align-items-start">
<div class="col-12 col-md-2 fw-semibold">Proton Flux</div>
<div class="col-12 col-md-3">
<span class="me-3"><strong id="sw-proton-flux"></strong> pfu</span>
<span class="me-3"><strong>S</strong><strong id="sw-solar-storm-scale"></strong></span>
</div>
<div class="col-12 col-md-7 text-muted" id="sw-proton-flux-desc"></div>
</div>
<div class="row py-2 align-items-start">
<div class="col-12 col-md-2 fw-semibold">Electron Flux</div>
<div class="col-12 col-md-3"><strong id="sw-electron-flux"></strong> efu</div>
<div class="col-12 col-md-7 text-muted" id="sw-electron-flux-desc"></div>
</div>
</div> </div>
</div> </div>
<script src="/js/common.js?v=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/conditions.js?v=1774769497"></script> <script src="/js/conditions.js?v=1774771259"></script>
<script>$(document).ready(function() { $("#nav-link-conditions").addClass("active"); }); <!-- highlight active page in nav --></script> <script>$(document).ready(function() { $("#nav-link-conditions").addClass("active"); }); <!-- highlight active page in nav --></script>
{% end %} {% end %}

View File

@@ -70,9 +70,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=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/spotsbandsandmap.js?v=1774769497"></script> <script src="/js/spotsbandsandmap.js?v=1774771259"></script>
<script src="/js/map.js?v=1774769497"></script> <script src="/js/map.js?v=1774771259"></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 %}

View File

@@ -87,9 +87,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=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/spotsbandsandmap.js?v=1774769497"></script> <script src="/js/spotsbandsandmap.js?v=1774771259"></script>
<script src="/js/spots.js?v=1774769497"></script> <script src="/js/spots.js?v=1774771259"></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 %}

View File

@@ -59,8 +59,8 @@
</div> </div>
</div> </div>
<script src="/js/common.js?v=1774769497"></script> <script src="/js/common.js?v=1774771259"></script>
<script src="/js/status.js?v=1774769497"></script> <script src="/js/status.js?v=1774771259"></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>

View File

@@ -20,12 +20,47 @@ function loadSolarConditions() {
Object.entries(jsonData.vhf_conditions).forEach(function([key, condition]) { Object.entries(jsonData.vhf_conditions).forEach(function([key, condition]) {
const cell = $('#vhf-conditions-' + key); const cell = $('#vhf-conditions-' + key);
cell.text(condition); cell.text(condition);
cell.addClass(condition === 'Band Closed' ? 'table-danger' : 'table-success'); let vhfClass;
if (condition === 'Band Closed') {
vhfClass = 'table-danger';
} else if (condition.includes('High')) {
vhfClass = 'table-warning';
} else {
vhfClass = 'table-success';
}
cell.addClass(vhfClass);
}); });
} }
if (jsonData.aurora_latitude !== null && jsonData.aurora_latitude !== undefined) { if (jsonData.aurora_latitude !== null && jsonData.aurora_latitude !== undefined) {
$('#vhf-conditions-aurora-lat').text(jsonData.aurora_latitude + '°'); $('#vhf-conditions-aurora-lat').text(jsonData.aurora_latitude + '°');
} }
// Solar Weather
const swFields = {
'sfi': 'sw-sfi',
'sunspots': 'sw-sunspots',
'band_conditions_desc': 'sw-band-conditions-desc',
'k_index': 'sw-k-index',
'a_index': 'sw-a-index',
'geomag_field': 'sw-geomag-field',
'geomag_storm_scale': 'sw-geomag-storm-scale',
'geomag_storm_desc': 'sw-geomag-storm-desc',
'geomag_noise': 'sw-geomag-noise',
'x_ray': 'sw-x-ray',
'blackout_desc': 'sw-blackout-desc',
'proton_flux': 'sw-proton-flux',
'solar_storm_scale': 'sw-solar-storm-scale',
'proton_flux_desc': 'sw-proton-flux-desc',
'electron_flux': 'sw-electron-flux',
'electron_flux_desc': 'sw-electron-flux-desc',
};
Object.entries(swFields).forEach(function([field, id]) {
const val = jsonData[field];
if (val !== null && val !== undefined) {
$('#' + id).text(val);
}
});
}); });
} }