Files
ems/db/migration/V076__pv_forecast_reference_day.sql
Dusan Vojacek 5ca5eab1d8
Some checks failed
CI and deploy / migration-check (push) Failing after 14s
CI and deploy / deploy (push) Has been skipped
sync reference days
2026-05-02 14:05:09 +02:00

22 lines
1.2 KiB
SQL

-- Kalendářní dny lokality označené jako referenční pro učení delty PV forecastu (dobrá obloha).
create table ems.site_pv_forecast_reference_day (
site_id int not null references ems.site (id) on delete cascade,
day_local date not null,
notes text null,
created_at timestamptz not null default now(),
primary key (site_id, day_local)
);
comment on table ems.site_pv_forecast_reference_day is
'Dny v kalendáři lokality podle jejího site.timezone (typicky datum ve zdi Europe/Prague), kterým se v ems.fn_pv_forecast_delta_profile zvýší váha řádků forecast_accuracy při počítání delta profilu.';
comment on column ems.site_pv_forecast_reference_day.day_local is
'Kalendářní datum v časové zóně lokality; porovnává se na (interval_start AT TIME ZONE site.timezone)::date ze slotů.';
alter table ems.site_pv_forecast_calibration
add column if not exists reference_day_weight_mult numeric null;
comment on column ems.site_pv_forecast_calibration.reference_day_weight_mult is
'Násobitel váhy učícího vzorku pro všechny sloty jejichž den spadá do site_pv_forecast_reference_day; NULL použije default v fn_pv_forecast_delta_profile (aktuálně 3).';