diff --git a/src/plots/forecast_horizon.py b/src/plots/forecast_horizon.py index fcee7b30..ed769d2a 100644 --- a/src/plots/forecast_horizon.py +++ b/src/plots/forecast_horizon.py @@ -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)]), ) @@ -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): @@ -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, } ) @@ -85,7 +85,7 @@ 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)]), ), @@ -93,7 +93,7 @@ def make_mae_forecast_horizon_group_by_forecast_horizon( ) 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 @@ -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")), ) @@ -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( @@ -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]) diff --git a/src/tables/summary.py b/src/tables/summary.py index 71e42d54..9b8af3f5 100644 --- a/src/tables/summary.py +++ b/src/tables/summary.py @@ -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)