deflex.calculate_key_values

deflex.calculate_key_values(results, ignore_chp=True)[source]

Get time series of typical key values.

  • marginal costs
  • highest emission
  • lowest emission
  • marginal costs power plant
  • emission of marginal costs power plant
Parameters:
  • results (dict) – Deflex results dictionary.
  • ignore_chp (bool) – Set False to include the chp-plants (default: True).
Returns:

Return type:

pandas.DataFrame

Examples

>>> import deflex as dflx
>>> fn = dflx.fetch_test_files("de03_fictive.dflx")
>>> my_results = dflx.restore_results(fn)
>>> df = calculate_key_values(my_results, ignore_chp=False)
>>> list(df.columns)[:3]
['marginal costs', 'highest emission', 'lowest emission']
>>> row = df.iloc[24]
>>> row.pop("marginal costs power plant").label
Label(cat='chp plant', tag='bioenergy', subtag='bioenergy', region='DE01')
>>> row
marginal costs                           47.573824
highest emission                              1.01
lowest emission                                0.0
emission of marginal cost power plant     0.016992
Name: 2022-01-02 00:00:00, dtype: object
>>> min_mc = df["marginal costs"].min()
>>> max_mc = df["marginal costs"].max()
>>> print("{0} - {1}".format(round(min_mc, 2), round(max_mc, 2)))
47.57 - 65.35
>>> df = calculate_key_values(my_results, ignore_chp=True)
>>> row = df.iloc[45]
>>> str(row.pop("marginal costs power plant").label)
'power-plant_natural-gas_06_natural-gas_DE01'
>>> row
marginal costs                           46.230384
highest emission                          1.299035
lowest emission                                0.0
emission of marginal cost power plant     0.335559
Name: 2022-01-02 21:00:00, dtype: object
>>> min_mc = df["marginal costs"].min()
>>> max_mc = df["marginal costs"].max()
>>> print("{0} - {1}".format(round(min_mc, 2), round(max_mc, 2)))
29.97 - 47.58