Skip to content

Commit 630d37d

Browse files
daniel-rdtlkstrp
andauthored
feat: add electricitymaps and entsoepy bidding zone data to data layer (#1991)
* feat: add electricitymaps and entsoepy bidding zone geospatial data to data layer * config: autogenerate config.default.yaml and schema.json * doc: add release note * feat: use copy2 and update urls to be version specific * feat: improve logger and handle raise timeout and url errors * fix: move new versions.csv entries to the correct alphabetical position * add to archive --------- Co-authored-by: lkstrp <lkstrp@pm.me>
1 parent 9450f99 commit 630d37d

8 files changed

Lines changed: 162 additions & 90 deletions

File tree

config/config.default.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,12 @@ data:
13921392
jrc_ardeco:
13931393
source: archive
13941394
version: latest
1395+
bidding_zones_electricitymaps:
1396+
source: archive
1397+
version: latest
1398+
bidding_zones_entsoepy:
1399+
source: archive
1400+
version: latest
13951401

13961402
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#overpass_api
13971403
overpass_api:

config/schema.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,46 @@
17911791
"type": "string"
17921792
}
17931793
}
1794+
},
1795+
"bidding_zones_electricitymaps": {
1796+
"description": "Configuration for a single data source.",
1797+
"properties": {
1798+
"source": {
1799+
"default": "archive",
1800+
"description": "Source of the data. 'archive' retrieves pre-built data, 'primary' retrieves from primary source.",
1801+
"enum": [
1802+
"archive",
1803+
"primary",
1804+
"build"
1805+
],
1806+
"type": "string"
1807+
},
1808+
"version": {
1809+
"default": "latest",
1810+
"description": "Version of the data to use. Uses the specific 'version' for the selected 'source' or the dataset tagged 'latest' for this source.",
1811+
"type": "string"
1812+
}
1813+
}
1814+
},
1815+
"bidding_zones_entsoepy": {
1816+
"description": "Configuration for a single data source.",
1817+
"properties": {
1818+
"source": {
1819+
"default": "archive",
1820+
"description": "Source of the data. 'archive' retrieves pre-built data, 'primary' retrieves from primary source.",
1821+
"enum": [
1822+
"archive",
1823+
"primary",
1824+
"build"
1825+
],
1826+
"type": "string"
1827+
},
1828+
"version": {
1829+
"default": "latest",
1830+
"description": "Version of the data to use. Uses the specific 'version' for the selected 'source' or the dataset tagged 'latest' for this source.",
1831+
"type": "string"
1832+
}
1833+
}
17941834
}
17951835
}
17961836
},
@@ -12833,6 +12873,46 @@
1283312873
"type": "string"
1283412874
}
1283512875
}
12876+
},
12877+
"bidding_zones_electricitymaps": {
12878+
"description": "Configuration for a single data source.",
12879+
"properties": {
12880+
"source": {
12881+
"default": "archive",
12882+
"description": "Source of the data. 'archive' retrieves pre-built data, 'primary' retrieves from primary source.",
12883+
"enum": [
12884+
"archive",
12885+
"primary",
12886+
"build"
12887+
],
12888+
"type": "string"
12889+
},
12890+
"version": {
12891+
"default": "latest",
12892+
"description": "Version of the data to use. Uses the specific 'version' for the selected 'source' or the dataset tagged 'latest' for this source.",
12893+
"type": "string"
12894+
}
12895+
}
12896+
},
12897+
"bidding_zones_entsoepy": {
12898+
"description": "Configuration for a single data source.",
12899+
"properties": {
12900+
"source": {
12901+
"default": "archive",
12902+
"description": "Source of the data. 'archive' retrieves pre-built data, 'primary' retrieves from primary source.",
12903+
"enum": [
12904+
"archive",
12905+
"primary",
12906+
"build"
12907+
],
12908+
"type": "string"
12909+
},
12910+
"version": {
12911+
"default": "latest",
12912+
"description": "Version of the data to use. Uses the specific 'version' for the selected 'source' or the dataset tagged 'latest' for this source.",
12913+
"type": "string"
12914+
}
12915+
}
1283612916
}
1283712917
}
1283812918
},

