From 4301f48d27968c1f3a1d66058e4fa770bbc262e7 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 31 Mar 2026 11:07:26 -0500 Subject: [PATCH] Guard against HRRR fill values in grid scoring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skip grid points where surface_temp_c or surface_dewpoint_c are physically impossible (< -80°C or > 60°C). HRRR returns -273.15 (absolute zero) for ocean/missing points which caused division by zero in absolute_humidity calculation. --- lib/microwaveprop/propagation.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/microwaveprop/propagation.ex b/lib/microwaveprop/propagation.ex index b3230264..bcb0ae40 100644 --- a/lib/microwaveprop/propagation.ex +++ b/lib/microwaveprop/propagation.ex @@ -22,8 +22,9 @@ defmodule Microwaveprop.Propagation do temp_c = hrrr_profile.surface_temp_c dewpoint_c = hrrr_profile.surface_dewpoint_c - # Skip points with missing surface data (ocean/outside-domain) - if is_nil(temp_c) or is_nil(dewpoint_c) do + # Skip points with missing or physically impossible surface data + if is_nil(temp_c) or is_nil(dewpoint_c) or temp_c < -80 or temp_c > 60 or + dewpoint_c < -80 or dewpoint_c > 50 do [] else score_grid_point_with_data(hrrr_profile, valid_time, temp_c, dewpoint_c, derived)