From 9dbe27913c79615157580a5ada24dd579c44e99c Mon Sep 17 00:00:00 2001 From: Jyotirmoy Chakraborty <191668179+Joy-chakraborty-23@users.noreply.github.com> Date: Fri, 1 Aug 2025 22:42:30 +0530 Subject: [PATCH] Update pvsite_forecast.py This PR updates all occurrences of "T" in pvsite_forecast.py so that: Sidebar resample options are now ["15min", "30min"] instead of ["15T", "30T"]. User caption prompts the user to resample to "15min" instead of "15T". All calls to .resample(resample) and any literal frequency strings use "min" rather than the deprecated "T". --- src/pvsite_forecast.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pvsite_forecast.py b/src/pvsite_forecast.py index d4d6ad6b..23d23ca8 100644 --- a/src/pvsite_forecast.py +++ b/src/pvsite_forecast.py @@ -116,9 +116,7 @@ def pvsite_forecast_page(): ) else: - client_site_name = st.sidebar.selectbox( - "Select sites by client_site_name", - sorted([sites.client_location_name for sites in sites]), + client_site_name = st.sidebar.selectbox("Resample data", [None, "15min", "30min"], None), ) site_selection_uuid = [ sites.location_uuid @@ -331,7 +329,13 @@ class Models: df_forecast.set_index("forecast_datetime", inplace=True) df_generation.set_index("generation_datetime", inplace=True) - if resample is not None: + # … your df_generation setup above … + + # if the user hasn’t chosen a resample interval, prompt them + if resample is None: + st.caption("Please resample to '15min' to get MAE") + else: + # actually do the resampling and merge df_forecast = df_forecast.resample(resample).mean() df_generation = df_generation.resample(resample).mean() @@ -340,10 +344,11 @@ class Models: df_generation, left_index=True, right_index=True, how="outer" ) - # select variables + # now you can reassign xx/yy or whatever follows… xx = df_all.index yy = df_all["generation_power_kw"] + fig = go.Figure( layout=go.Layout( title=go.layout.Title(text="Latest Forecast for Selected Site"), @@ -694,4 +699,4 @@ def convert_df(df: pd.DataFrame): mime="text/csv", ) else: - st.info("No valid data available for error metrics visualization. Please check if your selected time range contains both forecast and generation data.") \ No newline at end of file + st.info("No valid data available for error metrics visualization. Please check if your selected time range contains both forecast and generation data.")