Skip to content

Rule build_demand_profiles

Script Documentation

Creates electric demand profile csv.

Relevant Settings

.. code:: yaml

load:
    scale:
    ssp:
    weather_year:
    prediction_year:
    region_load:

Inputs

  • networks/base.nc: confer :ref:base, a base PyPSA Network
  • resources/bus_regions/regions_onshore.geojson: confer :mod:build_bus_regions
  • load_data_paths: paths to load profiles, e.g. hourly country load profiles produced by GEGIS
  • resources/shapes/gadm_shapes.geojson: confer :ref:shapes, file containing the gadm shapes

Outputs

  • resources/demand_profiles.csv: the content of the file is the electric demand profile associated to each bus. The file has the snapshots as rows and the buses of the network as columns.

Description

The rule :mod:build_demand creates load demand profiles in correspondence of the buses of the network. It creates the load paths for GEGIS outputs by combining the input parameters of the countries, weather year, prediction year, and SSP scenario. Then with a function that takes in the PyPSA network "base.nc", region and gadm shape data, the countries of interest, a scale factor, and the snapshots, it returns a csv file called "demand_profiles.csv", that allocates the load to the buses of the network according to GDP and population.

get_gegis_regions(countries)

Get the GEGIS region from the config file.

Parameters

region : str The region of the bus

Returns

str The GEGIS region

get_load_paths_gegis(ssp_parentfolder, config)

Create load paths for GEGIS outputs.

The paths are created automatically according to included country, weather year, prediction year and ssp scenario

Example

["/data/ssp2-2.6/2030/era5_2013/Africa.nc", "/data/ssp2-2.6/2030/era5_2013/Africa.nc"]

shapes_to_shapes(orig, dest)

Adopted from vresutils.transfer.Shapes2Shapes()

compose_gegis_load(load_paths, countries)

Read and merge GEGIS electricity demand data from multiple input files.

Parameters

load_paths : str or list[str] Paths to demand input files. countries : str or list[str] Region codes used to look for the demand data.

Returns

gegis_load : pd.DataFrame Electricity load with time index, and containing the columns region_code, region_name, and Electricity demand.

read_demcast_load(load_paths, weather_year, countries)

Load electricity demand data from DemandCast dataset for selected countries and a given weather year.

Parameters

load_paths : str Path to the parquet file with Demcast demand data. weather_year : int Weather year for which demand profile should be extracted. countries : str or list Country name or list of country names to subset the demand dataset.

Returns

demcast_load : pd.DataFrame Electricity load with time index, and containing the columns region_code, region_name, and Electricity demand.

References

Kevin Steijn, Vamsi Priya Goli, Enrico Antonini (2025) "DemandCast: Global hourly electricity demand forecasting" https://arxiv.org/abs/2510.08000

build_demand_profiles(n, load_source, load_paths, regions, admin_shapes, countries, scale, weather_year, start_date, end_date, out_path)

Create csv file of electric demand time series.

Parameters

n : pypsa network load_source : str Type of data source to be used for electricity demand load_paths: paths of the load files regions : .geojson Contains bus_id of low voltage substations and bus region shapes (voronoi cells) admin_shapes : .geojson contains subregional gdp, population and shape data countries : list List of countries that is config input scale : float The scale factor is multiplied with the load (1.3 = 30% more load) start_date: parameter The start_date is the first hour of the first day of the snapshots end_date: parameter The end_date is the last hour of the last day of the snapshots

Returns

demand_profiles.csv : csv file containing the electric demand time series