data/versions.csv

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ bfs_gdp_and_population,2019-03-28,primary,latest supported,2025-12-02,,https://d
77
bfs_gdp_and_population,2019-03-28,archive,latest supported,2025-12-02,,https://web.archive.org/web/20250818151254if_/https://dam-api.bfs.admin.ch/hub/api/dam/assets/7786557/master
88
bfs_road_vehicle_stock,unknown,primary,latest supported,2025-12-02,This dataset is not versioned and is updated regularly. The link points to the latest version. More information on the latest update on this website: https://www.bfs.admin.ch/bfs/de/home/statistiken/kataloge-datenbanken.assetdetail.33827666.html,https://datawrapper.dwcdn.net/31f3521eddfa82ada1a436983c31caf5/1/dataset.csv
99
bfs_road_vehicle_stock,2024-03-13,archive,latest supported,2025-12-02,,https://raw.githubusercontent.com/PyPSA/pypsa-eur/5b5d308bf70f15dd0b107d8a19c121093dcdd5bd/data/gr-e-11.03.02.01.01-cc.csv
10+
bidding_zones_electricitymaps,v1.238.0,primary,latest supported,2026-01-22,,https://raw.githubusercontent.com/electricitymaps/electricitymaps-contrib/refs/tags/v1.238.0/web/geo/world.geojson
11+
bidding_zones_electricitymaps,v1.238.0,archive,latest supported,2026-01-22,,https://data.pypsa.org/workflows/eur/bidding_zones_electricitymaps/v1.238.0/world.geojson
12+
bidding_zones_entsoepy,v0.6.18,primary,latest supported,2026-01-22,,https://raw.githubusercontent.com/EnergieID/entsoe-py/refs/tags/V0.6.18/entsoe/geo/geojson
13+
bidding_zones_entsoepy,v0.6.18,archive,latest supported,2026-01-22,,https://data.pypsa.org/workflows/eur/bidding_zones_entsoepy/v0.6.18
1014
co2stop,26-august-2020,primary,latest supported,2025-12-02,,https://setis.ec.europa.eu/document/download/786a884f-0b33-4789-b744-28004b16bd1a_en?filename=co2jrc_openformats.zip
1115
co2stop,26-august-2020,archive,latest supported,2026-01-13,,https://data.pypsa.org/workflows/eur/co2stop/26-august-2020/co2jrc_openformats.zip
1216
copernicus_land_cover,v3.0.1,primary,latest supported,2025-12-02,"The primary is already from Zenodo, documentation in https://zenodo.org/records/4723921",https://zenodo.org/records/3939050/files/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif
1317
copernicus_land_cover,v3.0.1,archive,latest supported,2026-01-20,"The primary is already from Zenodo, documentation in https://zenodo.org/records/4723921",https://data.pypsa.org/workflows/eur/copernicus_land_cover/v3.0.1
1418
copernicus_land_cover,v2.0.2,archive,deprecated supported,2026-01-13,,https://data.pypsa.org/workflows/eur/copernicus_land_cover/v2.0.2/PROBAV_LC100_global_v3.0.1_2015-base_Discrete-Classification-map_EPSG-4326.tif
1519
corine,v18_5,archive,latest supported,2026-01-13,,https://data.pypsa.org/workflows/eur/corine/v18_5/corine.zip
1620
corine,unknown,primary,latest supported,2025-12-02,Need to register with CLMS API and create an access token. The download URL is dynamic,
17-
costs,v0.13.4,primary,latest supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/v0.13.4/outputs
21+
costs,v0.13.4,primary,latest supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/refs/tags/v0.13.4/outputs
1822
costs,v0.13.4,archive,supported,2026-01-21,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://data.pypsa.org/workflows/eur/costs/v0.13.4
19-
costs,v0.13.3,primary,supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/v0.13.3/outputs
23+
costs,v0.13.3,primary,supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/refs/tags/v0.13.3/outputs
2024
costs,v0.13.3,archive,supported,2026-01-20,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://data.pypsa.org/workflows/eur/costs/v0.13.3
21-
costs,v0.13.2,primary,supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/v0.13.2/outputs
25+
costs,v0.13.2,primary,supported,2025-12-02,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://raw.githubusercontent.com/PyPSA/technology-data/refs/tags/v0.13.2/outputs
2226
costs,v0.13.2,archive,supported,2026-01-20,"Part of the `technologydata` repository and versioned on GitHub, i.e. no dedicated 'archive' entry.",https://data.pypsa.org/workflows/eur/costs/v0.13.2
2327
country_hdd,unknown,build,latest supported,2025-12-02,Latest dataset built using ERA5 runoff data. This takes a very long time to build.,
2428
country_hdd,2025-08-13,primary,latest supported,2025-12-02,,https://zenodo.org/records/16849356/files/era5-HDD-per-country.csv

