Extract grid<mode>grid type comments from clusters. Closes #113

This commit is contained in:
Ian Renton
2026-06-21 09:15:59 +01:00
parent b3db6e695c
commit 0c256447a8
9 changed files with 28 additions and 15 deletions

View File

@@ -288,6 +288,19 @@ 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_grid<mode>dx_grid" structures from the comment, e.g. "JN61ES<ES>JM56XT" or "JO02GQ<>KN17LG". These
# are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup.
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',
self.comment)
if grid_pair_match:
if not self.de_grid:
self.de_grid = grid_pair_match.group(1).upper()
if not self.dx_grid:
self.dx_grid = grid_pair_match.group(2).upper()
self.dx_location_source = "SPOT"
# DX Grid to lat/lon and vice versa in case one is missing
if self.dx_grid and not self.dx_latitude:
try: