NCEI ASOS 5-minute data client (Weather.NceiMetarClient): - fetch/3 pulls per-station monthly .dat files from NCEI C00418 - parse/1 decodes the fixed-width METAR format including precise T-group temperatures (T02110094 → 21.1/9.4°C) - metar_5min_observations table: schema-identical to surface_observations, separate table to avoid mixing cadences Weather.recent_surface_obs/3 prefers 5-min data when available, falls back to the hourly surface_observations table. Data URL: https://www.ncei.noaa.gov/data/automated-surface-observing-system-five-minute/access/YYYY/MM/asos-5min-KXXX-YYYYMM.dat Available back to 1996.
26 lines
915 B
Elixir
26 lines
915 B
Elixir
defmodule Microwaveprop.Repo.Migrations.CreateMetar5minObservations do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:metar_5min_observations, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true, null: false
|
|
add :station_id, references(:weather_stations, type: :binary_id, on_delete: :delete_all)
|
|
add :observed_at, :utc_datetime, null: false
|
|
add :temp_f, :float
|
|
add :dewpoint_f, :float
|
|
add :relative_humidity, :float
|
|
add :wind_speed_kts, :float
|
|
add :wind_direction_deg, :integer
|
|
add :sea_level_pressure_mb, :float
|
|
add :altimeter_setting, :float
|
|
add :sky_condition, :string
|
|
add :precip_1h_in, :float
|
|
add :wx_codes, :string
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create unique_index(:metar_5min_observations, [:station_id, :observed_at])
|
|
create index(:metar_5min_observations, [:observed_at])
|
|
end
|
|
end
|