Various stuff

This commit is contained in:
Ian Renton
2025-09-30 20:51:56 +01:00
parent 280749919d
commit 37692f41a8
9 changed files with 100 additions and 56 deletions

View File

@@ -8,4 +8,8 @@ class Band:
# Start frequency, in kHz
start_freq: float
# Stop frequency, in kHz
end_freq: float
end_freq: float
# Colour to use for this band, as per PSK Reporter
color: str
# Contrast colour to use for text against a background of the band colour
contrast_color: str

View File

@@ -7,10 +7,10 @@ import pytz
from pyhamtools.locator import locator_to_latlong, latlong_to_locator
from core.constants import DXCC_FLAGS
from core.utils import infer_mode_family_from_mode, infer_band_from_freq, infer_continent_from_callsign, \
from core.utils import infer_mode_type_from_mode, infer_band_from_freq, infer_continent_from_callsign, \
infer_country_from_callsign, infer_cq_zone_from_callsign, infer_itu_zone_from_callsign, infer_dxcc_id_from_callsign, \
infer_mode_from_comment, infer_name_from_callsign, infer_latlon_from_callsign_dxcc, infer_grid_from_callsign_dxcc, \
infer_latlon_from_callsign_qrz, infer_grid_from_callsign_qrz
infer_latlon_from_callsign_qrz, infer_grid_from_callsign_qrz, infer_mode_from_frequency
# Data class that defines a spot.
@@ -50,7 +50,9 @@ class Spot:
# Reported mode, such as SSB, PHONE, CW, FT8...
mode: str = None
# Inferred mode "family". One of "CW", "PHONE" or "DIGI".
mode_family: str = None
mode_type: str = None
# Source of the mode information. "SPOT", "COMMENT", "BANDPLAN" or "NONE"
mode_source: str = "NONE"
# Frequency, in kHz
freq: float = None
# Band, defined by the frequency, e.g. "40m" or "70cm"
@@ -77,11 +79,11 @@ class Spot:
latitude: float = None
longitude: float = None
# Location source. Indicates how accurate the location might be. Values: "SPOT", "QRZ, "DXCC", "NONE"
location_source: str = None
location_source: str = "NONE"
# Location good. Indicates that the software thinks the location data is good enough to plot on a map.
location_good: bool = None
location_good: bool = False
# QRT state. Some APIs return spots marked as QRT. Otherwise we can check the comments.
qrt: bool = None
qrt: bool = False
# Where we got the spot from, e.g. "POTA", "Cluster"...
source: str = None
# The ID the source gave it, if any.
@@ -118,11 +120,24 @@ class Spot:
band = infer_band_from_freq(self.freq)
self.band = band.name
# Mode from comments, mode family from mode
# Mode from comments or bandplan
if self.mode:
self.mode_source = "SPOT"
if self.comment and not self.mode:
self.mode=infer_mode_from_comment(self.comment)
if self.mode and not self.mode_family:
self.mode_family=infer_mode_family_from_mode(self.mode)
self.mode = infer_mode_from_comment(self.comment)
self.mode_source = "COMMENT"
if self.freq and not self.mode:
self.mode = infer_mode_from_frequency(self.freq)
self.mode_source = "BANDPLAN"
# Normalise "generic digital" modes. "DIGITAL", "DIGI" and "DATA" are just the same thing with no extra
# information, so standardise on "DATA"
if self.mode == "DIGI" or self.mode == "DIGITAL":
self.mode = "DATA"
# Mode type from mode
if self.mode and not self.mode_type:
self.mode_type = infer_mode_type_from_mode(self.mode)
# Grid to lat/lon and vice versa
if self.grid and not self.latitude: