prop/lib/microwaveprop_web
Graham McIntire a4cd7632eb
feat(skewt): hover crosshair + DB fallback for missing on-disk profiles
Two follow-ups to the earlier /skewt work:

1. Interactive crosshair (matches the SPC-viewer feel from the
   reference screenshot). Mousing over the diagram now drops a
   horizontal pressure cursor with a top-left readout box showing the
   pressure at the cursor's altitude (mb), the height in m and ft,
   and the linearly interpolated temperature and dewpoint at that
   level. Two coloured dots track the T and Td traces along the
   cursor so the user can read the spread visually.

   Mechanics: SkewtSvg.geometry/0 exposes the plot geometry (left,
   right, top, bottom, p_bottom, p_top, t_min, t_max, skew) as JSON;
   SkewtSvg emits an initially-hidden <g class="skewt-cursor"> layer.
   A new Skewt hook in assets/js/app.ts inverts pressure_y to recover
   pressure from the cursor's viewBox-Y, walks the (descending-pres-
   sorted) profile to interp T/Td/height, and updates the elements.
   The hook also handles mouseleave to hide the cursor and uses the
   SVG's screen-CTM so the math stays correct under any container
   aspect-ratio resize.

2. DB fallback for `available_valid_times`/`load_profile`. When the
   on-disk `ProfilesFile` has nothing for the location-and-window
   (true on dev, transient on prod between chain runs), SkewtLive
   now falls back to `HrrrProfileLookup.{list_valid_times_near,
   read_point_near}/3` against the `hrrr_profiles` Postgres table.
   The lookup uses the same ±0.07° spatial tolerance and the
   `(lat, lon, valid_time)` unique index that `Weather.find_nearest_
   hrrr/3` already relies on, so the queries are index-only.

   Returned shape matches `ProfilesFile.read_point/3` so SkewtLive
   reads from either source transparently. NaiveDateTime → UTC
   normalisation is centralised in `ensure_utc/1` so the LiveView
   sees `%DateTime{time_zone: "Etc/UTC"}` regardless of which side
   produced the value.

Tests: 6/6 new HrrrProfileLookupTest cases (list/limit/tolerance,
read nearest cell, nil for far cells, picks closest among matches),
3/3 SkewtLiveTest still green, 2,894 total Elixir tests + 221
properties green via mix test (one pre-existing flaky test in
admin/contact_edit_live re-runs clean). mix credo --strict clean.
mix assets.build clean.
2026-04-25 13:17:58 -05:00
..
components chore(deps): drop gettext 2026-04-24 12:31:21 -05:00
controllers fix(probes): stop DB saturation from SIGKILLing every pod 2026-04-21 16:00:04 -05:00
live feat(skewt): hover crosshair + DB fallback for missing on-disk profiles 2026-04-25 13:17:58 -05:00
plugs fix(plugs): normalize IPv4-mapped IPv6 peers so cf-connecting-ip wins 2026-04-25 09:54:20 -05:00
endpoint.ex fix(web): suppress HEAD request logs 2026-04-22 16:50:58 -05:00
live_table_footer.ex Show windowed page list in live_table footer 2026-04-13 10:02:19 -05:00
live_table_resource.ex fix(dialyzer): actually fix LiveTable warnings instead of hiding them 2026-04-21 12:58:10 -05:00
metrics_plug.ex fix(metrics): serve scrape body via PromEx.get_metrics 2026-04-18 16:50:37 -05:00
router.ex feat(skewt): add /skewt LiveView with HRRR-backed Skew-T-Log-P plot 2026-04-25 12:13:46 -05:00
skew_t.ex Rename ERA5 → NARR across the codebase 2026-04-16 09:22:23 -05:00
telemetry.ex perf(telemetry): cut hot-path overhead on scores_at cache hits 2026-04-20 16:12:01 -05:00
user_auth.ex fix(dialyzer): clear 125+ warnings under strict flags 2026-04-21 10:30:06 -05:00