From 634c4906841e27ef252cce4e631bb61d5fb6833c Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 23 Oct 2024 16:41:00 +0100 Subject: [PATCH] change column back to system id --- india_forecast_app/app.py | 5 +---- tests/test_app.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/india_forecast_app/app.py b/india_forecast_app/app.py index 9aee277..e17439c 100644 --- a/india_forecast_app/app.py +++ b/india_forecast_app/app.py @@ -85,7 +85,7 @@ def get_generation_data( session=db_session, site_uuids=site_uuids, start_utc=start, end_utc=end ) # hard code as for the moment - system_id = 1 + system_id = sites[0].ml_id if len(generation_data) == 0: log.warning("No generation found for the specified sites/period") @@ -129,9 +129,6 @@ def get_generation_data( col = generation_df.columns[0] generation_df[col] = generation_df[col].astype(float) * 1e3\ - # rename columns 0 to power_kw - generation_df.rename({col:"power_kw"}, axis=1, inplace=True) - # Site metadata dataframe sites_df = pd.DataFrame( [ diff --git a/tests/test_app.py b/tests/test_app.py index 1ecda49..d3faf17 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -51,7 +51,7 @@ def test_get_generation_data(db_session, sites, generation_db_values, init_times # Check for 5 (non-null) generation values assert len(gen_df) == 5 - assert not gen_df["power_kw"].isnull().any() # 0 is the ml_id/system_id of the wind site + assert not gen_df["0"].isnull().any() # 0 is the ml_id/system_id of the wind site # Check first and last timestamps are correct assert gen_df.index[0] == init_timestamp - dt.timedelta(hours=1)