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:
parent
a8f6a3b0e8
commit
0e885001bc
1 changed files with 10 additions and 4 deletions
|
|
@ -457,10 +457,16 @@ defmodule Microwaveprop.Weather do
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_hrrr_profile?(lat, lon, valid_time) do
|
def has_hrrr_profile?(lat, lon, valid_time) do
|
||||||
{rlat, rlon} = round_to_hrrr_grid(lat, lon)
|
dlat = 0.07
|
||||||
|
dlon = 0.07
|
||||||
|
|
||||||
HrrrProfile
|
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?()
|
|> Repo.exists?()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -476,8 +482,8 @@ defmodule Microwaveprop.Weather do
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_nearest_hrrr(lat, lon, timestamp) do
|
def find_nearest_hrrr(lat, lon, timestamp) do
|
||||||
dlat = 0.05
|
dlat = 0.07
|
||||||
dlon = 0.05
|
dlon = 0.07
|
||||||
time_start = DateTime.add(timestamp, -3600, :second)
|
time_start = DateTime.add(timestamp, -3600, :second)
|
||||||
time_end = DateTime.add(timestamp, 3600, :second)
|
time_end = DateTime.add(timestamp, 3600, :second)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue