Refactor radar distance search to match whole storm path

This commit is contained in:
XANTRONIX Industrial 2025-02-11 12:10:17 -05:00
parent 12ead19918
commit 0726782ee8

View file

@ -118,17 +118,29 @@ class StormReport():
select select
id, id,
call, call,
ST_Distance(coord, MakePoint(?, ?, %d), true) as distance ST_Distance(coord,
MakeLine(MakePoint(?, ?, {csr}),
MakePoint(?, ?, {csr})), true) as distance
from from
nexrad_radar nexrad_radar
where where
distance <= 460000 distance <= 230000
order by order by
distance asc distance asc
limit 3 """.format(csr=COORD_SYSTEM)
""" % (COORD_SYSTEM)
st = db.execute(sql, (self.coord_start.lon, radars = list()
self.coord_start.lat))
return st.fetchone() st = db.execute(sql, (
self.coord_start.lon, self.coord_start.lat,
self.coord_end.lon, self.coord_end.lat))
while True:
radar = st.fetchone()
if radar is None:
break
radars.append(radar)
return radars