mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-06-23 21:25:12 +00:00
Extract grid<mode>grid type comments from clusters. Closes #113
This commit is contained in:
13
data/spot.py
13
data/spot.py
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user