From cbb4120fcae157f126cec8897b0013c0f37e6510 Mon Sep 17 00:00:00 2001 From: Jyotirmoy Chakraborty <191668179+Joy-chakraborty-23@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:08:49 +0530 Subject: [PATCH 1/2] 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 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/pvsite_forecast.py b/src/pvsite_forecast.py index d4d6ad6..e1b912b 100644 --- a/src/pvsite_forecast.py +++ b/src/pvsite_forecast.py @@ -116,9 +116,9 @@ 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]), + +resample = st.sidebar.selectbox("Resample data", [None, "15min", "30min"], None) +, ) site_selection_uuid = [ sites.location_uuid @@ -331,7 +331,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 +346,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 +701,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.") From a80b6af08c2a692958554b39cce7465812ab138f Mon Sep 17 00:00:00 2001 From: Jyotirmoy Chakraborty <191668179+Joy-chakraborty-23@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:28:45 +0530 Subject: [PATCH 2/2] 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pvsite_forecast.py b/src/pvsite_forecast.py index e1b912b..7f8edbd 100644 --- a/src/pvsite_forecast.py +++ b/src/pvsite_forecast.py @@ -109,11 +109,11 @@ def pvsite_forecast_page(): "Select site by", ("site_uuid", "client_site_name") ) - if query_method == "site_uuid": - site_selection_uuid = st.sidebar.selectbox( - "Select sites by site_uuid", - site_uuids, - ) + if query_method == "site_uuid": + site_selection_uuid = st.sidebar.selectbox( + "Select sites by site_uuid", + site_uuids, + ) else: