Guard against HRRR fill values in grid scoring

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.
This commit is contained in:
Graham McIntire 2026-03-31 11:07:26 -05:00
parent 187fdf085e
commit 4301f48d27
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -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)