doc/data_inventory.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@
4141
"mobility_profiles","German Vehicle Activity Profiles","Vehicle activity profiles for different vehicle types and road types in Germany, based on monitoring data from the Federal Highway Research Institute (BASt). These profiles provide insights into travel behavior and patterns, which can be used for transport modeling and analysis.","Federal Highway Research Institute (BASt)","https://www.bast.de/DE/Themen/Digitales/HF_1/Massnahmen/verkehrszaehlung/Stundenwerte.html?nn=414410","CC-BY-4.0"
4242
"dh_areas","","Shapes of district heating areas","ISI Fraunhofer-Institut für System- und Innovationsforschung","https://fordatis.fraunhofer.de/handle/fordatis/341.5","CC-BY-4.0"
4343
"geothermal_heat_utilisation_potentials","","Potentials for Geothermal heat utilisation","ISI Fraunhofer-Institut für System- und Innovationsforschung","https://fordatis.fraunhofer.de/handle/fordatis/341.5","CC-BY-4.0"
44-
"jrc_ardeco","Annual Regional Database of the European Commission's Directorate General for Regional and Urban Policy","The database contains a set of long time-series variables and indicators for EU regions, as well as for regions in some EFTA and candidate countries, at various statistical scales (NUTS1, NUTS2, NUTS3, metro regions).","European Commission","https://territorial.ec.europa.eu/ardeco","similar to CC-BY"
44+
"jrc_ardeco","Annual Regional Database of the European Commission's Directorate General for Regional and Urban Policy","The database contains a set of long time-series variables and indicators for EU regions, as well as for regions in some EFTA and candidate countries, at various statistical scales (NUTS1, NUTS2, NUTS3, metro regions).","European Commission","https://territorial.ec.europa.eu/ardeco","similar to CC-BY"
45+
"bidding_zones_electricitymaps","Electricity Maps Bidding Zones","Geospatial data defining bidding zones for electricity markets in Europe","Electricity Maps","https://github.com/electricitymaps/electricitymaps-contrib","AGPL-3.0"
46+
"bidding_zones_entsoepy","ENTSOE-PY Bidding Zones","Geospatial data defining bidding zones for electricity markets in Europe","EnergieID","https://github.com/EnergieID/entsoe-py","MIT"

doc/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Release Notes
99
Upcoming Release
1010
================
1111

