heat_demand

Central module containing all code dealing with the future heat demand import.

This module obtains the residential and service-sector heat demand data for 2015 from Peta5.0.1, calculates future heat demands and saves them in the database with assigned census cell IDs.

class EgonPetaHeat(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

demand
id
scenario
sector
zensus_population_id
class HeatDemandImport(dependencies)[source]

Bases: egon.data.datasets.Dataset

Insert the annual heat demand per census cell for each scenario

This dataset downloads the heat demand raster data for private households and CTS from Peta 5.0.1 (https://s-eenergies-open-data-euf.hub.arcgis.com/maps/d7d18b63250240a49eb81db972aa573e/about) and stores it into files in the working directory. The data from Peta 5.0.1 represents the status quo of the year 2015. To model future heat demands, the data is scaled to meet target values from external sources. These target values are defined for each scenario in ScenarioParameters.

Dependencies
Resulting tables
name = 'heat-demands'
version = '0.0.1'
add_metadata()[source]

Writes metadata JSON string into table comment.

adjust_residential_heat_to_zensus(scenario)[source]

Adjust residential heat demands to fit to zensus population.

In some cases, Peta assigns residential heat demand to unpopulated cells. This can be caused by the different population data used in Peta or buildings in zenus cells without a population (see egon.data.importing.zensus.adjust_zensus_misc())

Residential heat demand in cells without zensus population is dropped. Residential heat demand in cells with zensus population is scaled to meet the overall residential heat demands.

Parameters:scenario (str) – Name of the scenario.
Returns:None
cutout_heat_demand_germany()[source]

Save cutouts of Germany’s 2015 heat demand densities from Europe-wide tifs.

  1. Get the German state boundaries
  2. Load the unzip 2015 heat demand data (Peta5_0_1) and
  3. Cutout Germany’s residential and service-sector heat demand densities
  4. Save the cutouts as tiffs
Parameters:None
Returns:None

Notes

The alternative of cutting out Germany from the pan-European raster based on German census cells, instead of using state boundaries with low resolution (to avoid inaccuracies), was not implemented in order to achieve consistency with other datasets (e.g. egon_mv_grid_district). Besides, all attempts to read, (union) and load cells from the local database failed, but were documented as commented code within this function and afterwards removed. If you want to have a look at the comments, please check out commit ec3391e182215b32cd8b741557a747118ab61664, which is the last commit still containing them.

Also the usage of a buffer around the boundaries and the subsequent selection of German cells was not implemented. could be used, but then it must be ensured that later only heat demands of cells belonging to Germany are used.

download_peta5_0_1_heat_demands()[source]

Download Peta5.0.1 tiff files.

The downloaded data contain residential and service-sector heat demands per hectar grid cell for 2015.

Parameters:None
Returns:None

Notes

The heat demand data in the Peta5.0.1 dataset are assumed not change. An upgrade to a higher Peta version is currently not foreseen. Therefore, for the version management we can assume that the dataset will not change, unless the code is changed.

future_heat_demand_germany(scenario_name)[source]

Calculate the future residential and service-sector heat demand per ha.

The calculation is based on Peta5_0_1 heat demand densities, cutout for Germany, for the year 2015. The given scenario name is used to read the adjustment factors for the heat demand rasters from the scenario table.

Parameters:scenario_name (str) – Selected scenario name for which assumptions will be loaded.
Returns:None

Notes

None

heat_demand_to_db_table()[source]

Import heat demand rasters and convert them to vector data.

Specify the rasters to import as raster file patterns (file type and directory containing raster files, which all will be imported). The rasters are stored in a temporary table called “heat_demand_rasters”. The final demand data, having the census IDs as foreign key (from the census population table), are genetated by the provided sql script (raster2cells-and-centroids.sql) and are stored in the table “demand.egon_peta_heat”.

Parameters:None
Returns:None

Notes

Please note that the data from “demand.egon_peta_heat” is deleted prior to the import, so make sure you’re not loosing valuable data.

scenario_data_import()[source]

Call all heat demand import related functions.

This function executes the functions that download, unzip and adjust the heat demand distributions from Peta5.0.1 and that save the future heat demand distributions for Germany as tiffs as well as with census grid IDs as foreign key in the database.

Parameters:None
Returns:None

Notes

None

unzip_peta5_0_1_heat_demands()[source]

Unzip the downloaded Peta5.0.1 tiff files.

Parameters:None
Returns:None

Notes

It is assumed that the Peta5.0.1 dataset does not change and that the version number does not need to be checked.