demandregio

The central module containing all code dealing with importing and adjusting data from demandRegio

class DemandRegio(dependencies)[source]

Bases: egon.data.datasets.Dataset

Extract and adjust data from DemandRegio

Demand data for the sectors households, CTS and industry are calculated using DemandRegio’s diaggregator and input data. To bring the resulting data in line with other data used in eGon-data and the eGon project in general some data needed to be adjusted or extended, e.g. in function adjust_ind_pes() or function adjust_cts_ind_nep(). The resulting data is written into newly created tables.

Dependencies
Resulting tables
name: str = 'DemandRegio'
version: str = '0.0.12'
class DemandRegioLoadProfiles(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

id
load_in_mwh
nuts3
year
class EgonDemandRegioCtsInd(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

demand
nuts3
scenario
wz
year
class EgonDemandRegioHH(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

demand
hh_size
nuts3
scenario
year
class EgonDemandRegioHouseholds(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

hh_size
households
nuts3
year
class EgonDemandRegioPopulation(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

nuts3
population
year
class EgonDemandRegioTimeseriesCtsInd(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

load_curve
slp
wz
year
class EgonDemandRegioWz(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

definition
sector
wz
adjust_cts_ind_nep(ec_cts_ind, sector)[source]

Add electrical demand of new largescale CTS und industrial consumers according to NEP 2021, scneario C 2035. Values per federal state are linear distributed over all CTS branches and nuts3 regions.

Parameters

ec_cts_ind (pandas.DataFrame) – CTS or industry demand without new largescale consumers.

Returns

ec_cts_ind (pandas.DataFrame) – CTS or industry demand including new largescale consumers.

adjust_ind_pes(ec_cts_ind)[source]

Adjust electricity demand of industrial consumers due to electrification of process heat based on assumptions of pypsa-eur-sec.

Parameters

ec_cts_ind (pandas.DataFrame) – Industrial demand without additional electrification

Returns

ec_cts_ind (pandas.DataFrame) – Industrial demand with additional electrification

create_tables()[source]

Create tables for demandregio data :returns: None.

data_in_boundaries(df)[source]

Select rows with nuts3 code within boundaries, used for testmode

Parameters

df (pandas.DataFrame) – Data for all nuts3 regions

Returns

pandas.DataFrame – Data for nuts3 regions within boundaries

disagg_households_power(scenario, year, weight_by_income=False, original=False, **kwargs)[source]

Perform spatial disaggregation of electric power in [GWh/a] by key and possibly weight by income. Similar to disaggregator.spatial.disagg_households_power

Parameters
  • by (str) – must be one of [‘households’, ‘population’]

  • weight_by_income (bool, optional) – Flag if to weight the results by the regional income (default False)

  • orignal (bool, optional) – Throughput to function households_per_size, A flag if the results should be left untouched and returned in original form for the year 2011 (True) or if they should be scaled to the given year by the population in that year (False).

Returns

pd.DataFrame or pd.Series

get_cached_tables()[source]

Get cached demandregio tables and db-dump from former runs

insert_cts_ind(scenario, year, engine, target_values)[source]

Calculates electrical demands of CTS and industry using demandregio’s disaggregator, adjusts them according to resulting values of NEP 2021 or JRC IDEES and insert results into the database.

Parameters
  • scenario (str) – Name of the corresponing scenario.

  • year (int) – The number of households per region is taken from this year.

  • target_values (dict) – List of target values for each scenario and sector.

Returns

None.

insert_cts_ind_demands()[source]

Insert electricity demands per nuts3-region in Germany according to demandregio using its disaggregator-tool in MWh

Returns

None.

insert_cts_ind_wz_definitions()[source]

Insert demandregio’s definitions of CTS and industrial branches

Returns

None.

insert_hh_demand(scenario, year, engine)[source]

Calculates electrical demands of private households using demandregio’s disaggregator and insert results into the database.

Parameters
  • scenario (str) – Name of the corresponding scenario.

  • year (int) – The number of households per region is taken from this year.

Returns

None.

insert_household_demand()[source]

Insert electrical demands for households according to demandregio using its disaggregator-tool in MWh

Returns

None.

insert_society_data()[source]

Insert population and number of households per nuts3-region in Germany according to demandregio using its disaggregator-tool

Returns

None.

insert_timeseries_per_wz(sector, year)[source]

Insert normalized electrical load time series for the selected sector

Parameters
  • sector (str) – Name of the sector. [‘CTS’, ‘industry’]

  • year (int) – Selected weather year

Returns

None.

match_nuts3_bl()[source]

Function that maps the federal state to each nuts3 region

Returns

df (pandas.DataFrame) – List of nuts3 regions and the federal state of Germany.

timeseries_per_wz()[source]

Calcultae and insert normalized timeseries per wz for cts and industry

Returns

None.

write_demandregio_hh_profiles_to_db(hh_profiles)[source]

Write HH demand profiles from demand regio into db. One row per year and nuts3. The annual load profile timeseries is an array.

schema: demand tablename: demandregio_household_load_profiles

Parameters

hh_profiles (pd.DataFrame)