277 @spec/@type annotations added to 58 files covering all public APIs: contexts (propagation, radio, weather, terrain, beacons, commercial), GRIB2 decoders, terrain analysis, duct detection, rain scatter, CSV/ADIF import, weather clients, and all Ecto schemas. Dialyzer passes with 0 errors.
37 lines
1.2 KiB
Elixir
37 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
|
|
|
|
@spec changeset(%__MODULE__{}, map()) :: Ecto.Changeset.t()
|
|
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
|