mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 01:04:33 +00:00
CQ/ITU zone lookups
This commit is contained in:
@@ -79,7 +79,8 @@ class Alert:
|
||||
if self.received_time and not self.received_time_iso:
|
||||
self.received_time_iso = datetime.fromtimestamp(self.received_time, pytz.UTC).isoformat()
|
||||
|
||||
# DX country, continent, zones etc. from callsign
|
||||
# DX country, continent, zones etc. from callsign. CQ/ITU zone are better looked up with a location but we don't
|
||||
# have a real location for alerts.
|
||||
if self.dx_calls and self.dx_calls[0] and not self.dx_country:
|
||||
self.dx_country = lookup_helper.infer_country_from_callsign(self.dx_calls[0])
|
||||
if self.dx_calls and self.dx_calls[0] and not self.dx_continent:
|
||||
|
||||
19
data/spot.py
19
data/spot.py
@@ -11,6 +11,7 @@ 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.geo_utils import lat_lon_to_cq_zone, lat_lon_to_itu_zone
|
||||
from core.lookup_helper import lookup_helper
|
||||
from core.sig_utils import populate_sig_ref_info, ANY_SIG_REGEX, get_ref_regex_for_sig
|
||||
from data.sig_ref import SIGRef
|
||||
@@ -152,15 +153,11 @@ class Spot:
|
||||
if len(split) > 1 and split[1] != "#":
|
||||
self.dx_ssid = split[1]
|
||||
|
||||
# DX country, continent, zones etc. from callsign
|
||||
# DX country, continent etc. from callsign
|
||||
if self.dx_call and not self.dx_country:
|
||||
self.dx_country = lookup_helper.infer_country_from_callsign(self.dx_call)
|
||||
if self.dx_call and not self.dx_continent:
|
||||
self.dx_continent = lookup_helper.infer_continent_from_callsign(self.dx_call)
|
||||
if self.dx_call and not self.dx_cq_zone:
|
||||
self.dx_cq_zone = lookup_helper.infer_cq_zone_from_callsign(self.dx_call)
|
||||
if self.dx_call and not self.dx_itu_zone:
|
||||
self.dx_itu_zone = lookup_helper.infer_itu_zone_from_callsign(self.dx_call)
|
||||
if self.dx_call and not self.dx_dxcc_id:
|
||||
self.dx_dxcc_id = lookup_helper.infer_dxcc_id_from_callsign(self.dx_call)
|
||||
if self.dx_dxcc_id and not self.dx_flag:
|
||||
@@ -332,6 +329,18 @@ class Spot:
|
||||
self.dx_grid = lookup_helper.infer_grid_from_callsign_dxcc(self.dx_call)
|
||||
self.dx_location_source = "DXCC"
|
||||
|
||||
# CQ and ITU zone lookup, preferably from location but failing that, from callsign
|
||||
if not self.dx_cq_zone:
|
||||
if self.dx_latitude:
|
||||
self.dx_cq_zone = lat_lon_to_cq_zone(self.dx_latitude, self.dx_longitude)
|
||||
elif self.dx_call:
|
||||
self.dx_cq_zone = lookup_helper.infer_cq_zone_from_callsign(self.dx_call)
|
||||
if not self.dx_itu_zone:
|
||||
if self.dx_latitude:
|
||||
self.dx_itu_zone = lat_lon_to_itu_zone(self.dx_latitude, self.dx_longitude)
|
||||
elif self.dx_call:
|
||||
self.dx_itu_zone = lookup_helper.infer_itu_zone_from_callsign(self.dx_call)
|
||||
|
||||
# DX Location is "good" if it is from a spot, or from QRZ if the callsign doesn't contain a slash, so the operator
|
||||
# is likely at home.
|
||||
self.dx_location_good = self.dx_latitude and self.dx_longitude and (
|
||||
|
||||
Reference in New Issue
Block a user