Skip to content

Commit

Permalink
Fix - Fixed wrong path for csv files when using load cost and prod pr…
Browse files Browse the repository at this point in the history
…ice forecasts
  • Loading branch information
davidusb-geek committed May 27, 2023
1 parent 31e23a3 commit 0de77aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/emhass/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def get_load_forecast(self, days_min_load_forecast: Optional[int] = 3, method: O
return P_Load_forecast

def get_load_cost_forecast(self, df_final: pd.DataFrame, method: Optional[str] = 'hp_hc_periods',
csv_path: Optional[str] = "/data/data_load_cost_forecast.csv") -> pd.DataFrame:
csv_path: Optional[str] = "data_load_cost_forecast.csv") -> pd.DataFrame:
r"""
Get the unit cost for the load consumption based on multiple tariff \
periods. This is the cost of the energy from the utility in a vector \
Expand All @@ -671,7 +671,7 @@ def get_load_cost_forecast(self, df_final: pd.DataFrame, method: Optional[str] =
and 'csv' to load a CSV file, defaults to 'hp_hc_periods'
:type method: str, optional
:param csv_path: The path to the CSV file used when method = 'csv', \
defaults to "/data/data_load_cost_forecast.csv"
defaults to "data_load_cost_forecast.csv"
:type csv_path: str, optional
:return: The input DataFrame with one additionnal column appended containing
the load cost for each time observation.
Expand Down
6 changes: 4 additions & 2 deletions tests/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,15 +413,17 @@ def test_get_load_cost_forecast(self):
df_input_data = self.fcst.get_load_cost_forecast(self.df_input_data)
self.assertTrue(self.fcst.var_load_cost in df_input_data.columns)
self.assertTrue(df_input_data.isnull().sum().sum()==0)
df_input_data = self.fcst.get_load_cost_forecast(self.df_input_data, method='csv')
df_input_data = self.fcst.get_load_cost_forecast(self.df_input_data, method='csv',
csv_path='/data/data_load_cost_forecast.csv')
self.assertTrue(self.fcst.var_load_cost in df_input_data.columns)
self.assertTrue(df_input_data.isnull().sum().sum()==0)

def test_get_prod_price_forecast(self):
df_input_data = self.fcst.get_prod_price_forecast(self.df_input_data)
self.assertTrue(self.fcst.var_prod_price in df_input_data.columns)
self.assertTrue(df_input_data.isnull().sum().sum()==0)
df_input_data = self.fcst.get_prod_price_forecast(self.df_input_data, method='csv')
df_input_data = self.fcst.get_prod_price_forecast(self.df_input_data, method='csv',
csv_path='/data/data_load_cost_forecast.csv')
self.assertTrue(self.fcst.var_prod_price in df_input_data.columns)
self.assertTrue(df_input_data.isnull().sum().sum()==0)

Expand Down

0 comments on commit 0de77aa

Please sign in to comment.