Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/plots/forecast_horizon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def make_mae_by_forecast_horizon(
go.Scatter(
x=df["datetime_utc"],
y=df["MAE"],
name=f"{forecast_horizon}-minute horizon",
name=f"{forecast_horizon / 60:.1f}-hour horizon",
mode="lines",
line=dict(color=line_color[i%len(line_color)]),
)
Expand All @@ -64,7 +64,7 @@ def make_mae_forecast_horizon_group_by_forecast_horizon(
text="Quartz Solar MAE by Forecast Horizon for Date Range(selected in sidebar)"
),
xaxis=go.layout.XAxis(title=go.layout.xaxis.Title(text="MAE (MW)")),
yaxis=go.layout.YAxis(title=go.layout.yaxis.Title(text="Forecast Horizon (minutes)")),
yaxis=go.layout.YAxis(title=go.layout.yaxis.Title(text="Forecast Horizon (hours)")),
)
)
for i, forecast_horizon in enumerate(forecast_horizon_selection):
Expand All @@ -76,7 +76,7 @@ def make_mae_forecast_horizon_group_by_forecast_horizon(
{
"MAE": y_mae_horizon,
"datetime_utc": x_mae_horizon,
"forecast_horizon": forecast_horizon,
"forecast_horizon": forecast_horizon / 60,
}
)

Expand All @@ -85,15 +85,15 @@ def make_mae_forecast_horizon_group_by_forecast_horizon(
go.Scatter(
x=df_mae_horizon["MAE"],
y=df_mae_horizon["forecast_horizon"],
name=f"{forecast_horizon}-minute horizon",
name=f"{forecast_horizon / 60:.1f}-hour horizon",
mode="markers",
line=dict(color=line_color[i%len(line_color)]),
),
]
)
fig.update_layout(
xaxis=dict(tickmode="linear", tick0=0, dtick=50),
yaxis=dict(tickmode="linear", tick0=0, dtick=60),
yaxis=dict(tickmode="linear", tick0=0, dtick=1),
)
fig.update_layout(xaxis_range=[0, MAE_LIMIT_DEFAULT])
return fig
Expand All @@ -109,7 +109,7 @@ def make_mae_vs_forecast_horizon_group_by_date(
fig = go.Figure(
layout=go.Layout(
title=go.layout.Title(text="Quartz Solar MAE Forecast Horizon Values by Date"),
xaxis=go.layout.XAxis(title=go.layout.xaxis.Title(text="Forecast Horizon (minutes)")),
xaxis=go.layout.XAxis(title=go.layout.xaxis.Title(text="Forecast Horizon (hours)")),
yaxis=go.layout.YAxis(title=go.layout.yaxis.Title(text="MAE (MW)")),
legend=go.layout.Legend(title=go.layout.legend.Title(text="Date")),
)
Expand All @@ -124,7 +124,7 @@ def make_mae_vs_forecast_horizon_group_by_date(
metric_values = metric_values_by_forecast_horizon[forecast_horizon]
dates = [value.datetime_interval.start_datetime_utc for value in metric_values]
mae_value = [round(float(value.value), 2) for value in metric_values]
forecast_horizons = [value.forecast_horizon_minutes for value in metric_values]
forecast_horizons = [value.forecast_horizon_minutes / 60 for value in metric_values]

# create dataframe for each date with a value for each forecast horizon
data = pd.DataFrame(
Expand Down Expand Up @@ -160,7 +160,7 @@ def make_mae_vs_forecast_horizon_group_by_date(
)
fig.add_traces(traces)
fig.update_layout(
xaxis=dict(tickmode="linear", tick0=0, dtick=60),
xaxis=dict(tickmode="linear", tick0=0, dtick=1),
yaxis=dict(tickmode="linear", tick0=0, dtick=50),
)
fig.update_layout(yaxis_range=[0, MAE_LIMIT_DEFAULT])
Expand Down
1 change: 1 addition & 0 deletions src/tables/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def make_forecast_horizon_table(all_forecast_horizons_df, y_plive_mae):
df_mae_horizon_mean.rename(columns={"MAE": "mean"}, inplace=True)
df_mae_horizon_std = all_forecast_horizons_df.groupby(["forecast_horizon"]).std().reset_index()
df_mae_horizon_mean["std"] = df_mae_horizon_std["MAE"]
df_mae_horizon_mean["forecast_horizon"] = df_mae_horizon_mean["forecast_horizon"].apply(lambda x: round(x / 60, 1))
pv_live_mae = np.round(np.mean(y_plive_mae), 2)
st.write(f"PV LIVE Mae {pv_live_mae} MW (intraday - day after)")
st.write(df_mae_horizon_mean)