Skip to content

Commit

Permalink
Feat - Added warning messages if passed list values contains non nume…
Browse files Browse the repository at this point in the history
…ric items
  • Loading branch information
davidusb-geek committed Oct 2, 2022
1 parent 1026d92 commit 61def2d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased
### Improvement
- Added more detailed examples to the forecast module documentation.
- Improved handling of datatime indexes in DataFrames on forecast module.
- Added warning messages if passed list values contains non numeric items.

## [0.3.19] - 2022-09-14
### Fix
- Updated default values for a working LP solver.
Expand Down
8 changes: 8 additions & 0 deletions src/emhass/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,35 @@ def treat_runtimeparams(runtimeparams: str, params:str, retrieve_hass_conf: dict
else:
logger.error("ERROR: The passed data is either not a list or the length is not correct, length should be "+str(len(forecast_dates)))
logger.error("Passed type is "+str(type(runtimeparams['pv_power_forecast']))+" and length is "+str(len(forecast_dates)))
if len([x for x in runtimeparams['pv_power_forecast'] if not str(x).isdigit()]) > 0:
logger.warning("There are non numeric values on the passed data, check for missing values (nans, null, etc)")
if 'load_power_forecast' in runtimeparams.keys():
if type(runtimeparams['load_power_forecast']) == list and len(runtimeparams['load_power_forecast']) >= len(forecast_dates):
params['passed_data']['load_power_forecast'] = runtimeparams['load_power_forecast']
optim_conf['load_forecast_method'] = 'list'
else:
logger.error("ERROR: The passed data is either not a list or the length is not correct, length should be "+str(len(forecast_dates)))
logger.error("Passed type is "+str(type(runtimeparams['load_power_forecast']))+" and length is "+str(len(forecast_dates)))
if len([x for x in runtimeparams['load_power_forecast'] if not str(x).isdigit()]) > 0:
logger.warning("There are non numeric values on the passed data, check for missing values (nans, null, etc)")
if 'load_cost_forecast' in runtimeparams.keys():
if type(runtimeparams['load_cost_forecast']) == list and len(runtimeparams['load_cost_forecast']) >= len(forecast_dates):
params['passed_data']['load_cost_forecast'] = runtimeparams['load_cost_forecast']
optim_conf['load_cost_forecast_method'] = 'list'
else:
logger.error("ERROR: The passed data is either not a list or the length is not correct, length should be "+str(len(forecast_dates)))
logger.error("Passed type is "+str(type(runtimeparams['load_cost_forecast']))+" and length is "+str(len(forecast_dates)))
if len([x for x in runtimeparams['load_cost_forecast'] if not str(x).isdigit()]) > 0:
logger.warning("There are non numeric values on the passed data, check for missing values (nans, null, etc)")
if 'prod_price_forecast' in runtimeparams.keys():
if type(runtimeparams['prod_price_forecast']) == list and len(runtimeparams['prod_price_forecast']) >= len(forecast_dates):
params['passed_data']['prod_price_forecast'] = runtimeparams['prod_price_forecast']
optim_conf['prod_price_forecast_method'] = 'list'
else:
logger.error("ERROR: The passed data is either not a list or the length is not correct, length should be "+str(len(forecast_dates)))
logger.error("Passed type is "+str(type(runtimeparams['prod_price_forecast']))+" and length is "+str(len(forecast_dates)))
if len([x for x in runtimeparams['prod_price_forecast'] if not str(x).isdigit()]) > 0:
logger.warning("There are non numeric values on the passed data, check for missing values (nans, null, etc)")
# Treat optimization configuration parameters passed at runtime
if 'num_def_loads' in runtimeparams.keys():
optim_conf['num_def_loads'] = runtimeparams['num_def_loads']
Expand Down

0 comments on commit 61def2d

Please sign in to comment.