Show per-duct layer heights in map detail panel
When clicking a grid point with ducting, the panel now shows each duct layer with base-top height in feet, thickness in meters, and minimum trapped frequency. Data flows from Duct.analyze through the scoring factors as a ducts array.
This commit is contained in:
parent
da0d0fcbdb
commit
bcdbf0b53a
3 changed files with 30 additions and 12 deletions
|
|
@ -363,17 +363,23 @@ function buildPopupHTML(detail, viewshedLoading) {
|
|||
</div>`
|
||||
}
|
||||
|
||||
function buildDuctInfoHTML(duct) {
|
||||
const freq = duct.best_duct_freq_ghz != null ? `${duct.best_duct_freq_ghz.toFixed(1)} GHz` : "—"
|
||||
const thick = duct.max_duct_thickness_m != null ? `${Math.round(duct.max_duct_thickness_m)} m` : "—"
|
||||
function buildDuctInfoHTML(info) {
|
||||
const layers = info.ducts || []
|
||||
let layerRows = ""
|
||||
if (layers.length > 0) {
|
||||
layerRows = layers.map((d, i) => {
|
||||
const baseFt = Math.round(d.base_m * 3.281)
|
||||
const topFt = Math.round(d.top_m * 3.281)
|
||||
const freq = d.min_freq_ghz != null ? `\u2265${d.min_freq_ghz.toFixed(1)} GHz` : ""
|
||||
return `<div style="font-size:11px;padding:1px 0;">
|
||||
Layer ${i + 1}: <strong>${baseFt}\u2013${topFt} ft</strong> (${d.thickness_m} m) ${freq}
|
||||
</div>`
|
||||
}).join("")
|
||||
}
|
||||
return `
|
||||
<div style="padding:4px 10px 6px;border-top:1px solid rgba(255,255,255,0.15);">
|
||||
<div style="font-size:10px;font-weight:700;opacity:0.5;margin-bottom:3px;text-transform:uppercase;letter-spacing:0.5px;">Ducting</div>
|
||||
<div style="font-size:12px;display:flex;gap:12px;">
|
||||
<span><strong>${duct.duct_count}</strong> layer${duct.duct_count !== 1 ? "s" : ""}</span>
|
||||
<span>Thickness: <strong>${thick}</strong></span>
|
||||
<span>Traps \u2265 <strong>${freq}</strong></span>
|
||||
</div>
|
||||
<div style="font-size:10px;font-weight:700;opacity:0.5;margin-bottom:3px;text-transform:uppercase;letter-spacing:0.5px;">Ducting — ${info.duct_count} layer${info.duct_count !== 1 ? "s" : ""}</div>
|
||||
${layerRows}
|
||||
</div>`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ defmodule Microwaveprop.Propagation do
|
|||
%{
|
||||
duct_count: hrrr_profile[:duct_count],
|
||||
best_duct_freq_ghz: hrrr_profile[:best_duct_freq_ghz],
|
||||
max_duct_thickness_m: hrrr_profile[:max_duct_thickness_m]
|
||||
max_duct_thickness_m: hrrr_profile[:max_duct_thickness_m],
|
||||
ducts: hrrr_profile[:ducts] || []
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -196,14 +196,25 @@ defmodule Microwaveprop.Weather.HrrrNativeClient do
|
|||
if profile.level_count >= 3 do
|
||||
duct_result = Duct.analyze(profile)
|
||||
|
||||
ducts_summary =
|
||||
Enum.map(duct_result.ducts, fn d ->
|
||||
%{
|
||||
base_m: round(d.base_m),
|
||||
top_m: round(d.top_m),
|
||||
thickness_m: round(d.thickness_m),
|
||||
min_freq_ghz: Duct.min_trapped_frequency_ghz(d)
|
||||
}
|
||||
end)
|
||||
|
||||
%{
|
||||
native_min_gradient: min_m_gradient(profile),
|
||||
best_duct_freq_ghz: duct_result.best_duct_band_ghz,
|
||||
max_duct_thickness_m: max_duct_thickness(duct_result.ducts),
|
||||
duct_count: length(duct_result.ducts)
|
||||
duct_count: length(duct_result.ducts),
|
||||
ducts: ducts_summary
|
||||
}
|
||||
else
|
||||
%{native_min_gradient: nil, best_duct_freq_ghz: nil, max_duct_thickness_m: nil, duct_count: 0}
|
||||
%{native_min_gradient: nil, best_duct_freq_ghz: nil, max_duct_thickness_m: nil, duct_count: 0, ducts: []}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue