HRRR provides hourly 3km-resolution atmospheric profiles, filling the temporal gaps (12-hourly soundings) and spatial gaps (only 9 sounding stations) in our current weather data. - Add hrrr_profiles table and hrrr_queued flag on QSOs - HrrrClient fetches GRIB2 data via HTTP Range requests + wgrib2 - HrrrFetchWorker derives refractivity/ducting params via SoundingParams - QsoWeatherEnqueueWorker now also enqueues HRRR jobs - QSO show page displays HRRR section with collapsible profile - Dockerfile builds wgrib2 from source for production
38 lines
1.2 KiB
Elixir
38 lines
1.2 KiB
Elixir
defmodule Microwaveprop.Weather.HrrrProfile do
|
|
@moduledoc false
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:id, :binary_id, autogenerate: true}
|
|
@foreign_key_type :binary_id
|
|
|
|
schema "hrrr_profiles" do
|
|
field :valid_time, :utc_datetime
|
|
field :lat, :float
|
|
field :lon, :float
|
|
field :run_time, :utc_datetime
|
|
field :profile, {:array, :map}
|
|
field :hpbl_m, :float
|
|
field :pwat_mm, :float
|
|
field :surface_temp_c, :float
|
|
field :surface_dewpoint_c, :float
|
|
field :surface_pressure_mb, :float
|
|
field :surface_refractivity, :float
|
|
field :min_refractivity_gradient, :float
|
|
field :ducting_detected, :boolean, default: false
|
|
field :duct_characteristics, {:array, :map}
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
@required_fields ~w(valid_time lat lon)a
|
|
@optional_fields ~w(run_time profile hpbl_m pwat_mm surface_temp_c surface_dewpoint_c surface_pressure_mb surface_refractivity min_refractivity_gradient ducting_detected duct_characteristics)a
|
|
|
|
def changeset(hrrr_profile, attrs) do
|
|
hrrr_profile
|
|
|> cast(attrs, @required_fields ++ @optional_fields)
|
|
|> validate_required(@required_fields)
|
|
|> unique_constraint([:lat, :lon, :valid_time])
|
|
end
|
|
end
|