Widen HRRR profile spatial matching from 0.05° to 0.07°

The propagation grid stores profiles at 0.125° intervals, so contacts
up to 0.0625° from a grid point would miss with the old 0.05° tolerance.
This caused has_hrrr_profile? and find_nearest_hrrr to fail matching
against existing data, leaving contacts incorrectly stuck as pending.
This commit is contained in:
Graham McIntire 2026-04-06 10:40:19 -05:00
parent a8f6a3b0e8
commit 0e885001bc

View file

@ -457,10 +457,16 @@ defmodule Microwaveprop.Weather do
end
def has_hrrr_profile?(lat, lon, valid_time) do
{rlat, rlon} = round_to_hrrr_grid(lat, lon)
dlat = 0.07
dlon = 0.07
HrrrProfile
|> where([h], h.lat == ^rlat and h.lon == ^rlon and h.valid_time == ^valid_time)
|> where(
[h],
h.lat >= ^(lat - dlat) and h.lat <= ^(lat + dlat) and
h.lon >= ^(lon - dlon) and h.lon <= ^(lon + dlon) and
h.valid_time == ^valid_time
)
|> Repo.exists?()
end
@ -476,8 +482,8 @@ defmodule Microwaveprop.Weather do
end
def find_nearest_hrrr(lat, lon, timestamp) do
dlat = 0.05
dlon = 0.05
dlat = 0.07
dlon = 0.07
time_start = DateTime.add(timestamp, -3600, :second)
time_end = DateTime.add(timestamp, 3600, :second)