backbonetools.io.outputs#
Classes
|
A class to convert a backbone output file to pandas dataframes and work with it (e.g. |
|
Class to analysis multiple backbone results together |
- class backbonetools.io.outputs.BackboneResult(path)#
Bases:
objectA class to convert a backbone output file to pandas dataframes and work with it (e.g. plot results or convert an invest result to a schedule input)
- __init__(path)#
initializes class by converting gdx file to dictionary of pandas dataframes
- eqn_as_df(eqn_name)#
converts a gams equation to a dataframe (e.g. for debugs)
- Parameters:
eqn_name (str) – name of equation
- Returns:
equation as dataframe
- Return type:
pandas.dataframe
- param_as_df(param_name, convert_time=True)#
converts a gams parameter to a dataframe
- param_as_df_gdxdump(param_name, encoding='1252', convert_time=True)#
converts a gams parameter to a dataframe with the ‘gdxdump’ GAMS utility via subprocess. This is sometimes beneficial, to circumvent decoding errors
- Parameters:
- Returns:
parameter as dataframe
- Return type:
pandas.dataframe
- set_as_df(set_name)#
converts a gams set to a dataframe
- Parameters:
set_name (str) – name of set
- Returns:
set as dataframe
- Return type:
pandas.dataframe
- set_symbols_as_attribs()#
Sets all output symbols as methods. This allows to access result parameters by BackboneResult.r_emission().
- class backbonetools.io.outputs.BackboneScenarioAnalysis(results_dir: str | None = None, result_files: list | None = None)#
Bases:
objectClass to analysis multiple backbone results together
- __init__(results_dir: str | None = None, result_files: list | None = None) None#
initalizes class by reading in multiple backbone files as instances of class BackboneResult
- Parameters:
- Raises:
ValueError – If neither results_dir or results_files is set
- energy_provided_per_unitType(unitTypeList=None, unitTypeDict=None) DataFrame#
returns pandas dataframe with energy provided per unit and scenario, can be grouped by unitType if either unitTypeList or unitTypeDict is given.
- Parameters:
unitTypeList (list, optional) – If plot shall be made by unit type rather than unit. Give list of unittypes. All units which name contains the unittype will be sorted to the unittype. Defaults to None.
unitTypeDict (dict, optional) – If plot shall be made by unit type rather than unit. Give dict of unittypes. All units which name contains the unittype key will be sorted to the unittype. Defaults to None.
- Returns:
pandas dataframe with energy provided per unit and scenario
- Return type:
pandas.DataFrame
- installed_capacity(unitTypeList=None, unitTypeDict=None) DataFrame#
Returns installed capacity per unit and scenario, can be grouped by unitType if either unitTypeList or unitTypeDict is given.
- Parameters:
unitTypeList (list, optional) – If plot shall be made by unit type rather than unit. Give list of unittypes. All units which name contains the unittype will be sorted to the unittype. Defaults to None.
unitTypeDict (dict, optional) – If plot shall be made by unit type rather than unit. Give dict of unittypes. All units which name contains the unittype key will be sorted to the unittype. Defaults to None.
- Returns:
dataframe with installed capacity per unit and scenario
- Return type:
pandas.DataFrame
- plot_energy_per_unitType(unitTypeList=None, unitTypeDict=None, colors=None)#
plots energy provided per unit and scenario, plot can be done by unitType if either unitTypeList or unitTypeDict is given.
- Parameters:
unitTypeList (list, optional) – If plot shall be made by unit type rather than unit. Give list of unittypes. All units which name contains the unittype will be sorted to the unittype. Defaults to None.
unitTypeDict (dict, optional) – If plot shall be made by unit type rather than unit. Give dict of unittypes. All units which name contains the unittype key will be sorted to the unittype. Defaults to None.
colors (list, optional) – list with colors for plotting. Defaults to None.
- Returns:
plot with energy provided per unit type
- Return type:
plotly.graph_objects.figure
- plot_energy_per_unitType_stacked(unitTypeList=None, unitTypeDict=None, colors=None)#
plots energy provided per unit and scenario as stacked bars, plot can be done by unitType if either unitTypeList or unitTypeDict is given.
- Parameters:
unitTypeList (list, optional) – If plot shall be made by unit type rather than unit. Give list of unittypes. All units which name contains the unittype will be sorted to the unittype. Defaults to None.
unitTypeDict (dict, optional) – If plot shall be made by unit type rather than unit. Give dict of unittypes. All units which name contains the unittype key will be sorted to the unittype. Defaults to None.
colors (list, optional) – list of colors for plotting. Defaults to None.
- Returns:
plot with energy provided per unit type as stacked bars
- Return type:
plotly.graph_objects.figure
- plot_installed_capacity(unitTypeList=None, unitTypeDict=None, colors=None)#
plots installed capacity per scenario, plot can be done by unitType if either unitTypeList or unitTypeDict is given.
- Parameters:
unitTypeList (list, optional) – If plot shall be made by unit type rather than unit. Give list of unittypes. All units which name contains the unittype will be sorted to the unittype. Defaults to None.
unitTypeDict (dict, optional) – If plot shall be made by unit type rather than unit. Give dict of unittypes. All units which name contains the unittype key will be sorted to the unittype. Defaults to None.
colors (list, optional) – list of colors. Defaults to None.
- Returns:
figure showing the invested capacities per scenario
- Return type:
plotly.express.fig
- plot_priceDurationCurve(nodes=[], stylelist=[], colorlist=None)#
Plots electricity price duration curves, i.e. the ordered dual variable of the balance constraint of each electricity node defined in the list “nodes” (the default is the complete list of electricity nodes) by Scenario.
- Parameters:
- Returns:
list of plotted pandas dataframes (price duration curves)
- Return type:
- plot_priceDurationCurve2(nodes=[], stylelist=[], colorlist=None)#
Plots electricity price duration curves, i.e. the ordered dual variable of the balance constraint of electricity nodes, for all scenarios by nodes as defined in the list “nodes” (the default is the complete list of electricity nodes) by Scenario.
- Parameters:
- Returns:
list of plotted pandas dataframes (price duration curves)
- Return type:
- plot_system_cost_composition()#
plots cost components per scenario
- Returns:
figure showing the cost components per scenario
- Return type:
plotly.express.fig
- set_symbols_as_attribs()#
Sets all output symbols as methods. This allows to access result parameters by BackboneResult.r_emission().
- system_cost_composition() DataFrame#
writes cost components (invest costs, transmission costs, emissions costs, fom costs, vom costs) per scenario to a dataframe
- Returns:
dataframe containing different cost components per scenario
- Return type:
pandas.DataFrame