demandregio

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

class DemandRegio(dependencies)[source]

Bases: 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

<egon.data.datasets.scenario_parameters.ScenarioParameters>` * ZensusVg250

Resulting tables
  • :py:class:`demand.egon_demandregio_hh

<egon.data.datasets.demandregio.EgonDemandRegioHH>` is created and filled * demand.egon_demandregio_cts_ind is created and filled * society.egon_demandregio_population is created and filled * society.egon_demandregio_household is created and filled * demand.egon_demandregio_wz is created and filled * demand.egon_demandregio_timeseries_cts_ind is created and filled

name: str = 'DemandRegio'
sources: DatasetSources = DatasetSources(tables={'vg250_krs': 'boundaries.vg250_krs'}, files={'wz_cts': 'WZ_definition/CTS_WZ_definition.csv', 'wz_industry': 'WZ_definition/ind_WZ_definition.csv', 'new_consumers_2035': 'new_largescale_consumers_nep.csv', 'cache_zip': 'demand_regio_backup/cache.zip', 'dbdump_zip': 'demand_regio_backup/status2019-egon-demandregio-cts-ind.zip'}, urls={})

The sources used by the datasets. Could be tables, files and urls

targets: DatasetTargets = DatasetTargets(tables={'hh_demand': 'demand.egon_demandregio_hh', 'cts_ind_demand': 'demand.egon_demandregio_cts_ind', 'population': 'society.egon_demandregio_population', 'households': 'society.egon_demandregio_household', 'wz_definitions': 'demand.egon_demandregio_wz', 'timeseries_cts_ind': 'demand.egon_demandregio_timeseries_cts_ind'}, files={'cache_dir': 'demandregio/cache', 'dbdump_dir': 'demandregio/dbdump'})

The targets created by the datasets. Could be tables and files

version: str = '0.0.19'
class DemandRegioLoadProfiles(**kwargs)[source]

Bases: Base

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

Bases: Base

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

Bases: Base

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

Bases: Base

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

Bases: Base

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

Bases: Base

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

Bases: 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, original=False, **kwargs)[source]

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

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

  • 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

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)