fix(contact): align Mechanism panel with Propagation Analysis ducts
The radar-only RainScatterClassifier sees ducting only when HRRR's pressure-level M-profile flagged it. Sounding-detected and gradient- inferred ducts surface in elevation_profile.ducts via the analysis pipeline — promote those into :tropo_duct so the Mechanism badge agrees with the narrative.
This commit is contained in:
parent
4b10d63e67
commit
c0a884dc99
1 changed files with 19 additions and 1 deletions
|
|
@ -624,13 +624,31 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
elevation_profile
|
elevation_profile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mechanism = upgrade_mechanism(socket.assigns[:mechanism], elevation_profile)
|
||||||
|
|
||||||
assign(socket,
|
assign(socket,
|
||||||
elevation_profile: elevation_profile,
|
elevation_profile: elevation_profile,
|
||||||
propagation_analysis: propagation_analysis,
|
propagation_analysis: propagation_analysis,
|
||||||
data_sources: data_sources
|
data_sources: data_sources,
|
||||||
|
mechanism: mechanism
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The radar-only RainScatterClassifier sees ducting only when HRRR's
|
||||||
|
# pressure-level M-profile already flagged it. Sounding and gradient-
|
||||||
|
# inferred ducts surface in elevation_profile.ducts via the analysis
|
||||||
|
# pipeline — promote those into :tropo_duct so the Mechanism panel
|
||||||
|
# agrees with the Propagation Analysis narrative.
|
||||||
|
defp upgrade_mechanism(nil, _profile), do: nil
|
||||||
|
defp upgrade_mechanism(:tropo_duct, _profile), do: :tropo_duct
|
||||||
|
defp upgrade_mechanism(:likely_rainscatter, _profile), do: :likely_rainscatter
|
||||||
|
|
||||||
|
defp upgrade_mechanism(mechanism, %{ducts: [_ | _] = ducts}) do
|
||||||
|
if Enum.any?(ducts, &Map.get(&1, :likely)), do: :tropo_duct, else: mechanism
|
||||||
|
end
|
||||||
|
|
||||||
|
defp upgrade_mechanism(mechanism, _profile), do: mechanism
|
||||||
|
|
||||||
defp load_iemre(contact) do
|
defp load_iemre(contact) do
|
||||||
case Weather.iemre_for_contact(contact) do
|
case Weather.iemre_for_contact(contact) do
|
||||||
%{hourly: hourly} = obs when is_list(hourly) and hourly != [] ->
|
%{hourly: hourly} = obs when is_list(hourly) and hourly != [] ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue