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
id,
call,
ST_Distance(coord, MakePoint(?, ?, %d), true) as distance
ST_Distance(coord,
MakeLine(MakePoint(?, ?, {csr}),
MakePoint(?, ?, {csr})), true) as distance
from
nexrad_radar
where
distance <= 460000
distance <= 230000
order by
distance asc
limit 3
""" % (COORD_SYSTEM)
""".format(csr=COORD_SYSTEM)
st = db.execute(sql, (self.coord_start.lon,
self.coord_start.lat))
radars = list()
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