diff --git a/core/constants.py b/core/constants.py index ae8a00a..d114a22 100644 --- a/core/constants.py +++ b/core/constants.py @@ -89,3 +89,17 @@ UNKNOWN_BAND = Band(name="Unknown", start_freq=0, end_freq=0) # Continents CONTINENTS = ["EU", "NA", "SA", "AS", "AF", "OC", "AN"] + +# Propagation modes used in VHF/UHF DX cluster comments, e.g. "JN61ESJM56XT". I don't think there's an official list +# of these anywhere, but here are some I've seen or seen reference to +PROPAGATION_MODES = { + "F2": "F2 layer ionospheric", + "ES": "Sporadic-E", + "TR": "Tropospheric ducting", + "TEP": "Trans-Equatorial Propagation", + "EME": "Earth-Moon-Earth", + "AU": "Aurora", + "MS": "Meteor scatter", + "RS": "Rain scatter", + "AS": "Aircraft scatter" +} diff --git a/data/spot.py b/data/spot.py index ed2ad1f..6da7007 100644 --- a/data/spot.py +++ b/data/spot.py @@ -10,7 +10,7 @@ import pytz from pyhamtools.locator import locator_to_latlong, latlong_to_locator from core.config import MAX_SPOT_AGE -from core.constants import MODE_ALIASES +from core.constants import MODE_ALIASES, PROPAGATION_MODES from core.geo_utils import lat_lon_to_cq_zone, lat_lon_to_itu_zone from core.lookup_helper import lookup_helper, infer_band_from_freq, infer_mode_from_comment, \ infer_mode_from_frequency, infer_mode_type_from_mode @@ -99,6 +99,8 @@ class Spot: freq: float | None = None # Band, defined by the frequency, e.g. "40m" or "70cm" band: str | None = None + # Propagation mode, if known + propagation_mode: str | None = None # Comment left by the spotter, if any comment: str | None = None # QRT state. Some APIs return spots marked as QRT. Otherwise we can check the comments. @@ -288,19 +290,30 @@ class Spot: if self.sig_refs and len(self.sig_refs) > 0 and not self.sig: self.sig = self.sig_refs[0].sig - # Parse "de_griddx_grid" structures from the comment, e.g. "JN61ESJM56XT" or "JO02GQ<>KN17LG". These - # are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup. + # Parse "de_griddx_grid" structures from the comment, e.g. "JN61ESJM56XT" or "JO02GQ<>KN17LG". + # These are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup, as well as + # being the only source we have for propagation mode. if self.comment: - grid_pair_match = re.search( - r'\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)<[^>]*>([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b', + grid_mode_grid_match = re.search( + r'\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)<([^>]*)>([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b', self.comment) - if grid_pair_match: + if grid_mode_grid_match: + # regex matches, so extract grids: if not self.de_grid: - self.de_grid = grid_pair_match.group(1).upper() + self.de_grid = grid_mode_grid_match.group(1).upper() if not self.dx_grid: - self.dx_grid = grid_pair_match.group(2).upper() + self.dx_grid = grid_mode_grid_match.group(3).upper() self.dx_location_source = "SPOT" + # And extract propagation mode: + mode_tag = grid_mode_grid_match.group(2).upper() + if mode_tag and not self.propagation_mode: + if mode_tag in PROPAGATION_MODES: + self.propagation_mode = PROPAGATION_MODES[mode_tag] + else: + self.propagation_mode = mode_tag + logging.info("Seen a new propagation mode tag not yet in the system: {}", mode_tag) + # DX Grid to lat/lon and vice versa in case one is missing if self.dx_grid and not self.dx_latitude: try: diff --git a/templates/add_spot.html b/templates/add_spot.html index 966ec3d..2088db5 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 384598a..3d40888 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -75,7 +75,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 178145c..2b5582a 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -77,8 +77,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 361d970..b03764a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -10,10 +10,10 @@ - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 835522e..8bd545b 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index 7948b9f..77ef68f 100644 --- a/templates/map.html +++ b/templates/map.html @@ -95,8 +95,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index 09330bd..a8e8ef7 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -116,8 +116,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 6cd615c..f84de02 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,7 +59,7 @@ - +