Closed peterdudfield closed 2 years ago
SQL to get PV MAE
select AVG(ABS(solar_generation_kw_in_day - solar_generation_kw_day_after))
from (
select datetime_utc, solar_generation_kw as solar_generation_kw_day_after from gsp_yield
join location on gsp_yield.location_id = location.id
where gsp_id=0
and solar_generation_kw + 1 > solar_generation_kw
and datetime_utc > '2022-09-01'
and regime='day-after'
) a join (
select datetime_utc, solar_generation_kw as solar_generation_kw_in_day from gsp_yield
join location on gsp_yield.location_id = location.id
where gsp_id=0
and solar_generation_kw + 1 > solar_generation_kw
and datetime_utc > '2022-09-01'
and regime='in-day') b on a.datetime_utc = b.datetime_utc
-- order by a.datetime_utc
select distinct on (start_datetime_utc) start_datetime_utc, value from metric_value
join metric on metric_value.metric_id = metric.id
join location on metric_value.location_id = location.id
join datetime_interval on metric_value.datetime_interval_id = datetime_interval.id
where metric.id = 1
and gsp_id =0
and start_datetime_utc > '2022-09-01'
and forecast_horizon_minutes is Null
order by start_datetime_utc, created_utc
Gets the daily MAE for national
also useful
select
target_time::TIMESTAMP::DATE as date,
avg(abs(forecast_value_latest.expected_power_generation_megawatts - gsp_yield.solar_generation_kw / 1000)) as err
from forecast_value_latest
join location on location.gsp_id = forecast_value_latest.gsp_id
join gsp_yield on gsp_yield.location_id = location.id
where target_time < '2022-09-15'
and target_time >= '2022-08-01'
and gsp_yield.solar_generation_kw +1 > gsp_yield.solar_generation_kw
and gsp_yield.datetime_utc = forecast_value_latest.target_time
and forecast_value_latest.gsp_id = 152
and regime = 'day-after'
group by date
-- order by target_time
Detailed Description
Compare OCF Forecast with PV live updated Compare PV live initial with PV live updated
Datetimes Try to do July until now
Context
We think OCF Forecast is better than PV live initial, but good to get some numbers on it
Possible Implementation
SQL code. Later tasks is to add a metric for comparing PV lives values every day