From 52d7a8e93e00ee4ae27b92425e25bd123b2bb0c9 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 23 Oct 2024 16:34:12 +0100 Subject: [PATCH] change to power_kw --- india_forecast_app/app.py | 4 ++-- india_forecast_app/models/pvnet/model.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/india_forecast_app/app.py b/india_forecast_app/app.py index 5e5b7e0..9aee277 100644 --- a/india_forecast_app/app.py +++ b/india_forecast_app/app.py @@ -89,7 +89,7 @@ def get_generation_data( if len(generation_data) == 0: log.warning("No generation found for the specified sites/period") - generation_df = pd.DataFrame() + generation_df = pd.DataFrame(columns=[system_id]) else: # Convert to dataframe @@ -130,7 +130,7 @@ def get_generation_data( generation_df[col] = generation_df[col].astype(float) * 1e3\ # rename columns 0 to power_kw - generation_df.rename({col:"power_kw"}, inplace=True) + generation_df.rename({col:"power_kw"}, axis=1, inplace=True) # Site metadata dataframe sites_df = pd.DataFrame( diff --git a/india_forecast_app/models/pvnet/model.py b/india_forecast_app/models/pvnet/model.py index 86dce40..12dd1ef 100644 --- a/india_forecast_app/models/pvnet/model.py +++ b/india_forecast_app/models/pvnet/model.py @@ -241,7 +241,7 @@ def _prepare_data_sources(self): # if generation_da is still empty make nans if len(generation_da) == 0: - generation_df = pd.DataFrame(index=forecast_timesteps, columns=["0"], data=0.0001) + generation_df = pd.DataFrame(index=forecast_timesteps, columns=generation_da.columns, data=0.0001) generation_da = generation_df.to_xarray() generation_da.to_netcdf(wind_netcdf_path, engine="h5netcdf")