diff --git a/algo.md b/algo.md index 596ae0cf..80572f2f 100644 --- a/algo.md +++ b/algo.md @@ -2,24 +2,30 @@ ## Overview -Propagation scoring and prediction for microwave amateur radio bands (10-241 GHz), calibrated against 57,492 QSOs with distance data, validated against 18,540 signal samples from 7 commercial terrestrial links at 11/24/68 GHz, and grounded in ITU-R atmospheric models. +Propagation scoring and prediction for microwave amateur radio bands (10-241 GHz), calibrated against 57,488 tropospheric QSOs with distance data, validated against commercial terrestrial links at 11/24/68 GHz, and grounded in ITU-R atmospheric models. The algorithm has two operating regimes: -1. **Beyond-LOS** — Ham radio paths (50-1000+ km) where atmospheric ducting and refraction are essential. This is the primary use case. +1. **Beyond-LOS** — Ham radio paths (50-1000+ km) where atmospheric ducting and refraction are essential. This is the primary use case. Terrain analysis confirms **97.2% of all QSO paths are terrain-blocked** (average diffraction loss 36.2 dB), making atmospheric propagation mechanisms the sole enabler. 2. **LOS** — Known fixed links or short paths with clear Fresnel clearance where gaseous absorption is the dominant variable. The regime distinction matters because refractivity effects are *inverted* between the two: enhanced refraction extends beyond-LOS range but causes multipath fading on short LOS paths. ### Calibration Dataset -**QSO data:** 57,492 tropospheric contacts across 13 bands (ARRL Microwave Contest, 2019-2024), filtered to exclude EME/satellite. Weather-matched against 95 ASOS stations (surface) and 9 RAOB stations (soundings). +**QSO data:** 58,282 total QSOs across 13+ bands (ARRL Microwave Contest, 1992-2024). 57,488 with tropospheric distance data after excluding 4 EME contacts (QRA64D/JT4F modes >3,000 km). Enriched with weather from 1,299 ASOS stations (58,398 surface observations), 112 RAOB stations (3,901 soundings), 4,522 HRRR model profiles, 3,675 IEMRE gridded hourly observations, and 58,276 terrain path profiles. -**Link data:** 18,540 samples from 7 commercial links near DFW (March 14-29 2026), correlated with KTKI ASOS and HRRR model refractivity profiles. No rain during observation period. +**Link data:** 7 commercial links near DFW (Greenville/Commerce TX area) at 11/24/68 GHz, polled via SNMP at 5-minute intervals. All links use KTKI ASOS for weather correlation. Live polling is active; historical dataset from March 14-29 2026 (18,540 samples) was used for initial algorithm validation. + +**Terrain analysis:** 58,276 QSO paths profiled — 56,658 BLOCKED (97.2%, avg 36.2 dB diffraction), 1,277 CLEAR (2.2%), 341 FRESNEL_PARTIAL (0.6%). Blocked paths average *longer* distances than clear paths (215 km vs 84 km at 10 GHz) because ducting enables beyond-LOS paths by definition. **Confirmed long-range contacts:** - 47 GHz: 116.0 km (Nov 2025), 98.8 km (Jun 2024) -- 24 GHz: 542.1 km (Sep 2002, longest), 101.0 km (Nov 2025) -- 10 GHz: 1,609 km (longest in dataset) +- 24 GHz: 710.0 km (rainscatter, CW), 542.1 km (Sep 2002, longest tropo) +- 10 GHz: 2,393 km (longest tropospheric in dataset) + +**Additional data sources (not yet integrated into scoring):** +- Solar indices: 9,586 daily values (1998-2026) — SFI, SSN, Ap/Kp. Not relevant for tropospheric microwave propagation but available for future VHF/sporadic-E extension. +- IEMRE gridded hourly data: weather at QSO endpoint grid points (0.125° resolution) with percentage sky cover, soil temperature, wind components. More granular than nearest-ASOS matching. --- @@ -131,21 +137,21 @@ These findings drive the scoring model's design. Each contradicts or refines ass The most important discovery. At 10 GHz, more moisture = longer paths (refractivity dominates, absorption negligible). At 24+ GHz, more moisture = shorter paths (absorption dominates). -**10 GHz — humidity helps (N=52,456 QSOs):** +**10 GHz — humidity helps (N=53,013 QSOs):** | Abs. Humidity | Avg Dist | P90 Dist | |---------------|----------|----------| | 5-8 g/m^3 | 193 km | 342 km | | 11-14 g/m^3 | 215 km | 383 km | | 17+ g/m^3 | 230 km | 519 km | -**24 GHz — humidity hurts (N=3,439 QSOs):** +**24 GHz — humidity hurts (N=3,639 QSOs):** | Abs. Humidity | Avg Dist | P90 Dist | |---------------|----------|----------| | 5-8 g/m^3 | 115 km | 154 km | | 11-14 g/m^3 | 105 km | 174 km | | 17+ g/m^3 | 53 km | 103 km | -**47 GHz — humidity hurts, less severely (N=576 QSOs):** +**47 GHz — humidity hurts, less severely (N=689 QSOs):** | Abs. Humidity | Avg Dist | P90 Dist | |---------------|----------|----------| | 0-5 g/m^3 | 191 km | 234 km | @@ -175,13 +181,43 @@ Contradicts the original model's high-pressure = good assumption: Low pressure systems bring frontal boundaries with strong temperature/moisture gradients that create inversions and ducts. The key is gradient structure, not absolute pressure. -### Finding 4: Boundary Layer Depth Sweet Spot +### Finding 4: Boundary Layer Depth — Time-Dependent Sweet Spot -Moderate BL depth (500-1000m) produces the best results across all bands — indicating an elevated inversion high enough to trap signals but not so deep that full convective mixing has occurred. +Sounding data (3,901 profiles) reveals that BL depth interpretation depends on sounding time: -### Finding 5: Binary Duct Detection Is Weak +| Sounding Time | Avg BL Depth | Ducting % | Mechanism | +|---------------|-------------|-----------|-----------| +| 00Z (evening) | 1,370m | 54.0% | Elevated ducts within deep residual BL | +| 12Z (morning) | 335m | 53.7% | Surface/radiation ducts from shallow nocturnal BL | -Simple "duct detected yes/no" from soundings shows negligible correlation with distance (avg dist: 214 vs 216 km at 10 GHz). This is because soundings are 12-hourly point samples while conditions evolve continuously, and duct characteristics (strength, height) matter more than binary presence. +Ducting rate is identical at both times (~54%), but via different mechanisms. At 12Z, shallow BL (<500m) is the signature. At 00Z, the duct is typically elevated within a deeper residual boundary layer. A single BL depth threshold won't work across both regimes — use BL depth relative to expected diurnal range. + +HRRR profile data (4,522 profiles) confirms the relationship is monotonic: + +| BL Depth Bin | Count | Avg N | Avg Min Gradient | +|-------------|-------|-------|------------------| +| 0-200m | 1,096 | 342.6 | -93.7 | +| 200-500m | 1,091 | 346.6 | -81.5 | +| 500-1000m | 1,242 | 337.0 | -70.1 | +| 1000-1500m | 735 | 328.8 | -58.3 | +| 1500-2000m | 299 | 325.2 | -51.0 | +| 2000m+ | 60 | 309.4 | -45.4 | + +### Finding 5: Binary Duct Detection Is Weak — Use Continuous Gradient + +Ducting is the **majority case** in soundings: 2,099 ducting (53.8%) vs 1,800 non-ducting (46.2%). Binary detection has near-zero discriminating power. + +| Ducting | Count | Avg N | Avg Min Gradient | Avg BL Depth | Avg K-Index | Avg LI | +|---------|-------|-------|------------------|-------------|-------------|--------| +| No | 1,800 | 327.4 | -123.4 | 986m | 16.7 | 22.8 | +| Yes | 2,099 | 340.2 | -388.7 | 738m | 12.7 | 25.3 | + +The continuous gradient (-389 vs -123) is the real signal — a 3x magnitude difference. HRRR data shows 79% of profiles in "Enhanced" regime (gradient -40 to -100), so the scoring must discriminate *within* the enhanced category, not just between standard and enhanced. + +**Stability indices and ducting:** +- K-index is **lower** for ducting (12.7 vs 16.7) — stable atmosphere favors ducting, not convection +- Lifted Index is **higher** for ducting (25.3 vs 22.8) — confirms stability correlation +- **Precipitable water is identical** (28.0 mm) for both ducting and non-ducting — PWAT is NOT a useful ducting discriminator. It plateaus as a gradient predictor above ~15mm. ### Finding 6: Diurnal Signal Variation Sets a Noise Floor @@ -191,6 +227,51 @@ Commercial link data shows 1-5 dB daily variation even on perfectly clear, stabl On short LOS paths (3-7 km), sub-refractive conditions (dN/dh > -40/km) produce the best signal — minimal multipath, clean beam coupling. On long beyond-LOS paths (50-500+ km), enhanced refraction/ducting is essential. The algorithm must handle both regimes. +### Finding 8: Time-of-Day Effect Scales with Frequency + +Night/dawn (22Z-10Z) enhancement vs afternoon baseline, from QSO distance data: + +| Band | Afternoon Avg | Night/Dawn Avg | Enhancement | P90 Boost | +|------|--------------|----------------|-------------|-----------| +| 10 GHz | 209.7 km | 218.6 km | +4% | +8% | +| 24 GHz | 93.8 km | 119.7 km | +28% | +16% | +| 47 GHz | 63.5 km | 86.6 km | +36% | +42% | +| 75 GHz | 38.1 km | 175.4 km | +360% | +237% | + +At 10 GHz the effect is modest. At 47+ GHz it is the **dominant variable**, more important than most weather parameters. The 75 GHz result is from only 20 night/dawn QSOs but the 4.6x multiplier is consistent with strong ducting being the *only* path at that frequency. + +### Finding 9: Ducting Peaks June-July, Not August + +Monthly ducting probability from 3,901 soundings: + +| Month | Soundings | Ducting % | Avg N | Avg Min Gradient | Avg PWAT (mm) | +|-------|-----------|-----------|-------|------------------|---------------| +| Jan | 32 | 21.9% | 306.2 | -133.4 | 9.5 | +| Feb | 58 | 17.2% | 304.4 | -132.7 | 6.6 | +| Mar | 37 | **10.8%** | 293.3 | -112.5 | 6.6 | +| Apr | 64 | 37.5% | 306.0 | -152.0 | 14.0 | +| May | 68 | 48.5% | 323.3 | -233.1 | 20.5 | +| Jun | 134 | **68.7%** | 335.0 | -322.7 | 28.6 | +| Jul | 85 | **76.5%** | 339.3 | -301.4 | 27.6 | +| Aug | 1,700 | 53.9% | 341.9 | -260.7 | 33.3 | +| Sep | 1,564 | 56.4% | 332.4 | -286.5 | 26.2 | +| Oct | 48 | 60.4% | 321.5 | -314.3 | 17.9 | +| Nov | 53 | 56.6% | 308.4 | -264.3 | 10.6 | +| Dec | 58 | 12.1% | 305.0 | -139.8 | 10.5 | + +**March is the worst month** (10.8%), not winter. December-February averages ~17%. The sharp ramp April→July is nonlinear. Contest data (Aug-Sep) slightly undersamples the true ducting peak (Jun-Jul at 69-77%). Note: Aug/Sep have disproportionate sounding counts because data is enriched from QSO time windows during contest months. + +### Finding 10: Mode Matters — CW Has 24% Range Advantage + +| Mode | QSOs | Avg Distance | +|------|------|-------------| +| CW | 19,863 | 232.2 km | +| PH (SSB) | 37,077 | 186.5 km | +| FM | 178 | 144.1 km | +| DG (digital) | 122 | 192.4 km | + +The CW advantage (~7 dB bandwidth: 10*log10(2700/500)) translates to 24% longer average distances. Scoring tier range estimates should be qualified by mode. One confirmed 710 km rainscatter contact at 24 GHz (CW mode). + --- ## Part 3: Band Configuration @@ -204,9 +285,12 @@ On short LOS paths (3-7 km), sub-refractive conditions (dN/dh > -40/km) produce humidity_effect: :beneficial, # More moisture = more refractivity = longer paths humidity_penalty: 0.0, rain_k: 0.010, rain_alpha: 1.28, - seasonal_base: %{1 => 88, 2 => 84, 3 => 72, 4 => 62, 5 => 55, - 6 => 42, 7 => 28, 8 => 28, 9 => 52, 10 => 68, - 11 => 96, 12 => 88}, + # Seasonal pattern INVERTED from 24+ GHz: ducting + humidity both help 10G + # Ducting peaks Jun-Jul (69-77%), March worst (10.8%), Dec-Feb ~12-22% + # Score tracks ducting probability scaled to 0-100 + seasonal_base: %{1 => 38, 2 => 32, 3 => 22, 4 => 55, 5 => 68, + 6 => 90, 7 => 95, 8 => 75, 9 => 78, 10 => 82, + 11 => 78, 12 => 25}, seasonal_adj: %{}, typical_range_km: 200, extended_range_km: 500, @@ -219,7 +303,9 @@ On short LOS paths (3-7 km), sub-refractive conditions (dN/dh > -40/km) produce humidity_effect: :harmful, # 22.235 GHz H2O line shoulder humidity_penalty: 1.6, rain_k: 0.070, rain_alpha: 1.07, - seasonal_base: %{1 => 88, 2 => 84, 3 => 72, 4 => 62, 5 => 51, + # 24G: humidity hurts, so best in dry months. But March is worst for ducting. + # Balance: winter dry + some ducting > spring dry + no ducting + seasonal_base: %{1 => 88, 2 => 84, 3 => 68, 4 => 62, 5 => 51, 6 => 34, 7 => 18, 8 => 18, 9 => 48, 10 => 68, 11 => 96, 12 => 88}, seasonal_adj: %{5 => -4, 6 => -8, 7 => -10, 8 => -10, 9 => -4}, @@ -432,10 +518,11 @@ end ### 4. Sky Cover Score -Data shows modest impact at 24/47 GHz, near-zero at 10 GHz. VV (vertical visibility / fog) is a moderate penalty due to near-surface moisture content. +Data shows modest impact at 24/47 GHz, near-zero at 10 GHz. VV (vertical visibility / fog) is a moderate penalty due to near-surface moisture content. Supports both METAR categories (from ASOS) and percentage sky cover (from IEMRE gridded data). ```elixir -def score_sky(condition) do +def score_sky(condition) when is_binary(condition) do + # METAR category from ASOS case condition do c when c in ["CLR", "SKC"] -> 100 "FEW" -> 88 @@ -446,6 +533,17 @@ def score_sky(condition) do _ -> 50 end end + +def score_sky(pct) when is_number(pct) do + # Percentage sky cover from IEMRE (0-100%) + cond do + pct <= 6 -> 100 # CLR equivalent + pct <= 25 -> 88 # FEW + pct <= 50 -> 60 # SCT + pct <= 87 -> 25 # BKN + true -> 5 # OVC + end +end ``` ### 5. Season Score @@ -531,7 +629,9 @@ end ### 9. Refractivity Score — When Sounding/HRRR Data Available -Best predictor when available, but only available from 12-hourly soundings or HRRR model. Binary duct detection is weak; refractivity gradient and BL depth are stronger signals. +Best predictor when available. Binary duct detection is useless (54% baseline rate). Use continuous gradient magnitude and BL depth instead. Surface-based ducts (base=0) matter more than elevated ducts. + +From sounding data: avg gradient -389 N/km for ducting events vs -123 for non-ducting. From HRRR: BL depth < 200m correlates with avg gradient of -93.7 (approaching super-refraction). ```elixir def score_refractivity(sounding_or_hrrr, band_config) do @@ -539,25 +639,35 @@ def score_refractivity(sounding_or_hrrr, band_config) do sounding_or_hrrr == nil -> 50 # No data — neutral sounding_or_hrrr.min_dn_dh < -500 -> - # Super-refraction — ducting probable + # Strong ducting — gradient 3x non-ducting average case band_config.humidity_effect do :beneficial -> 98 # 10 GHz benefits most from ducting :harmful -> 85 # Higher bands benefit but absorption limits range end - sounding_or_hrrr.min_dn_dh < -200 -> - 80 # Enhanced refraction + sounding_or_hrrr.min_dn_dh < -300 -> + # Moderate ducting — near ducting average of -389 + case band_config.humidity_effect do + :beneficial -> 92 + :harmful -> 78 + end + sounding_or_hrrr.min_dn_dh < -200 -> + 80 # Enhanced refraction — above non-ducting average of -123 + + # BL depth signal: shallow BL at 12Z = strong surface duct potential sounding_or_hrrr.bl_depth_m != nil and - sounding_or_hrrr.bl_depth_m >= 500 and - sounding_or_hrrr.bl_depth_m <= 1000 -> - 78 # Sweet-spot BL depth — elevated inversion + sounding_or_hrrr.bl_depth_m < 300 -> + 82 # Very shallow BL — strong inversion cap (12Z signature) sounding_or_hrrr.min_dn_dh < -100 -> 65 # Mild enhancement + sounding_or_hrrr.min_dn_dh < -60 -> + 55 # Slightly enhanced — within the broad "Enhanced" HRRR regime + true -> - 50 # Standard conditions + 42 # Standard/sub-refractive — HRRR shows only 5% of profiles here end end ``` @@ -568,39 +678,45 @@ end ### Weights +Revised from expanded dataset. Key changes: refractivity weight doubled (HRRR now provides hourly data, not just 12-hourly soundings), time-of-day weight increased (data shows it's the dominant variable above 24 GHz), pressure reduced (weak standalone predictor, 5% was still generous). + | Factor | Weight | Rationale | |--------|--------|-----------| -| Humidity | 22% | Dominant variable, but split role by frequency | -| Time of Day | 18% | Strongest diurnal predictor in QSO data | -| Td Depression | 14% | Proxy for humidity aloft — strong signal | +| Humidity | 20% | Dominant variable, but split role by frequency | +| Time of Day | 20% | First-order effect at 24+ GHz (28-360% enhancement at night) | +| Td Depression | 12% | Proxy for humidity aloft — strong signal | +| Refractivity | 10% | Best predictor; HRRR provides hourly coverage, sounding gradient is 3x discriminator | | Sky Cover | 10% | Modest effect, mainly at higher frequencies | -| Season | 10% | Long-term baseline | -| Wind | 8% | Data shows minimal impact; penalty only for extremes | +| Season | 10% | Long-term baseline — now ducting-calibrated per band | +| Wind | 6% | Data shows minimal impact; penalty only for extremes | | Rain | 8% | Critical for 24+ GHz paths | -| Pressure | 5% | Weak standalone predictor | -| Refractivity | 5% | Best predictor when available, but often unavailable | +| Pressure | 4% | Weak standalone predictor | ```elixir def composite_score(factors) do round( - factors.humidity * 0.22 + - factors.time_of_day * 0.18 + - factors.td_depression * 0.14 + + factors.humidity * 0.20 + + factors.time_of_day * 0.20 + + factors.td_depression * 0.12 + + factors.refractivity * 0.10 + factors.sky * 0.10 + factors.season * 0.10 + - factors.wind * 0.08 + + factors.wind * 0.06 + factors.rain * 0.08 + - factors.pressure * 0.05 + - factors.refractivity * 0.05 + factors.pressure * 0.04 ) end ``` ### Score Tiers with Per-Band Range Estimates +Range estimates are for CW mode. For SSB/phone, reduce by ~20%. For FM, reduce by ~40%. + +Database stats for reference: 10G avg=213 km, P90=383 km, max=2,393 km. 24G avg=98 km, P90=179 km, max=710 km. 47G avg=66 km, P90=122 km, max=343 km. 75G avg=64 km, P90=177 km, max=289 km. + | Score | Label | 10G | 24G | 47G | 75G | |-------|-------|-----|-----|-----|-----| -| 80-100 | EXCELLENT | 400-1000+ km | 200-500 km | 120-300 km | 80-200+ km | +| 80-100 | EXCELLENT | 400-2000+ km | 200-500 km | 120-300 km | 80-200+ km | | 65-79 | GOOD | 250-400 km | 120-200 km | 80-120 km | 50-80 km | | 50-64 | MARGINAL | 150-250 km | 70-120 km | 50-80 km | 30-50 km | | 33-49 | POOR | 80-150 km | 40-70 km | 25-50 km | 15-30 km | @@ -989,20 +1105,27 @@ For surface ducts, the beam must arrive at <0.5° grazing incidence to be trappe **Primary mechanisms:** Ducting, enhanced refraction **Key variable:** Refractivity profile, NOT humidity absorption (0.012 dB/km total is negligible) **Best conditions:** Moderate-high humidity (12-20 g/m^3), temperature inversions, stable atmosphere, late evening through early morning -**Unique:** Largely insensitive to rain. Can propagate through cloud decks. Marine ducting produces 1000+ km coastal paths. Frontal boundaries create strong refractive gradients. +**Best months:** June-July (ducting probability 69-77%). August contest data undersamples peak season. +**Worst month:** March (10.8% ducting — worse than deep winter) +**Dataset:** 53,013 QSOs, avg 213 km, P90 383 km, max 2,393 km. CW avg 232 km vs PH avg 187 km. +**Unique:** Largely insensitive to rain. Can propagate through cloud decks. Marine ducting produces 1000+ km coastal paths. Frontal boundaries create strong refractive gradients. 97.2% of paths are terrain-blocked — ducting IS the propagation mechanism. ### 24 GHz (1.2cm) — Water Vapor Line Band **Primary mechanisms:** Ducting (reduced by absorption), enhanced refraction **Key variable:** Absolute humidity (22.235 GHz H2O line makes this THE most humidity-sensitive band) **Best conditions:** Very dry air (<8 g/m^3), cold season (Nov-Mar), clear skies, pre-dawn through early morning -**Unique:** 10x more sensitive to water vapor than 10 GHz. Summer Gulf moisture devastates range. Rain scatter is a viable alternative mechanism (710 km QSO documented). +**Night enhancement:** +28% avg distance, +16% P90 vs afternoon (119.7 km vs 93.8 km) +**Dataset:** 3,639 QSOs, avg 98 km, P90 179 km, max 710 km (rainscatter CW). +**Unique:** 10x more sensitive to water vapor than 10 GHz. Summer Gulf moisture devastates range. Rain scatter is a viable alternative mechanism (710 km QSO documented). March is the worst ducting month (10.8%) but also has low humidity, creating a tension between ducting availability and absorption loss. ### 47 GHz (6mm) — Atmospheric Window **Primary mechanisms:** Ducting (in atmospheric window), enhanced LOS **Key variable:** Balance of humidity and refractivity; very dry air dramatically helps **Best conditions:** Dry air (<8 g/m^3), clear skies, strong inversions, early morning +**Night enhancement:** +36% avg distance, +42% P90 vs afternoon (86.6 km vs 63.5 km). Time-of-day is the dominant variable at this frequency. +**Dataset:** 689 QSOs, avg 66 km, P90 122 km, max 343 km. **Unique:** Window between 22 GHz H2O and 60 GHz O2. O2 absorption ~0.045 dB/km is fixed. Ducting is the ONLY way beyond ~150 km. ### 68 GHz — V-Band Edge @@ -1016,8 +1139,10 @@ For surface ducts, the beam must arrive at <0.5° grazing incidence to be trappe **Primary mechanisms:** Rare ducting, enhanced LOS **Key variable:** Dry air + no precipitation -**Best conditions:** Very dry (<5 g/m^3), no rain, strong inversions, winter -**Unique:** 289 km record (California marine duct). Only 81 QSOs with distance data. Rain attenuation severe (~1 dB/km at 4 mm/hr). +**Best conditions:** Very dry (<5 g/m^3), no rain, strong inversions, winter, night/dawn +**Night enhancement:** +360% avg distance vs afternoon (175.4 km vs 38.1 km). At this frequency, nighttime propagation is essentially a different regime. Daytime contacts are limited to ~40 km; nighttime contacts regularly exceed 150 km. +**Dataset:** 104 QSOs, avg 64 km, P90 177 km, max 289 km. +**Unique:** 289 km record (California marine duct). Rain attenuation severe (~1 dB/km at 4 mm/hr). ### 122 GHz (2.5mm) — O2 Line Wing @@ -1046,33 +1171,58 @@ For surface ducts, the beam must arrive at <0.5° grazing incidence to be trappe ``` Surface Observations (ASOS, every 5-20 min) - -> temp, dewpoint, wind, pressure, sky, visibility + -> temp, dewpoint, wind, pressure, sky, visibility, wx_codes -> compute: abs_humidity, Td depression -> per-band scoring functions -> composite score per band -> 6-hour prediction timeline -Sounding Data (RAOB 00Z/12Z) + HRRR Model (hourly) - -> refractivity profile, dN/dh gradient, ducts, BL depth - -> refractivity score component - -> regime classification (LOS vs beyond-LOS for specific paths) +HRRR Model (hourly, per grid point) + -> refractivity profile, dN/dh gradient, ducts, BL depth, PWAT, surface N + -> refractivity score component (10% weight — best discriminator) + -> 4,522 profiles in DB: 79% Enhanced, 15% Super, 5% Standard, 0.7% Ducting + -> Key thresholds: gradient < -300 = moderate ducting, < -500 = strong ducting + -> HPBL < 200m = strongest signal for enhanced propagation + +Sounding Data (RAOB 00Z/12Z) + -> 3,901 soundings from 112 stations + -> Same derived params as HRRR but only twice daily + -> 54% show ducting — binary flag useless, gradient magnitude is the signal + -> K-index INVERSELY correlates with ducting (12.7 ducting vs 16.7 non-ducting) + -> PWAT is NOT a ducting discriminator (identical 28.0 mm both cases) + +IEMRE Gridded Data (hourly, 0.125° resolution) + -> temp, dewpoint, sky_cover_pct, wind (u/v), precip at QSO endpoint locations + -> More granular than nearest-ASOS matching + -> 3,675 gridded observations in DB, enriched per-QSO Terrain Data (SRTM) -> path profile, Fresnel clearance, earth bulge - -> determines LOS vs beyond-LOS regime + -> 97.2% of QSO paths are BLOCKED (avg 36.2 dB diffraction loss) + -> 2.2% CLEAR, 0.6% FRESNEL_PARTIAL + -> Blocked paths average LONGER distances (215 km) than clear paths (84 km) + -> Determines LOS vs beyond-LOS regime -> diffraction loss calculation +Commercial Link Data (SNMP polling, 5-min intervals) + -> 7 links at 11/24/68 GHz near DFW + -> rx_power_0, rx_power_1 (dual-chain MIMO on af11x), tx_power + -> Signal variation scales with frequency: 68G > 24G > 11G + -> Correlated with KTKI ASOS surface obs + Link Budget (point-to-point) -> FSPL + gaseous + rain + diffraction - duct enhancement -> margin = RX power - sensitivity -> success % = margin_to_success(margin, prop_score) + -> Note: 36 dB avg diffraction > 14 dB max duct enhancement + (gap closed by station EIRP + receiver sensitivity + troposcatter) ``` ### Display: Band Conditions Panel For each band: - Current score (0-100, colored badge) -- Estimated range (km, from score tier table) +- Estimated range (km, from score tier table, qualified by mode) - Key limiting factor ("High humidity: 16 g/m^3", "Strong inversion detected") - Trend arrow (improving/stable/degrading from last hour) - 6-hour prediction timeline with confidence shading @@ -1094,8 +1244,12 @@ For each band: | Duct M-unit threshold | 2 | Noise filter | | Inversion min strength | 0.5C | Below is noise | | Inversion height limit | 5000m AGL | Above irrelevant | -| BL depth sweet spot | 500-1000m | Empirical from QSO data | +| BL depth shallow threshold | <300m | HRRR: avg gradient -93.7 at BL<200m | +| Ducting gradient threshold | -300 N/km | Sounding avg for ducting events: -389 | +| Non-ducting gradient avg | -123 N/km | Sounding avg for non-ducting events | +| Ducting surface N threshold | 330 | Above this, ducting probability >50% | | Signal prediction floor | +/- 2-3 dB | Measured from link data | +| CW bandwidth advantage | ~7 dB | 10*log10(2700/500); 24% range increase | ## ITU-R References @@ -1108,8 +1262,19 @@ For each band: ## Data References -- ARRL Microwave Contest QSO database: 57,492 contacts with distance (2019-2024) -- IEM ASOS observations: 95 stations, +/-2hr window match -- IEM RAOB soundings: 9 stations, +/-6hr window match -- Commercial link data: 18,540 samples, 7 links at 11/24/68 GHz (March 2026) -- HRRR model: hourly refractivity profiles (March 2026 validation period) +- ARRL Microwave Contest QSO database: 58,282 total, 57,488 tropospheric with distance (1992-2024) +- IEM ASOS observations: 1,299 stations, 58,398 surface observations +- IEM RAOB soundings: 112 stations, 3,901 soundings +- IEMRE gridded hourly: 3,675 observations at 0.125° resolution +- HRRR model profiles: 4,522 profiles with refractivity, BL depth, PWAT +- Terrain profiles: 58,276 QSO paths (97.2% blocked, avg 36.2 dB diffraction) +- Commercial link data: 7 links at 11/24/68 GHz near DFW, SNMP-polled +- Solar indices: 9,586 daily values (1998-2026) — reserved for future use + +## Known Data Quality Issues + +- **EME contamination**: 4 QSOs >3,000 km remain in dataset (QRA64D/JT4F modes). Filter on `distance_km < 3000` for tropospheric analysis. +- **Unmodeled bands**: 142, 145, 288, 322, 403, 411 GHz have 1-4 QSOs each but no band_config entries. Too sparse for statistical analysis. +- **Sounding data recency**: Latest soundings are from Sep 2024. Ingestion pipeline may need restart for live enrichment. +- **Surface obs density**: Historical obs are sparse (~1 per 4.7 days per station) because they were fetched per-QSO-window. Live polling is now active for continuous coverage. +- **Weather codes (wx_codes)**: Stored in surface_observations but unused by scoring. Direct fog/thunderstorm/freezing-rain detection could supplement indirect inference from Td depression and sky condition. diff --git a/lib/microwaveprop/workers/qso_weather_enqueue_worker.ex b/lib/microwaveprop/workers/qso_weather_enqueue_worker.ex index 40a30b28..2c8846ca 100644 --- a/lib/microwaveprop/workers/qso_weather_enqueue_worker.ex +++ b/lib/microwaveprop/workers/qso_weather_enqueue_worker.ex @@ -12,8 +12,8 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorker do @asos_radius_km 150 @sounding_radius_km 300 - # Oban jobs have ~15 params each; PG limit is 65535 params per query - @insert_batch_size 1000 + # Oban jobs have ~149 params each; PG limit is 65535 params per query + @insert_batch_size 400 @impl Oban.Worker def perform(%Oban.Job{}) do @@ -150,13 +150,17 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorker do {rlat, rlon} = Weather.round_to_hrrr_grid(lat, lon) rounded_time = HrrrClient.nearest_hrrr_hour(qso.qso_timestamp) - [ - HrrrFetchWorker.new(%{ - "lat" => rlat, - "lon" => rlon, - "valid_time" => DateTime.to_iso8601(rounded_time) - }) - ] + if Weather.has_hrrr_profile?(rlat, rlon, rounded_time) do + [] + else + [ + HrrrFetchWorker.new(%{ + "lat" => rlat, + "lon" => rlon, + "valid_time" => DateTime.to_iso8601(rounded_time) + }) + ] + end else [] end @@ -168,6 +172,9 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorker do lat |> Weather.nearby_stations(lon, "asos", @asos_radius_km) + |> Enum.reject(fn station -> + Weather.has_surface_observations?(station.id, start_dt, end_dt) + end) |> Enum.map(fn station -> WeatherFetchWorker.new(%{ "fetch_type" => "asos", @@ -189,13 +196,17 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorker do {rlat, rlon} = Weather.round_to_iemre_grid(lat, lon) date = DateTime.to_date(qso.qso_timestamp) - [ - IemreFetchWorker.new(%{ - "lat" => rlat, - "lon" => rlon, - "date" => Date.to_iso8601(date) - }) - ] + if Weather.has_iemre_observation?(rlat, rlon, date) do + [] + else + [ + IemreFetchWorker.new(%{ + "lat" => rlat, + "lon" => rlon, + "date" => Date.to_iso8601(date) + }) + ] + end else [] end @@ -206,7 +217,9 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorker do stations = Weather.nearby_stations(lat, lon, "sounding", @sounding_radius_km) - for station <- stations, sounding_time <- sounding_times do + for station <- stations, + sounding_time <- sounding_times, + not Weather.has_sounding?(station.id, sounding_time) do WeatherFetchWorker.new(%{ "fetch_type" => "raob", "station_id" => station.id, diff --git a/test/microwaveprop/workers/qso_weather_enqueue_worker_test.exs b/test/microwaveprop/workers/qso_weather_enqueue_worker_test.exs index 53f880db..379fa8fd 100644 --- a/test/microwaveprop/workers/qso_weather_enqueue_worker_test.exs +++ b/test/microwaveprop/workers/qso_weather_enqueue_worker_test.exs @@ -118,6 +118,49 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorkerTest do assert QsoWeatherEnqueueWorker.build_weather_jobs([qso]) == [] end + + test "skips ASOS job when surface observations already exist for that station and time window" do + station = create_asos_station("KDFW", 32.90, -97.04) + qso = create_qso() + + # Insert a surface observation within the time window (qso ± 2 hours) + Weather.upsert_surface_observation(station, %{ + observed_at: ~U[2026-03-28 18:00:00Z], + temp_f: 75.0 + }) + + jobs = QsoWeatherEnqueueWorker.build_weather_jobs([qso]) + + asos_jobs = + Enum.filter(jobs, fn j -> + j.changes.args["fetch_type"] == "asos" + end) + + assert asos_jobs == [] + end + + test "skips RAOB job when sounding already exists for that station and time" do + station = create_sounding_station("FWD", 32.83, -97.30) + qso = create_qso() + + # Insert soundings for both bracketing times (00Z and 12Z on 2026-03-28) + for time <- Weather.sounding_times_around(qso.qso_timestamp) do + Weather.upsert_sounding(station, %{ + observed_at: time, + profile: [%{"pres" => 1013.0, "tmpc" => 25.0}], + level_count: 1 + }) + end + + jobs = QsoWeatherEnqueueWorker.build_weather_jobs([qso]) + + raob_jobs = + Enum.filter(jobs, fn j -> + j.changes.args["fetch_type"] == "raob" + end) + + assert raob_jobs == [] + end end describe "perform/1" do @@ -247,6 +290,26 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorkerTest do assert QsoWeatherEnqueueWorker.build_hrrr_jobs([qso]) == [] end + + test "skips HRRR job when profile already exists for that location and time" do + qso = create_qso(%{pos1: %{"lat" => 32.907, "lon" => -97.038}}) + + # Insert a profile at the rounded grid point and nearest hour + Weather.upsert_hrrr_profile(%{ + valid_time: ~U[2026-03-28 18:00:00Z], + lat: 32.91, + lon: -97.04, + run_time: ~U[2026-03-28 18:00:00Z], + profile: [%{"pres" => 1000.0, "tmpc" => 25.0}], + hpbl_m: 1500.0, + pwat_mm: 25.0, + surface_temp_c: 25.0, + surface_dewpoint_c: 18.0, + surface_pressure_mb: 1013.0 + }) + + assert QsoWeatherEnqueueWorker.build_hrrr_jobs([qso]) == [] + end end describe "build_terrain_jobs/1" do @@ -373,6 +436,20 @@ defmodule Microwaveprop.Workers.QsoWeatherEnqueueWorkerTest do qso = create_qso(%{pos1: nil}) assert QsoWeatherEnqueueWorker.build_iemre_jobs([qso]) == [] end + + test "skips IEMRE job when observation already exists for that location and date" do + qso = create_qso(%{pos1: %{"lat" => 32.907, "lon" => -97.038}}) + + # Insert an IEMRE observation at the rounded grid point and date + Weather.upsert_iemre_observation(%{ + lat: 32.875, + lon: -97.0, + date: ~D[2026-03-28], + hourly: [%{"hour" => 0, "p01m_mm" => 0.0}] + }) + + assert QsoWeatherEnqueueWorker.build_iemre_jobs([qso]) == [] + end end describe "perform/1 iemre enqueue" do