Phase 3 NEXRAD spike: IEM n0q composite available at 5-min cadence back to 2022+. Compression-ratio proxy shows afternoon images have 13-81% more texture than dawn (directionally correct), but the n0q product thresholds out the faint clear-air returns needed for BL stability detection. Parked until MRMS or Level III products can be investigated. See docs/research/nexrad_spike.md. Phase 6: hrrr_climatology table aggregating surface_temp_c by (lat, lon, month, hour) from the 42M+ hrrr_profiles grid-point rows. mix hrrr_climatology builds it via a single SQL GROUP BY + upsert. Backtest.Features.temperature_anomaly computes current_temp minus climatological mean — the meteorologist's "temperature deviation above normal" predictor for summer afternoon enhancement.
36 lines
1.2 KiB
Elixir
36 lines
1.2 KiB
Elixir
defmodule Microwaveprop.Weather.HrrrClimatology do
|
|
@moduledoc """
|
|
Pre-computed mean and stddev of surface temperature from
|
|
`hrrr_profiles`, keyed on `(lat, lon, month, hour)`.
|
|
|
|
Used by Phase 6 to compute temperature anomaly: how much hotter
|
|
(or cooler) a given hour is compared to the same grid cell's
|
|
typical value for that month and time of day. The meteorologist
|
|
noted that extremely hot days (~10°F above normal in summer)
|
|
produce enhanced ducting even in the afternoon when the
|
|
time-of-day factor normally suppresses the score.
|
|
"""
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:id, :binary_id, autogenerate: true}
|
|
@foreign_key_type :binary_id
|
|
|
|
schema "hrrr_climatology" do
|
|
field :lat, :float
|
|
field :lon, :float
|
|
field :month, :integer
|
|
field :hour, :integer
|
|
field :mean_surface_temp_c, :float
|
|
field :stddev_surface_temp_c, :float
|
|
field :sample_count, :integer
|
|
end
|
|
|
|
def changeset(record, attrs) do
|
|
record
|
|
|> cast(attrs, [:lat, :lon, :month, :hour, :mean_surface_temp_c, :stddev_surface_temp_c, :sample_count])
|
|
|> validate_required([:lat, :lon, :month, :hour])
|
|
|> unique_constraint([:lat, :lon, :month, :hour])
|
|
end
|
|
end
|