From 0e885001bc9d28058a61a90eb8dadac0f2df757f Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 6 Apr 2026 10:40:19 -0500 Subject: [PATCH] =?UTF-8?q?Widen=20HRRR=20profile=20spatial=20matching=20f?= =?UTF-8?q?rom=200.05=C2=B0=20to=200.07=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- lib/microwaveprop/weather.ex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/microwaveprop/weather.ex b/lib/microwaveprop/weather.ex index e25fd05f..19d2f8ce 100644 --- a/lib/microwaveprop/weather.ex +++ b/lib/microwaveprop/weather.ex @@ -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)