12+
* Added missing bidding zone data sources to data layer (https://github.com/PyPSA/pypsa-eur/pull/1991).
13+
1214
* Fix virtual bus naming when building the transmission network from raw OSM data to use persistent names (https://github.com/PyPSA/pypsa-eur/pull/1956).
1315

1416
* Fix column selection when preparing OSM pre-built releases (https://github.com/PyPSA/pypsa-eur/pull/1956).

rules/retrieve.smk

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,62 @@ if (EU_NUTS2021_DATASET := dataset_version("eu_nuts2021"))["source"] in [
319319
unpack_archive(output["zip_file"], Path(output.shapes_level_3).parent)
320320

321321

322-
rule retrieve_bidding_zones:
323-
message:
324-
"Retrieving bidding zones data from ENTSO-E and Electricity Maps"
325-
output:
326-
file_entsoepy="data/busshapes/bidding_zones_entsoepy.geojson",
327-
file_electricitymaps="data/busshapes/bidding_zones_electricitymaps.geojson",
328-
log:
329-
"logs/retrieve_bidding_zones.log",
330-
resources:
331-
mem_mb=1000,
332-
retries: 2
333-
script:
334-
"../scripts/retrieve_bidding_zones.py"
322+
if (
323+
BIDDING_ZONES_ELECTRICITYMAPS_DATASET := dataset_version(
324+
"bidding_zones_electricitymaps"
325+
)
326+
)["source"] in ["primary"]:
327+
328+
rule retrieve_bidding_zones_electricitymaps:
329+
input:
330+
geojson=storage(BIDDING_ZONES_ELECTRICITYMAPS_DATASET["url"]),
331+
output:
332+
geojson=f"{BIDDING_ZONES_ELECTRICITYMAPS_DATASET["folder"]}/bidding_zones_electricitymaps.geojson",
333+
log:
334+
"logs/retrieve_bidding_zones_electricitymaps.log",
335+
resources:
336+
mem_mb=1000,
337+
retries: 2
338+
run:
339+
copy2(input["geojson"], output["geojson"])
340+
341+
342+
if (BIDDING_ZONES_ENTSOEPY_DATASET := dataset_version("bidding_zones_entsoepy"))[
343+
"source"
344+
] in ["primary"]:
345+
346+
rule retrieve_bidding_zones_entsoepy:
347+
output:
348+
geojson=f"{BIDDING_ZONES_ENTSOEPY_DATASET['folder']}/bidding_zones_entsoepy.geojson",
349+
log:
350+
"logs/retrieve_bidding_zones_entsoepy.log",
351+
resources:
352+
mem_mb=1000,
353+
retries: 2
354+
run:
355+
import entsoe
356+
import geopandas as gpd
357+
from urllib.error import HTTPError, URLError
358+
359+
logger.info("Downloading entsoe-py zones...")
360+
gdfs: list[gpd.GeoDataFrame] = []
361+
url = f"{BIDDING_ZONES_ENTSOEPY_DATASET['url']}"
362+
for area in entsoe.Area:
363+
name = area.name
364+
try:
365+
file_url = f"{url}/{name}.geojson"
366+
gdfs.append(gpd.read_file(file_url))
367+
except HTTPError as e:
368+
logger.debug(f"Area file not available for {name}: {e}")
369+
continue
370+
except (URLError, TimeoutError) as e:
371+
raise Exception(f"Network error retrieving {name}: {e}")
372+
shapes = pd.concat(gdfs, ignore_index=True) # type: ignore
373+
374+
logger.info("Downloading entsoe-py zones... Done")
375+
376+
shapes.to_file(output.geojson)
377+
335378

336379

337380
if (CUTOUT_DATASET := dataset_version("cutout"))["source"] in [

scripts/lib/validation/config/data.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,11 @@ class DataConfig(BaseModel):
219219
default_factory=_DataSourceConfig,
220220
description="JRC ARDECO data source configuration.",
221221
)
222+
bidding_zones_electricitymaps: _DataSourceConfig = Field(
223+
default_factory=_DataSourceConfig,
224+
description="Electricitymaps bidding zones data source configuration.",
225+
)
226+
bidding_zones_entsoepy: _DataSourceConfig = Field(
227+
default_factory=_DataSourceConfig,
228+
description="Entsoepy bidding zones data source configuration.",
229+
)

scripts/retrieve_bidding_zones.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)