Population and Energy Balances¶
The rules on this page distribute population within countries and derive the annual energy and emission totals per country and sector from statistical energy balances. They are the common basis of the sectoral demand rules for heating, transport and industry.
Population layouts¶
build_population_layouts¶
Maps population (total, urban, rural) onto weather cutout grid cells from NUTS3 shapes.
Script, inputs, outputs and settings
- Script:
scripts/build_population_layouts.py - Inputs:
resources/nuts3_shapes.geojson, output ofretrieve_worldbank_urban_population, depends on configuration - Outputs:
resources/pop_layout_total.nc,resources/pop_layout_urban.nc,resources/pop_layout_rural.nc
Build gridded total, urban and rural population layouts on the cutout grid.
NUTS3 population is spread over the cutout grid cells in proportion to the area each NUTS3 region covers in a cell. Within each country, cells are sorted by population density and the least dense cells count as rural until their cumulative population reaches the country's rural share from World Bank urbanisation statistics; the remaining cells count as urban. Kosovo takes the urbanisation rate of Serbia. The layouts serve to regionalise demands and population-based potentials.
build_clustered_population_layouts¶
Aggregates total, urban and rural population layouts to clustered model regions.
Script, inputs, outputs and settings
- Script:
scripts/build_clustered_population_layouts.py - Inputs:
resources/pop_layout_total.nc,resources/pop_layout_urban.nc,resources/pop_layout_rural.nc,resources/onshore_regions.geojson, depends on configuration - Outputs:
resources/pop_layout.csv
Aggregate gridded population layouts to clustered model regions.
The total, urban and rural population layouts on the cutout grid are summed over each onshore region using the cutout indicator matrix. The output table also holds each region's country and its share of the national population, which later rules use to distribute national demands and capacities to regions.
Energy balances and totals¶
build_eurostat_balances¶
Preprocesses Eurostat energy balances into a tidy table per country, year and carrier.
Script, inputs, outputs and settings
- Script:
scripts/build_eurostat_balances.py - Inputs: output of
retrieve_eurostat_balances - Outputs:
resources/eurostat_energy_balances.csv
Build long-format Eurostat energy balances per country and year in TWh/a.
The compressed Eurostat energy balance table is read, melted to long format and restricted to entries reported in GWh. Missing totals for domestic aviation are filled from the nearest reported year, country codes are harmonised with the JRC-IDEES convention (UK to GB, EL to GR), and values are converted from GWh to TWh. The result feeds the country-level energy totals from which sectoral demands are derived.
build_swiss_energy_balances¶
Extracts historic Swiss energy balances in TWh per year from the federal spreadsheet.
Script, inputs, outputs and settings
- Script:
scripts/build_swiss_energy_balances.py - Inputs: output of
retrieve_swiss_energy_balances - Outputs:
resources/switzerland_energy_balances.csv
Extract historic Swiss energy balances per sector and year in TWh/a.
Switzerland is not covered by the Eurostat energy balances, so final energy use is read from the tables of the Swiss Federal Office of Energy (BFE) overall energy statistics. Total and electricity consumption are extracted for residential and services (space heating, hot water, cooking), for road, rail, domestic aviation and navigation, and for international aviation; international navigation is set to zero. Values are converted from PJ/a to TWh/a and indexed like the Eurostat balances so that both can be merged into the country-level energy totals.
build_transformation_output_coke¶
Extracts coke oven transformation output per country from Eurostat energy balances.
Script, inputs, outputs and settings
- Script:
scripts/build_transformation_output_coke.py - Inputs:
resources/eurostat_energy_balances.csv - Outputs:
resources/transformation_output_coke.csv
build_energy_totals¶
Builds annual energy demand totals per country and sector from JRC IDEES and Eurostat data.
Script, inputs, outputs and settings
- Script:
scripts/build_energy_totals.py - Inputs:
resources/nuts3_shapes.geojson,resources/switzerland_energy_balances.csv, depends on configuration, output ofretrieve_jrc_idees,data/district_heat_share.csv,resources/eurostat_energy_balances.csv, output ofretrieve_eurostat_household_balances - Outputs:
resources/energy_totals.csv,resources/transport_data_raw.csv,resources/district_heat_share.csv,resources/heating_efficiencies.csv - Settings:
countries,energy
Build annual energy demand totals per country, sector and end use from JRC-IDEES and Eurostat data.
For EU27 countries, final energy per sector and end use (residential and services space, water and cooking heat, transport modes, agriculture) is read from the JRC-IDEES balances. Other countries are filled from the Eurostat balances of build_eurostat_balances and the Swiss energy balances, with end-use splits taken from the EU average; Norway's heating fractions use national statistics. Residential totals are then updated with Eurostat's disaggregated household balances.
Three further outputs are derived: the district heating share per country, with a fallback file for countries without IDEES data; transport data with the number of passenger cars and average fuel efficiency, using the BFS vehicle stock for Switzerland and averages for missing countries; and space and water heating efficiencies per carrier.
build_heat_totals¶
Approximates annual heat demand per country for all weather years via heating degree days.
Script, inputs, outputs and settings
- Script:
scripts/build_heat_totals.py - Inputs: depends on configuration,
resources/energy_totals.csv - Outputs:
resources/heat_totals.csv
Extend annual space heating demand per country to weather years without energy statistics.
For residential and services space heating (total and electricity), the annual demand from build_energy_totals for 2007 to 2021 is regressed linearly on the annual heating degree days per country; the range is limited because the fit assumes a constant building stock. The fitted line predicts the demand for all other years with known heating degree days, and reported and predicted values are combined into one series per country, clipped at zero.
Sparse data
Gaps are filled forward and backward to keep more years for the fit (for example GB from 2020 and CH before 2010). If only one year is available, the origin is added as a second point so that a line can be fitted.
build_country_hdd¶
Computes daily heating degree days per country from ERA5 temperatures for all weather years.
Script, inputs, outputs and settings
- Script:
scripts/build_country_hdd.py - Inputs: depends on configuration,
resources/country_shapes.geojson - Outputs: depends on configuration
Build country-level heating degree days in Europe for each country. Used for rescaling heat demand in weather years not covered by energy balance statistics.
| Field | Dimensions | Unit | Description |
|---|---|---|---|
| index/time | time | day | Datestamp, YYYY-MM-DD |
| <columns> | country | ISO-3166 A2 | Aggregated HDDs per country |
build_co2_totals¶
Computes historical CO2 emissions per country and sector from EEA and Eurostat data.
Script, inputs, outputs and settings
- Script:
scripts/build_co2_totals.py - Inputs: output of
retrieve_ghg_emissions,resources/eurostat_energy_balances.csv - Outputs:
resources/co2_totals.csv - Settings:
countries,energy,co2_budget.emissions_scope
build_population_weighted_energy_totals¶
Distributes country-level energy demand totals to model regions by population.
Script, inputs, outputs and settings
- Script:
scripts/build_population_weighted_energy_totals.py - Inputs:
resources/{kind}_totals.csv,resources/pop_layout.csv - Outputs:
resources/pop_weighted_{kind}_totals.csv - Settings:
snapshots,enable.drop_leap_day - Wildcards:
{kind}
Distribute country-level energy or heat totals to clustered model regions by population.
Annual totals per country are averaged over the requested years (the reference year for energy totals, the weather years of the snapshots for heat totals), mapped to each region via its country and scaled by the region's share of national population from the clustered population layout. The regional totals are the basis for building sectoral demand time series.