Solar condition monitoring improvements, mostly polling GIRO at a steady continual rate rather than bursting every hour, bug fixes and commenting improvements

This commit is contained in:
Ian Renton
2026-06-21 08:53:06 +01:00
parent bed263fada
commit b3db6e695c
12 changed files with 75 additions and 69 deletions

View File

@@ -4,16 +4,20 @@ HF_BANDS = [b for b in BANDS if b.is_ham_hf]
def _latest(d) -> float | None:
return float(d[max(d.keys())]) if d else None
"""Given a map where the key is a timestamp and the value is a number represented as a string, find the latest
timestamp and return the corresponding value as a float."""
val = str(d[max(d.keys())]) if d else None
return float(val) if (val is not None and val != "None") else None
def compute_band_states(fof2_dict, muf_dict, luf_dict):
"""Compute HF band states from the latest foF2, MUF and LUF values.
States:
Closed if band frequency is above MUF or below LUF (if known)
Short if band frequency is >= LUF and < foF2 (good for NVIS)
Long if band frequency is >= foF2 and < MUF (good for DX)
Returns a map where the keys are HF bands and the values are as follows:
"Closed" if band frequency is above MUF or below LUF (if known)
"Short" if band frequency is >= LUF and < foF2 (good for NVIS)
"Long" if band frequency is >= foF2 and < MUF (good for DX)
"""
fof2 = _latest(fof2_dict)