prop/test/microwaveprop/weather
Graham McIntire ed67efb256
Add MRMS rain mosaic, fix beacons crash, fix UTC clock flash
MRMS
----
Layer the NOAA MRMS PrecipRate product onto the score grid so rain fade
updates every 2 minutes instead of every hour alongside HRRR. New modules:

- Microwaveprop.Weather.MrmsClient: fetches the latest .grib2.gz off the
  NCEP mirror (Req auto-decompresses so no gunzip step), writes the raw
  GRIB2 to a temp file, and calls the existing wgrib2 wrapper with the
  0.125 propagation grid spec to get interpolated cells. Returns a
  %{{lat, lon} => mm_per_hour} map with missing-value sentinels dropped.

- Microwaveprop.Weather.MrmsCache: ETS-backed GenServer mirroring
  ScoreCache/GridCache. Caches a single "current" entry keyed by
  valid_time with PubSub broadcast so peer nodes stay in sync and only
  the Oban leader pays the fetch + regrid cost.

- Microwaveprop.Workers.MrmsFetchWorker: cron every 2 minutes, short-
  circuits when the cached valid_time already matches the newest file.

Microwaveprop.Propagation.AsosNudge.compute/4 now takes an optional
rain_grid. When a cell has MRMS rain >= 0.1 mm/hr it gets patched onto
the HRRR profile's `precip_mm` field (the scorer already reads it there)
and the cell is re-scored even with no ASOS station nearby. Cells with
MRMS rain below the threshold aren't touched so dry cells keep their
raw HRRR scores (which have the wind/sky/native-gradient signal that
isn't persisted on HrrrProfile rows and would otherwise be lost).

AsosAdjustmentWorker pulls MrmsCache on every tick and passes the grid
through to AsosNudge.compute/4. Also skips the IemClient error branch
that can never happen and handles the ASOS-empty + MRMS-empty case
explicitly. MrmsCache wired into the supervision tree; MrmsFetchWorker
cron entry added to config.exs and dev.exs.

Four new AsosNudge cases cover MRMS-only re-scoring, threshold gating,
and the wet/dry score delta.

Beacons 500
-----------
Beacon.format_freq/1 and format_mw/1 crashed on whole-number floats
(e.g. 24192.0) because `frac == 0.0` could become false under float
rounding while `trim_trailing_zeros/1` stripped the decimal point,
leaving a 1-element list that couldn't be destructured as [_, frac].
Shared format_number/1 helper handles integer input directly and
pattern-matches both the "int-only" and "int + frac" shapes.

Added stream_data property tests covering the whole microwave range for
both integers and floats to catch this class of bug before prod.

UTC clock flash
---------------
The /weather and /map UTC clocks were empty until the JS hook mounted
post-WebSocket, producing a several-second blank spot on initial load
and a clobber risk on sidebar re-renders. Mount now computes a
server-rendered `initial_utc_clock` string and the template seeds the
element with that plus `phx-update="ignore"` so LiveView morphdom won't
overwrite what the hook writes.
2026-04-12 14:49:20 -05:00
..
grib2 Fix all remaining credo --strict issues (0 issues) 2026-04-12 10:26:53 -05:00
era5_batch_client_test.exs Batch ERA5 fetches by month and 2° tile 2026-04-09 13:01:49 -05:00
frontal_analysis_test.exs Fix credo warnings: struct specs, length/1, and test patterns 2026-04-12 10:26:53 -05:00
grid_cache_test.exs Cache /weather grid, defer contact show mount, cache stats 2026-04-12 12:55:50 -05:00
hrrr_client_test.exs Add HRRR batch fetch client with multi-point grid extraction 2026-03-30 17:08:21 -05:00
hrrr_native_client_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
hrrr_native_profile_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
hrrr_profile_test.exs Partition hrrr_profiles by valid_time for query performance 2026-04-01 11:03:33 -05:00
iem_client_test.exs Add Tier 2 test coverage: SolarIndexWorker, HrrrFetchWorker, IemClient 2026-04-06 10:15:38 -05:00
iemre_observation_test.exs Add IEM precipitation data to QSO weather pipeline 2026-03-30 13:18:11 -05:00
mrms_client_test.exs Add MRMS rain mosaic, fix beacons crash, fix UTC clock flash 2026-04-12 14:49:20 -05:00
ncei_metar_client_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
nexrad_cache_test.exs Add more caching to make the map feel instant 2026-04-12 12:26:25 -05:00
nexrad_client_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
nexrad_observation_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
solar_client_test.exs Add QSO import, solar indices, Oban workers, LiveView UI, and parallel weather import 2026-03-29 13:04:55 -05:00
sounding_params_test.exs Fix credo warnings: struct specs, length/1, and test patterns 2026-04-12 10:26:53 -05:00
sounding_test.exs Add weather data schema, context, sounding params, and IEM ingestion 2026-03-28 15:57:19 -05:00
station_test.exs Add weather data schema, context, sounding params, and IEM ingestion 2026-03-28 15:57:19 -05:00
surface_observation_test.exs Add IEM precipitation data to QSO weather pipeline 2026-03-30 13:18:11 -05:00
theta_e_test.exs Phase 2 tasks 2.1-2.4: BL turbulence feature computations 2026-04-10 08:21:23 -05:00
weather_layers_test.exs Add WeatherLayers module for deriving upper-air map fields from HRRR profiles 2026-04-03 16:49:17 -05:00