backbonetools.io.inputs#
Functions for processing backbone input data
Classes
|
A class to convert an input file to pandas dataframes and work with it (e.g. |
- class backbonetools.io.inputs.BackboneInput(path)#
Bases:
objectA class to convert an input file to pandas dataframes and work with it (e.g. time series aggregation via tsam)
- __init__(path)#
initializes class by converting gdx file to dictionary of pandas dataframes
- Parameters:
path (str) – path to input file
- Raises:
FileNotFoundError – If path to input file was not found
- aggregate_timeseries(export_path, hours_per_period=168, n_periods=3, err_indicators=None)#
use tsam to aggregate time series
- Parameters:
export_path (str) – path where file with aggregated time series shall be saved
hours_per_period (int, optional) – numbers of hours per period (tsam parameter). Defaults to 24*7.
n_periods (int, optional) – number of representative periods (tsam paramter). Defaults to 3.
err_indicators (str, optional) – only “print” or None possible, for debugging. Defaults to None.
- Raises:
NotImplementedError – if err_indicators is something else but “print” or None
- property input_symbols#
gets all symbols from the input file
- Raises:
ge – if something is wrong with the length of the file
- Returns:
list of all symbols in input file
- Return type:
- param_as_df_gdxdump(symbol, encoding='1252', convert_time=True) DataFrame#
Use the ‘gdxdump’ GAMS utility via subprocess to convert a parameter into a pd.DataFrame. This is sometimes beneficial, to circumvent decoding errors
- Returns:
parameter converted to a pandas dataframe
- Return type:
pandas.dataframe
- set_symbols_as_attribs()#
Sets all input symbols as methods. Allows for easy access like bb_input.p_gnu_io() or bb_input.ts_influx()
- update_gams_parameter_in_db(param_name: str, indices: list, value: float | None = None, apply_percentage: float | None = None) GamsDatabase#
change gams parameter in a database
- Parameters:
- Raises:
ge – if record cannot be found
ValueError – if neither value nor percentage are passed
- Returns:
gams databased with changed value
- Return type:
GamsDatabase