From f981236c415acaa5f78eb3efac10f80a19625397 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 10:03:09 +0100 Subject: [PATCH 001/787] Add function for list of sources --- src/egon/data/metadata.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 8ade5c733..6b80bfb7c 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -180,7 +180,7 @@ def license_geonutzv(attribution): def generate_resource_fields_from_sqla_model(model): - """ Generate a template for the resource fields for metadata from a SQL + """Generate a template for the resource fields for metadata from a SQL Alchemy model. For details on the fields see field 14.6.1 of `Open Energy Metadata @@ -218,7 +218,7 @@ def generate_resource_fields_from_sqla_model(model): def generate_resource_fields_from_db_table(schema, table, geom_columns=None): - """ Generate a template for the resource fields for metadata from a + """Generate a template for the resource fields for metadata from a database table. For details on the fields see field 14.6.1 of `Open Energy Metadata @@ -270,3 +270,32 @@ def generate_resource_fields_from_db_table(schema, table, geom_columns=None): } for col in table.c ] + + +def sources(): + return { + "vg250": { + "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", + "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der " + "hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden " + "mit ihren Grenzen, statistischen Schlüsselzahlen, Namen der " + "Verwaltungseinheit sowie die spezifische Bezeichnung der " + "Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": licenses_datenlizenz_deutschland( + "© Bundesamt für Kartographie und Geodäsie " + "2020 (Daten verändert)" + ), + }, + "zensus": { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zusätzlich zur " + "Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- " + "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " + "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", + "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", + "license": licenses_datenlizenz_deutschland( + "© Statistische Ämter des Bundes und der Länder 2014" + ), + }, + } From e21500ab34d0fc0cec96dcfa638fbfdcfe3d3ac3 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Mon, 13 Dec 2021 11:00:44 +0100 Subject: [PATCH 002/787] Add BGR datasource --- src/egon/data/metadata.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 6b80bfb7c..8c309ba6d 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -298,4 +298,21 @@ def sources(): "© Statistische Ämter des Bundes und der Länder 2014" ), }, + "bgr": { + "title": "Übersicht der in InSpEE und InSpEE-DS ausgewerteten Salinarbereiche und Salzstrukturen", + "description": "The data include availability of saltstructures for energy storage and energy " + "storage potential per federal state in Germany. The data-bundle provdides the shapefiles " + "corresponding to the data provided in figure 7-1 (Donadei, S., et al., 2020, p. 7-5). The " + "energy storage potential data are accumulated per federal state and provided in table " + "7-1 (Donadei, S., et al., 2020, p. 7-5).\n" + "Donadei, S., Horváth, B., Horváth, P.-L., Keppliner, J., Schneider, G.-S., & Zander-Schiebenhöfer, D. (2020). " + "Teilprojekt Bewertungskriterien und Potenzialabschätzung. BGR. Informationssystem Salz: Planungsgrundlagen, " + "Auswahlkriterien und Potenzialabschätzung für die Errichtung von Salzkavernen zur Speicherung von Erneuerbaren " + "Energien (Wasserstoff und Druckluft) – Doppelsalinare und flach lagernde Salzschichten: " + "InSpEE-DS. Sachbericht. Hannover: BGR.", + "path": "https://dx.doi.org/10.5281/zenodo.4896526", + "license": license_geonutzv( + "Datenquellen: InSpEE-Salzstrukturen, © BGR, Hannover, 2015 & Flach lagernde Salze, © BGR, Hannover, 2021" + ), + }, } From 4ab5946a5bc9e364f188c8ef0554640d72db6e5a Mon Sep 17 00:00:00 2001 From: IlkaCu Date: Mon, 13 Dec 2021 11:55:21 +0100 Subject: [PATCH 003/787] Add osm, mastr, hotmaps to sources dict --- src/egon/data/metadata.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 6b80bfb7c..9b3e4b355 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -274,6 +274,36 @@ def generate_resource_fields_from_db_table(schema, table, geom_columns=None): def sources(): return { + "hotmaps_industrial_sites": { + "titel": "industrial_sites_Industrial_Database", + "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", + "path": "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database", + "licenses": license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter"), + }, + "hotmaps_scen_buildings": { + "titel": "scen_current_building_demand", + "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario", + "path": "https://gitlab.com/hotmaps/scen_current_building_demand", + "licenses": license_ccby("© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller"), + }, + "mastr": { + "title": "open-MaStR power unit registry", + "description": "Raw data download Marktstammdatenregister (MaStR) data " + "using the webservice. All data from the Marktstammdatenregister is included." + "There are duplicates included. For further information read in the documentation" + "of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", + "path": "https://sandbox.zenodo.org/record/808086", + "licenses": licenses_datenlizenz_deutschland( + "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" + ), + }, + "openstreetmap": { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined " + "spatial extent at ''referenceDate''", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": license_odbl("© OpenStreetMap contributors"), + }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der " From a4eb6bca1a6d31de79e4f68d928344fa2e8d3608 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Mon, 13 Dec 2021 12:00:31 +0100 Subject: [PATCH 004/787] Insert individual sources for BGR and openffe gas - Split BGR data into four individual sources (report, structural data 1 and 2 as well as data bundle containing shapefiles) - Add ffe data for industrial gas demand --- src/egon/data/metadata.py | 85 +++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index d71c117a5..4732833a7 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -328,21 +328,80 @@ def sources(): "© Statistische Ämter des Bundes und der Länder 2014" ), }, - "bgr": { - "title": "Übersicht der in InSpEE und InSpEE-DS ausgewerteten Salinarbereiche und Salzstrukturen", - "description": "The data include availability of saltstructures for energy storage and energy " - "storage potential per federal state in Germany. The data-bundle provdides the shapefiles " - "corresponding to the data provided in figure 7-1 (Donadei, S., et al., 2020, p. 7-5). The " - "energy storage potential data are accumulated per federal state and provided in table " - "7-1 (Donadei, S., et al., 2020, p. 7-5).\n" - "Donadei, S., Horváth, B., Horváth, P.-L., Keppliner, J., Schneider, G.-S., & Zander-Schiebenhöfer, D. (2020). " - "Teilprojekt Bewertungskriterien und Potenzialabschätzung. BGR. Informationssystem Salz: Planungsgrundlagen, " - "Auswahlkriterien und Potenzialabschätzung für die Errichtung von Salzkavernen zur Speicherung von Erneuerbaren " - "Energien (Wasserstoff und Druckluft) – Doppelsalinare und flach lagernde Salzschichten: " - "InSpEE-DS. Sachbericht. Hannover: BGR.", + "bgr_inspeeds_data_bundle": { + "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " + "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " + "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", + "description": "The data-bundle provides the shapefiles corresponding to the data provided in figure 7-1 " + "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state " + " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " + "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", "license": license_geonutzv( - "Datenquellen: InSpEE-Salzstrukturen, © BGR, Hannover, 2015 & Flach lagernde Salze, © BGR, Hannover, 2021" + "???" + ), + }, + "bgr_inspeeds_report": { + "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " + "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " + "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", + "description": "The report includes availability of saltstructures for energy storage and energy " + "storage potential accumulated per federal state in Germany.", + "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", + "license": license_geonutzv( + "© BGR, Hannover, 2021" + ), + }, + "bgr_inspee": { + "title": "Salt structures in Northern Germany", + "description": "The application \"Information System Salt Structures\" provides information about the " + "areal distribution of salt structures (stocks and pillows) in Northern Germany. With general structural " + "describing information, such as depth, secondary thickness, types of use or state of exploration, queries " + "can be conducted. Contours of the salt structures can be displayed at horizontal cross-sections at four " + "different depths up to a maximum depth of 2000 m below NN. A data sheet with information and further " + "reading is provided for every single salt structure. Taking into account the fact that this work was " + "undertaken at a scale for providing an overview and not for investigation of single structures, the scale " + "of display is limited to a minimum of 1:300.000. This web application is the product of a BMWi-funded " + "research project \"InSpEE\" running from the year 2012 to 2015. The acronym stands for \"Information system " + "salt structures: planning basis, selection criteria and estimation of the potential for the construction " + "of salt caverns for the storage of renewable energies (hydrogen and compressed air)\".", + "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", + "license": license_geonutzv( + "© BGR, Hannover, 2015" + ), + }, + "bgr_inspeeds": { + "title": "Flat layered salts in Germany", + "description": "Which salt formations are suitable for storing hydrogen or compressed air? " + "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment " + "of suitable sites even if their exploration is still at an early stage and there is little knowledge of " + "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " + "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University " + "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for " + "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. " + "Such caverns could store renewable energy in the form of hydrogen or compressed air. While the previous " + "project InSpEE was limited to salt formations of great thickness in Northern Germany, salt horizons of " + "different ages have now been examined all over Germany. To estimate the potential, depth contour maps of " + "the top and the base as well as thickness maps of the respective stratigraphic units and reference " + "profiles were developed. Information on compressed air and hydrogen storage potential were given for the " + "identified areas and for the individual federal states. The web service " + "\"Information system for flat layered salt\" gives access to this data. The scale of display is limited " + "to a minimum of 1:300.000. This geographic information is product of a BMWi-funded research project " + "\"InSpEE-DS\" running from the year 2015 to 2019. The acronym stands for \"Information system salt: " + "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " + "for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers\".", + "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", + "license": license_geonutzv( + "© BGR, Hannover, 2021" + ), + }, + "openffe_gas": { + "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", + "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " + "More information at https://extremos.ffe.de/.", + "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", + "license": license_ccby( + "© FfE, eXtremOS Project" ), }, } From a994a6e4b8318ef07ac550e49a826410bf56b9a8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 12:10:39 +0100 Subject: [PATCH 005/787] Sort sources alphabetically --- src/egon/data/metadata.py | 146 ++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 77 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 4732833a7..38fb6c523 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -274,6 +274,65 @@ def generate_resource_fields_from_db_table(schema, table, geom_columns=None): def sources(): return { + "bgr_inspee": { + "title": "Salt structures in Northern Germany", + "description": 'The application "Information System Salt Structures" provides information about the ' + "areal distribution of salt structures (stocks and pillows) in Northern Germany. With general structural " + "describing information, such as depth, secondary thickness, types of use or state of exploration, queries " + "can be conducted. Contours of the salt structures can be displayed at horizontal cross-sections at four " + "different depths up to a maximum depth of 2000 m below NN. A data sheet with information and further " + "reading is provided for every single salt structure. Taking into account the fact that this work was " + "undertaken at a scale for providing an overview and not for investigation of single structures, the scale " + "of display is limited to a minimum of 1:300.000. This web application is the product of a BMWi-funded " + 'research project "InSpEE" running from the year 2012 to 2015. The acronym stands for "Information system ' + "salt structures: planning basis, selection criteria and estimation of the potential for the construction " + 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', + "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", + "license": license_geonutzv("© BGR, Hannover, 2015"), + }, + "bgr_inspeeds": { + "title": "Flat layered salts in Germany", + "description": "Which salt formations are suitable for storing hydrogen or compressed air? " + "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment " + "of suitable sites even if their exploration is still at an early stage and there is little knowledge of " + "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " + "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University " + "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for " + "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. " + "Such caverns could store renewable energy in the form of hydrogen or compressed air. While the previous " + "project InSpEE was limited to salt formations of great thickness in Northern Germany, salt horizons of " + "different ages have now been examined all over Germany. To estimate the potential, depth contour maps of " + "the top and the base as well as thickness maps of the respective stratigraphic units and reference " + "profiles were developed. Information on compressed air and hydrogen storage potential were given for the " + "identified areas and for the individual federal states. The web service " + '"Information system for flat layered salt" gives access to this data. The scale of display is limited ' + "to a minimum of 1:300.000. This geographic information is product of a BMWi-funded research project " + '"InSpEE-DS" running from the year 2015 to 2019. The acronym stands for "Information system salt: ' + "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " + 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', + "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", + "license": license_geonutzv("© BGR, Hannover, 2021"), + }, + "bgr_inspeeds_data_bundle": { + "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " + "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " + "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", + "description": "The data-bundle provides the shapefiles corresponding to the data provided in figure 7-1 " + "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state " + " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " + "the data.", + "path": "https://dx.doi.org/10.5281/zenodo.4896526", + "license": license_geonutzv("???"), + }, + "bgr_inspeeds_report": { + "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " + "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " + "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", + "description": "The report includes availability of saltstructures for energy storage and energy " + "storage potential accumulated per federal state in Germany.", + "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", + "license": license_geonutzv("© BGR, Hannover, 2021"), + }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -284,7 +343,9 @@ def sources(): "titel": "scen_current_building_demand", "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario", "path": "https://gitlab.com/hotmaps/scen_current_building_demand", - "licenses": license_ccby("© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller"), + "licenses": license_ccby( + "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller" + ), }, "mastr": { "title": "open-MaStR power unit registry", @@ -297,6 +358,13 @@ def sources(): "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" ), }, + "openffe_gas": { + "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", + "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " + "More information at https://extremos.ffe.de/.", + "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", + "license": license_ccby("© FfE, eXtremOS Project"), + }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined " @@ -328,80 +396,4 @@ def sources(): "© Statistische Ämter des Bundes und der Länder 2014" ), }, - "bgr_inspeeds_data_bundle": { - "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " - "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " - "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", - "description": "The data-bundle provides the shapefiles corresponding to the data provided in figure 7-1 " - "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state " - " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " - "the data.", - "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_geonutzv( - "???" - ), - }, - "bgr_inspeeds_report": { - "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " - "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " - "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", - "description": "The report includes availability of saltstructures for energy storage and energy " - "storage potential accumulated per federal state in Germany.", - "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", - "license": license_geonutzv( - "© BGR, Hannover, 2021" - ), - }, - "bgr_inspee": { - "title": "Salt structures in Northern Germany", - "description": "The application \"Information System Salt Structures\" provides information about the " - "areal distribution of salt structures (stocks and pillows) in Northern Germany. With general structural " - "describing information, such as depth, secondary thickness, types of use or state of exploration, queries " - "can be conducted. Contours of the salt structures can be displayed at horizontal cross-sections at four " - "different depths up to a maximum depth of 2000 m below NN. A data sheet with information and further " - "reading is provided for every single salt structure. Taking into account the fact that this work was " - "undertaken at a scale for providing an overview and not for investigation of single structures, the scale " - "of display is limited to a minimum of 1:300.000. This web application is the product of a BMWi-funded " - "research project \"InSpEE\" running from the year 2012 to 2015. The acronym stands for \"Information system " - "salt structures: planning basis, selection criteria and estimation of the potential for the construction " - "of salt caverns for the storage of renewable energies (hydrogen and compressed air)\".", - "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", - "license": license_geonutzv( - "© BGR, Hannover, 2015" - ), - }, - "bgr_inspeeds": { - "title": "Flat layered salts in Germany", - "description": "Which salt formations are suitable for storing hydrogen or compressed air? " - "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment " - "of suitable sites even if their exploration is still at an early stage and there is little knowledge of " - "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " - "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University " - "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for " - "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. " - "Such caverns could store renewable energy in the form of hydrogen or compressed air. While the previous " - "project InSpEE was limited to salt formations of great thickness in Northern Germany, salt horizons of " - "different ages have now been examined all over Germany. To estimate the potential, depth contour maps of " - "the top and the base as well as thickness maps of the respective stratigraphic units and reference " - "profiles were developed. Information on compressed air and hydrogen storage potential were given for the " - "identified areas and for the individual federal states. The web service " - "\"Information system for flat layered salt\" gives access to this data. The scale of display is limited " - "to a minimum of 1:300.000. This geographic information is product of a BMWi-funded research project " - "\"InSpEE-DS\" running from the year 2015 to 2019. The acronym stands for \"Information system salt: " - "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " - "for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers\".", - "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", - "license": license_geonutzv( - "© BGR, Hannover, 2021" - ), - }, - "openffe_gas": { - "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", - "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " - "More information at https://extremos.ffe.de/.", - "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", - "license": license_ccby( - "© FfE, eXtremOS Project" - ), - }, } From c6612fcadee12baa8998115470edbd681decf847 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 12:12:27 +0100 Subject: [PATCH 006/787] Add demandregio, nep, era5, tyndp, peta to sources list --- src/egon/data/metadata.py | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 38fb6c523..55ad3fd90 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -333,6 +333,35 @@ def sources(): "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", "license": license_geonutzv("© BGR, Hannover, 2021"), }, + "demandregio": { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " + "zeitlichen Auflösung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": license_ccby("© FZJ, TUB, FfE"), + }, + "era5": { + "title": "ERA5 global reanalysis", + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate " + "and weather for the past 4 to 7 decades. Currently data is available from 1950, " + "split into Climate Data Store entries for 1950-1978 (preliminary back extension) and f" + "rom 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. " + "See the online ERA5 documentation " + "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " + "for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "license": { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. " + "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use " + "may include, but is not limited to: reproduction; distribution; communication to the public; " + "adaptation, modification and combination with other data and information; or any " + "combination of the foregoing", + "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", + }, + }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -358,6 +387,19 @@ def sources(): "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" ), }, + "nep2021": { + "title": "Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf", + "description": "Die vier deutschen Übertragungsnetzbetreiber zeigen mit " + "diesem ersten Entwurf des Netzentwicklungsplans 2035, Version 2021, den " + "benötigten Netzausbau für die nächsten Jahre auf. Der NEP-Bericht beschreibt " + "keine konkreten Trassenverläufe von Übertragungsleitungen, sondern er " + "dokumentiert den notwendigen Übertragungsbedarf zwischen Netzknoten. " + "Das heißt, es werden Anfangs- und Endpunkte von zukünftigen Leitungsverbindungen " + "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " + "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", + "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", + "license": license_ccby("© Übertragungsnetzbetreiber"), + }, "openffe_gas": { "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " @@ -372,6 +414,33 @@ def sources(): "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": license_odbl("© OpenStreetMap contributors"), }, + "peta": { + "title": "Pan-European Thermal Atlas, Peta version 5.0.1", + "description": "Modelled Heat Demand distribution (in GJ per hectare grid cell) for residential and service " + "heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined " + "top-down bottom-up approach of HRE4. " + "National sector-specific heat demand data, derived by the FORECAST model in HRE4 for residential " + "(delivered energy, for space heating and hot water) and service-sector (delivered energy, for space heating, hot " + "water and process heat) buildings for the year 2015, were distributed using modelled, spatial " + "statistics based floor areas in 100x100m grids and a population grid. " + "For further information please see the documentation available on the Heat Roadmap Europe website, " + "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "license": license_ccby( + "© Europa-Universität Flensburg, Halmstad University and Aalborg University" + ), + }, + "tyndp": { + "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", + "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. " + "Scenarios are not forecasts; they set out a range of possible futures used by the ENTSOs to test future " + "electricity and gas infrastructure needs and projects. The scenarios are ambitious as they deliver " + "a low carbon energy system for Europe by 2050. The ENTSOs have developed credible scenarios that are " + "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " + "low carbon future is achieved.", + "path": "https://tyndp.entsoe.eu/maps-data", + "license": license_ccby("© ENTSO-E and ENTSOG"), + }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der " From 0d886f840c1290092e9037fcbed517c1da5adf66 Mon Sep 17 00:00:00 2001 From: IlkaCu Date: Mon, 13 Dec 2021 13:52:48 +0100 Subject: [PATCH 007/787] Add authors --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index a17b7fd23..c8e0681eb 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,4 +2,4 @@ Authors ======= -* Guido Pleßmann, Ilka Cußman, Stephan Günther, Jonathan Amme, Julian Endres - https://github.com/openego/eGon-data +* Jonathan Amme, Clara Büttner, Ilka Cußman, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte - https://github.com/openego/eGon-data From 0d78d2b7c14b636d0526a9da80aa07cd1595d3f4 Mon Sep 17 00:00:00 2001 From: IlkaCu Date: Mon, 13 Dec 2021 14:07:41 +0100 Subject: [PATCH 008/787] Add seenergies and egon-data to sources dict --- src/egon/data/metadata.py | 54 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 55ad3fd90..4d32a8b7e 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -178,6 +178,34 @@ def license_geonutzv(attribution): "attribution": attribution, } +def license_agpl(attribution): + """ + License information for GNU Affero General Public License v3.0 + + Parameters + ---------- + attribution : str + Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG' + + Returns + ------- + dict + OEP metadata conform data license information + """ + return { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are" + "conditioned on making available complete source code of licensed " + "works and modifications, which include larger works using a licensed" + "work, under the same license. Copyright and license notices must be" + "preserved. Contributors provide an express grant of patent rights." + "When a modified version is used to provide a service over a network," + "the complete source code of the modified version must be made available.", + "attribution": attribution, + } + def generate_resource_fields_from_sqla_model(model): """Generate a template for the resource fields for metadata from a SQL @@ -340,6 +368,13 @@ def sources(): "path": "https://doi.org/10.34805/ffe-119-20", "license": license_ccby("© FZJ, TUB, FfE"), }, + "egon-data": { + "titel": "eGon-data", + "description": "Workflow to download, process and generate data sets" + "suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": license_agpl("© Jonathan Amme, Clara Büttner, Ilka Cußman, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte") + }, "era5": { "title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate " @@ -361,7 +396,6 @@ def sources(): "combination of the foregoing", "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", }, - }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -409,7 +443,7 @@ def sources(): }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", - "description": "Full data extract of OpenStreetMap data for defined " + "description": "Full data extract of OpenStreetMap data for defined" "spatial extent at ''referenceDate''", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": license_odbl("© OpenStreetMap contributors"), @@ -430,6 +464,22 @@ def sources(): "© Europa-Universität Flensburg, Halmstad University and Aalborg University" ), }, + "schmidt": { + "title": "Supplementary material to the masters thesis: " + "NUTS-3 Regionalization of Industrial Load Shifting Potential in Germany using a Time-Resolved Model", + "description": "Supplementary material to the named masters thesis, containing data on industrial processes" + "for the estimation of NUTS-3 load shifting potential of suitable electrically powered industrial processes" + "(cement milling, mechanical pulping, paper production, air separation).", + "path": "https://zenodo.org/record/3613767", + "licenses": license_ccby("© 2019 Danielle Schmidt"), + }, + "seenergies": { + "title": "D5 1 Industry Dataset With Demand Data", + "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data" + "within main sectors: Chemical industry, Iron and steel, Non-ferrous metals, Non-metallic minerals, Paper and printing, and Refineries.", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", + "licenses": license_ccby("© Europa-Universität Flensburg") + }, "tyndp": { "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. " From e6edf5e5a7d00cd9301cc6c41244e1dbf86f5bac Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 14:48:02 +0100 Subject: [PATCH 009/787] Add missing } --- src/egon/data/metadata.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 4d32a8b7e..125121d08 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -396,6 +396,7 @@ def sources(): "combination of the foregoing", "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", }, + }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", From 99262f6bbf7139d5dd830cb9ddeaf7347ecabdb3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 14:49:44 +0100 Subject: [PATCH 010/787] Add metadata for scenario capacities --- src/egon/data/datasets/scenario_capacities.py | 100 +++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 243e85846..2a986a6d2 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -9,11 +9,22 @@ from sqlalchemy.orm import sessionmaker import numpy as np import pandas as pd +import time +import datetime from egon.data import db from egon.data.config import settings from egon.data.datasets import Dataset import egon.data.config +from egon.data.metadata import ( + context, + meta_metadata, + license_ccby, + sources, + generate_resource_fields_from_sqla_model, +) +import json + ### will be later imported from another file ### Base = declarative_base() @@ -60,9 +71,9 @@ class ScenarioCapacities(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioCapacities", - version="0.0.5", + version="0.0.6", dependencies=dependencies, - tasks=(create_table, insert_data_nep), + tasks=(create_table, insert_data_nep, add_metadata), ) @@ -234,7 +245,7 @@ def insert_capacities_per_federal_state_nep(): def population_share(): - """ Calulate share of population in testmode + """Calulate share of population in testmode Returns ------- @@ -459,3 +470,86 @@ def insert_data_nep(): insert_capacities_per_federal_state_nep() insert_nep_list_powerplants() + + +def add_metadata(): + + fields = pd.DataFrame( + generate_resource_fields_from_sqla_model(EgonScenarioCapacities) + ).set_index("name") + + fields.loc["index", "description"] = "Index" + fields.loc[ + "component", "description" + ] = "Name of representative PyPSA component" + fields.loc["carrier", "description"] = "Name of carrier" + fields.loc["capacity", "description"] = "Installed capacity" + fields.loc["capacity", "unit"] = "MW" + fields.loc[ + "nuts", "description" + ] = "NUTS region, either federal state or Germany" + fields.loc[ + "scenario_name", "description" + ] = "Name of corresponding eGon scenario" + + fields = fields.reset_index().to_dict(orient="records") + + meta = { + "name": "supply.egon_scenario_capacities", + "title": "eGon scenario capacities", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Installed capacities of scenarios used in the eGon project", + "language": ["de-DE"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["nep2021"], + sources()["vg250"], + sources()["zensus"], + ], + "licenses": [license_ccby( + "© Übertragungsnetzbetreiber; " + "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " + "© Statistische Ämter des Bundes und der Länder 2014", + )], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_scenario_capacities", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + with open('metadata_scenario_capacities.json', 'w') as outfile: + json.dump(meta, outfile, indent=4) + + meta_json = "'" + json.dumps(meta) + "'" + + db.submit_comment( + meta_json, + EgonScenarioCapacities.__table__.schema, + EgonScenarioCapacities.__table__.name, + ) From 80df6733a9afcbbeefad6f01b4fd5233e2a7d348 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 14:51:58 +0100 Subject: [PATCH 011/787] Add licenses in list --- src/egon/data/metadata.py | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 125121d08..5a230a985 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -316,7 +316,7 @@ def sources(): "salt structures: planning basis, selection criteria and estimation of the potential for the construction " 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", - "license": license_geonutzv("© BGR, Hannover, 2015"), + "license": [license_geonutzv("© BGR, Hannover, 2015")], }, "bgr_inspeeds": { "title": "Flat layered salts in Germany", @@ -339,7 +339,7 @@ def sources(): "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", - "license": license_geonutzv("© BGR, Hannover, 2021"), + "license": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_data_bundle": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -350,7 +350,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_geonutzv("???"), + "license": [license_geonutzv("???")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -359,21 +359,21 @@ def sources(): "description": "The report includes availability of saltstructures for energy storage and energy " "storage potential accumulated per federal state in Germany.", "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", - "license": license_geonutzv("© BGR, Hannover, 2021"), + "license": [license_geonutzv("© BGR, Hannover, 2021")], }, "demandregio": { "title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " "zeitlichen Auflösung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", - "license": license_ccby("© FZJ, TUB, FfE"), + "license": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { "titel": "eGon-data", "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", - "licenses": license_agpl("© Jonathan Amme, Clara Büttner, Ilka Cußman, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte") + "licenses": [license_agpl("© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte")] }, "era5": { "title": "ERA5 global reanalysis", @@ -385,7 +385,7 @@ def sources(): "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " "for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", - "license": { + "license": [{ "name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", @@ -395,21 +395,21 @@ def sources(): "adaptation, modification and combination with other data and information; or any " "combination of the foregoing", "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", - }, + },] }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", "path": "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database", - "licenses": license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter"), + "licenses": [license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter")], }, "hotmaps_scen_buildings": { "titel": "scen_current_building_demand", "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario", "path": "https://gitlab.com/hotmaps/scen_current_building_demand", - "licenses": license_ccby( + "licenses": [license_ccby( "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller" - ), + )], }, "mastr": { "title": "open-MaStR power unit registry", @@ -418,9 +418,9 @@ def sources(): "There are duplicates included. For further information read in the documentation" "of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", "path": "https://sandbox.zenodo.org/record/808086", - "licenses": licenses_datenlizenz_deutschland( + "licenses": [licenses_datenlizenz_deutschland( "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" - ), + )], }, "nep2021": { "title": "Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf", @@ -433,21 +433,21 @@ def sources(): "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", - "license": license_ccby("© Übertragungsnetzbetreiber"), + "license": [license_ccby("© Übertragungsnetzbetreiber")], }, "openffe_gas": { "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " "More information at https://extremos.ffe.de/.", "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", - "license": license_ccby("© FfE, eXtremOS Project"), + "license": [license_ccby("© FfE, eXtremOS Project")], }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined" "spatial extent at ''referenceDate''", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", - "licenses": license_odbl("© OpenStreetMap contributors"), + "licenses": [license_odbl("© OpenStreetMap contributors")], }, "peta": { "title": "Pan-European Thermal Atlas, Peta version 5.0.1", @@ -461,9 +461,9 @@ def sources(): "For further information please see the documentation available on the Heat Roadmap Europe website, " "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", - "license": license_ccby( + "license": [license_ccby( "© Europa-Universität Flensburg, Halmstad University and Aalborg University" - ), + )], }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -472,14 +472,14 @@ def sources(): "for the estimation of NUTS-3 load shifting potential of suitable electrically powered industrial processes" "(cement milling, mechanical pulping, paper production, air separation).", "path": "https://zenodo.org/record/3613767", - "licenses": license_ccby("© 2019 Danielle Schmidt"), + "licenses": [license_ccby("© 2019 Danielle Schmidt")], }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data" "within main sectors: Chemical industry, Iron and steel, Non-ferrous metals, Non-metallic minerals, Paper and printing, and Refineries.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", - "licenses": license_ccby("© Europa-Universität Flensburg") + "licenses": [license_ccby("© Europa-Universität Flensburg")] }, "tyndp": { "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", @@ -490,7 +490,7 @@ def sources(): "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " "low carbon future is achieved.", "path": "https://tyndp.entsoe.eu/maps-data", - "license": license_ccby("© ENTSO-E and ENTSOG"), + "license": [license_ccby("© ENTSO-E and ENTSOG")], }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", @@ -500,10 +500,10 @@ def sources(): "Verwaltungseinheit sowie die spezifische Bezeichnung der " "Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", - "licenses": licenses_datenlizenz_deutschland( + "licenses": [licenses_datenlizenz_deutschland( "© Bundesamt für Kartographie und Geodäsie " "2020 (Daten verändert)" - ), + )], }, "zensus": { "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", @@ -512,8 +512,8 @@ def sources(): "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", - "license": licenses_datenlizenz_deutschland( + "license": [licenses_datenlizenz_deutschland( "© Statistische Ämter des Bundes und der Länder 2014" - ), + )], }, } From c14d16b5546d077100936ba89d803b8b27406b49 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 15:00:19 +0100 Subject: [PATCH 012/787] Add documentation to add_metadata --- src/egon/data/datasets/scenario_capacities.py | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 2a986a6d2..ecf3e1fdb 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -473,11 +473,20 @@ def insert_data_nep(): def add_metadata(): + """Add metdata to supply.egon_scenario_capacities + Returns + ------- + None. + + """ + + # Import column names and datatypes fields = pd.DataFrame( generate_resource_fields_from_sqla_model(EgonScenarioCapacities) ).set_index("name") + # Set descriptions and units fields.loc["index", "description"] = "Index" fields.loc[ "component", "description" @@ -492,6 +501,7 @@ def add_metadata(): "scenario_name", "description" ] = "Name of corresponding eGon scenario" + # Reformat pandas.DataFrame to dict fields = fields.reset_index().to_dict(orient="records") meta = { @@ -512,11 +522,13 @@ def add_metadata(): sources()["vg250"], sources()["zensus"], ], - "licenses": [license_ccby( - "© Übertragungsnetzbetreiber; " - "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " - "© Statistische Ämter des Bundes und der Länder 2014", - )], + "licenses": [ + license_ccby( + "© Übertragungsnetzbetreiber; " + "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " + "© Statistische Ämter des Bundes und der Länder 2014", + ) + ], "contributors": [ { "title": "Clara Büttner", @@ -543,11 +555,11 @@ def add_metadata(): ], "metaMetadata": meta_metadata(), } - with open('metadata_scenario_capacities.json', 'w') as outfile: - json.dump(meta, outfile, indent=4) + # Create json dump meta_json = "'" + json.dumps(meta) + "'" + # Add metadata as a comment to the table db.submit_comment( meta_json, EgonScenarioCapacities.__table__.schema, From 60d13a1decdae5cc611bb9c0aa6f5664497d09d7 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 13 Dec 2021 15:08:19 +0100 Subject: [PATCH 013/787] Add Scigrid_gas, Einspeiseatlas and pipepline_classification to sources dict --- src/egon/data/metadata.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 5a230a985..a876e7480 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -375,6 +375,16 @@ def sources(): "path": "https://github.com/openego/eGon-data", "licenses": [license_agpl("© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte")] }, + "Einspeiseatlas": { + "title": "Einspeiseatlas", + "description": "Im Einspeiseatlas finden sie sich die Informationen " + "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " + "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", + "path": "https://www.biogaspartner.de/einspeiseatlas/", + "license": license_ccby( + "Deutsche Energie-Agentur (dena, 2021)" + ), + }, "era5": { "title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate " @@ -465,6 +475,16 @@ def sources(): "© Europa-Universität Flensburg, Halmstad University and Aalborg University" )], }, + "pipeline_classification": { + "title": "Technical pipeline characteristics for high pressure pipelines", + "description": "Parameters for the classification of gas pipelines, " + "the whole documentation could is available at: " + "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", + "path": "https://zenodo.org/record/5743452", + "license": license_ccby( + "© DIW Berlin, 2017" + ), + }, "schmidt": { "title": "Supplementary material to the masters thesis: " "NUTS-3 Regionalization of Industrial Load Shifting Potential in Germany using a Time-Resolved Model", @@ -474,6 +494,18 @@ def sources(): "path": "https://zenodo.org/record/3613767", "licenses": [license_ccby("© 2019 Danielle Schmidt")], }, + "SciGRID_gas": { + "title": "SciGRID_gas IGGIELGN", + "description": "The SciGRID_gas dataset represents the European " + "gas transport network (pressure levels of 20 bars and higher) " + "including the geo-referenced transport pipelines, compressor " + "stations, LNG terminals, storage, production sites, gas power " + "plants, border points, and demand time series. ", + "path": "https://dx.doi.org/10.5281/zenodo.4896526", + "license": license_ccby( + " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + ), + }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data" From 626269999d65f7645f739ecd385077c65bb323bd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 16:47:03 +0100 Subject: [PATCH 014/787] Add egon-data to metadata soutces --- src/egon/data/datasets/scenario_capacities.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index ecf3e1fdb..50fa83cb8 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -521,12 +521,14 @@ def add_metadata(): sources()["nep2021"], sources()["vg250"], sources()["zensus"], + sources()["egon-data"], ], "licenses": [ license_ccby( "© Übertragungsnetzbetreiber; " "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " "© Statistische Ämter des Bundes und der Länder 2014", + "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", ) ], "contributors": [ From 68a9165d9a07d57d1a74edb666259ddeccbb6304 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 16:47:24 +0100 Subject: [PATCH 015/787] Update metadata --- .../data/datasets/heat_demand/__init__.py | 199 +++--------------- 1 file changed, 33 insertions(+), 166 deletions(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index 111ab168c..876d87c05 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -38,8 +38,16 @@ get_sector_parameters, ) import egon.data.config - -# import time +from egon.data.metadata import ( + context, + meta_metadata, + license_ccby, + sources, + generate_resource_fields_from_sqla_model, +) +import json +import time +import datetime # class for airflow task management (and version control) @@ -47,8 +55,7 @@ class HeatDemandImport(Dataset): def __init__(self, dependencies): super().__init__( name="heat-demands", - # version=self.target_files + "_0.0", - version="0.0.2", # maybe rethink the naming + version="0.0.3", dependencies=dependencies, tasks=(scenario_data_import), ) @@ -561,166 +568,26 @@ def add_metadata(): """ Writes metadata JSON string into table comment. - TODO - ---- - Meta data must be check and adjusted to the egon_data standard: - - Add context - - Meta data for Census Population Table must be added. - - Check how to reference the heat demand adjustment factors """ - - # Prepare variables - license_peta5_0_1 = [ - { - "name": "Creative Commons Attribution 4.0 International", - "title": "CC BY 4.0", - "path": "https://creativecommons.org/licenses/by/4.0/", - "instruction": ( - "You are free: To Share, To Adapt;" - " As long as you: Attribute!" - ), - "attribution": "© Flensburg, Halmstad and Aalborg universities", - } - ] - url_peta = ( - "https://s-eenergies-open-data-euf.hub.arcgis.com/search?" - "categories=seenergies_buildings" - ) - - url_geodatenzentrum = ( - "https://daten.gdz.bkg.bund.de/produkte/vg/" - "vg250_ebenen_0101/2020/vg250_01-01.geo84.shape." - "ebenen.zip" - ) - license_heat = [ - { - # this could be the license of "heat" - "name": "Creative Commons Attribution 4.0 International", - "title": "CC BY 4.0", - "path": "https://creativecommons.org/licenses/by/4.0/", - "instruction": ( - "You are free: To Share, To Adapt;" - " As long as you: Attribute!" - ), - "attribution": "© Europa-Universität Flensburg", # if all agree - } - ] - license_BKG = [ - { - "title": "Datenlizenz Deutschland – Namensnennung – Version 2.0", - "path": "www.govdata.de/dl-de/by-2-0", - "instruction": ( - "Jede Nutzung ist unter den Bedingungen dieser „Datenlizenz " - "Deutschland - Namensnennung - Version 2.0 zulässig.\nDie " - "bereitgestellten Daten und Metadaten dürfen für die " - "kommerzielle und nicht kommerzielle Nutzung insbesondere:" - "(1) vervielfältigt, ausgedruckt, präsentiert, verändert, " - "bearbeitet sowie an Dritte übermittelt werden;\n " - "(2) mit eigenen Daten und Daten Anderer zusammengeführt und " - "zu selbständigen neuen Datensätzen verbunden werden;\n " - "(3) in interne und externe Geschäftsprozesse, Produkte und " - "Anwendungen in öffentlichen und nicht öffentlichen " - "elektronischen Netzwerken eingebunden werden." - ), - "attribution": "© Bundesamt für Kartographie und Geodäsie", - } - ] - # Metadata creation meta = { "name": "egon_peta_heat_metadata", "title": "eGo_n scenario-specific future heat demand data", + "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Future heat demands per hectare grid cell of " "the residential and service sector", "language": ["EN"], + "context": context(), "spatial": { - "location": "", + "location": None, "extent": "Germany", "resolution": "100x100m", }, - "temporal": { - "referenceDate": "scenario-specific", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, - }, "sources": [ - { - # for Peta5_0_1 - "title": "Peta5_0_1_HD_res and Peta5 0 1 HD ser", - "description": "Der Datenbestand umfasst sämtliche " - "Verwaltungseinheiten aller hierarchischen " - "Verwaltungsebenen vom Staat bis zu den " - "Gemeinden mit ihren Verwaltungsgrenzen, " - "statistischen Schlüsselzahlen und dem " - "Namen der Verwaltungseinheit sowie der " - "spezifischen Bezeichnung der " - "Verwaltungsebene des jeweiligen " - "Bundeslandes.", - "path": url_peta, - "licenses": license_peta5_0_1, - }, - { - # for the vg250_sta_union used - Please check! - "title": "Dienstleistungszentrum des Bundes für " - "Geoinformation und Geodäsie - Open Data", - "description": "Dieser Datenbestand steht über " - "Geodatendienste gemäß " - "Geodatenzugangsgesetz (GeoZG) " - "(http://www.geodatenzentrum.de/auftrag/pdf" - "/geodatenzugangsgesetz.pdf) für die " - "kommerzielle und nicht kommerzielle " - "Nutzung geldleistungsfrei zum Download " - "und zur Online-Nutzung zur Verfügung. Die " - "Nutzung der Geodaten und Geodatendienste " - "wird durch die Verordnung zur Festlegung " - "der Nutzungsbestimmungen für die " - "Bereitstellung von Geodaten des Bundes " - "(GeoNutzV) (http://www.geodatenzentrum.de" - "/auftrag/pdf/geonutz.pdf) geregelt. " - "Insbesondere hat jeder Nutzer den " - "Quellenvermerk zu allen Geodaten, " - "Metadaten und Geodatendiensten erkennbar " - "und in optischem Zusammenhang zu " - "platzieren. Veränderungen, Bearbeitungen, " - "neue Gestaltungen oder sonstige " - "Abwandlungen sind mit einem " - "Veränderungshinweis im Quellenvermerk zu " - "versehen. Quellenvermerk und " - "Veränderungshinweis sind wie folgt zu " - "gestalten. Bei der Darstellung auf einer " - "Webseite ist der Quellenvermerk mit der " - "URL http://www.bkg.bund.de zu verlinken. " - "© GeoBasis-DE / BKG © GeoBasis-DE / BKG " - " " - "(Daten verändert) Beispiel: " - "© GeoBasis-DE / BKG 2013", - "path": url_geodatenzentrum, - "licenses": "Geodatenzugangsgesetz (GeoZG)", - "copyright": "© GeoBasis-DE / BKG 2016 (Daten verändert)", - }, - { - # for the vg250_sta_union used, too - Please check! - "title": "BKG - Verwaltungsgebiete 1:250.000 (vg250)", - "description": "Der Datenbestand umfasst sämtliche " - "Verwaltungseinheiten aller hierarchischen " - "Verwaltungsebenen vom Staat bis zu den " - "Gemeinden mit ihren Verwaltungsgrenzen, " - "statistischen Schlüsselzahlen und dem " - "Namen der Verwaltungseinheit sowie der " - "spezifischen Bezeichnung der " - "Verwaltungsebene des jeweiligen " - "Bundeslandes.", - "path": "http://www.bkg.bund.de", - "licenses": license_BKG, - }, + sources()["egon-data"], + sources()["peta"], + sources()["vg250"], + sources()["zensus"], ], "resources": [ { @@ -783,24 +650,24 @@ def add_metadata(): "dialect": {"delimiter": "none", "decimalSeparator": "."}, } ], - "licenses": license_heat, + "licenses": [license_ccby("© Europa-Universität Flensburg")], "contributors": [ { - "title": "Eva, Günni, Clara", - "email": "", - "date": "2021-03-04", - "object": "", - "comment": "Processed data", - } - ], - "metaMetadata": { # https://github.com/OpenEnergyPlatform/oemetadata - "metadataVersion": "OEP-1.4.0", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": ("https://creativecommons.org/publicdomain/zero/1.0/"), + "title": "EvaWie", + "email": "http://github.com/EvaWie", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", }, - }, + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Updated metadata", + }, + ], + "metaMetadata": meta_metadata(), } meta_json = "'" + json.dumps(meta) + "'" From 7545890cebb0522177147754e2b96631d6f41202 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 17:10:27 +0100 Subject: [PATCH 016/787] Add metadata to renewable_feedin --- src/egon/data/datasets/renewable_feedin.py | 115 ++++++++++++++++++++- 1 file changed, 112 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 7deaf566a..97178ecfa 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -8,16 +8,26 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.datasets.era5 import import_cutout +from egon.data.datasets.era5 import import_cutout, EgonRenewableFeedIn from egon.data.datasets.scenario_parameters import get_sector_parameters import egon.data.config +import time +import datetime +from egon.data.metadata import ( + context, + meta_metadata, + license_ccby, + sources, + generate_resource_fields_from_sqla_model, +) +import json class RenewableFeedin(Dataset): def __init__(self, dependencies): super().__init__( name="RenewableFeedin", - version="0.0.5", + version="0.0.6", dependencies=dependencies, tasks={wind, pv, solar_thermal, heat_pump_cop, wind_offshore}, ) @@ -124,7 +134,6 @@ def federal_states_per_weather_cell(): .set_index("w_id") ) - weather_cells = weather_cells.dropna(axis=0, subset=["federal_state"]) return weather_cells.to_crs(4326) @@ -539,3 +548,103 @@ def insert_feedin(data, carrier, weather_year): con=db.engine(), if_exists="append", ) + + +def add_metadata(): + """Add metdata to supply.egon_era5_renewable_feedin + + Returns + ------- + None. + + """ + + # Import column names and datatypes + fields = [ + { + "description": "Weather cell index", + "name": "w_id", + "type": "integer", + "unit": "none", + }, + { + "description": "Weather year", + "name": "weather_year", + "type": "integer", + "unit": "none", + }, + { + "description": "Energy carrier", + "name": "carrier", + "type": "string", + "unit": "none", + }, + { + "description": "Weather-dependent feedin timeseries", + "name": "feedin", + "type": "array", + "unit": "p.u.", + }, + ] + + meta = { + "name": "supply.egon_era5_renewable_feedin", + "title": "eGon feedin timeseries for RES", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Weather-dependent feedin timeseries for RES", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + ], + "licenses": [ + license_ccby( + "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " + "© Copernicus Climate Change Service (C3S) Climate Data Store " + "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", + ) + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_scenario_capacities", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Create json dump + meta_json = "'" + json.dumps(meta) + "'" + + # Add metadata as a comment to the table + db.submit_comment( + meta_json, + EgonRenewableFeedIn.__table__.schema, + EgonRenewableFeedIn.__table__.name, + ) From e04a3b1c469bfc85adef189fb2a2549353139dd8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 17:20:43 +0100 Subject: [PATCH 017/787] Update metadata for district_heating areas --- .../district_heating_areas/__init__.py | 132 +++++++----------- 1 file changed, 51 insertions(+), 81 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 339152765..82ebde10c 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -28,6 +28,15 @@ ) # for metadata creation +import time +import datetime +from egon.data.metadata import ( + context, + meta_metadata, + license_ccby, + sources, + generate_resource_fields_from_sqla_model, +) import json # import time @@ -45,7 +54,7 @@ def __init__(self, dependencies): super().__init__( name="district-heating-areas", # version=self.target_files + "_0.0", - version="0.0.1", # maybe rethink the naming + version="0.0.2", # maybe rethink the naming dependencies=dependencies, tasks=(create_tables, demarcation), ) @@ -687,29 +696,12 @@ def add_metadata(): """ Writes metadata JSON string into table comment. - TODO - ---- - - Meta data must be check and adjusted to the egon_data standard: - - Add context - - authors and institutions """ # Prepare variables license_district_heating_areas = [ - { - # this could be the license of the "district_heating_areas" - "name": "Creative Commons Attribution 4.0 International", - "title": "CC BY 4.0", - "path": "https://creativecommons.org/licenses/by/4.0/", - "instruction": ( - "You are free: To Share, To Adapt;" - " As long as you: Attribute!" - ), - "attribution": "© Europa-Universität Flensburg", # if all agree - # "attribution": "© ZNES Flensburg", # alternative - } + license_ccby("© Europa-Universität Flensburg") ] # Metadata creation for district heating areas (polygons) @@ -719,25 +711,14 @@ def add_metadata(): "description": "Modelled future district heating areas for " "the supply of residential and service-sector heat demands", "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), "spatial": {"location": "", "extent": "Germany", "resolution": ""}, - "temporal": { - "referenceDate": "scenario-specific", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, - }, "sources": [ - { - # eGon scenario specific heat demand distribution based - # on Peta5_0_1, using vg250 boundaries - }, - { - # Census gridded apartment data - }, + sources()["peta"], + sources()["egon-data"], + sources()["zensus"], + sources()["vg250"], ], "resources": [ { @@ -796,21 +777,21 @@ def add_metadata(): "licenses": license_district_heating_areas, "contributors": [ { - "title": "Eva, Clara", - "email": "", - "date": "2021-05-07", - "object": "", - "comment": "Processed data", - } - ], - "metaMetadata": { # https://github.com/OpenEnergyPlatform/oemetadata - "metadataVersion": "OEP-1.4.0", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": ("https://creativecommons.org/publicdomain/zero/1.0/"), + "title": "EvaWie", + "email": "http://github.com/EvaWie", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", }, - }, + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Updated metadata", + }, + ], + "metaMetadata": meta_metadata(), } meta_json = "'" + json.dumps(meta) + "'" @@ -824,25 +805,14 @@ def add_metadata(): " for supply of residential and service-sector heat demands" " assigned to zensus_population_ids", "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), "spatial": {"location": "", "extent": "Germany", "resolution": ""}, - "temporal": { - "referenceDate": "scenario-specific", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, - }, "sources": [ - { - # eGon scenario specific heat demand distribution based - # on Peta5_0_1, using vg250 boundaries - }, - { - # Census gridded apartment data - }, + sources()["peta"], + sources()["egon-data"], + sources()["zensus"], + sources()["vg250"], ], # Add the license for the map table "resources": [ @@ -897,21 +867,21 @@ def add_metadata(): "licenses": license_district_heating_areas, "contributors": [ { - "title": "Eva, Clara", - "email": "", - "date": "2021-05-07", - "object": "", - "comment": "Processed data", - } - ], - "metaMetadata": { # https://github.com/OpenEnergyPlatform/oemetadata - "metadataVersion": "OEP-1.4.0", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": ("https://creativecommons.org/publicdomain/zero/1.0/"), + "title": "EvaWie", + "email": "http://github.com/EvaWie", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", }, - }, + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Updated metadata", + }, + ], + "metaMetadata": meta_metadata(), } meta_json = "'" + json.dumps(meta) + "'" From 55ff8a2090a73545ea190fb2b15333b16a6ab6fd Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Mon, 13 Dec 2021 17:22:11 +0100 Subject: [PATCH 018/787] Define method to retrieve etrago table metadata - Add pypsa requirement - Create a pypsa network and read the component metadata - Add comment on egon_etrago table creation with the respective metadata --- setup.py | 1 + src/egon/data/datasets/etrago_setup.py | 108 +++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 2c104098d..491c6e843 100755 --- a/setup.py +++ b/setup.py @@ -97,6 +97,7 @@ def read(*names, **kwargs): "pandas>1.2.0", "psycopg2", "pyaml", + "pypsa==0.17.1", "rasterio", "rtree", "sqlalchemy<1.4", diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 669b32ef3..84b798e4d 100644 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -1,4 +1,7 @@ # coding: utf-8 +import datetime +import json + from geoalchemy2.types import Geometry from shapely.geometry import LineString from sqlalchemy import ( @@ -12,16 +15,99 @@ Numeric, String, Text, + schema, #??? ) from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd +import pandas as pd +import pypsa from egon.data import db from egon.data.datasets import Dataset +from egon.data.metadata import ( + context, + generate_resource_fields_from_sqla_model, + license_ccby, + meta_metadata, + sources, +) Base = declarative_base() metadata = Base.metadata +network = pypsa.Network() + + +def get_pypsa_field_descriptors(component): + + ident = component.lower() + "_id" + + data = network.component_attrs[component].rename({"name": ident}) + data.loc[ident, "type"] = "int" + data.loc["scn_name"] = [ + "string", + "n/a", + "n/a", + "Name of the eGon scenario", + "Input", + ] + + return data + + +def get_meta( + schema, component, source_list=[], license_list=[], contributor_list=[] +): + + table = "egon_etrago_" + component.lower() + fields = ( + get_pypsa_field_descriptors(component) + .reset_index() + .to_dict(orient="records") + ) + # geometry column still missing + + meta = { + "name": schema + "." + table, + "title": component, + "id": "WILL_BE_SET_AT_PUBLICATION", + # no automatic description? PyPSA descriptions do not quite fit our + # scope + "description": "TODO", + "language": ["en-EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": source_list, + "licenses": license_list, + "contributors": contributor_list, + "resources": [ + { + "profile": "tabular-data-resource", + "name": schema + "." + table, + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["scn_name", component.lower() + "_id"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Create json dump + meta_json = "'" + json.dumps(meta, indent=4) + "'" + + return meta_json + class EtragoSetup(Dataset): def __init__(self, dependencies): @@ -35,7 +121,7 @@ def __init__(self, dependencies): class EgonPfHvBus(Base): __tablename__ = "egon_etrago_bus" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Bus")} scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -61,7 +147,10 @@ class EgonPfHvBusTimeseries(Base): class EgonPfHvGenerator(Base): __tablename__ = "egon_etrago_generator" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta("grid", "Generator"), + } scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(BigInteger, primary_key=True, nullable=False) @@ -110,7 +199,7 @@ class EgonPfHvGeneratorTimeseries(Base): class EgonPfHvLine(Base): __tablename__ = "egon_etrago_line" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Line")} scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -151,7 +240,7 @@ class EgonPfHvLineTimeseries(Base): class EgonPfHvLink(Base): __tablename__ = "egon_etrago_link" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Link")} scn_name = Column(String, primary_key=True, nullable=False) link_id = Column(BigInteger, primary_key=True, nullable=False) @@ -191,7 +280,7 @@ class EgonPfHvLinkTimeseries(Base): class EgonPfHvLoad(Base): __tablename__ = "egon_etrago_load" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Load")} scn_name = Column(String, primary_key=True, nullable=False) load_id = Column(BigInteger, primary_key=True, nullable=False) @@ -227,7 +316,7 @@ class EgonPfHvCarrier(Base): class EgonPfHvStorage(Base): __tablename__ = "egon_etrago_storage" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Storage")} scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) @@ -274,7 +363,7 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): __tablename__ = "egon_etrago_store" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Store")} scn_name = Column(String, primary_key=True, nullable=False) store_id = Column(BigInteger, primary_key=True, nullable=False) @@ -323,7 +412,10 @@ class EgonPfHvTempResolution(Base): class EgonPfHvTransformer(Base): __tablename__ = "egon_etrago_transformer" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta("grid", "Transformer"), + } scn_name = Column(String, primary_key=True, nullable=False) trafo_id = Column(BigInteger, primary_key=True, nullable=False) From 775cd544fef99060ed154f8dc79a65ce4a7aeb36 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Dec 2021 17:41:53 +0100 Subject: [PATCH 019/787] Add metadata for zenszs map vg250 --- src/egon/data/datasets/zensus_vg250.py | 124 ++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/zensus_vg250.py b/src/egon/data/datasets/zensus_vg250.py index dc429ce80..b4234c01e 100644 --- a/src/egon/data/datasets/zensus_vg250.py +++ b/src/egon/data/datasets/zensus_vg250.py @@ -7,12 +7,33 @@ from egon.data import db from egon.data.datasets import Dataset from egon.data.datasets.vg250 import vg250_metadata_resources_fields -from egon.data.metadata import (context, licenses_datenlizenz_deutschland, - meta_metadata) +from egon.data.metadata import ( + context, + licenses_datenlizenz_deutschland, + meta_metadata, +) from geoalchemy2 import Geometry -from sqlalchemy import (BigInteger, Column, Float, Integer, SmallInteger, - String, func, select) +from sqlalchemy import ( + BigInteger, + Column, + Float, + Integer, + SmallInteger, + String, + func, + select, +) from sqlalchemy.ext.declarative import declarative_base +import time +import datetime +from egon.data.metadata import ( + context, + meta_metadata, + license_ccby, + sources, + generate_resource_fields_from_sqla_model, +) +import json Base = declarative_base() @@ -21,7 +42,7 @@ class ZensusVg250(Dataset): def __init__(self, dependencies): super().__init__( name="ZensusVg250", - version="0.0.2", + version="0.0.3", dependencies=dependencies, tasks=( map_zensus_vg250, @@ -29,6 +50,7 @@ def __init__(self, dependencies): add_metadata_zensus_inside_ger, population_in_municipalities, add_metadata_vg250_gem_pop, + add_metadata_vg250_zensus, ), ) @@ -639,3 +661,95 @@ def add_metadata_vg250_gem_pop(): Vg250GemPopulation.__table__.schema, Vg250GemPopulation.__table__.name, ) + + +def add_metadata_vg250_zensus(): + # Import column names and datatypes + fields = [ + { + "name": "zensus_population_id", + "description": "Index of zensus population cell", + "type": "integer", + "unit": "none", + }, + { + "name": "zensus_geom", + "description": "Gemetry of zensus cell", + "type": "geometry(point,3035)", + "unit": "none", + }, + { + "name": "vg250_municipality_id", + "description": "Index of municipality", + "type": "integer", + "unit": "none", + }, + { + "name": "vg250_nuts3", + "description": "NUTS3 region-code", + "type": "varchar", + "unit": "none", + }, + ] + + meta = { + "name": "boundaries.egon_map_zensus_vg250", + "title": "eGon feedin timeseries for RES", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Weather-dependent feedin timeseries for RES", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": "100mx100m", + }, + "sources": [ + sources()["zensus"], + sources()["vg250"], + sources()["egon-data"], + ], + "licenses": [ + license_ccby( + "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " + "© Statistische Ämter des Bundes und der Länder 2014 " + "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", + ) + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Added metadata", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "boundaries.egon_map_zensus_vg250", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Create json dump + meta_json = "'" + json.dumps(meta) + "'" + + # Add metadata as a comment to the table + db.submit_comment( + meta_json, + MapZensusVg250.__table__.schema, + MapZensusVg250.__table__.name, + ) From edee1f0b6f686d6701e834086fea75a039902638 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Tue, 14 Dec 2021 15:54:37 +0100 Subject: [PATCH 020/787] Add Storage key to components dict --- src/egon/data/datasets/etrago_setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 84b798e4d..abaf33f1b 100644 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -36,6 +36,8 @@ metadata = Base.metadata network = pypsa.Network() +# add Storage key (called StorageUnit in PyPSA) +network.component_attrs['Storage'] = network.component_attrs['StorageUnit'] def get_pypsa_field_descriptors(component): @@ -56,7 +58,7 @@ def get_pypsa_field_descriptors(component): def get_meta( - schema, component, source_list=[], license_list=[], contributor_list=[] + schema, component, description='TODO', source_list=[], license_list=[], contributor_list=[] ): table = "egon_etrago_" + component.lower() @@ -73,7 +75,7 @@ def get_meta( "id": "WILL_BE_SET_AT_PUBLICATION", # no automatic description? PyPSA descriptions do not quite fit our # scope - "description": "TODO", + "description": description, "language": ["en-EN"], "publicationDate": datetime.date.today().isoformat(), "context": context(), From 46a1605c70e6587f1ce8cd6816c32c0b066e589a Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Wed, 15 Dec 2021 07:46:24 +0100 Subject: [PATCH 021/787] Add contributor dict with example usage Similar to the sources dict in metadata.py I added a contributor dict, so full name and github handle are easily accesible. Import the contributors to add them to the metadata. It is possible to update the dict according to the work done in the respective section. Might need a .copy() to not manipulate the original dict, I am not sure however. --- src/egon/data/datasets/etrago_setup.py | 17 ++++++++ src/egon/data/metadata.py | 57 +++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index abaf33f1b..b21428935 100644 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -30,6 +30,7 @@ license_ccby, meta_metadata, sources, + contributors ) Base = declarative_base() @@ -364,6 +365,22 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): + so = sources() + source_list = [ + so['bgr_inspee'], so['bgr_inspeeds'], so['bgr_inspeeds_data_bundle'], + so['bgr_inspeeds_data_bundle'], so['bgr_inspeeds_report'] + ] + co = contributors() + contributor_list = [ + co['an'].update( + {"comment": "Add CH4 storage"} + ), + co['fw'].update( + {"comment": "Add H2 storage"} + ), + ] + li = contributors() + license_list = [] __tablename__ = "egon_etrago_store" __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Store")} diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index a876e7480..794181562 100644 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,3 +1,5 @@ +import time + from egon.data.db import engine from geoalchemy2 import Geometry from sqlalchemy import MetaData, Table @@ -345,7 +347,7 @@ def sources(): "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", - "description": "The data-bundle provides the shapefiles corresponding to the data provided in figure 7-1 " + "description": "Shapefiles corresponding to the data provided in figure 7-1 " "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state " " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", @@ -549,3 +551,56 @@ def sources(): )], }, } + + +def contributors(): + return { + "am": { + "title": "Aadit Malla", + "email": "https://github.com/aadit879", + }, + "an": { + "title": "Amélia Nadal", + "email": "https://github.com/AmeliaNadal", + }, + "cb": { + "title": "Clara Büttner", + "email": "https://github.com/ClaraBuettner", + }, + "ce": { + "title": "Carlos Epia", + "email": "https://github.com/CarlosEpia", + }, + "fw": { + "title": "Francesco Witte", + "email": "https://github.com/fwitte", + }, + "gp": { + "title": "Guido Pleßmann", + "email": "https://github.com/gplssm", + }, + "ik": { + "title": "Ilka Cußmann", + "email": "https://github.com/IlkaCu", + }, + "ja": { + "title": "Jonathan Amme", + "email": "https://github.com/nesnoj", + }, + "je": { + "title": "Jane Doe", + "email": "https://github.com/JaneDoe", + }, + "ke": { + "title": "Katharina Esterl", + "email": "https://github.com/KathiEsterl", + }, + "sg": { + "title": "Stephan Günther", + "email": "https://github.com/gnn", + }, + "um": { + "title": "Ulf Müller", + "email": "https://github.com/ulfmueller", + }, + } \ No newline at end of file From 95247fe4e7d602e685a0ab6b16e92ad3255e3d40 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Wed, 19 Jan 2022 08:07:37 +0100 Subject: [PATCH 022/787] Fix example usage --- src/egon/data/datasets/etrago_setup.py | 36 ++++++++++++++------------ 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index b21428935..69c583895 100644 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -59,7 +59,7 @@ def get_pypsa_field_descriptors(component): def get_meta( - schema, component, description='TODO', source_list=[], license_list=[], contributor_list=[] + schema, component, description="TODO", source_list=[], license_list=[], contributor_list=[] ): table = "egon_etrago_" + component.lower() @@ -365,24 +365,28 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): - so = sources() + source_dict = sources() source_list = [ - so['bgr_inspee'], so['bgr_inspeeds'], so['bgr_inspeeds_data_bundle'], - so['bgr_inspeeds_data_bundle'], so['bgr_inspeeds_report'] + source_dict['bgr_inspee'], source_dict['bgr_inspeeds'], + source_dict['bgr_inspeeds_data_bundle'], + source_dict['bgr_inspeeds_data_bundle'], + source_dict['bgr_inspeeds_report'] ] - co = contributors() + contributors_dict = contributors() contributor_list = [ - co['an'].update( - {"comment": "Add CH4 storage"} - ), - co['fw'].update( - {"comment": "Add H2 storage"} - ), + {key: value for key, value in contributors_dict[author]} + for author in ["an", "fw"] ] - li = contributors() - license_list = [] + + contributor_list[0]["comment"] = "Add H2 storage" + contributor_list[1]["comment"] = "Add CH4 storage" + license_list = [data["license"] for data in source_list] __tablename__ = "egon_etrago_store" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Store")} + __table_args__ = { + "schema": "grid", "comment": get_meta( + "grid", "Store", source_list, license_list, contributor_list + ) + } scn_name = Column(String, primary_key=True, nullable=False) store_id = Column(BigInteger, primary_key=True, nullable=False) @@ -471,12 +475,12 @@ class EgonPfHvTransformerTimeseries(Base): trafo_id = Column(BigInteger, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) s_max_pu = Column(ARRAY(Float(precision=53))) - + class EgonPfHvBusmap(Base): __tablename__ = "egon_etrago_hv_busmap" __table_args__ = {"schema": "grid"} - + scn_name = Column(Text, primary_key=True, nullable=False) bus0 = Column(Text, primary_key=True, nullable=False) bus1 = Column(Text, primary_key=True, nullable=False) From 7dbf30d2d5c7fac43987d91282210ca023985ca7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 26 Jan 2023 10:49:55 +0100 Subject: [PATCH 023/787] Add pipeline for status quo model --- .../data/airflow/dags/pipeline_status_quo.py | 397 ++++++++++++++++++ 1 file changed, 397 insertions(+) create mode 100755 src/egon/data/airflow/dags/pipeline_status_quo.py diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py new file mode 100755 index 000000000..bf331985b --- /dev/null +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -0,0 +1,397 @@ +import os + +from airflow.utils.dates import days_ago +import airflow + +from egon.data.config import set_numexpr_threads +from egon.data.datasets import database +from egon.data.datasets.calculate_dlr import Calculate_dlr +from egon.data.datasets.ch4_prod import CH4Production +from egon.data.datasets.ch4_storages import CH4Storages +from egon.data.datasets.chp import Chp +from egon.data.datasets.chp_etrago import ChpEtrago +from egon.data.datasets.data_bundle import DataBundle +from egon.data.datasets.demandregio import DemandRegio +from egon.data.datasets.district_heating_areas import DistrictHeatingAreas +from egon.data.datasets.DSM_cts_ind import DsmPotential +from egon.data.datasets.electrical_neighbours import ElectricalNeighbours +from egon.data.datasets.electricity_demand import ( + CtsElectricityDemand, + HouseholdElectricityDemand, +) +from egon.data.datasets.electricity_demand_etrago import ElectricalLoadEtrago +from egon.data.datasets.electricity_demand_timeseries import ( + hh_buildings, + hh_profiles, +) +from egon.data.datasets.electricity_demand_timeseries.cts_buildings import ( + CtsDemandBuildings, +) +from egon.data.datasets.emobility.heavy_duty_transport import ( + HeavyDutyTransport, +) +from egon.data.datasets.emobility.motorized_individual_travel import ( + MotorizedIndividualTravel, +) +from egon.data.datasets.emobility.motorized_individual_travel_charging_infrastructure import ( # noqa: E501 + MITChargingInfrastructure, +) +from egon.data.datasets.era5 import WeatherData +from egon.data.datasets.etrago_setup import EtragoSetup +from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen +from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks +from egon.data.datasets.gas_areas import GasAreaseGon100RE, GasAreaseGon2035 +from egon.data.datasets.gas_grid import GasNodesandPipes +from egon.data.datasets.gas_neighbours import GasNeighbours +from egon.data.datasets.heat_demand import HeatDemandImport +from egon.data.datasets.heat_demand_europe import HeatDemandEurope +from egon.data.datasets.heat_demand_timeseries import HeatTimeSeries +from egon.data.datasets.heat_etrago import HeatEtrago +from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable +from egon.data.datasets.heat_supply import HeatSupply +from egon.data.datasets.hydrogen_etrago import ( + HydrogenBusEtrago, + HydrogenGridEtrago, + HydrogenMethaneLinkEtrago, + HydrogenPowerLinkEtrago, + HydrogenStoreEtrago, +) +from egon.data.datasets.industrial_gas_demand import ( + IndustrialGasDemand, + IndustrialGasDemandeGon100RE, + IndustrialGasDemandeGon2035, +) +from egon.data.datasets.industrial_sites import MergeIndustrialSites +from egon.data.datasets.industry import IndustrialDemandCurves +from egon.data.datasets.loadarea import LoadArea, OsmLanduse +from egon.data.datasets.mastr import mastr_data_setup +from egon.data.datasets.mv_grid_districts import mv_grid_districts_setup +from egon.data.datasets.osm import OpenStreetMap +from egon.data.datasets.osm_buildings_streets import OsmBuildingsStreets +from egon.data.datasets.osmtgmod import Osmtgmod +from egon.data.datasets.power_etrago import OpenCycleGasTurbineEtrago +from egon.data.datasets.power_plants import PowerPlants +from egon.data.datasets.pypsaeursec import PypsaEurSec +from egon.data.datasets.re_potential_areas import re_potential_area_setup +from egon.data.datasets.renewable_feedin import RenewableFeedin +from egon.data.datasets.saltcavern import SaltcavernData +from egon.data.datasets.sanity_checks import SanityChecks +from egon.data.datasets.scenario_capacities import ScenarioCapacities +from egon.data.datasets.scenario_parameters import ScenarioParameters +from egon.data.datasets.society_prognosis import SocietyPrognosis +from egon.data.datasets.storages import Storages +from egon.data.datasets.storages_etrago import StorageEtrago +from egon.data.datasets.substation import SubstationExtraction +from egon.data.datasets.substation_voronoi import SubstationVoronoi +from egon.data.datasets.tyndp import Tyndp +from egon.data.datasets.vg250 import Vg250 +from egon.data.datasets.vg250_mv_grid_districts import Vg250MvGridDistricts +from egon.data.datasets.zensus import ZensusMiscellaneous, ZensusPopulation +from egon.data.datasets.zensus_mv_grid_districts import ZensusMvGridDistricts +from egon.data.datasets.zensus_vg250 import ZensusVg250 + +# Set number of threads used by numpy and pandas +set_numexpr_threads() + +with airflow.DAG( + "powerd-status-quo-processing-pipeline", + description="The PoWerD Status Quo data processing DAG.", + default_args={"start_date": days_ago(1)}, + template_searchpath=[ + os.path.abspath( + os.path.join( + os.path.dirname(__file__), "..", "..", "processing", "vg250" + ) + ) + ], + is_paused_upon_creation=False, + schedule_interval=None, +) as pipeline: + + tasks = pipeline.task_dict + + setup = database.Setup() + + osm = OpenStreetMap(dependencies=[setup]) + + data_bundle = DataBundle(dependencies=[setup]) + + # Import VG250 (Verwaltungsgebiete 250) data + vg250 = Vg250(dependencies=[setup]) + + # Scenario table + scenario_parameters = ScenarioParameters(dependencies=[setup]) + + # Download TYNDP data + tyndp_data = Tyndp(dependencies=[setup]) + + # Import zensus population + zensus_population = ZensusPopulation(dependencies=[setup, vg250]) + + # Combine zensus and VG250 data + zensus_vg250 = ZensusVg250(dependencies=[vg250, zensus_population]) + + # Download and import zensus data on households, buildings and apartments + zensus_miscellaneous = ZensusMiscellaneous( + dependencies=[zensus_population, zensus_vg250] + ) + + # Import DemandRegio data + demandregio = DemandRegio( + dependencies=[data_bundle, scenario_parameters, setup, vg250] + ) + + # OSM (OpenStreetMap) buildings, streets and amenities + osm_buildings_streets = OsmBuildingsStreets( + dependencies=[osm, zensus_miscellaneous] + ) + + # Import weather data + weather_data = WeatherData( + dependencies=[scenario_parameters, setup, vg250] + ) + + # Future national heat demands for foreign countries based on Hotmaps + # download only, processing in PyPSA-Eur-Sec fork + hd_abroad = HeatDemandEurope(dependencies=[setup]) + + # Set eTraGo input tables + setup_etrago = EtragoSetup(dependencies=[setup]) + + substation_extraction = SubstationExtraction(dependencies=[osm, vg250]) + + # Generate the osmTGmod ehv/hv grid model + osmtgmod = Osmtgmod( + dependencies=[ + scenario_parameters, + setup_etrago, + substation_extraction, + tasks["osm.download"], + ] + ) + + # Fix eHV subnetworks in Germany manually + fix_subnetworks = FixEhvSubnetworks(dependencies=[osmtgmod]) + + # Retrieve MaStR (Marktstammdatenregister) data + mastr_data = mastr_data_setup(dependencies=[setup]) + + # Create Voronoi polygons + substation_voronoi = SubstationVoronoi( + dependencies=[tasks["osmtgmod.substation.extract"], vg250] + ) + + # MV (medium voltage) grid districts + mv_grid_districts = mv_grid_districts_setup( + dependencies=[substation_voronoi] + ) + + # Import potential areas for wind onshore and ground-mounted PV + re_potential_areas = re_potential_area_setup( + dependencies=[data_bundle, setup] + ) + + # Calculate future heat demand based on Peta5_0_1 data + heat_demand_Germany = HeatDemandImport( + dependencies=[scenario_parameters, vg250, zensus_vg250] + ) + + # Extract landuse areas from the `osm` dataset + osm_landuse = OsmLanduse(dependencies=[osm, vg250]) + + # Calculate feedin from renewables + renewable_feedin = RenewableFeedin( + dependencies=[vg250, zensus_vg250, weather_data] + ) + + # Demarcate district heating areas + district_heating_areas = DistrictHeatingAreas( + dependencies=[ + heat_demand_Germany, + scenario_parameters, + zensus_miscellaneous, + ] + ) + + # TODO: What does "trans" stand for? + # Calculate dynamic line rating for HV (high voltage) trans lines + dlr = Calculate_dlr( + dependencies=[data_bundle, osmtgmod, weather_data, fix_subnetworks] + ) + + # Map zensus grid districts + zensus_mv_grid_districts = ZensusMvGridDistricts( + dependencies=[mv_grid_districts, zensus_population] + ) + + # Map federal states to mv_grid_districts + vg250_mv_grid_districts = Vg250MvGridDistricts( + dependencies=[mv_grid_districts, vg250] + ) + + # Create household demand profiles on zensus level + hh_demand_profiles_setup = hh_profiles.HouseholdDemands( + dependencies=[ + demandregio, + tasks[ + "osm_buildings_streets" + ".create-buildings-residential-zensus-mapping" + ], + vg250, + zensus_miscellaneous, + zensus_mv_grid_districts, + zensus_vg250, + ] + ) + + # Household electricity demand buildings + hh_demand_buildings_setup = hh_buildings.setup( + dependencies=[ + tasks[ + "electricity_demand_timeseries" + ".hh_profiles" + ".houseprofiles-in-census-cells" + ] + ] + ) + + # Get household electrical demands for cencus cells + household_electricity_demand_annual = HouseholdElectricityDemand( + dependencies=[ + tasks[ + "electricity_demand_timeseries" + ".hh_buildings" + ".map-houseprofiles-to-buildings" + ] + ] + ) + + # Distribute electrical CTS demands to zensus grid + cts_electricity_demand_annual = CtsElectricityDemand( + dependencies=[ + demandregio, + heat_demand_Germany, + # household_electricity_demand_annual, + tasks["electricity_demand.create-tables"], + tasks["etrago_setup.create-tables"], + zensus_mv_grid_districts, + zensus_vg250, + ] + ) + + # Industry + industrial_sites = MergeIndustrialSites( + dependencies=[data_bundle, setup, vg250] + ) + demand_curves_industry = IndustrialDemandCurves( + dependencies=[ + demandregio, + industrial_sites, + osm_landuse, + mv_grid_districts, + osm, + ] + ) + + # Electrical loads to eTraGo + electrical_load_etrago = ElectricalLoadEtrago( + dependencies=[ + cts_electricity_demand_annual, + demand_curves_industry, + hh_demand_buildings_setup, + ] + ) + + + # run pypsa-eur-sec + run_pypsaeursec = PypsaEurSec( + dependencies=[ + weather_data, + hd_abroad, + osmtgmod, + setup_etrago, + data_bundle, + electrical_load_etrago, + ] + ) + + # Deal with electrical neighbours + foreign_lines = ElectricalNeighbours( + dependencies=[run_pypsaeursec, tyndp_data] + ) + + # Import NEP (Netzentwicklungsplan) data + scenario_capacities = ScenarioCapacities( + dependencies=[ + data_bundle, + run_pypsaeursec, + setup, + vg250, + zensus_population, + ] + ) + + # CHP locations + chp = Chp( + dependencies=[ + demand_curves_industry, + district_heating_areas, + industrial_sites, + osm_landuse, + mastr_data, + mv_grid_districts, + scenario_capacities, + ] + ) + + # Power plants + power_plants = PowerPlants( + dependencies=[ + chp, + cts_electricity_demand_annual, + household_electricity_demand_annual, + mastr_data, + mv_grid_districts, + re_potential_areas, + renewable_feedin, + scenario_capacities, + scenario_parameters, + setup, + substation_extraction, + tasks["etrago_setup.create-tables"], + vg250_mv_grid_districts, + zensus_mv_grid_districts, + ] + ) + + create_ocgt = OpenCycleGasTurbineEtrago( + dependencies=[power_plants] + ) + + # Fill eTraGo generators tables + fill_etrago_generators = Egon_etrago_gen( + dependencies=[power_plants, weather_data] + ) + + + # Pumped hydro units + pumped_hydro = Storages( + dependencies=[ + mastr_data, + mv_grid_districts, + power_plants, + scenario_capacities, + scenario_parameters, + setup, + vg250_mv_grid_districts, + ] + ) + + # CHP to eTraGo + chp_etrago = ChpEtrago(dependencies=[chp]) + + # Storages to eTraGo + storage_etrago = StorageEtrago( + dependencies=[pumped_hydro, scenario_parameters, setup_etrago] + ) + From be10d66fafc1848faa9b8e40ddbe1233c94bfb0e Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 9 Feb 2023 11:08:16 +0100 Subject: [PATCH 024/787] add historical status quo scenario --- src/egon/data/datasets/scenario_parameters/parameters.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 6bde24d73..9e4a73b28 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -125,6 +125,11 @@ def global_settings(scenario): "weather_year": 2011, "population_year": 2021, } + elif scenario == "SQ2015_hist": + parameters = { + "weather_year": 2015, + "population_year": 2015, + } else: print(f"Scenario name {scenario} is not valid.") From f3f6c91d34f68d00ea3d9efe0a8cb90624d4cf9e Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 9 Feb 2023 12:16:43 +0100 Subject: [PATCH 025/787] insert SQ2015_hist scenario --- src/egon/data/datasets/demandregio/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 6d8ff5810..d9f132283 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -433,7 +433,7 @@ def disagg_households_power( ) # Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario - if scenario in ["eGon2021", "eGon2035"]: + if scenario in ["SQ2015_hist", "eGon2021", "eGon2035"]: # chose demand per household size from survey including weighted DHW power_per_HH = demand_per_hh_size["weighted DWH"] / 1e3 @@ -600,7 +600,7 @@ def insert_household_demand(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in ["eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["SQ2015_hist", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] @@ -629,7 +629,7 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in ["eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["SQ2015_hist", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] From 6ea328743e467db687d79ae78228bd9b8eca6953 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 9 Feb 2023 12:22:13 +0100 Subject: [PATCH 026/787] reducing pipeline and adding a new specific datasets_sq20215.yml file with a differing osm-file download --- .../data/airflow/dags/pipeline_status_quo.py | 21 - src/egon/data/datasets_sq2015.yml | 1234 +++++++++++++++++ 2 files changed, 1234 insertions(+), 21 deletions(-) create mode 100644 src/egon/data/datasets_sq2015.yml diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index bf331985b..27787bf40 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -72,11 +72,9 @@ from egon.data.datasets.power_etrago import OpenCycleGasTurbineEtrago from egon.data.datasets.power_plants import PowerPlants from egon.data.datasets.pypsaeursec import PypsaEurSec -from egon.data.datasets.re_potential_areas import re_potential_area_setup from egon.data.datasets.renewable_feedin import RenewableFeedin from egon.data.datasets.saltcavern import SaltcavernData from egon.data.datasets.sanity_checks import SanityChecks -from egon.data.datasets.scenario_capacities import ScenarioCapacities from egon.data.datasets.scenario_parameters import ScenarioParameters from egon.data.datasets.society_prognosis import SocietyPrognosis from egon.data.datasets.storages import Storages @@ -186,11 +184,6 @@ dependencies=[substation_voronoi] ) - # Import potential areas for wind onshore and ground-mounted PV - re_potential_areas = re_potential_area_setup( - dependencies=[data_bundle, setup] - ) - # Calculate future heat demand based on Peta5_0_1 data heat_demand_Germany = HeatDemandImport( dependencies=[scenario_parameters, vg250, zensus_vg250] @@ -320,16 +313,6 @@ dependencies=[run_pypsaeursec, tyndp_data] ) - # Import NEP (Netzentwicklungsplan) data - scenario_capacities = ScenarioCapacities( - dependencies=[ - data_bundle, - run_pypsaeursec, - setup, - vg250, - zensus_population, - ] - ) # CHP locations chp = Chp( @@ -340,7 +323,6 @@ osm_landuse, mastr_data, mv_grid_districts, - scenario_capacities, ] ) @@ -352,9 +334,7 @@ household_electricity_demand_annual, mastr_data, mv_grid_districts, - re_potential_areas, renewable_feedin, - scenario_capacities, scenario_parameters, setup, substation_extraction, @@ -380,7 +360,6 @@ mastr_data, mv_grid_districts, power_plants, - scenario_capacities, scenario_parameters, setup, vg250_mv_grid_districts, diff --git a/src/egon/data/datasets_sq2015.yml b/src/egon/data/datasets_sq2015.yml new file mode 100644 index 000000000..035d04e0c --- /dev/null +++ b/src/egon/data/datasets_sq2015.yml @@ -0,0 +1,1234 @@ +openstreetmap: + original_data: + source: + url: "https://download.geofabrik.de/europe/germany-160101.osm.pbf" + url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-160101.osm.pbf" + stylefile: "oedb.style" + target: + table_prefix: "osm" + file: "germany-160101.osm.pbf" + file_testmode: "schleswig-holstein-160101.osm.pbf" + processed: + schema: "openstreetmap" + tables: + - "osm_line" + - "osm_nodes" + - "osm_point" + - "osm_polygon" + - "osm_rels" + - "osm_roads" + - "osm_ways" +vg250: + original_data: + source: + url: "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip" + target: + file: "vg250_01-01.geo84.shape.ebenen.zip" + processed: + schema: "boundaries" + file_table_map: + "VG250_STA.shp": "vg250_sta" + "VG250_LAN.shp": "vg250_lan" + "VG250_RBZ.shp": "vg250_rbz" + "VG250_KRS.shp": "vg250_krs" + "VG250_VWG.shp": "vg250_vwg" + "VG250_GEM.shp": "vg250_gem" + +bgr: + processed: + schema: "boundaries" + file_table_map: + "Potenzialbewertung_InSpEE_InSpEE_DS.shp": "inspee_saltstructures" + sources: + vg250_federal_states: + schema: 'boundaries' + table: 'vg250_lan' + saltcaverns: + schema: 'boundaries' + table: 'inspee_saltstructures' + targets: + storage_potential: + schema: 'grid' + table: 'egon_saltstructures_storage_potential' + +zensus_population: + original_data: + source: + url: "https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Bevoelkerung_100m_Gitter.zip?__blob=publicationFile&v=3" + target: + file: "csv_Bevoelkerung_100m_Gitter.zip" + processed: + schema: "society" + table: "destatis_zensus_population_per_ha" +zensus_misc: + original_data: + source: + url: + - "https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Haushalte_100m_Gitter.zip?__blob=publicationFile&v=2" + - "https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Gebaeude_100m_Gitter.zip?__blob=publicationFile&v=2" + - "https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Wohnungen_100m_Gitter.zip?__blob=publicationFile&v=5" + processed: + schema: "society" + file_table_map: + "csv_Haushalte_100m_Gitter.zip": "egon_destatis_zensus_household_per_ha" + "csv_Gebaeude_100m_Gitter.zip": "egon_destatis_zensus_building_per_ha" + "csv_Wohnungen_100m_Gitter.zip": "egon_destatis_zensus_apartment_per_ha" + +map_zensus_vg250: + sources: + zensus_population: + schema: 'society' + table: 'destatis_zensus_population_per_ha' + vg250_municipalities: + schema: 'boundaries' + table: 'vg250_gem' + targets: + map: + schema: 'boundaries' + table: 'egon_map_zensus_vg250' + +demandregio_installation: + sources: + git-repository: "https://github.com/openego/disaggregator.git" + branch: "features/pip_install" + targets: + path: 'demandregio-disaggregator' + +demandregio_society: + sources: + disaggregator: + path: 'demandregio-disaggregator' + vg250_krs: + schema: 'boundaries' + table: 'vg250_krs' + scenarios: + schema: 'scenario' + table: 'egon_scenario_parameters' + targets: + population: + schema: 'society' + table: 'egon_demandregio_population' + household: + schema: 'society' + table: 'egon_demandregio_household' + + +demandregio_household_demand: + sources: + disaggregator: + path: 'demandregio-disaggregator' + vg250_krs: + schema: 'boundaries' + table: 'vg250_krs' + scenarios: + schema: 'scenario' + table: 'egon_scenario_parameters' + targets: + household_demand: + schema: 'demand' + table: 'egon_demandregio_hh' + +demandregio_cts_ind_demand: + sources: + disaggregator: + path: 'demandregio-disaggregator' + vg250_krs: + schema: 'boundaries' + table: 'vg250_krs' + new_consumers_2035: 'new_largescale_consumers_nep.csv' + new_consumers_2050: + "pes-demand-today": "industrial_energy_demand_per_country_today.csv" + "pes-production-tomorrow": "industrial_production_per_country_tomorrow_2050.csv" + "pes-sector-ratios": "industry_sector_ratios.csv" + wz_definitions: + "CTS": 'CTS_WZ_definition.csv' + "industry": 'ind_WZ_definition.csv' + scenarios: + schema: 'scenario' + table: 'egon_scenario_parameters' + targets: + cts_ind_demand: + schema: 'demand' + table: 'egon_demandregio_cts_ind' + wz_definitions: + schema: 'demand' + table: 'egon_demandregio_wz' + timeseries_cts_ind: + schema: 'demand' + table: 'egon_demandregio_timeseries_cts_ind' + +electrical_demands_households: + sources: + demandregio: + schema: 'demand' + table: 'egon_demandregio_hh' + scenarios: ["eGon2035", "eGon100RE"] + population_prognosis_zensus: + schema: 'society' + table: 'egon_population_prognosis' + map_zensus_vg250: + schema: 'boundaries' + table: 'egon_map_zensus_vg250' + targets: + household_demands_zensus: + schema: 'demand' + table: 'egon_demandregio_zensus_electricity' + +electrical_demands_cts: + sources: + demandregio: + schema: 'demand' + table: 'egon_demandregio_cts_ind' + scenarios: ["eGon2035", "eGon100RE"] + demandregio_wz: + schema: 'demand' + table: 'egon_demandregio_wz' + heat_demand_cts: + schema: 'demand' + table: 'egon_peta_heat' + map_zensus_vg250: + schema: 'boundaries' + table: 'egon_map_zensus_vg250' + targets: + cts_demands_zensus: + schema: 'demand' + table: 'egon_demandregio_zensus_electricity' + +substation_extraction: + sources: + osm_ways: + schema: 'openstreetmap' + table: 'osm_ways' + osm_nodes: + schema: 'openstreetmap' + table: 'osm_nodes' + osm_points: + schema: 'openstreetmap' + table: 'osm_point' + osm_lines: + schema: 'openstreetmap' + table: 'osm_line' + targets: + hvmv_substation: + schema: 'grid' + table: 'egon_hvmv_transfer_buses' + ehv_substation: + schema: 'grid' + table: 'egon_ehv_transfer_buses' + transfer_busses: + table: 'transfer_busses_complete' + +substation_voronoi: + sources: + hvmv_substation: + schema: 'grid' + table: 'egon_hvmv_substation' + ehv_substation: + schema: 'grid' + table: 'egon_ehv_substation' + boundaries: + schema: 'boundaries' + table: 'vg250_sta_union' + targets: + hvmv_substation_voronoi: + schema: 'grid' + table: 'egon_hvmv_substation_voronoi' + ehv_substation_voronoi: + schema: 'grid' + table: 'egon_ehv_substation_voronoi' + +society_prognosis: + soucres: + zensus_population: + schema: 'society' + table: 'destatis_zensus_population_per_ha' + zensus_households: + schema: 'society' + table: 'egon_destatis_zensus_household_per_ha' + demandregio_population: + schema: 'society' + table: 'egon_demandregio_population' + demandregio_households: + schema: 'society' + table: 'egon_demandregio_household' + map_zensus_vg250: + schema: 'boundaries' + table: 'egon_map_zensus_vg250' + + target: + population_prognosis: + schema: 'society' + table: 'egon_population_prognosis' + household_prognosis: + schema: 'society' + table: 'egon_household_prognosis' + +scenario_input: + sources: + eGon2035: + capacities: "NEP2035_V2021_scnC2035.xlsx" + list_conv_pp: "Kraftwerksliste_NEP_2021_konv.csv" + eGon100RE: + capacities: "nodal_capacities.csv" + boundaries: + schema: 'boundaries' + table: 'vg250_lan' + zensus_population: + schema: 'society' + table: 'destatis_zensus_population_per_ha' + targets: + scenario_capacities: + schema: 'supply' + table: 'egon_scenario_capacities' + nep_conventional_powerplants: + schema: 'supply' + table: 'egon_nep_2021_conventional_powerplants' + +mastr: + technologies: + - "wind" + - "hydro" + - "solar" + - "biomass" + - "combustion" + - "nuclear" + - "gsgk" + - "storage" + file_basename: "bnetza_mastr" + deposit_id: 808086 + +mastr_new: + technologies: + - "wind" + - "hydro" + - "solar" + - "biomass" + file_basename: "bnetza_mastr" + deposit_id: 1132987 + +re_potential_areas: + target: + schema: "supply" + path_table_map: + "potentialarea_pv_agriculture.gpkg": "egon_re_potential_area_pv_agriculture" + "potentialarea_pv_road_railway.gpkg": "egon_re_potential_area_pv_road_railway" + "potentialarea_wind.gpkg": "egon_re_potential_area_wind" + path_table_map_testmode: + "potentialarea_pv_agriculture_SH.gpkg": "egon_re_potential_area_pv_agriculture" + "potentialarea_pv_road_railway_SH.gpkg": "egon_re_potential_area_pv_road_railway" + "potentialarea_wind_SH.gpkg": "egon_re_potential_area_wind" + +peta5_0_1_res_heat_demands: + original_data: + source: + # In case the link breaks (hopefully it does not), you are able to download + # the data manually. Here you also find background information: + # https://s-eenergies-open-data-euf.hub.arcgis.com/search?categories=seenergies_buildings + # https://www.arcgis.com/home/item.html?id=d7d18b63250240a49eb81db972aa573e + url: "https://arcgis.com/sharing/rest/content/items/d7d18b63250240a49eb81db972aa573e/data" + target: + path: "Peta5_0_1_HD_res.zip" + processed: + schema: "demand" + file_table_map: + table: # 2015 heat demand data not stored in database +peta5_0_1_ser_heat_demands: + original_data: + source: + # In case the link breaks (hopefully it does not), you are able to download + # the data manually. Here you also find background information: + # https://s-eenergies-open-data-euf.hub.arcgis.com/search?categories=seenergies_buildings + # https://www.arcgis.com/home/item.html?id=52ff5e02111142459ed5c2fe3d80b3a0 + url: "https://arcgis.com/sharing/rest/content/items/52ff5e02111142459ed5c2fe3d80b3a0/data" + target: + path: "Peta5_0_1_HD_ser.zip" + processed: + schema: "demand" + file_table_map: + table: # 2015 heat demand data not stored in database + +hotmaps_current_policy_scenario_heat_demands_buildings: + sources: + url: "https://gitlab.com/hotmaps/scen_current_building_demand/-/raw/master/data/scen_current_building_demand.csv?inline=false" + targets: + path: "scen_current_building_demand.csv" + +power_plants: + sources: + mastr_pv: "bnetza_mastr_solar_cleaned.csv" + mastr_wind: "bnetza_mastr_wind_cleaned.csv" + mastr_biomass: "bnetza_mastr_biomass_cleaned.csv" + mastr_hydro: "bnetza_mastr_hydro_cleaned.csv" + mastr_location: "location_elec_generation_raw.csv" + mastr_combustion_without_chp: "supply.egon_mastr_conventional_without_chp" + mastr_storage: "bnetza_mastr_storage_cleaned.csv" + mastr_gsgk: "bnetza_mastr_gsgk_cleaned.csv" + capacities: "supply.egon_scenario_capacities" + geom_germany: "boundaries.vg250_sta_union" + geom_federal_states: "boundaries.vg250_lan" + egon_mv_grid_district: "grid.egon_mv_grid_district" + ehv_voronoi: "grid.egon_ehv_substation_voronoi" + nep_conv: "supply.egon_nep_2021_conventional_powerplants" + buses_data: "osmtgmod_results.bus_data" + power_plants: 'supply.egon_power_plants' + nep_2035: "NEP2035_V2021_scnC2035.xlsx" + target: + table: 'egon_power_plants' + schema: 'supply' + +storages: + sources: + mastr_storage: "bnetza_mastr_storage_cleaned.csv" + capacities: "supply.egon_scenario_capacities" + geom_germany: "boundaries.vg250_sta_union" + geom_federal_states: "boundaries.vg250_lan" + egon_mv_grid_district: "grid.egon_mv_grid_district" + ehv_voronoi: "grid.egon_ehv_substation_voronoi" + nep_conv: "supply.egon_nep_2021_conventional_powerplants" + nep_capacities: "NEP2035_V2021_scnC2035.xlsx" + generators: "grid.egon_etrago_generator" + bus: "grid.egon_etrago_bus" + target: + table: 'egon_storages' + schema: 'supply' + +landuse: + sources: + osm_polygons: + schema: 'openstreetmap' + table: 'osm_polygon' + vg250: + schema: 'boundaries' + table: 'vg250_sta_union' + target: + table: 'osm_landuse' + schema: 'openstreetmap' + +era5_weather_data: + targets: + weather_data: + path: 'cutouts' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + +renewable_feedin: + sources: + era5_weather_data: + path: 'cutouts' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + vg250_lan_union: + schema: 'boundaries' + table: 'vg250_lan_union' + vg250_sta_union: + schema: 'boundaries' + table: 'vg250_sta_union' + targets: + feedin_table: + schema: 'supply' + table: 'egon_era5_renewable_feedin' + +map_zensus_grid_districts: + sources: + zensus_population: + schema: 'society' + table: 'destatis_zensus_population_per_ha' + egon_mv_grid_district: + schema: 'grid' + table: 'egon_mv_grid_district' + targets: + map: + schema: 'boundaries' + table: 'egon_map_zensus_grid_districts' + +electrical_load_curves_cts: + sources: + map_grid_districts: + schema: 'boundaries' + table: 'egon_map_zensus_grid_districts' + map_vg250: + schema: 'boundaries' + table: 'egon_map_zensus_vg250' + zensus_electricity: + schema: 'demand' + table: 'egon_demandregio_zensus_electricity' + demandregio_cts: + schema: 'demand' + table: 'egon_demandregio_cts_ind' + demandregio_wz: + schema: 'demand' + table: 'egon_demandregio_wz' + demandregio_timeseries: + schema: 'demand' + table: 'egon_demandregio_timeseries_cts_ind' + hvmv_substation: + schema: 'grid' + table: 'egon_hvmv_substation' + targets: + cts_demand_curves: + schema: 'demand' + table: 'egon_etrago_electricity_cts' + +hh_demand_profiles: + sources: + household_electricity_demand_profiles: + path_testmode: "hh_el_load_profiles_2511.hdf" + path: "hh_el_load_profiles_100k.hdf" + + zensus_household_types: + path: "Zensus2011_Personen.csv" + +map_mvgrid_vg250: + sources: + egon_mv_grid_district: + schema: 'grid' + table: 'egon_mv_grid_district' + federal_states: + schema: 'boundaries' + table: 'vg250_lan_union' + targets: + map: + schema: 'boundaries' + table: 'egon_map_mvgriddistrict_vg250' + +solar_rooftop: + sources: + solar_feedin: + schema: 'supply' + table: 'egon_era5_renewable_feedin' + egon_mv_grid_district: + schema: 'grid' + table: 'egon_mv_grid_district' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + electricity_demand: + schema: 'demand' + table: 'egon_demandregio_zensus_electricity' + map_zensus_grid_districts: + schema: 'boundaries' + table: 'egon_map_zensus_grid_districts' + map_grid_boundaries: + schema: 'boundaries' + table: 'egon_map_mvgriddistrict_vg250' + scenario_capacities: + schema: 'supply' + table: 'egon_scenario_capacities' + federal_states: + schema: 'boundaries' + table: 'vg250_lan' + targets: + generators: + schema: 'grid' + table: 'egon_etrago_generator' + generator_timeseries: + schema: 'grid' + table: 'egon_etrago_generator_timeseries' + +data-bundle: + sources: + zenodo: + deposit_id: 1095882 + targets: + file: + 'data_bundle_egon_data.zip' + +pypsa-technology-data: + sources: + zenodo: + deposit_id: 5544025 + file: 'PyPSA/technology-data-v0.3.0.zip' + targets: + file: + 'pypsa_technology_data_egon_data.zip' + data_dir: + 'PyPSA-technology-data-94085a8/outputs/' + +heat_supply: + sources: + scenario_capacities: + schema: 'supply' + table: 'egon_scenario_capacities' + district_heating_areas: + schema: 'demand' + table: 'egon_district_heating_areas' + chp: + schema: 'supply' + table: 'egon_chp_plants' + federal_states: + schema: 'boundaries' + table: 'vg250_lan' + heat_demand: + schema: 'demand' + table: 'egon_peta_heat' + map_zensus_grid: + schema: 'boundaries' + table: 'egon_map_zensus_grid_districts' + map_vg250_grid: + schema: 'boundaries' + table: 'egon_map_mvgriddistrict_vg250' + mv_grids: + schema: 'grid' + table: 'egon_mv_grid_district' + map_dh: + schema: 'demand' + table: 'egon_map_zensus_district_heating_areas' + etrago_buses: + table: 'egon_etrago_bus' + schema: 'grid' + targets: + district_heating_supply: + schema: 'supply' + table: 'egon_district_heating' + individual_heating_supply: + schema: 'supply' + table: 'egon_individual_heating' + +etrago_heat: + sources: + scenario_capacities: + schema: 'supply' + table: 'egon_scenario_capacities' + district_heating_areas: + schema: 'demand' + table: 'egon_district_heating_areas' + map_district_heating_areas: + schema: 'demand' + table: 'egon_map_zensus_district_heating_areas' + mv_grids: + schema: 'grid' + table: 'egon_mv_grid_district' + district_heating_supply: + schema: 'supply' + table: 'egon_district_heating' + individual_heating_supply: + schema: 'supply' + table: 'egon_individual_heating' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + feedin_timeseries: + schema: 'supply' + table: 'egon_era5_renewable_feedin' + egon_mv_grid_district: + schema: 'grid' + table: 'egon_mv_grid_district' + heat_demand: + schema: 'demand' + table: 'egon_peta_heat' + ch4_voronoi: + schema: 'grid' + table: 'egon_gas_voronoi' + targets: + heat_buses: + schema: 'grid' + table: 'egon_etrago_bus' + heat_generators: + schema: 'grid' + table: 'egon_etrago_generator' + heat_generator_timeseries: + schema: 'grid' + table: 'egon_etrago_generator_timeseries' + heat_links: + schema: 'grid' + table: 'egon_etrago_link' + heat_link_timeseries: + schema: 'grid' + table: 'egon_etrago_link_timeseries' + heat_stores: + schema: 'grid' + table: 'egon_etrago_store' + +etrago_hydrogen: + sources: + saltcavern_data: + schema: 'grid' + table: 'egon_saltstructures_storage_potential' + buses: + schema: 'grid' + table: 'egon_etrago_bus' + H2_AC_map: + schema: 'grid' + table: 'egon_etrago_ac_h2' + targets: + hydrogen_buses: + schema: 'grid' + table: 'egon_etrago_bus' + hydrogen_links: + schema: 'grid' + table: 'egon_etrago_link' + hydrogen_stores: + schema: 'grid' + table: 'egon_etrago_store' + +industrial_sites: + sources: + hotmaps: + url: "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database/-/raw/388278c6df35889b1447a959fc3759e3d78bf659/data/Industrial_Database.csv?inline=false" + path: "data_Industrial_Database.csv" + seenergies: + url: "https://opendata.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0.csv" + path: "D5_1_Industry_Dataset_With_Demand_Data.csv" + schmidt: + path: "MA_Schmidt_Industriestandorte_georef.csv" + targets: + hotmaps: + schema: "demand" + table: "egon_hotmaps_industrial_sites" + seenergies: + schema: "demand" + table: "egon_seenergies_industrial_sites" + schmidt: + schema: "demand" + table: "egon_schmidt_industrial_sites" + sites: + schema: "demand" + table: "egon_industrial_sites" + +distributed_industrial_demand: + sources: + demandregio: + schema: 'demand' + table: 'egon_demandregio_cts_ind' + scenarios: ["eGon2021", "eGon2035", "eGon100RE"] + wz: + schema: 'demand' + table: 'egon_demandregio_wz' + osm_landuse: + schema: 'openstreetmap' + table: 'osm_landuse' + industrial_sites: + schema: 'demand' + table: 'egon_industrial_sites' + vg250_krs: + schema: 'boundaries' + table: 'vg250_krs' + targets: + osm: + schema: 'demand' + table: 'egon_demandregio_osm_ind_electricity' + sites: + schema: 'demand' + table: 'egon_demandregio_sites_ind_electricity' + +electrical_load_curves_industry: + sources: + osm: + schema: 'demand' + table: 'egon_demandregio_osm_ind_electricity' + osm_landuse: + schema: 'openstreetmap' + table: 'osm_landuse' + sites: + schema: 'demand' + table: 'egon_demandregio_sites_ind_electricity' + sites_geom: + schema: 'demand' + table: 'egon_industrial_sites' + demandregio_industry: + schema: 'demand' + table: 'egon_demandregio_cts_ind' + demandregio_wz: + schema: 'demand' + table: 'egon_demandregio_wz' + demandregio_timeseries: + schema: 'demand' + table: 'egon_demandregio_timeseries_cts_ind' + hvmv_substation: + schema: 'grid' + table: 'egon_hvmv_substation' + egon_mv_grid_district: + schema: 'grid' + table: 'egon_mv_grid_district' + egon_ehv_voronoi: + schema: 'grid' + table: 'egon_ehv_substation_voronoi' + targets: + osm_load: + schema: 'demand' + table: 'egon_osm_ind_load_curves' + osm_load_individual: + schema: 'demand' + table: 'egon_osm_ind_load_curves_individual' + sites_load: + schema: 'demand' + table: 'egon_sites_ind_load_curves' + sites_load_individual: + schema: 'demand' + table: 'egon_sites_ind_load_curves_individual' + +etrago_electricity: + sources: + etrago_buses: + table: 'egon_etrago_bus' + schema: 'grid' + osm_curves: + schema: 'demand' + table: 'egon_osm_ind_load_curves' + sites_curves: + schema: 'demand' + table: 'egon_sites_ind_load_curves' + cts_curves: + schema: 'demand' + table: 'egon_etrago_electricity_cts' + household_curves: + schema: 'demand' + table: 'egon_etrago_electricity_households' + targets: + etrago_load: + schema: 'grid' + table: 'egon_etrago_load' + etrago_load_curves: + schema: 'grid' + table: 'egon_etrago_load_timeseries' + +chp_location: + sources: + list_conv_pp: + table: 'egon_nep_2021_conventional_powerplants' + schema: 'supply' + mastr_combustion: 'bnetza_mastr_combustion_cleaned.csv' + mastr_location: 'location_elec_generation_raw.csv' + egon_mv_grid_district: 'grid.egon_mv_grid_district' + ehv_voronoi: "grid.egon_ehv_substation_voronoi" + etrago_buses: + table: 'egon_etrago_bus' + schema: 'grid' + osm_landuse: + table: 'osm_landuse' + schema: 'openstreetmap' + osm_polygon: + table: 'osm_polygon' + schema: 'openstreetmap' + district_heating_areas: + schema: 'demand' + table: 'egon_district_heating_areas' + industrial_demand_osm: + schema: 'demand' + table: 'egon_demandregio_osm_ind_electricity' + vg250_lan: + schema: 'boundaries' + table: 'vg250_lan' + mastr_biomass: "bnetza_mastr_biomass_cleaned.csv" + targets: + chp_table: + table: 'egon_chp_plants' + schema: 'supply' + mastr_conventional_without_chp: + table: 'egon_mastr_conventional_without_chp' + schema: 'supply' + +chp_etrago: + sources: + chp_table: + table: 'egon_chp_plants' + schema: 'supply' + district_heating_areas: + schema: 'demand' + table: 'egon_district_heating_areas' + etrago_buses: + table: 'egon_etrago_bus' + schema: 'grid' + targets: + link: + schema: 'grid' + table: 'egon_etrago_link' + generator: + schema: 'grid' + table: 'egon_etrago_generator' + +DSM_CTS_industry: + sources: + cts_loadcurves: + schema: 'demand' + table: 'egon_etrago_electricity_cts' + ind_osm_loadcurves: + schema: 'demand' + table: 'egon_osm_ind_load_curves' + ind_osm_loadcurves_individual: + schema: 'demand' + table: 'egon_osm_ind_load_curves_individual' + ind_sites_loadcurves: + schema: 'demand' + table: 'egon_sites_ind_load_curves' + ind_sites_loadcurves_individual: + schema: 'demand' + table: 'egon_sites_ind_load_curves_individual' + ind_sites: + schema: 'demand' + table: 'egon_industrial_sites' + ind_sites_schmidt: + schema: 'demand' + table: 'egon_schmidt_industrial_sites' + demandregio_ind_sites: + schema: 'demand' + table: 'egon_demandregio_sites_ind_electricity' + targets: + bus: + schema: 'grid' + table: 'egon_etrago_bus' + link: + schema: 'grid' + table: 'egon_etrago_link' + link_timeseries: + schema: 'grid' + table: 'egon_etrago_link_timeseries' + store: + schema: 'grid' + table: 'egon_etrago_store' + store_timeseries: + schema: 'grid' + table: 'egon_etrago_store_timeseries' + cts_loadcurves_dsm: + schema: 'demand' + table: 'egon_etrago_electricity_cts_dsm_timeseries' + ind_osm_loadcurves_individual_dsm: + schema: 'demand' + table: 'egon_osm_ind_load_curves_individual_dsm_timeseries' + demandregio_ind_sites_dsm: + schema: 'demand' + table: 'egon_demandregio_sites_ind_electricity_dsm_timeseries' + ind_sites_loadcurves_individual: + schema: 'demand' + table: 'egon_sites_ind_load_curves_individual_dsm_timeseries' + +generators_etrago: + sources: + bus: + schema: 'grid' + table: 'egon_etrago_bus' + power_plants: + schema: 'supply' + table: 'egon_power_plants' + renewable_feedin: + schema: 'supply' + table: 'egon_era5_renewable_feedin' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + egon_mv_grid_district: 'grid.egon_mv_grid_district' + ehv_voronoi: 'grid.egon_ehv_substation_voronoi' + targets: + etrago_generators: + schema: 'grid' + table: 'egon_etrago_generator' + etrago_gen_time: + schema: 'grid' + table: 'egon_etrago_generator_timeseries' + + +gas_grid: + targets: + links: + schema: 'grid' + table: 'egon_etrago_link' + buses: + schema: 'grid' + table: 'egon_etrago_bus' + + +gas_stores: + source: + buses: + schema: 'grid' + table: 'egon_etrago_bus' + target: + stores: + schema: 'grid' + table: 'egon_etrago_store' + +gas_prod: + source: + buses: + schema: 'grid' + table: 'egon_etrago_bus' + target: + stores: + schema: 'grid' + table: 'egon_etrago_generator' + +weather_BusID: + sources: + power_plants: + schema: 'supply' + table: 'egon_power_plants' + renewable_feedin: + schema: 'supply' + table: 'egon_era5_renewable_feedin' + weather_cells: + schema: 'supply' + table: 'egon_era5_weather_cells' + boundaries: + schema: 'boundaries' + table: 'vg250_sta' + egon_mv_grid_district: 'grid.egon_mv_grid_district' + ehv_voronoi: 'grid.egon_ehv_substation_voronoi' + targets: + power_plants: + schema: 'supply' + table: 'egon_power_plants' + +storage_etrago: + sources: + storage: + table: 'egon_storages' + schema: 'supply' + scenario_parameters: + table: 'egon_scenario_parameters' + schema: 'scenario' + bus: + table: 'egon_etrago_bus' + schema: 'grid' + ehv-substation: + table: 'egon_ehv_substation' + schema: 'grid' + hv-substation: + table: 'egon_hvmv_substation' + schema: 'grid' + targets: + storage: + schema: 'grid' + table: 'egon_etrago_storage' + + +dlr: + sources: + trans_lines: + schema: "grid" + table: "egon_etrago_line" + line_timeseries: + schema: "grid" + table: "egon_etrago_line_timeseries" + targets: + line_timeseries: + schema: "grid" + table: "egon_etrago_line_timeseries" + +electrical_neighbours: + sources: + electricity_buses: + schema: 'grid' + table: 'egon_etrago_bus' + lines: + schema: 'grid' + table: 'egon_etrago_line' + german_borders: + schema: 'boundaries' + table: 'vg250_sta_union' + osmtgmod_bus: + schema: 'osmtgmod_results' + table: 'bus_data' + osmtgmod_branch: + schema: 'osmtgmod_results' + table: 'branch_data' + tyndp_capacities: "TYNDP-2020-Scenario-Datafile.xlsx.zip" + tyndp_demand_2030: "Demand_TimeSeries_2030_DistributedEnergy.xlsx" + tyndp_demand_2040: "Demand_TimeSeries_2040_DistributedEnergy.xlsx" + targets: + buses: + schema: 'grid' + table: 'egon_etrago_bus' + lines: + schema: 'grid' + table: 'egon_etrago_line' + links: + schema: 'grid' + table: 'egon_etrago_link' + transformers: + schema: 'grid' + table: 'egon_etrago_transformer' + loads: + schema: 'grid' + table: 'egon_etrago_load' + load_timeseries: + schema: 'grid' + table: 'egon_etrago_load_timeseries' + generators: + schema: 'grid' + table: 'egon_etrago_generator' + generators_timeseries: + schema: 'grid' + table: 'egon_etrago_generator_timeseries' + storage: + schema: 'grid' + table: 'egon_etrago_storage' + +tyndp: + sources: + capacities: "https://2020.entsos-tyndp-scenarios.eu/wp-content/uploads/2020/06/TYNDP-2020-Scenario-Datafile.xlsx.zip" + demand_2030: "https://eepublicdownloads.entsoe.eu/tyndp-documents/2020-data/Demand_TimeSeries_2030_DistributedEnergy.xlsx" + demand_2040: "https://eepublicdownloads.entsoe.eu/tyndp-documents/2020-data/Demand_TimeSeries_2040_DistributedEnergy.xlsx" + targets: + capacities: "TYNDP-2020-Scenario-Datafile.xlsx.zip" + demand_2030: "Demand_TimeSeries_2030_DistributedEnergy.xlsx" + demand_2040: "Demand_TimeSeries_2040_DistributedEnergy.xlsx" + +gas_neighbours: + sources: + tyndp_capacities: "TYNDP-2020-Scenario-Datafile.xlsx.zip" + buses: + schema: 'grid' + table: 'egon_etrago_bus' + links: + schema: 'grid' + table: 'egon_etrago_link' + targets: + generators: + schema: 'grid' + table: 'egon_etrago_generator' + loads: + schema: 'grid' + table: 'egon_etrago_load' + load_timeseries: + schema: 'grid' + table: 'egon_etrago_load_timeseries' + stores: + schema: 'grid' + table: 'egon_etrago_store' + links: + schema: 'grid' + table: 'egon_etrago_link' + +emobility_mit: + original_data: + sources: + RS7: + url: "https://www.bmvi.de/SharedDocs/DE/Anlage/G/regiostar-referenzdateien.xlsx?__blob=publicationFile" + file: "regiostar-referenzdateien.xlsx" + file_processed: "regiostar-referenzdateien_preprocessed.csv" + sheet: "ReferenzGebietsstand2020" + KBA: + url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2021.xlsx?__blob=publicationFile&v=2" + file: "fz1_2021.xlsx" + file_processed: "fz1_2021_preprocessed.csv" + sheet: "FZ1.1" + columns: "D, J:N" + skiprows: 8 + trips: + eGon2035: + file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" + file_metadata: "metadata_simbev_run.json" + eGon100RE: + file: "eGon100RE_RS7_min2k_2022-06-01_175444_simbev_run.tar.gz" + file_metadata: "metadata_simbev_run.json" + scenario: + # used scenario variation (available scenarios see parameters.py) + variation: + eGon2035: "NEP C 2035" + eGon100RE: "Reference 2050" + # name of low-flex scenario + lowflex: + create_lowflex_scenario: True + names: + eGon2035: "eGon2035_lowflex" + eGon100RE: "eGon100RE_lowflex" + + model_timeseries: + reduce_memory: True + export_results_to_csv: True + parallel_tasks: 10 + +charging_infrastructure: + original_data: + sources: + tracbev: + url: "https://zenodo.org/record/6466480/files/data.zip?download=1" + file: "data.zip" + files_to_use: + - "hpc_positions.gpkg" + - "landuse.gpkg" + - "poi_cluster.gpkg" + - "public_positions.gpkg" + srid: 3035 + constants: + work_weight_retail: 0.8 + work_weight_commercial: 1.25 + work_weight_industrial: 1 + single_family_home_share: 0.6 + single_family_home_spots: 1.5 + multi_family_home_share: 0.4 + multi_family_home_spots: 10 + random_seed: 5 + targets: + charging_infrastructure: + schema: "grid" + table: "egon_emob_charging_infrastructure" + cols_to_export: + - "mv_grid_id" + - "use_case" + - "weight" + - "geometry" + +mobility_hgv: + original_data: + sources: + BAST: + url: "https://www.bast.de/DE/Verkehrstechnik/Fachthemen/v2-verkehrszaehlung/Daten/2020_1/Jawe2020.csv?view=renderTcDataExportCSV&cms_strTyp=A" + file: "Jawe2020.csv" + relevant_columns: ["DTV_SV_MobisSo_Q", "Koor_WGS84_E", "Koor_WGS84_N"] + srid: 4326 + germany: + url: "https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/1_deutschland/1_sehr_hoch.geo.json" + NUTS: + url: "https://daten.gdz.bkg.bund.de/produkte/vg/nuts250_1231/aktuell/nuts250_12-31.utm32s.shape.zip" + file: "nuts250_12-31.utm32s.shape.zip" + shp_file: "nuts250_12-31.utm32s.shape/nuts250_1231/250_NUTS1.shp" + NUTS_CODE: "DEF" + tables: + srid: 3035 + srid_buses: 4326 + constants: + # leakage rate / losses - constant + # https://www.energy.gov/eere/fuelcells/doe-technical-targets-hydrogen-delivery + # --> 0.5% + leakage: True + leakage_rate: 0.005 + # Hydrogen + # HGV traffic hydrogen consumption in kg per 100 km + # Assumption: 30L Diesel / 100 km --> kgH2/100 km + hydrogen_consumption: 6.68 + # share of FCEV trucks + # within the egon project the flat guess is 100% + fcev_share: 1. + scenarios: + - "eGon2035" + - "eGon100RE" + carrier: "H2_hgv_load" + energy_value_h2: 39.4 # kWh/kg + hours_per_year: 8760 + fac: 0.001 + hgv_mileage: + # NEP data + # https://www.netzentwicklungsplan.de/sites/default/files/paragraphs-files/NEP_2035_V2021_2_Entwurf_Teil1.pdf + # total amount of HGVs - Scenario C 2035 + # hgv_amount = 100000 + # HGV traffic annual mileage per vehicle + # hgv_mean_mileage = 100000 + # Total mileage + eGon2035: 10000000000 + # Langfristszenarien + # https://www.langfristszenarien.de/enertile-explorer-wAssets/docs/LFS3_Langbericht_Verkehr_final.pdf#page=17 + eGon100RE: 40000000000 + +home_batteries: + constants: + scenarios: + - "eGon2035" + - "eGon100RE" + # Mean ratio between the storage capacity and the power of the pv rooftop system + cbat_ppv_ratio: 1 + rtol: 0.05 + max_it: 100 + sources: + etrago_storage: + schema: 'grid' + table: 'egon_etrago_storage' + storage: + schema: 'supply' + table: 'egon_storages' + targets: + home_batteries: + schema: 'supply' + table: 'egon_home_batteries' From 1035625f101fa1bc44004a605fbcc841534337c3 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Feb 2023 12:11:10 +0100 Subject: [PATCH 027/787] re-include heat, gas and e-mobility --- .../data/airflow/dags/pipeline_status_quo.py | 175 +++++++++++++++++- 1 file changed, 172 insertions(+), 3 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 27787bf40..93871d3d9 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -75,6 +75,7 @@ from egon.data.datasets.renewable_feedin import RenewableFeedin from egon.data.datasets.saltcavern import SaltcavernData from egon.data.datasets.sanity_checks import SanityChecks +from egon.data.datasets.scenario_capacities import ScenarioCapacities from egon.data.datasets.scenario_parameters import ScenarioParameters from egon.data.datasets.society_prognosis import SocietyPrognosis from egon.data.datasets.storages import Storages @@ -139,6 +140,11 @@ dependencies=[data_bundle, scenario_parameters, setup, vg250] ) + # Society prognosis + society_prognosis = SocietyPrognosis( + dependencies=[demandregio, zensus_miscellaneous] + ) + # OSM (OpenStreetMap) buildings, streets and amenities osm_buildings_streets = OsmBuildingsStreets( dependencies=[osm, zensus_miscellaneous] @@ -189,6 +195,11 @@ dependencies=[scenario_parameters, vg250, zensus_vg250] ) + # Download industrial gas demand + industrial_gas_demand = IndustrialGasDemand( + dependencies=[scenario_parameters] + ) + # Extract landuse areas from the `osm` dataset osm_landuse = OsmLanduse(dependencies=[osm, vg250]) @@ -295,6 +306,19 @@ ] ) + # Heat time Series + heat_time_series = HeatTimeSeries( + dependencies=[ + data_bundle, + demandregio, + heat_demand_Germany, + district_heating_areas, + vg250, + zensus_mv_grid_districts, + hh_demand_buildings_setup, + weather_data, + ] + ) # run pypsa-eur-sec run_pypsaeursec = PypsaEurSec( @@ -305,6 +329,7 @@ setup_etrago, data_bundle, electrical_load_etrago, + heat_time_series, ] ) @@ -313,16 +338,58 @@ dependencies=[run_pypsaeursec, tyndp_data] ) + # Import gas grid + gas_grid_insert_data = GasNodesandPipes( + dependencies=[ + data_bundle, + foreign_lines, + osmtgmod, + scenario_parameters, + tasks["etrago_setup.create-tables"], + ] + ) + # Create gas voronoi eGon2035 + create_gas_polygons_egon2035 = GasAreaseGon2035( + dependencies=[setup_etrago, insert_hydrogen_buses, vg250] + ) + + # Gas abroad + gas_abroad_insert_data = GasNeighbours( + dependencies=[ + gas_grid_insert_data, + run_pypsaeursec, + foreign_lines, + insert_hydrogen_buses, + create_gas_polygons_egon100RE, + ] + ) + + # Import gas production + gas_production_insert_data = CH4Production( + dependencies=[create_gas_polygons_egon2035] + ) + + # Import CH4 storages + insert_data_ch4_storages = CH4Storages( + dependencies=[create_gas_polygons_egon2035] + ) + + # Assign industrial gas demand eGon2035 + IndustrialGasDemandeGon2035( + dependencies=[create_gas_polygons_egon2035, industrial_gas_demand] + ) # CHP locations chp = Chp( dependencies=[ + create_gas_polygons_egon2035, demand_curves_industry, district_heating_areas, industrial_sites, osm_landuse, mastr_data, mv_grid_districts, + scenario_capacities, ] ) @@ -335,6 +402,7 @@ mastr_data, mv_grid_districts, renewable_feedin, + scenario_capacities, scenario_parameters, setup, substation_extraction, @@ -345,7 +413,7 @@ ) create_ocgt = OpenCycleGasTurbineEtrago( - dependencies=[power_plants] + dependencies=[create_gas_polygons_egon2035, power_plants] ) # Fill eTraGo generators tables @@ -353,24 +421,125 @@ dependencies=[power_plants, weather_data] ) - + # Heat supply + heat_supply = HeatSupply( + dependencies=[ + chp, + data_bundle, + district_heating_areas, + zensus_mv_grid_districts, + ] + ) # Pumped hydro units pumped_hydro = Storages( dependencies=[ mastr_data, mv_grid_districts, power_plants, + scenario_capacities, scenario_parameters, setup, vg250_mv_grid_districts, ] ) + # Heat to eTraGo + heat_etrago = HeatEtrago( + dependencies=[ + heat_supply, + mv_grid_districts, + renewable_feedin, + setup_etrago, + heat_time_series, + ] + ) + # CHP to eTraGo - chp_etrago = ChpEtrago(dependencies=[chp]) + chp_etrago = ChpEtrago(dependencies=[chp, heat_etrago]) + + # HTS to eTraGo table + hts_etrago_table = HtsEtragoTable( + dependencies=[ + district_heating_areas, + heat_etrago, + heat_time_series, + mv_grid_districts, + ] + ) # Storages to eTraGo storage_etrago = StorageEtrago( dependencies=[pumped_hydro, scenario_parameters, setup_etrago] ) + # eMobility: motorized individual travel + emobility_mit = MotorizedIndividualTravel( + dependencies=[ + data_bundle, + mv_grid_districts, + scenario_parameters, + setup_etrago, + zensus_mv_grid_districts, + zensus_vg250, + storage_etrago, + hts_etrago_table, + chp_etrago, + components_dsm, + heat_etrago, + fill_etrago_generators, + create_ocgt, + insert_H2_storage, + insert_power_to_h2_installations, + insert_h2_to_ch4_grid_links, + create_gas_polygons_egon100RE, + gas_production_insert_data, + insert_data_ch4_storages, + ] + ) + + mit_charging_infrastructure = MITChargingInfrastructure( + dependencies=[mv_grid_districts, hh_demand_buildings_setup] + ) + + # eMobility: heavy duty transport + heavy_duty_transport = HeavyDutyTransport( + dependencies=[vg250, setup_etrago, create_gas_polygons_egon2035] + ) + + cts_demand_buildings = CtsDemandBuildings( + dependencies=[ + osm_buildings_streets, + cts_electricity_demand_annual, + hh_demand_buildings_setup, + tasks["heat_demand_timeseries.export-etrago-cts-heat-profiles"], + ] + ) + + # Create load areas + load_areas = LoadArea( + dependencies=[ + osm_landuse, + zensus_vg250, + household_electricity_demand_annual, + tasks[ + "electricity_demand_timeseries" + ".hh_buildings" + ".get-building-peak-loads" + ], + cts_demand_buildings, + demand_curves_industry, + ] + ) + + # ########## Keep this dataset at the end + # Sanity Checks + sanity_checks = SanityChecks( + dependencies=[ + storage_etrago, + hts_etrago_table, + fill_etrago_generators, + household_electricity_demand_annual, + cts_demand_buildings, + emobility_mit, + ] + ) From 1fb9823bc44c2b1ecd25d74b7d7893e1ae6256ae Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Feb 2023 12:21:43 +0100 Subject: [PATCH 028/787] add todos --- src/egon/data/airflow/dags/pipeline_status_quo.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 93871d3d9..393b6a550 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -58,7 +58,6 @@ ) from egon.data.datasets.industrial_gas_demand import ( IndustrialGasDemand, - IndustrialGasDemandeGon100RE, IndustrialGasDemandeGon2035, ) from egon.data.datasets.industrial_sites import MergeIndustrialSites @@ -348,7 +347,7 @@ tasks["etrago_setup.create-tables"], ] ) - # Create gas voronoi eGon2035 + # Create gas voronoi eGon2035 TODO: adjust for SQ create_gas_polygons_egon2035 = GasAreaseGon2035( dependencies=[setup_etrago, insert_hydrogen_buses, vg250] ) @@ -374,7 +373,7 @@ dependencies=[create_gas_polygons_egon2035] ) - # Assign industrial gas demand eGon2035 + # Assign industrial gas demand eGon2035 TODO: adjust for SQ IndustrialGasDemandeGon2035( dependencies=[create_gas_polygons_egon2035, industrial_gas_demand] ) @@ -472,7 +471,7 @@ dependencies=[pumped_hydro, scenario_parameters, setup_etrago] ) - # eMobility: motorized individual travel + # eMobility: motorized individual travel TODO: adjust for SQ emobility_mit = MotorizedIndividualTravel( dependencies=[ data_bundle, @@ -501,7 +500,7 @@ dependencies=[mv_grid_districts, hh_demand_buildings_setup] ) - # eMobility: heavy duty transport + # eMobility: heavy duty transport TODO: adjust for SQ heavy_duty_transport = HeavyDutyTransport( dependencies=[vg250, setup_etrago, create_gas_polygons_egon2035] ) From fe3c3cc6acde77be6476542ddc90ab696a187959 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Feb 2023 13:31:35 +0100 Subject: [PATCH 029/787] tyndp download has to be adjusted --- src/egon/data/airflow/dags/pipeline_status_quo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 393b6a550..71ea9b9d1 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -121,7 +121,7 @@ scenario_parameters = ScenarioParameters(dependencies=[setup]) # Download TYNDP data - tyndp_data = Tyndp(dependencies=[setup]) + tyndp_data = Tyndp(dependencies=[setup]) TODO: kick out or adjust # Import zensus population zensus_population = ZensusPopulation(dependencies=[setup, vg250]) From f5a5b19d1d87998082be7d78cf739be76f5e1268 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 1 Mar 2023 13:14:47 +0100 Subject: [PATCH 030/787] Apply black and isort --- src/egon/data/datasets/etrago_setup.py | 31 ++++++++++++------- .../data/datasets/heat_demand/__init__.py | 11 +++---- src/egon/data/datasets/renewable_feedin.py | 17 +++++----- src/egon/data/datasets/scenario_capacities.py | 13 ++++---- src/egon/data/datasets/zensus_vg250.py | 24 ++++++-------- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 69c583895..47487118c 100644 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -4,6 +4,7 @@ from geoalchemy2.types import Geometry from shapely.geometry import LineString +from sqlalchemy import schema # ??? from sqlalchemy import ( ARRAY, BigInteger, @@ -15,7 +16,6 @@ Numeric, String, Text, - schema, #??? ) from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd @@ -26,11 +26,11 @@ from egon.data.datasets import Dataset from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_sqla_model, license_ccby, meta_metadata, sources, - contributors ) Base = declarative_base() @@ -38,7 +38,7 @@ network = pypsa.Network() # add Storage key (called StorageUnit in PyPSA) -network.component_attrs['Storage'] = network.component_attrs['StorageUnit'] +network.component_attrs["Storage"] = network.component_attrs["StorageUnit"] def get_pypsa_field_descriptors(component): @@ -59,7 +59,12 @@ def get_pypsa_field_descriptors(component): def get_meta( - schema, component, description="TODO", source_list=[], license_list=[], contributor_list=[] + schema, + component, + description="TODO", + source_list=[], + license_list=[], + contributor_list=[], ): table = "egon_etrago_" + component.lower() @@ -367,10 +372,11 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): source_dict = sources() source_list = [ - source_dict['bgr_inspee'], source_dict['bgr_inspeeds'], - source_dict['bgr_inspeeds_data_bundle'], - source_dict['bgr_inspeeds_data_bundle'], - source_dict['bgr_inspeeds_report'] + source_dict["bgr_inspee"], + source_dict["bgr_inspeeds"], + source_dict["bgr_inspeeds_data_bundle"], + source_dict["bgr_inspeeds_data_bundle"], + source_dict["bgr_inspeeds_report"], ] contributors_dict = contributors() contributor_list = [ @@ -383,9 +389,10 @@ class EgonPfHvStore(Base): license_list = [data["license"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { - "schema": "grid", "comment": get_meta( + "schema": "grid", + "comment": get_meta( "grid", "Store", source_list, license_list, contributor_list - ) + ), } scn_name = Column(String, primary_key=True, nullable=False) @@ -617,7 +624,7 @@ def create_tables(): def temp_resolution(): - """ Insert temporal resolution for etrago + """Insert temporal resolution for etrago Returns ------- @@ -635,7 +642,7 @@ def temp_resolution(): def link_geom_from_buses(df, scn_name): - """ Add LineString geometry accoring to geometry of buses to links + """Add LineString geometry accoring to geometry of buses to links Parameters ---------- diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index 876d87c05..7f250440b 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -14,10 +14,12 @@ from pathlib import Path # for database import from urllib.request import urlretrieve +import datetime # for metadata creation import json import os +import time import zipfile from jinja2 import Template @@ -37,17 +39,14 @@ EgonScenario, get_sector_parameters, ) -import egon.data.config from egon.data.metadata import ( context, - meta_metadata, + generate_resource_fields_from_sqla_model, license_ccby, + meta_metadata, sources, - generate_resource_fields_from_sqla_model, ) -import json -import time -import datetime +import egon.data.config # class for airflow task management (and version control) diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 97178ecfa..2cbbaa4ee 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -2,25 +2,26 @@ Central module containing all code dealing with processing era5 weather data. """ +import datetime +import json +import time + import geopandas as gpd import numpy as np import pandas as pd from egon.data import db from egon.data.datasets import Dataset -from egon.data.datasets.era5 import import_cutout, EgonRenewableFeedIn +from egon.data.datasets.era5 import EgonRenewableFeedIn, import_cutout from egon.data.datasets.scenario_parameters import get_sector_parameters -import egon.data.config -import time -import datetime from egon.data.metadata import ( context, - meta_metadata, + generate_resource_fields_from_sqla_model, license_ccby, + meta_metadata, sources, - generate_resource_fields_from_sqla_model, ) -import json +import egon.data.config class RenewableFeedin(Dataset): @@ -469,7 +470,7 @@ def heat_pump_cop(): # Calculate coefficient of performance for air sourced heat pumps # according to Brown et. al - cop = 6.81 - 0.121 * delta_t + 0.00063 * delta_t ** 2 + cop = 6.81 - 0.121 * delta_t + 0.00063 * delta_t**2 df = pd.DataFrame( index=temperature.to_pandas().index, diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 50fa83cb8..6ba8fb148 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -3,28 +3,27 @@ """ from pathlib import Path +import datetime +import json +import time from sqlalchemy import Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import numpy as np import pandas as pd -import time -import datetime from egon.data import db from egon.data.config import settings from egon.data.datasets import Dataset -import egon.data.config from egon.data.metadata import ( context, - meta_metadata, + generate_resource_fields_from_sqla_model, license_ccby, + meta_metadata, sources, - generate_resource_fields_from_sqla_model, ) -import json - +import egon.data.config ### will be later imported from another file ### Base = declarative_base() diff --git a/src/egon/data/datasets/zensus_vg250.py b/src/egon/data/datasets/zensus_vg250.py index b4234c01e..62b412350 100644 --- a/src/egon/data/datasets/zensus_vg250.py +++ b/src/egon/data/datasets/zensus_vg250.py @@ -2,16 +2,6 @@ import json import time -import egon.data.config -import geopandas as gpd -from egon.data import db -from egon.data.datasets import Dataset -from egon.data.datasets.vg250 import vg250_metadata_resources_fields -from egon.data.metadata import ( - context, - licenses_datenlizenz_deutschland, - meta_metadata, -) from geoalchemy2 import Geometry from sqlalchemy import ( BigInteger, @@ -24,16 +14,20 @@ select, ) from sqlalchemy.ext.declarative import declarative_base -import time -import datetime +import geopandas as gpd + +from egon.data import db +from egon.data.datasets import Dataset +from egon.data.datasets.vg250 import vg250_metadata_resources_fields from egon.data.metadata import ( context, - meta_metadata, + generate_resource_fields_from_sqla_model, license_ccby, + licenses_datenlizenz_deutschland, + meta_metadata, sources, - generate_resource_fields_from_sqla_model, ) -import json +import egon.data.config Base = declarative_base() From 0277794b7d63ecd06d78d469f942a8b08ba8ab53 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 6 Mar 2023 13:46:57 +0100 Subject: [PATCH 031/787] Adapt contributors function --- src/egon/data/datasets/etrago_setup.py | 15 +++++++-------- src/egon/data/metadata.py | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) mode change 100644 => 100755 src/egon/data/metadata.py diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 92cc68731..50b8c5c79 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -113,7 +113,7 @@ def get_meta( } # Create json dump - meta_json = "'" + json.dumps(meta, indent=4) + "'" + meta_json = "'" + json.dumps(meta, indent=4, ensure_ascii=False) + "'" return meta_json @@ -391,12 +391,7 @@ class EgonPfHvStore(Base): source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], ] - contributors_dict = contributors() - contributor_list = [ - {key: value for key, value in contributors_dict[author]} - for author in ["an", "fw"] - ] - + contributor_list = contributors(["an", "fw"]) contributor_list[0]["comment"] = "Add H2 storage" contributor_list[1]["comment"] = "Add CH4 storage" license_list = [data["license"] for data in source_list] @@ -404,7 +399,11 @@ class EgonPfHvStore(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Store", source_list, license_list, contributor_list + "grid", + "Store", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, ), } diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py old mode 100644 new mode 100755 index 794181562..5cbf47cc4 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -546,15 +546,17 @@ def sources(): "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", - "license": [licenses_datenlizenz_deutschland( - "© Statistische Ämter des Bundes und der Länder 2014" - )], + "license": [ + licenses_datenlizenz_deutschland( + "© Statistische Ämter des Bundes und der Länder 2014" + ) + ], }, } -def contributors(): - return { +def contributors(authorlist): + contributors_dict = { "am": { "title": "Aadit Malla", "email": "https://github.com/aadit879", @@ -603,4 +605,8 @@ def contributors(): "title": "Ulf Müller", "email": "https://github.com/ulfmueller", }, - } \ No newline at end of file + } + return [ + {key: value for key, value in contributors_dict[author].items()} + for author in authorlist + ] From 88055235e0d4d372c56a2b8cec8371769121a89a Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 6 Mar 2023 13:47:32 +0100 Subject: [PATCH 032/787] Apply black and isort --- src/egon/data/metadata.py | 112 +++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 5cbf47cc4..e7cbb5a7d 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,10 +1,11 @@ import time -from egon.data.db import engine from geoalchemy2 import Geometry from sqlalchemy import MetaData, Table from sqlalchemy.dialects.postgresql.base import ischema_names +from egon.data.db import engine + def context(): """ @@ -180,6 +181,7 @@ def license_geonutzv(attribution): "attribution": attribution, } + def license_agpl(attribution): """ License information for GNU Affero General Public License v3.0 @@ -375,7 +377,11 @@ def sources(): "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", - "licenses": [license_agpl("© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte")] + "licenses": [ + license_agpl( + "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte" + ) + ], }, "Einspeiseatlas": { "title": "Einspeiseatlas", @@ -383,9 +389,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "license": license_ccby( - "Deutsche Energie-Agentur (dena, 2021)" - ), + "license": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), }, "era5": { "title": "ERA5 global reanalysis", @@ -397,31 +401,37 @@ def sources(): "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " "for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", - "license": [{ - "name": "Licence to use Copernicus Products", - "title": "Licence to use Copernicus Products", - "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", - "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. " - "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use " - "may include, but is not limited to: reproduction; distribution; communication to the public; " - "adaptation, modification and combination with other data and information; or any " - "combination of the foregoing", - "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", - },] + "license": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. " + "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use " + "may include, but is not limited to: reproduction; distribution; communication to the public; " + "adaptation, modification and combination with other data and information; or any " + "combination of the foregoing", + "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", + }, + ], }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", "path": "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database", - "licenses": [license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter")], + "licenses": [ + license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter") + ], }, "hotmaps_scen_buildings": { "titel": "scen_current_building_demand", "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario", "path": "https://gitlab.com/hotmaps/scen_current_building_demand", - "licenses": [license_ccby( - "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller" - )], + "licenses": [ + license_ccby( + "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller" + ) + ], }, "mastr": { "title": "open-MaStR power unit registry", @@ -430,9 +440,11 @@ def sources(): "There are duplicates included. For further information read in the documentation" "of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", "path": "https://sandbox.zenodo.org/record/808086", - "licenses": [licenses_datenlizenz_deutschland( - "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" - )], + "licenses": [ + licenses_datenlizenz_deutschland( + "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" + ) + ], }, "nep2021": { "title": "Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf", @@ -473,19 +485,19 @@ def sources(): "For further information please see the documentation available on the Heat Roadmap Europe website, " "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", - "license": [license_ccby( - "© Europa-Universität Flensburg, Halmstad University and Aalborg University" - )], + "license": [ + license_ccby( + "© Europa-Universität Flensburg, Halmstad University and Aalborg University" + ) + ], }, "pipeline_classification": { - "title": "Technical pipeline characteristics for high pressure pipelines", - "description": "Parameters for the classification of gas pipelines, " - "the whole documentation could is available at: " - "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", - "path": "https://zenodo.org/record/5743452", - "license": license_ccby( - "© DIW Berlin, 2017" - ), + "title": "Technical pipeline characteristics for high pressure pipelines", + "description": "Parameters for the classification of gas pipelines, " + "the whole documentation could is available at: " + "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", + "path": "https://zenodo.org/record/5743452", + "license": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -497,23 +509,23 @@ def sources(): "licenses": [license_ccby("© 2019 Danielle Schmidt")], }, "SciGRID_gas": { - "title": "SciGRID_gas IGGIELGN", - "description": "The SciGRID_gas dataset represents the European " - "gas transport network (pressure levels of 20 bars and higher) " - "including the geo-referenced transport pipelines, compressor " - "stations, LNG terminals, storage, production sites, gas power " - "plants, border points, and demand time series. ", - "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_ccby( - " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" - ), + "title": "SciGRID_gas IGGIELGN", + "description": "The SciGRID_gas dataset represents the European " + "gas transport network (pressure levels of 20 bars and higher) " + "including the geo-referenced transport pipelines, compressor " + "stations, LNG terminals, storage, production sites, gas power " + "plants, border points, and demand time series. ", + "path": "https://dx.doi.org/10.5281/zenodo.4896526", + "license": license_ccby( + " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + ), }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data" "within main sectors: Chemical industry, Iron and steel, Non-ferrous metals, Non-metallic minerals, Paper and printing, and Refineries.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", - "licenses": [license_ccby("© Europa-Universität Flensburg")] + "licenses": [license_ccby("© Europa-Universität Flensburg")], }, "tyndp": { "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", @@ -534,10 +546,12 @@ def sources(): "Verwaltungseinheit sowie die spezifische Bezeichnung der " "Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", - "licenses": [licenses_datenlizenz_deutschland( - "© Bundesamt für Kartographie und Geodäsie " - "2020 (Daten verändert)" - )], + "licenses": [ + licenses_datenlizenz_deutschland( + "© Bundesamt für Kartographie und Geodäsie " + "2020 (Daten verändert)" + ) + ], }, "zensus": { "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", From 107a47361cd8176c4800414c60b1cf14b04c66e5 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 13 Mar 2023 10:47:47 +0100 Subject: [PATCH 033/787] switch to 2019 for the historic validation scenario --- src/egon/data/datasets/demandregio/__init__.py | 6 +++--- src/egon/data/datasets/scenario_parameters/parameters.py | 6 +++--- .../data/{datasets_sq2015.yml => datasets_sq2019.yml} | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/egon/data/{datasets_sq2015.yml => datasets_sq2019.yml} (99%) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index d9f132283..bb8235c44 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -433,7 +433,7 @@ def disagg_households_power( ) # Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario - if scenario in ["SQ2015_hist", "eGon2021", "eGon2035"]: + if scenario in ["2019", "eGon2021", "eGon2035"]: # chose demand per household size from survey including weighted DHW power_per_HH = demand_per_hh_size["weighted DWH"] / 1e3 @@ -600,7 +600,7 @@ def insert_household_demand(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in ["SQ2015_hist", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["2019", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] @@ -629,7 +629,7 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in ["SQ2015_hist", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["2019", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 9e4a73b28..80e65d14f 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -125,10 +125,10 @@ def global_settings(scenario): "weather_year": 2011, "population_year": 2021, } - elif scenario == "SQ2015_hist": + elif scenario == "2019": parameters = { - "weather_year": 2015, - "population_year": 2015, + "weather_year": 2019, + "population_year": 2019, } else: diff --git a/src/egon/data/datasets_sq2015.yml b/src/egon/data/datasets_sq2019.yml similarity index 99% rename from src/egon/data/datasets_sq2015.yml rename to src/egon/data/datasets_sq2019.yml index 035d04e0c..11998680e 100644 --- a/src/egon/data/datasets_sq2015.yml +++ b/src/egon/data/datasets_sq2019.yml @@ -1,13 +1,13 @@ openstreetmap: original_data: source: - url: "https://download.geofabrik.de/europe/germany-160101.osm.pbf" - url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-160101.osm.pbf" + url: "https://download.geofabrik.de/europe/germany-200101.osm.pbf" + url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-200101.osm.pbf" stylefile: "oedb.style" target: table_prefix: "osm" - file: "germany-160101.osm.pbf" - file_testmode: "schleswig-holstein-160101.osm.pbf" + file: "germany-200101.osm.pbf" + file_testmode: "schleswig-holstein-200101.osm.pbf" processed: schema: "openstreetmap" tables: From eb4979c8bf561fe50269df513415d57fed41f8d0 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 13 Mar 2023 11:19:30 +0100 Subject: [PATCH 034/787] hard switch of weather year to 2019 --- src/egon/data/datasets/era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index 4a0391ab8..0b44d6d93 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -69,7 +69,7 @@ def import_cutout(boundary="Europe"): Weather data stored in cutout """ - weather_year = get_sector_parameters("global", "eGon2035")["weather_year"] + weather_year = get_sector_parameters("global", "2019")["weather_year"] if boundary == "Europe": xs = slice(-12.0, 35.1) From fb7dc7c3db4b9f45b1451e39f71335d674d7d458 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 13 Mar 2023 11:59:04 +0100 Subject: [PATCH 035/787] avoid syntax error --- src/egon/data/airflow/dags/pipeline_status_quo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 71ea9b9d1..ad5a6c778 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -121,7 +121,7 @@ scenario_parameters = ScenarioParameters(dependencies=[setup]) # Download TYNDP data - tyndp_data = Tyndp(dependencies=[setup]) TODO: kick out or adjust + tyndp_data = Tyndp(dependencies=[setup]) #TODO: kick out or adjust # Import zensus population zensus_population = ZensusPopulation(dependencies=[setup, vg250]) From 196bff77530c0c9257d4abb90c8811cc59a28ecd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:15:33 +0100 Subject: [PATCH 036/787] Rename 'license' to 'licenses' --- src/egon/data/metadata.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e7cbb5a7d..48b1f5611 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -320,7 +320,7 @@ def sources(): "salt structures: planning basis, selection criteria and estimation of the potential for the construction " 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", - "license": [license_geonutzv("© BGR, Hannover, 2015")], + "licenses": [license_geonutzv("© BGR, Hannover, 2015")], }, "bgr_inspeeds": { "title": "Flat layered salts in Germany", @@ -343,7 +343,7 @@ def sources(): "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_data_bundle": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -354,7 +354,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": [license_geonutzv("???")], + "licenses": [license_geonutzv("???")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -363,14 +363,14 @@ def sources(): "description": "The report includes availability of saltstructures for energy storage and energy " "storage potential accumulated per federal state in Germany.", "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "demandregio": { "title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " "zeitlichen Auflösung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", - "license": [license_ccby("© FZJ, TUB, FfE")], + "licenses": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { "titel": "eGon-data", @@ -389,7 +389,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "license": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), + "licenses": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), }, "era5": { "title": "ERA5 global reanalysis", @@ -401,7 +401,7 @@ def sources(): "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " "for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", - "license": [ + "licenses": [ { "name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", @@ -457,14 +457,14 @@ def sources(): "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", - "license": [license_ccby("© Übertragungsnetzbetreiber")], + "licenses": [license_ccby("© Übertragungsnetzbetreiber")], }, "openffe_gas": { "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " "More information at https://extremos.ffe.de/.", "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", - "license": [license_ccby("© FfE, eXtremOS Project")], + "licenses": [license_ccby("© FfE, eXtremOS Project")], }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", @@ -485,7 +485,7 @@ def sources(): "For further information please see the documentation available on the Heat Roadmap Europe website, " "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", - "license": [ + "licenses": [ license_ccby( "© Europa-Universität Flensburg, Halmstad University and Aalborg University" ) @@ -497,7 +497,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "license": license_ccby("© DIW Berlin, 2017"), + "licenses": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -516,7 +516,7 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_ccby( + "licenses": license_ccby( " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" ), }, @@ -536,7 +536,7 @@ def sources(): "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " "low carbon future is achieved.", "path": "https://tyndp.entsoe.eu/maps-data", - "license": [license_ccby("© ENTSO-E and ENTSOG")], + "licenses": [license_ccby("© ENTSO-E and ENTSOG")], }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", @@ -560,7 +560,7 @@ def sources(): "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", - "license": [ + "licenses": [ licenses_datenlizenz_deutschland( "© Statistische Ämter des Bundes und der Länder 2014" ) From 4fbe7d116a6f072bfd6c3054b5b256226d823640 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:15:48 +0100 Subject: [PATCH 037/787] Fix name --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 48b1f5611..72cab6afa 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -595,7 +595,7 @@ def contributors(authorlist): "title": "Guido Pleßmann", "email": "https://github.com/gplssm", }, - "ik": { + "ic": { "title": "Ilka Cußmann", "email": "https://github.com/IlkaCu", }, From 066f3178ae1a850108ccf01baa727de828419cc2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:16:33 +0100 Subject: [PATCH 038/787] Fill metadata for static tables --- src/egon/data/datasets/etrago_setup.py | 179 +++++++++++++++++++++++-- 1 file changed, 171 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 50b8c5c79..9ebf6568b 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -129,8 +129,32 @@ def __init__(self, dependencies): class EgonPfHvBus(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["peta"], + + ] + + contributor_list = contributors(["ic", "cb", "ke", "an"]) + contributor_list[0]["comment"] = "Added electricity substations" + contributor_list[1]["comment"] = "Added heat buses" + contributor_list[2]["comment"] = "Added DSM buses" + contributor_list[3]["comment"] = "Added gas sector buses" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_bus" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Bus")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Bus", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -156,10 +180,33 @@ class EgonPfHvBusTimeseries(Base): class EgonPfHvGenerator(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["mastr"], + sources()["nep2021"], + sources()["tyndp"], + ] + + contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) + contributor_list[0]["comment"] = "Added hydro and biomass plants" + contributor_list[1]["comment"] = "Added solar and geothermal plants" + contributor_list[2]["comment"] = "Added wind on- and offshore plants" + contributor_list[3]["comment"] = "Added gas feedin generators" + contributor_list[4]["comment"] = "Added pv ground mounted" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_generator" __table_args__ = { "schema": "grid", - "comment": get_meta("grid", "Generator"), + "comment": get_meta( + "grid", "Generator", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), } scn_name = Column(String, primary_key=True, nullable=False) @@ -213,8 +260,28 @@ class EgonPfHvGeneratorTimeseries(Base): class EgonPfHvLine(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb"]) + contributor_list[0]["comment"] = "Added lines from osmTGmod tables" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_line" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Line")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -256,6 +323,34 @@ class EgonPfHvLineTimeseries(Base): class EgonPfHvLink(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["nep2021"], + sources()["peta"], + sources()["mastr"], + ] + + contributor_list = contributors(["ic", "cb", "ke", "ja"]) + contributor_list[0]["comment"] = "Added DC lines from osmTGmod tables" + contributor_list[1]["comment"] = "Added CHPs and heat links" + contributor_list[2]["comment"] = "Added DSM links" + contributor_list[3]["comment"] = "Added e-Mobility links" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_link" + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Link", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } + __tablename__ = "egon_etrago_link" __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Link")} @@ -298,8 +393,35 @@ class EgonPfHvLinkTimeseries(Base): class EgonPfHvLoad(Base): + + source_list = [ + sources()["egon-data"], + sources()["demandregio"], + sources()["nep2021"], + sources()["peta"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb", "an", "ja"]) + contributor_list[0]["comment"] = "Added electrical demands" + contributor_list[1]["comment"] = "Added heat deands" + contributor_list[2]["comment"] = "Added gas demands" + contributor_list[3]["comment"] = "Added mobility demands" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_load" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Load")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Load", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) load_id = Column(BigInteger, primary_key=True, nullable=False) @@ -334,8 +456,28 @@ class EgonPfHvCarrier(Base): class EgonPfHvStorage(Base): + + source_list = [ + sources()["egon-data"], + sources()["nep2021"], + sources()["mastr"], + ] + + contributor_list = contributors(["ic"]) + contributor_list[0]["comment"] = "Added battery and pumped hydro storage units" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_storage" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Storage")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Storage", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) @@ -391,10 +533,14 @@ class EgonPfHvStore(Base): source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], ] - contributor_list = contributors(["an", "fw"]) + contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" contributor_list[1]["comment"] = "Add CH4 storage" - license_list = [data["license"] for data in source_list] + contributor_list[2]["comment"] = "Add DSM storage" + contributor_list[3]["comment"] = "Add heat storage" + contributor_list[4]["comment"] = "Add e-mobility storage" + + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", @@ -455,10 +601,27 @@ class EgonPfHvTempResolution(Base): class EgonPfHvTransformer(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb"]) + contributor_list[0]["comment"] = "Added transformes from osmTGmod tables" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_transformer" __table_args__ = { "schema": "grid", - "comment": get_meta("grid", "Transformer"), + "comment": get_meta( + "grid", "Transformer", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), } scn_name = Column(String, primary_key=True, nullable=False) From 2347b06e635229eee90b0b2b4c2cb707456fd660 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:17:30 +0100 Subject: [PATCH 039/787] Apply black and isort --- src/egon/data/datasets/etrago_setup.py | 48 +++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 9ebf6568b..e311e2c3a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -129,12 +129,11 @@ def __init__(self, dependencies): class EgonPfHvBus(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], sources()["peta"], - ] contributor_list = contributors(["ic", "cb", "ke", "an"]) @@ -142,14 +141,15 @@ class EgonPfHvBus(Base): contributor_list[1]["comment"] = "Added heat buses" contributor_list[2]["comment"] = "Added DSM buses" contributor_list[3]["comment"] = "Added gas sector buses" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_bus" __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Bus", + "grid", + "Bus", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -180,7 +180,7 @@ class EgonPfHvBusTimeseries(Base): class EgonPfHvGenerator(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -195,14 +195,15 @@ class EgonPfHvGenerator(Base): contributor_list[2]["comment"] = "Added wind on- and offshore plants" contributor_list[3]["comment"] = "Added gas feedin generators" contributor_list[4]["comment"] = "Added pv ground mounted" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_generator" __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Generator", + "grid", + "Generator", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -260,7 +261,7 @@ class EgonPfHvGeneratorTimeseries(Base): class EgonPfHvLine(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -276,7 +277,8 @@ class EgonPfHvLine(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Line", + "grid", + "Line", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -323,7 +325,7 @@ class EgonPfHvLineTimeseries(Base): class EgonPfHvLink(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -344,13 +346,14 @@ class EgonPfHvLink(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Link", + "grid", + "Link", source_list=source_list, license_list=license_list, contributor_list=contributor_list, ), } - + __tablename__ = "egon_etrago_link" __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Link")} @@ -393,7 +396,7 @@ class EgonPfHvLinkTimeseries(Base): class EgonPfHvLoad(Base): - + source_list = [ sources()["egon-data"], sources()["demandregio"], @@ -416,7 +419,8 @@ class EgonPfHvLoad(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Load", + "grid", + "Load", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -456,7 +460,7 @@ class EgonPfHvCarrier(Base): class EgonPfHvStorage(Base): - + source_list = [ sources()["egon-data"], sources()["nep2021"], @@ -464,7 +468,9 @@ class EgonPfHvStorage(Base): ] contributor_list = contributors(["ic"]) - contributor_list[0]["comment"] = "Added battery and pumped hydro storage units" + contributor_list[0][ + "comment" + ] = "Added battery and pumped hydro storage units" license_list = [data["licenses"] for data in source_list] @@ -472,7 +478,8 @@ class EgonPfHvStorage(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Storage", + "grid", + "Storage", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -539,7 +546,7 @@ class EgonPfHvStore(Base): contributor_list[2]["comment"] = "Add DSM storage" contributor_list[3]["comment"] = "Add heat storage" contributor_list[4]["comment"] = "Add e-mobility storage" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { @@ -601,7 +608,7 @@ class EgonPfHvTempResolution(Base): class EgonPfHvTransformer(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -617,7 +624,8 @@ class EgonPfHvTransformer(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Transformer", + "grid", + "Transformer", source_list=source_list, license_list=license_list, contributor_list=contributor_list, From 8feefdd739683c913cc8905e05cb13858ff07021 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 13 Mar 2023 17:56:45 +0100 Subject: [PATCH 040/787] Add gas sector sources and contributors --- src/egon/data/datasets/etrago_setup.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index e311e2c3a..3ab08e8a2 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -134,13 +134,16 @@ class EgonPfHvBus(Base): sources()["egon-data"], sources()["openstreetmap"], sources()["peta"], + sources()["SciGRID_gas"], + sources()["bgr_inspeeds_data_bundle"], ] - contributor_list = contributors(["ic", "cb", "ke", "an"]) + contributor_list = contributors(["ic", "cb", "ke", "an", "fw"]) contributor_list[0]["comment"] = "Added electricity substations" contributor_list[1]["comment"] = "Added heat buses" contributor_list[2]["comment"] = "Added DSM buses" - contributor_list[3]["comment"] = "Added gas sector buses" + contributor_list[3]["comment"] = "Added CH4 sector buses" + contributor_list[4]["comment"] = "Added H2 sector buses" license_list = [data["licenses"] for data in source_list] @@ -187,6 +190,8 @@ class EgonPfHvGenerator(Base): sources()["mastr"], sources()["nep2021"], sources()["tyndp"], + sources()["SciGRID_gas"], + sources()["Einspeiseatlas"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) @@ -332,13 +337,17 @@ class EgonPfHvLink(Base): sources()["nep2021"], sources()["peta"], sources()["mastr"], + sources()["SciGRID_gas"], + sources()["pipeline_classification"], ] - contributor_list = contributors(["ic", "cb", "ke", "ja"]) + contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) contributor_list[0]["comment"] = "Added DC lines from osmTGmod tables" contributor_list[1]["comment"] = "Added CHPs and heat links" contributor_list[2]["comment"] = "Added DSM links" contributor_list[3]["comment"] = "Added e-Mobility links" + contributor_list[4]["comment"] = "Added H2 related links" + contributor_list[5]["comment"] = "Added CH4 links" license_list = [data["licenses"] for data in source_list] @@ -405,6 +414,8 @@ class EgonPfHvLoad(Base): sources()["schmidt"], sources()["hotmaps_industrial_sites"], sources()["openstreetmap"], + sources()["openffe_gas"], + sources()["tyndp"], ] contributor_list = contributors(["ic", "cb", "an", "ja"]) @@ -537,8 +548,8 @@ class EgonPfHvStore(Base): source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], source_dict["bgr_inspeeds_data_bundle"], - source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], + source_dict["SciGRID_gas"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" From b65f7172458eb9f47276cba9cfb68fc5442bc492 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 13 Mar 2023 17:57:21 +0100 Subject: [PATCH 041/787] Adjust metadata sources --- src/egon/data/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 72cab6afa..85015ad84 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -354,7 +354,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": [license_geonutzv("???")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -497,7 +497,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "licenses": license_ccby("© DIW Berlin, 2017"), + "licenses": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -517,7 +517,7 @@ def sources(): "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", "licenses": license_ccby( - " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" ), }, "seenergies": { From 7bee98e64de3d07d04c55dd939d1f4e8556750ac Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Tue, 14 Mar 2023 09:19:35 +0100 Subject: [PATCH 042/787] Add metadata for gas voronois and gas mapping tables --- src/egon/data/datasets/gas_areas.py | 75 +++++++- src/egon/data/datasets/hydrogen_etrago/bus.py | 178 +++++++++++++++++- 2 files changed, 248 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/egon/data/datasets/hydrogen_etrago/bus.py diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index e1ae47ec4..7e1b3649c 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -1,6 +1,9 @@ """The central module containing code to create CH4 and H2 voronoi polygons """ +import datetime +import json + from geoalchemy2.types import Geometry from sqlalchemy import BigInteger, Column, Text from sqlalchemy.ext.declarative import declarative_base @@ -8,6 +11,12 @@ from egon.data import db from egon.data.datasets import Dataset from egon.data.datasets.generate_voronoi import get_voronoi_geodataframe +from egon.data.metadata import ( + context, + contributors, + license_ccby, + meta_metadata, +) class GasAreaseGon2035(Dataset): @@ -34,8 +43,72 @@ def __init__(self, dependencies): class EgonPfHvGasVoronoi(Base): + meta = { + "name": "grid.egon_gas_voronoi", + "title": "Gas voronoi areas", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "H2 and CH4 voronoi cells", + "language": ["en-EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": None, + "licenses": [license_ccby("eGon development team")], + "contributors": contributors(["fw"]), + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_gas_voronoi", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "scn_name", + "description": "Name of the scenario", + "type": "str", + "unit": None, + }, + { + "name": "bus_id", + "description": "Unique identifier", + "type": "integer", + "unit": None, + }, + { + "name": "carrier", + "description": "Carrier of the voronoi cell", + "type": "str", + "unit": None, + }, + { + "name": "geom", + "description": "Voronoi cell geometry", + "type": "Geometry(Polygon, 4326)", + "unit": None, + }, + ], + "primaryKey": ["scn_name", "bus_id"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + # Create json dump + meta_json = "'" + json.dumps(meta, indent=4, ensure_ascii=False) + "'" + __tablename__ = "egon_gas_voronoi" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": meta_json, + } scn_name = Column(Text, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py old mode 100644 new mode 100755 index ca18eebf6..d98afa831 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -1,7 +1,11 @@ """The central module containing all code dealing with heat sector in etrago """ +import datetime +import json from geoalchemy2 import Geometry +from sqlalchemy import BigInteger, Column, Text +from sqlalchemy.ext.declarative import declarative_base from egon.data import config, db from egon.data.datasets.etrago_helpers import ( @@ -9,10 +13,16 @@ finalize_bus_insertion, initialise_bus_insertion, ) +from egon.data.metadata import ( + context, + contributors, + license_ccby, + meta_metadata, +) def insert_hydrogen_buses(scenario="eGon2035"): - """ Insert hydrogen buses to etrago table + """Insert hydrogen buses to etrago table Hydrogen buses are divided into cavern and methane grid attached buses @@ -40,6 +50,84 @@ def insert_hydrogen_buses(scenario="eGon2035"): insert_H2_buses_from_CH4_grid(hydrogen_buses, carrier, target, scenario) +Base = declarative_base() + + +class EgonMapACH2(Base): + meta_ac_h2 = { + "name": "grid.egon_etrago_ac_h2", + "title": "Mapping table of AC-H2 buses", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Table mapping AC and H2 buses in Germany", + "language": ["en-EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": None, + "licenses": [license_ccby("eGon development team")], + "contributors": contributors(["fw"]), + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_ac_h2", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "scn_name", + "description": "Name of the scenario", + "type": "str", + "unit": None, + }, + { + "name": "bus_H2", + "description": "H2 bus_id", + "type": "integer", + "unit": None, + }, + { + "name": "bus_AC", + "description": "AC bus_id", + "type": "integer", + "unit": None, + }, + ], + "primaryKey": ["scn_name", "bus_H2"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + # Create json dump + meta_json_ac_h2 = ( + "'" + json.dumps(meta_ac_h2, indent=4, ensure_ascii=False) + "'" + ) + + __tablename__ = "egon_etrago_ac_h2" + __table_args__ = { + "schema": "grid", + "comment": meta_json_ac_h2, + } + + scn_name = Column(Text, primary_key=True, nullable=False) + bus_H2 = Column(BigInteger, primary_key=True, nullable=False) + bus_AC = Column(BigInteger, primary_key=False, nullable=False) + + +def create_AC_H2_table(): + engine = db.engine() + EgonMapACH2.__table__.drop(bind=engine, checkfirst=True) + EgonMapACH2.__table__.create(bind=engine, checkfirst=True) + + def insert_H2_buses_from_saltcavern(gdf, carrier, sources, target, scn_name): """Insert the H2 buses based saltcavern locations to db. @@ -93,15 +181,93 @@ def insert_H2_buses_from_saltcavern(gdf, carrier, sources, target, scn_name): gdf_H2_cavern["bus_AC"] = AC_bus_ids gdf_H2_cavern["scn_name"] = hydrogen_bus_ids["scn_name"] + create_AC_H2_table() + # Insert data to db gdf_H2_cavern.to_sql( "egon_etrago_ac_h2", db.engine(), schema="grid", index=False, - if_exists="replace", + if_exists="append", + ) + + +class EgonMapH2CH4(Base): + meta_H2_CH4 = { + "name": "grid.egon_etrago_ch4_h2", + "title": "Mapping table of CH4-H2 buses", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Table mapping CH4 and H2 buses in Germany", + "language": ["en-EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": None, + "licenses": [license_ccby("eGon development team")], + "contributors": contributors(["fw"]), + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_ch4_h2", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "scn_name", + "description": "Name of the scenario", + "type": "str", + "unit": None, + }, + { + "name": "bus_H2", + "description": "H2 bus_id", + "type": "integer", + "unit": None, + }, + { + "name": "bus_CH4", + "description": "CH4 bus_id", + "type": "integer", + "unit": None, + }, + ], + "primaryKey": ["scn_name", "bus_H2"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Create json dump + meta_json_H2_CH4 = ( + "'" + json.dumps(meta_H2_CH4, indent=4, ensure_ascii=False) + "'" ) + __tablename__ = "egon_etrago_ch4_h2" + __table_args__ = { + "schema": "grid", + "comment": meta_json_H2_CH4, + } + + scn_name = Column(Text, primary_key=True, nullable=False) + bus_H2 = Column(BigInteger, primary_key=True, nullable=False) + bus_CH4 = Column(BigInteger, primary_key=False, nullable=False) + + +def create_H2_CH4_table(): + engine = db.engine() + EgonMapH2CH4.__table__.drop(bind=engine, checkfirst=True) + EgonMapH2CH4.__table__.create(bind=engine, checkfirst=True) + def insert_H2_buses_from_CH4_grid(gdf, carrier, target, scn_name): """Insert the H2 buses based on CH4 grid to db. @@ -140,18 +306,22 @@ def insert_H2_buses_from_CH4_grid(gdf, carrier, target, scn_name): gdf_H2_CH4["bus_CH4"] = CH4_bus_ids["bus_id"] gdf_H2_CH4["scn_name"] = CH4_bus_ids["scn_name"] + create_H2_CH4_table() + # Insert data to db gdf_H2_CH4.to_sql( "egon_etrago_ch4_h2", engine, schema="grid", index=False, - if_exists="replace", + if_exists="append", ) def insert_hydrogen_buses_eGon100RE(): """Copy H2 buses from the eGon2035 to the eGon100RE scenario.""" copy_and_modify_buses( - "eGon2035", "eGon100RE", {"carrier": ["H2_grid", "H2_saltcavern"]}, + "eGon2035", + "eGon100RE", + {"carrier": ["H2_grid", "H2_saltcavern"]}, ) From 960cb713d2d27d360d2f18906a2b6ceac8f69347 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 14 Mar 2023 14:13:23 +0100 Subject: [PATCH 043/787] add metadata for grid.egon_emob_charging_infrastructure --- .../__init__.py | 21 +-- .../db_classes.py | 128 +++++++++++++++++- 2 files changed, 139 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/__init__.py index c30453d29..a6e7c019c 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/__init__.py @@ -1,14 +1,14 @@ """ Motorized Individual Travel (MIT) Charging Infrastructure -Main module for preparation of static model data for cahrging infrastructure for -motorized individual travel. +Main module for preparation of static model data for cahrging infrastructure +for motorized individual travel. **Contents of this module** * Creation of DB tables * Download and preprocessing of vehicle registration data from zenodo -* Determination of all potential charging locations for the four charging use cases - home, work, public and hpc per mv grid district +* Determination of all potential charging locations for the four charging use + cases home, work, public and hpc per mv grid district * Write results to DB **Configuration** @@ -19,10 +19,11 @@ **Charging Infrastructure** The charging infrastructure allocation is based on [TracBEV[( -https://github.com/rl-institut/tracbev). TracBEV is a tool for the regional allocation -of charging infrastructure. In practice this allows users to use results generated via -[SimBEV](https://github.com/rl-institut/simbev) and place the corresponding charging -points on a map. These are split into the four use cases home, work, public and hpc. +https://github.com/rl-institut/tracbev). TracBEV is a tool for the regional +allocation of charging infrastructure. In practice this allows users to use +results generated via [SimBEV](https://github.com/rl-institut/simbev) and place +the corresponding charging points on a map. These are split into the four use +cases home, work, public and hpc. """ from __future__ import annotations @@ -36,6 +37,7 @@ from egon.data.datasets import Dataset from egon.data.datasets.emobility.motorized_individual_travel_charging_infrastructure.db_classes import ( # noqa: E501 EgonEmobChargingInfrastructure, + add_metadata, ) from egon.data.datasets.emobility.motorized_individual_travel_charging_infrastructure.infrastructure_allocation import ( # noqa: E501 run_tracbev, @@ -117,7 +119,7 @@ class MITChargingInfrastructure(Dataset): def __init__(self, dependencies): super().__init__( name="MITChargingInfrastructure", - version="0.0.1", + version="0.0.2", dependencies=dependencies, tasks=( { @@ -125,5 +127,6 @@ def __init__(self, dependencies): get_tracbev_data, }, run_tracbev, + add_metadata, ), ) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index 67f7a0e81..9bb76c21d 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -2,11 +2,20 @@ DB tables / SQLAlchemy ORM classes for charging infrastructure """ +import datetime +import json + from geoalchemy2 import Geometry from sqlalchemy import Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base -from egon.data import config +from egon.data import config, db +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + license_odbl, + meta_metadata, +) Base = declarative_base() DATASET_CFG = config.datasets()["charging_infrastructure"] @@ -28,3 +37,120 @@ class EgonEmobChargingInfrastructure(Base): srid=DATASET_CFG["original_data"]["sources"]["tracbev"]["srid"] ) ) + + +def add_metadata(): + meta = { + "name": "grid.egon_emob_charging_infrastructure", + "title": "eGon Electromobility Charging Infrastructure", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": ( + "Identified sites for charging infrastructure for motorized " + "individual travel using TracBEV" + ), + "language": "en-US", + "keywords": [ + "mit", + "charging", + "infrastructure", + "electromobility", + "tracbev", + ], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": "1 m", + }, + "temporal": { + "referenceDate": "2022-04-21", + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + { + "title": "TracBEV input data", + "description": ( + "This data set is used with the software tool TracBEV to " + "calculate locations for charging infrastructure from " + "SimBEV results." + ), + "path": "https://zenodo.org/record/6466480#.YmE9xtPP1hE", + "licenses": [license_odbl(attribution="© Schiel, Moritz")], + } + ], + "licenses": [ + license_odbl(attribution="© eGon development team"), + ], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-14", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_emob_charging_infrastructure", + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + DATASET_CFG["targets"]["charging_infrastructure"][ + "schema" + ], + DATASET_CFG["targets"]["charging_infrastructure"][ + "table" + ], + ), + "primaryKey": "cp_id", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github.com/Op" + "enEnergyPlatform/oemetadata/blob/master/metadata/v141/metadat" + "a_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time zone " + "(YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, en-US, " + "de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/OpenEnergyP" + "latform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + meta_json = "'" + json.dumps(meta) + "'" + + db.submit_comment( + meta_json, + DATASET_CFG["targets"]["charging_infrastructure"]["schema"], + DATASET_CFG["targets"]["charging_infrastructure"]["table"], + ) From 80b868716bcc25046666561bc96d74f4cfb91dd6 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 14 Mar 2023 15:21:51 +0100 Subject: [PATCH 044/787] Add technology data and dsm source --- src/egon/data/datasets/etrago_setup.py | 7 ++++++ src/egon/data/metadata.py | 31 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 3ab08e8a2..cd5b27bfe 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -192,6 +192,7 @@ class EgonPfHvGenerator(Base): sources()["tyndp"], sources()["SciGRID_gas"], sources()["Einspeiseatlas"], + sources()["technology-data"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) @@ -339,6 +340,8 @@ class EgonPfHvLink(Base): sources()["mastr"], sources()["SciGRID_gas"], sources()["pipeline_classification"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], ] contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) @@ -476,6 +479,7 @@ class EgonPfHvStorage(Base): sources()["egon-data"], sources()["nep2021"], sources()["mastr"], + sources()["technology-data"], ] contributor_list = contributors(["ic"]) @@ -544,12 +548,15 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): source_dict = sources() + # TODO: Add other sources for dsm source_list = [ source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], source_dict["SciGRID_gas"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 85015ad84..f4d489b2d 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -415,6 +415,22 @@ def sources(): }, ], }, + "dsm-heitkoetter": { + "title": "Assessment of the regionalised demand response potential " + "in Germany using an open source tool and dataset", + "description": "With the expansion of renewable energies in Germany, " + "imminent grid congestion events occur more often. One approach for " + "avoiding curtailment of renewable energies is to cover excess feed-in " + "by demand response. As curtailment is often a local phenomenon, in " + "this work we determine the regional demand response potential for " + "the 401 German administrative districts with a temporal resolution " + "of 15 min, including technical, socio-technical and economic " + "restrictions.", + "path": "https://doi.org/10.1016/j.adapen.2020.100001", + "licenses": [ + license_ccby("© 2020 German Aerospace Center (DLR), " + "Institute of Networked Energy Systems.")], + }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -527,6 +543,21 @@ def sources(): "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", "licenses": [license_ccby("© Europa-Universität Flensburg")], }, + "technology-data": { + "titel": "Energy System Technology Data v0.3.0", + "description": "This script compiles assumptions on energy system " + "technologies (such as costs, efficiencies, lifetimes, etc.) for " + "chosen years (e.g. [2020, 2030, 2050]) from a variety of sources " + "into CSV files to be read by energy system modelling software. " + "The merged outputs have standardized cost years, technology names, " + "units and source information.", + "path": "https://github.com/PyPSA/technology-data/tree/v0.3.0", + "licenses": [ + license_agpl( + "© Marta Victoria (Aarhus University), Kun Zhu (Aarhus University), Elisabeth Zeyen (TUB), Tom Brown (TUB)" + ) + ], + }, "tyndp": { "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. " From e341fff12eb2c73712c8c15f89be663d9e1b66b2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 14 Mar 2023 16:10:27 +0100 Subject: [PATCH 045/787] Add metadata for generaotr and bus timeseries tables --- src/egon/data/datasets/etrago_setup.py | 212 ++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index cd5b27bfe..7501f303e 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -174,8 +174,94 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): + + metadata = { + "name": "grid.egon_etrago_bus_timeseries", + "title": "Bus Timeseries", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "TODO", + "language": [ + "en-EN" + ], + "publicationDate": "2023-03-14", + "context": context(), + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "" + }, + "sources": [ + sources()["egon-data"] + ], + "licenses": [ + sources()["egon-data"]["licenses"] + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "https://github.com/ClaraBuettner", + "comment": "Added meta data" + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_bus_timeseries", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "attribute": "bus_id", + "type": "int", + "unit": "", + "default": "", + "description": "Unique name", + "status": "Input (required)" + }, + { + "attribute": "v_mag_pu_set", + "type": "array", + "unit": "per unit", + "default": "1.", + "description": "Voltage magnitude set point, per unit of v_nom.", + "status": "Input (optional)" + }, + { + "attribute": "scn_name", + "type": "string", + "unit": "n/a", + "default": "n/a", + "description": "Name of the eGon scenario", + "status": "Input" + } + ], + "primaryKey": [ + "scn_name", + "bus_id" + ], + "foreignKeys": [] + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + __tablename__ = "egon_etrago_bus_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": metadata} scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -253,8 +339,130 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): + + metadata = { + "name": "grid.egon_etrago_generator_timeseries", + "title": "Generator Timeseries", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "TODO", + "language": [ + "en-EN" + ], + "publicationDate": "2023-03-14", + "context": context(), + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "" + }, + "sources": [ + sources()["egon-data"], + sources()["era5"] + ], + "licenses": [ + sources()["egon-data"]["licenses"][0], + sources()["era5"]["licenses"][0], + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "https://github.com/ClaraBuettner", + "comment": "Added meta data" + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_bus_timeseries", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "attribute": "generator_id", + "type": "int", + "unit": "", + "default": "", + "description": "Unique name", + }, + { + "attribute": "scn_name", + "type": "string", + "unit": "n/a", + "default": "n/a", + "description": "Name of the eGon scenario", + }, + { + "attribute": "temp_id", + "type": "integer", + "unit": "n/a", + "default": "n/a", + "description": "Unique identifyier of temporal index", + }, + { + "attribute": "p_min_pu", + "type": "array of floats", + "unit": "per unit", + "default": "0.", + "description": "The minimum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions and compulsory feed-in; for conventional generators it represents a minimal dispatch). Note that if comittable is False and p_min_pu > 0, this represents a must-run condition.", + "status": "Input (optional)" + }, + { + "attribute": "p_max_pu", + "type": "array of floats", + "unit": "per unit", + "default": "1.", + "description": "The maximum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions; for conventional generators it represents a maximum dispatch).", + }, + { + "attribute": "p_set", + "type": "array of floats", + "unit": "MW", + "default": "0.", + "description": "active power set point (for PF)", + }, + { + "attribute": "q_set", + "type": "array of floats", + "unit": "MVar", + "default": "0.", + "description": "reactive power set point (for PF)", + }, + { + "attribute": "marginal_cost", + "type": "array of floats", + "unit": "currency/MWh", + "default": "0.", + "description": "Marginal cost of production of 1 MWh.", + }, + ], + "primaryKey": [ + "scn_name", + "generator_id" + "temp_id" + ], + "foreignKeys": [] + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + __tablename__ = "egon_etrago_generator_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": metadata} scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) From 83ad9bfdd42f29cbd7ad13ee21055eb6b72b9c08 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Wed, 15 Mar 2023 13:20:21 +0100 Subject: [PATCH 046/787] Add sources for gas metadata --- src/egon/data/datasets/etrago_setup.py | 2 +- src/egon/data/datasets/gas_areas.py | 16 ++++++------ src/egon/data/datasets/hydrogen_etrago/bus.py | 25 +++++++++++-------- src/egon/data/metadata.py | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 50b8c5c79..23857aec7 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -394,7 +394,7 @@ class EgonPfHvStore(Base): contributor_list = contributors(["an", "fw"]) contributor_list[0]["comment"] = "Add H2 storage" contributor_list[1]["comment"] = "Add CH4 storage" - license_list = [data["license"] for data in source_list] + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 7e1b3649c..160bba978 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -11,12 +11,7 @@ from egon.data import db from egon.data.datasets import Dataset from egon.data.datasets.generate_voronoi import get_voronoi_geodataframe -from egon.data.metadata import ( - context, - contributors, - license_ccby, - meta_metadata, -) +from egon.data.metadata import context, contributors, meta_metadata, sources class GasAreaseGon2035(Dataset): @@ -43,6 +38,11 @@ def __init__(self, dependencies): class EgonPfHvGasVoronoi(Base): + source_list = [ + sources()["openstreetmap"], + sources()["SciGRID_gas"], + sources()["bgr_inspeeds_data_bundle"], + ] meta = { "name": "grid.egon_gas_voronoi", "title": "Gas voronoi areas", @@ -56,8 +56,8 @@ class EgonPfHvGasVoronoi(Base): "extent": "Germany", "resolution": None, }, - "sources": None, - "licenses": [license_ccby("eGon development team")], + "sources": source_list, + "licenses": [data["licenses"] for data in source_list], "contributors": contributors(["fw"]), "resources": [ { diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py index d98afa831..66eaad900 100755 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -13,12 +13,7 @@ finalize_bus_insertion, initialise_bus_insertion, ) -from egon.data.metadata import ( - context, - contributors, - license_ccby, - meta_metadata, -) +from egon.data.metadata import context, contributors, meta_metadata, sources def insert_hydrogen_buses(scenario="eGon2035"): @@ -54,6 +49,11 @@ def insert_hydrogen_buses(scenario="eGon2035"): class EgonMapACH2(Base): + source_list = [ + sources()["openstreetmap"], + sources()["SciGRID_gas"], + sources()["bgr_inspeeds_data_bundle"], + ] meta_ac_h2 = { "name": "grid.egon_etrago_ac_h2", "title": "Mapping table of AC-H2 buses", @@ -67,8 +67,8 @@ class EgonMapACH2(Base): "extent": "Germany", "resolution": None, }, - "sources": None, - "licenses": [license_ccby("eGon development team")], + "sources": source_list, + "licenses": [data["licenses"] for data in source_list], "contributors": contributors(["fw"]), "resources": [ { @@ -194,6 +194,11 @@ def insert_H2_buses_from_saltcavern(gdf, carrier, sources, target, scn_name): class EgonMapH2CH4(Base): + source_list = [ + sources()["openstreetmap"], + sources()["SciGRID_gas"], + sources()["bgr_inspeeds_data_bundle"], + ] meta_H2_CH4 = { "name": "grid.egon_etrago_ch4_h2", "title": "Mapping table of CH4-H2 buses", @@ -207,8 +212,8 @@ class EgonMapH2CH4(Base): "extent": "Germany", "resolution": None, }, - "sources": None, - "licenses": [license_ccby("eGon development team")], + "sources": source_list, + "licenses": [data["licenses"] for data in source_list], "contributors": contributors(["fw"]), "resources": [ { diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e7cbb5a7d..c055d5118 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -320,7 +320,7 @@ def sources(): "salt structures: planning basis, selection criteria and estimation of the potential for the construction " 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", - "license": [license_geonutzv("© BGR, Hannover, 2015")], + "licenses": [license_geonutzv("© BGR, Hannover, 2015")], }, "bgr_inspeeds": { "title": "Flat layered salts in Germany", From d8f8ea184de1dfc14a4c0b0cf2a46f0445daa07f Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Wed, 15 Mar 2023 13:21:02 +0100 Subject: [PATCH 047/787] Remane 'license' to 'licenses' --- src/egon/data/metadata.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index c055d5118..48b1f5611 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -343,7 +343,7 @@ def sources(): "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_data_bundle": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -354,7 +354,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": [license_geonutzv("???")], + "licenses": [license_geonutzv("???")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -363,14 +363,14 @@ def sources(): "description": "The report includes availability of saltstructures for energy storage and energy " "storage potential accumulated per federal state in Germany.", "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "demandregio": { "title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " "zeitlichen Auflösung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", - "license": [license_ccby("© FZJ, TUB, FfE")], + "licenses": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { "titel": "eGon-data", @@ -389,7 +389,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "license": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), + "licenses": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), }, "era5": { "title": "ERA5 global reanalysis", @@ -401,7 +401,7 @@ def sources(): "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " "for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", - "license": [ + "licenses": [ { "name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", @@ -457,14 +457,14 @@ def sources(): "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", - "license": [license_ccby("© Übertragungsnetzbetreiber")], + "licenses": [license_ccby("© Übertragungsnetzbetreiber")], }, "openffe_gas": { "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " "More information at https://extremos.ffe.de/.", "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", - "license": [license_ccby("© FfE, eXtremOS Project")], + "licenses": [license_ccby("© FfE, eXtremOS Project")], }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", @@ -485,7 +485,7 @@ def sources(): "For further information please see the documentation available on the Heat Roadmap Europe website, " "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", - "license": [ + "licenses": [ license_ccby( "© Europa-Universität Flensburg, Halmstad University and Aalborg University" ) @@ -497,7 +497,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "license": license_ccby("© DIW Berlin, 2017"), + "licenses": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -516,7 +516,7 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_ccby( + "licenses": license_ccby( " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" ), }, @@ -536,7 +536,7 @@ def sources(): "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " "low carbon future is achieved.", "path": "https://tyndp.entsoe.eu/maps-data", - "license": [license_ccby("© ENTSO-E and ENTSOG")], + "licenses": [license_ccby("© ENTSO-E and ENTSOG")], }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", @@ -560,7 +560,7 @@ def sources(): "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", - "license": [ + "licenses": [ licenses_datenlizenz_deutschland( "© Statistische Ämter des Bundes und der Länder 2014" ) From f5110308a61978ba3f83fa7188807ee4fdfe827f Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 15 Mar 2023 13:29:53 +0100 Subject: [PATCH 048/787] add metadata for supply.egon_home_batteries (resolve open TODOs later) --- .../db_classes.py | 7 +- .../data/datasets/storages/home_batteries.py | 131 ++++++++++++++++++ 2 files changed, 135 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index 9bb76c21d..f28a966a5 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -40,6 +40,9 @@ class EgonEmobChargingInfrastructure(Base): def add_metadata(): + """ + Add metadata to table grid.egon_emob_charging_infrastructure + """ meta = { "name": "grid.egon_emob_charging_infrastructure", "title": "eGon Electromobility Charging Infrastructure", @@ -147,10 +150,8 @@ def add_metadata(): }, } - meta_json = "'" + json.dumps(meta) + "'" - db.submit_comment( - meta_json, + f"'{json.dumps(meta)}'", DATASET_CFG["targets"]["charging_infrastructure"]["schema"], DATASET_CFG["targets"]["charging_infrastructure"]["table"], ) diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 40d19c1ea..286e27bd9 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -32,6 +32,9 @@ The selection of buildings is done randomly until a result is reached which is close to achieving the sizing specification. """ +import datetime +import json + from loguru import logger from numpy.random import RandomState from sqlalchemy import Column, Float, Integer, String @@ -40,6 +43,11 @@ import pandas as pd from egon.data import config, db +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + meta_metadata, +) Base = declarative_base() @@ -188,6 +196,129 @@ class EgonHomeBatteries(Base): capacity = Column(Float) +def add_metadata(): + """ + Add metadata to table supply.egon_home_batteries + """ + targets = config.datasets()["home_batteries"]["targets"] + + meta = { + "name": ( + f"{targets['home_batteries']['schema']}." + f"{targets['home_batteries']['table']}" + ), + "title": "eGon Home Batteries", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Home storage systems allocated to buildings", + "language": "en-US", + "keywords": ["battery", "batteries", "home", "storage", "building"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "building", + }, + "temporal": { + "referenceDate": "2021-12-31", + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + { + "title": "TODO", + "description": "TODO", + "path": "TODO", + "licenses": [ + { + "name": "TODO", + "title": "TODO", + "path": "TODO", + "instruction": "TODO", + "attribution": "TODO", + } + ], + } + ], + "licenses": [ + { + "name": "TODO", + "title": "TODO", + "path": "TODO", + "instruction": "TODO", + "attribution": "© eGon development team", + } + ], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-15", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": ( + f"{targets['home_batteries']['schema']}." + f"{targets['home_batteries']['table']}" + ), + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + targets["home_batteries"]["schema"], + targets["home_batteries"]["table"], + ), + "primaryKey": "index", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github.com/" + "OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/" + "metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time zone " + "(YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, en-US, " + "de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + targets["home_batteries"]["schema"], + targets["home_batteries"]["table"], + ) + + def create_table(df): """Create mapping table home battery <-> building id""" engine = db.engine() From 069e2843c930693f6685819a6006193b978c56fb Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 15 Mar 2023 14:02:39 +0100 Subject: [PATCH 049/787] add DL-DE-BY-2.0 license to metadata.py --- src/egon/data/metadata.py | 46 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e7cbb5a7d..62533c978 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,5 +1,3 @@ -import time - from geoalchemy2 import Geometry from sqlalchemy import MetaData, Table from sqlalchemy.dialects.postgresql.base import ischema_names @@ -206,7 +204,49 @@ def license_agpl(attribution): "work, under the same license. Copyright and license notices must be" "preserved. Contributors provide an express grant of patent rights." "When a modified version is used to provide a service over a network," - "the complete source code of the modified version must be made available.", + "the complete source code of the modified version must be made " + "available.", + "attribution": attribution, + } + + +def license_dedl(attribution): + """ + License information for Data licence Germany – attribution – version 2.0 + + Parameters + ---------- + attribution : str + Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG' + + Returns + ------- + dict + OEP metadata conform data license information + """ + return { + "name": "DL-DE-BY-2.0", + "title": "Data licence Germany – attribution – version 2.0", + "path": "https://www.govdata.de/dl-de/by-2-0", + "instruction": ( + "Any use will be permitted provided it fulfils the requirements of" + " this 'Data licence Germany – attribution – Version 2.0'. The " + "data and meta-data provided may, for commercial and " + "non-commercial use, in particular be copied, printed, presented, " + "altered, processed and transmitted to third parties; be merged " + "with own data and with the data of others and be combined to form" + " new and independent datasets; be integrated in internal and " + "external business processes, products and applications in public " + "and non-public electronic networks. The user must ensure that the" + " source note contains the following information: the name of the " + "provider, the annotation 'Data licence Germany – attribution – " + "Version 2.0' or 'dl-de/by-2-0' referring to the licence text " + "available at www.govdata.de/dl-de/by-2-0, and a reference to the " + "dataset (URI). This applies only if the entity keeping the data " + "provides the pieces of information 1-3 for the source note. " + "Changes, editing, new designs or other amendments must be marked " + "as such in the source note." + ), "attribution": attribution, } From d133ac053232f206c64ebccdc16d17adfdfe4f0d Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 15 Mar 2023 14:32:18 +0100 Subject: [PATCH 050/787] add metadata for mastr datasets --- .../datasets/power_plants/mastr_db_classes.py | 153 ++++++++++++++++++ .../data/datasets/storages/home_batteries.py | 2 + 2 files changed, 155 insertions(+) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index 7891dd796..d00dff3a1 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -1,3 +1,6 @@ +import datetime +import json + from geoalchemy2 import Geometry from sqlalchemy import ( Boolean, @@ -10,6 +13,14 @@ ) from sqlalchemy.ext.declarative import declarative_base +from egon.data import config, db +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + license_dedl, + meta_metadata, +) + Base = declarative_base() @@ -280,3 +291,145 @@ class EgonPowerPlantsStorage(Base): geometry_geocoded = Column(Boolean) geom = Column(Geometry("POINT", 4326), index=True, nullable=True) + + +def add_metadata(): + technologies = config.datasets()["mastr_new"]["technologies"] + + target_tables = { + "pv": EgonPowerPlantsPv, + "wind": EgonPowerPlantsWind, + "biomass": EgonPowerPlantsBiomass, + "hydro": EgonPowerPlantsHydro, + "combustion": EgonPowerPlantsCombustion, + "gsgk": EgonPowerPlantsGsgk, + "nuclear": EgonPowerPlantsNuclear, + "storage": EgonPowerPlantsStorage, + } + + for technology in technologies: + target_table = target_tables[technology] + + meta = { + "name": ( + f"{target_table.__table_args__['schema']}." + f"{target_table.__tablename__}" + ), + "title": f"eGon {technology} power plants", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": ( + f"eGon {technology} power plants status quo derived from MaStR" + ), + "language": "en-US", + "keywords": [technology, "mastr"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "1 m", + }, + "temporal": { + "referenceDate": ( + config.datasets()["mastr_new"]["egon2021_date_max"].split( + " " + )[0] + ), + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + { + "title": "Data bundle for egon-data", + "description": ( + "Data bundle for egon-data: A transparent and " + "reproducible data processing pipeline for energy " + "system modeling" + ), + "path": ( + "https://sandbox.zenodo.org/record/" + "1167119#.Y_dWM4CZMVM" + ), + "licenses": [license_dedl(attribution="© Cußmann, Ilka")], + }, + { + "title": ( + "open-MaStR power unit registry for eGo^n project" + ), + "description": ( + "Data from Marktstammdatenregister (MaStR) data using " + "the data dump from 2022-11-17 for eGon-data." + ), + "path": "https://sandbox.zenodo.org/record/1132987", + "licenses": [license_dedl(attribution="© Amme, Jonathan")], + }, + ], + "licenses": [license_dedl(attribution="© eGon development team")], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-15", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": ( + f"{target_table.__table_args__['schema']}." + f"{target_table.__tablename__}" + ), + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + target_table.__table_args__["schema"], + target_table.__tablename__, + ), + "primaryKey": "id", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github." + "com/OpenEnergyPlatform/oemetadata/blob/master/metadata/" + "v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + target_table.__table_args__["schema"], + target_table.__tablename__, + ) diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 286e27bd9..c8ed8e61c 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -181,6 +181,8 @@ def allocate_home_batteries_to_buildings(): create_table(pd.concat(df_list, ignore_index=True)) + add_metadata() + class EgonHomeBatteries(Base): targets = config.datasets()["home_batteries"]["targets"] From 9123cc75e46b793b595efd4c5e688fc5e3533036 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:32:53 +0100 Subject: [PATCH 051/787] Add time series meta data automised --- src/egon/data/datasets/etrago_setup.py | 460 +++++++++++++------------ 1 file changed, 241 insertions(+), 219 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 7501f303e..11f33f2b9 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -42,11 +42,24 @@ network.component_attrs["Storage"] = network.component_attrs["StorageUnit"] -def get_pypsa_field_descriptors(component): +def get_pypsa_field_descriptors(component, timeseries=False): ident = component.lower() + "_id" data = network.component_attrs[component].rename({"name": ident}) + data = data[data.status!="Output"] + + + if timeseries: + data = data[data['type'].str.contains('series')] + data.loc["temp_id"] = [ + "integer", + "n/a", + "n/a", + "Unique identifyier of temporal index", + "Input", + ] + data.loc[ident, "type"] = "int" data.loc["scn_name"] = [ "string", @@ -55,7 +68,6 @@ def get_pypsa_field_descriptors(component): "Name of the eGon scenario", "Input", ] - return data @@ -66,11 +78,15 @@ def get_meta( source_list=[], license_list=[], contributor_list=[], + timeseries=False, ): table = "egon_etrago_" + component.lower() + + if timeseries: + table = table + "_timeseries" fields = ( - get_pypsa_field_descriptors(component) + get_pypsa_field_descriptors(component, timeseries) .reset_index() .to_dict(orient="records") ) @@ -117,7 +133,6 @@ def get_meta( return meta_json - class EtragoSetup(Dataset): def __init__(self, dependencies): super().__init__( @@ -175,93 +190,28 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): - metadata = { - "name": "grid.egon_etrago_bus_timeseries", - "title": "Bus Timeseries", - "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "TODO", - "language": [ - "en-EN" - ], - "publicationDate": "2023-03-14", - "context": context(), - "spatial": { - "location": "", - "extent": "Germany", - "resolution": "" - }, - "sources": [ - sources()["egon-data"] - ], - "licenses": [ - sources()["egon-data"]["licenses"] - ], - "contributors": [ - { - "title": "Clara Büttner", - "email": "https://github.com/ClaraBuettner", - "comment": "Added meta data" - }, - ], - "resources": [ - { - "profile": "tabular-data-resource", - "name": "grid.egon_etrago_bus_timeseries", - "path": "", - "format": "PostgreSQL", - "encoding": "UTF-8", - "schema": { - "fields": [ - { - "attribute": "bus_id", - "type": "int", - "unit": "", - "default": "", - "description": "Unique name", - "status": "Input (required)" - }, - { - "attribute": "v_mag_pu_set", - "type": "array", - "unit": "per unit", - "default": "1.", - "description": "Voltage magnitude set point, per unit of v_nom.", - "status": "Input (optional)" - }, - { - "attribute": "scn_name", - "type": "string", - "unit": "n/a", - "default": "n/a", - "description": "Name of the eGon scenario", - "status": "Input" - } - ], - "primaryKey": [ - "scn_name", - "bus_id" - ], - "foreignKeys": [] - }, - "dialect": { - "delimiter": "", - "decimalSeparator": "." - } - } - ], - "metaMetadata": { - "metadataVersion": "OEP-1.4.1", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - } - } - + + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added metadata" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_bus_timeseries" - __table_args__ = {"schema": "grid", - "comment": metadata} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Bus", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -340,129 +290,31 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): - metadata = { - "name": "grid.egon_etrago_generator_timeseries", - "title": "Generator Timeseries", - "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "TODO", - "language": [ - "en-EN" - ], - "publicationDate": "2023-03-14", - "context": context(), - "spatial": { - "location": "", - "extent": "Germany", - "resolution": "" - }, - "sources": [ + + source_list = [ sources()["egon-data"], - sources()["era5"] - ], - "licenses": [ - sources()["egon-data"]["licenses"][0], - sources()["era5"]["licenses"][0], - ], - "contributors": [ - { - "title": "Clara Büttner", - "email": "https://github.com/ClaraBuettner", - "comment": "Added meta data" - }, - ], - "resources": [ - { - "profile": "tabular-data-resource", - "name": "grid.egon_etrago_bus_timeseries", - "path": "", - "format": "PostgreSQL", - "encoding": "UTF-8", - "schema": { - "fields": [ - { - "attribute": "generator_id", - "type": "int", - "unit": "", - "default": "", - "description": "Unique name", - }, - { - "attribute": "scn_name", - "type": "string", - "unit": "n/a", - "default": "n/a", - "description": "Name of the eGon scenario", - }, - { - "attribute": "temp_id", - "type": "integer", - "unit": "n/a", - "default": "n/a", - "description": "Unique identifyier of temporal index", - }, - { - "attribute": "p_min_pu", - "type": "array of floats", - "unit": "per unit", - "default": "0.", - "description": "The minimum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions and compulsory feed-in; for conventional generators it represents a minimal dispatch). Note that if comittable is False and p_min_pu > 0, this represents a must-run condition.", - "status": "Input (optional)" - }, - { - "attribute": "p_max_pu", - "type": "array of floats", - "unit": "per unit", - "default": "1.", - "description": "The maximum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions; for conventional generators it represents a maximum dispatch).", - }, - { - "attribute": "p_set", - "type": "array of floats", - "unit": "MW", - "default": "0.", - "description": "active power set point (for PF)", - }, - { - "attribute": "q_set", - "type": "array of floats", - "unit": "MVar", - "default": "0.", - "description": "reactive power set point (for PF)", - }, - { - "attribute": "marginal_cost", - "type": "array of floats", - "unit": "currency/MWh", - "default": "0.", - "description": "Marginal cost of production of 1 MWh.", - }, - ], - "primaryKey": [ - "scn_name", - "generator_id" - "temp_id" - ], - "foreignKeys": [] - }, - "dialect": { - "delimiter": "", - "decimalSeparator": "." - } - } - ], - "metaMetadata": { - "metadataVersion": "OEP-1.4.1", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - } - } - + sources()["era5"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added p_max_pu timeseries for pv and wind" + + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_generator_timeseries" - __table_args__ = {"schema": "grid", - "comment": metadata} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Generator", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } + scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) @@ -529,8 +381,29 @@ class EgonPfHvLine(Base): class EgonPfHvLineTimeseries(Base): + + source_list = [ + sources()["egon-data"], + sources()["nep2021"], + ] + + contributor_list = contributors(["ce", "cb"]) + contributor_list[0]["comment"] = "Added s_max_pu timeseries" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_line_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": get_meta( + "grid", + "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -602,8 +475,36 @@ class EgonPfHvLink(Base): class EgonPfHvLinkTimeseries(Base): + source_list = [ + sources()["egon-data"], + sources()["era5"], + sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], + ] + + contributor_list = contributors(["cb", "ke", "ja"]) + contributor_list[0]["comment"] = "Added efficiency timeseries for heat pumps" + contributor_list[1]["comment"] = "Added dsm link timeseries" + contributor_list[2]["comment"] = "Added e mobility link timeseries" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_link_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Link", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) link_id = Column(BigInteger, primary_key=True, nullable=False) @@ -660,8 +561,40 @@ class EgonPfHvLoad(Base): class EgonPfHvLoadTimeseries(Base): + source_list = [ + sources()["egon-data"], + sources()["demandregio"], + sources()["nep2021"], + sources()["peta"], + sources()["openffe_gas"], + sources()["tyndp"], + sources()["era5"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["cb", "ic", "ja", "an"]) + contributor_list[0]["comment"] = "Added heat load timeseries" + contributor_list[1]["comment"] = "Added electricity load timeseries" + contributor_list[2]["comment"] = "Added e mobility load timeseries" + contributor_list[3]["comment"] = "Added gas load timeseries" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_load_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Load", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) load_id = Column(BigInteger, primary_key=True, nullable=False) @@ -671,8 +604,27 @@ class EgonPfHvLoadTimeseries(Base): class EgonPfHvCarrier(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["fw"]) + contributor_list[0][ + "comment" + ] = "Added list of carriers" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_carrier" - __table_args__ = {"schema": "grid"} + __table_args__ = { "schema": "grid", + "comment": get_meta( + "grid", + "Carrier", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } name = Column(Text, primary_key=True, nullable=False) co2_emissions = Column(Float(53), server_default="0.") @@ -739,8 +691,30 @@ class EgonPfHvStorage(Base): class EgonPfHvStorageTimeseries(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0][ + "comment" + ] = "Added metadata" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_storage_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Storage", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } + scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) @@ -810,9 +784,38 @@ class EgonPfHvStore(Base): class EgonPfHvStoreTimeseries(Base): - __tablename__ = "egon_etrago_store_timeseries" - __table_args__ = {"schema": "grid"} + source_dict = sources() + # TODO: Add other sources for dsm + source_list = [ + source_dict["bgr_inspee"], + source_dict["bgr_inspeeds"], + source_dict["bgr_inspeeds_data_bundle"], + source_dict["bgr_inspeeds_report"], + source_dict["SciGRID_gas"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], + ] + contributor_list = contributors(["ke", "ja"]) + contributor_list[0]["comment"] = "Add DSM storage" + contributor_list[1]["comment"] = "Add e-mobility storage" + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_store_timeseries" + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Store", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) store_id = Column(BigInteger, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -888,8 +891,27 @@ class EgonPfHvTransformer(Base): class EgonPfHvTransformerTimeseries(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_transformer_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Transformer", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) trafo_id = Column(BigInteger, primary_key=True, nullable=False) From 19ad6583d161bf4904b5989bebca41b9fc8b3e6e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:33:13 +0100 Subject: [PATCH 052/787] Delete unused imports --- src/egon/data/datasets/etrago_setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 11f33f2b9..de184193a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -28,8 +28,6 @@ from egon.data.metadata import ( context, contributors, - generate_resource_fields_from_sqla_model, - license_ccby, meta_metadata, sources, ) From f857b09e8a3a889e1bf9201e51ab6228c4e9ebe8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:33:24 +0100 Subject: [PATCH 053/787] Add dsm sources --- src/egon/data/datasets/etrago_setup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index de184193a..eb51103b2 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -421,6 +421,9 @@ class EgonPfHvLink(Base): sources()["pipeline_classification"], sources()["technology-data"], sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["demandregio"], ] contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) @@ -728,7 +731,7 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): source_dict = sources() - # TODO: Add other sources for dsm + source_list = [ source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], @@ -737,6 +740,10 @@ class EgonPfHvStore(Base): source_dict["SciGRID_gas"], sources()["technology-data"], sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" From baa66adc187d6f25827fc02dd6db21aba6277f7f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:34:03 +0100 Subject: [PATCH 054/787] Apply black and isort --- src/egon/data/datasets/etrago_setup.py | 100 +++++++++++-------------- 1 file changed, 45 insertions(+), 55 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index eb51103b2..45356c64a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -25,12 +25,7 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.metadata import ( - context, - contributors, - meta_metadata, - sources, -) +from egon.data.metadata import context, contributors, meta_metadata, sources Base = declarative_base() metadata = Base.metadata @@ -45,11 +40,10 @@ def get_pypsa_field_descriptors(component, timeseries=False): ident = component.lower() + "_id" data = network.component_attrs[component].rename({"name": ident}) - data = data[data.status!="Output"] + data = data[data.status != "Output"] - - if timeseries: - data = data[data['type'].str.contains('series')] + if timeseries: + data = data[data["type"].str.contains("series")] data.loc["temp_id"] = [ "integer", "n/a", @@ -80,7 +74,7 @@ def get_meta( ): table = "egon_etrago_" + component.lower() - + if timeseries: table = table + "_timeseries" fields = ( @@ -131,6 +125,7 @@ def get_meta( return meta_json + class EtragoSetup(Dataset): def __init__(self, dependencies): super().__init__( @@ -187,7 +182,6 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): - source_list = [ sources()["egon-data"], @@ -287,16 +281,16 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): - - + source_list = [ sources()["egon-data"], sources()["era5"], ] contributor_list = contributors(["cb"]) - contributor_list[0]["comment"] = "Added p_max_pu timeseries for pv and wind" - + contributor_list[0][ + "comment" + ] = "Added p_max_pu timeseries for pv and wind" license_list = [data["licenses"] for data in source_list] @@ -313,7 +307,6 @@ class EgonPfHvGeneratorTimeseries(Base): ), } - scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -379,7 +372,7 @@ class EgonPfHvLine(Base): class EgonPfHvLineTimeseries(Base): - + source_list = [ sources()["egon-data"], sources()["nep2021"], @@ -392,16 +385,17 @@ class EgonPfHvLineTimeseries(Base): license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_line_timeseries" - __table_args__ = {"schema": "grid", - "comment": get_meta( - "grid", - "Line", - source_list=source_list, - license_list=license_list, - contributor_list=contributor_list, - timeseries=True - ), - } + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -487,13 +481,14 @@ class EgonPfHvLinkTimeseries(Base): ] contributor_list = contributors(["cb", "ke", "ja"]) - contributor_list[0]["comment"] = "Added efficiency timeseries for heat pumps" + contributor_list[0][ + "comment" + ] = "Added efficiency timeseries for heat pumps" contributor_list[1]["comment"] = "Added dsm link timeseries" contributor_list[2]["comment"] = "Added e mobility link timeseries" license_list = [data["licenses"] for data in source_list] - - + __tablename__ = "egon_etrago_link_timeseries" __table_args__ = { "schema": "grid", @@ -562,7 +557,7 @@ class EgonPfHvLoad(Base): class EgonPfHvLoadTimeseries(Base): - source_list = [ + source_list = [ sources()["egon-data"], sources()["demandregio"], sources()["nep2021"], @@ -582,8 +577,7 @@ class EgonPfHvLoadTimeseries(Base): contributor_list[3]["comment"] = "Added gas load timeseries" license_list = [data["licenses"] for data in source_list] - - + __tablename__ = "egon_etrago_load_timeseries" __table_args__ = { "schema": "grid", @@ -610,22 +604,21 @@ class EgonPfHvCarrier(Base): ] contributor_list = contributors(["fw"]) - contributor_list[0][ - "comment" - ] = "Added list of carriers" - + contributor_list[0]["comment"] = "Added list of carriers" + license_list = [data["licenses"] for data in source_list] - + __tablename__ = "egon_etrago_carrier" - __table_args__ = { "schema": "grid", - "comment": get_meta( - "grid", - "Carrier", - source_list=source_list, - license_list=license_list, - contributor_list=contributor_list, - ), - } + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Carrier", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } name = Column(Text, primary_key=True, nullable=False) co2_emissions = Column(Float(53), server_default="0.") @@ -697,9 +690,7 @@ class EgonPfHvStorageTimeseries(Base): ] contributor_list = contributors(["cb"]) - contributor_list[0][ - "comment" - ] = "Added metadata" + contributor_list[0]["comment"] = "Added metadata" license_list = [data["licenses"] for data in source_list] @@ -712,11 +703,10 @@ class EgonPfHvStorageTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } - scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -818,7 +808,7 @@ class EgonPfHvStoreTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } scn_name = Column(String, primary_key=True, nullable=False) @@ -914,7 +904,7 @@ class EgonPfHvTransformerTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } From 082dbd18022536c216092e5b2127141556c01659 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:36:50 +0100 Subject: [PATCH 055/787] Add vg250 to generator sources --- src/egon/data/datasets/etrago_setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 45356c64a..dd57ee8a5 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -221,6 +221,7 @@ class EgonPfHvGenerator(Base): sources()["SciGRID_gas"], sources()["Einspeiseatlas"], sources()["technology-data"], + sources()["vg250"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) From 2c6f96ee0f2993f01733547962e7e77be2220566 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:53:22 +0100 Subject: [PATCH 056/787] Update default values for meta data --- src/egon/data/datasets/etrago_setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index dd57ee8a5..7a7a10724 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -60,6 +60,8 @@ def get_pypsa_field_descriptors(component, timeseries=False): "Name of the eGon scenario", "Input", ] + data.unit.fillna("none", inplace=True) + data.default.fillna("n/a", inplace=True) return data @@ -114,7 +116,10 @@ def get_meta( "primaryKey": ["scn_name", component.lower() + "_id"], "foreignKeys": [], }, - "dialect": {"delimiter": None, "decimalSeparator": "."}, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + }, } ], "metaMetadata": meta_metadata(), From 0be7172886abf379c021305bf1efb86c85c002af Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:53:49 +0100 Subject: [PATCH 057/787] Fix licenses list in metadata --- src/egon/data/datasets/etrago_setup.py | 34 +++++++++++++------------- src/egon/data/metadata.py | 8 +++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 7a7a10724..0a79be0dd 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -158,7 +158,7 @@ class EgonPfHvBus(Base): contributor_list[3]["comment"] = "Added CH4 sector buses" contributor_list[4]["comment"] = "Added H2 sector buses" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_bus" __table_args__ = { @@ -195,7 +195,7 @@ class EgonPfHvBusTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_bus_timeseries" __table_args__ = { @@ -236,7 +236,7 @@ class EgonPfHvGenerator(Base): contributor_list[3]["comment"] = "Added gas feedin generators" contributor_list[4]["comment"] = "Added pv ground mounted" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator" __table_args__ = { @@ -298,7 +298,7 @@ class EgonPfHvGeneratorTimeseries(Base): "comment" ] = "Added p_max_pu timeseries for pv and wind" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator_timeseries" __table_args__ = { @@ -334,7 +334,7 @@ class EgonPfHvLine(Base): contributor_list[0]["comment"] = "Added lines from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_line" __table_args__ = { @@ -388,7 +388,7 @@ class EgonPfHvLineTimeseries(Base): contributor_list[0]["comment"] = "Added s_max_pu timeseries" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_line_timeseries" __table_args__ = { @@ -434,7 +434,7 @@ class EgonPfHvLink(Base): contributor_list[4]["comment"] = "Added H2 related links" contributor_list[5]["comment"] = "Added CH4 links" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_link" __table_args__ = { @@ -493,7 +493,7 @@ class EgonPfHvLinkTimeseries(Base): contributor_list[1]["comment"] = "Added dsm link timeseries" contributor_list[2]["comment"] = "Added e mobility link timeseries" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_link_timeseries" __table_args__ = { @@ -538,7 +538,7 @@ class EgonPfHvLoad(Base): contributor_list[2]["comment"] = "Added gas demands" contributor_list[3]["comment"] = "Added mobility demands" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load" __table_args__ = { @@ -582,7 +582,7 @@ class EgonPfHvLoadTimeseries(Base): contributor_list[2]["comment"] = "Added e mobility load timeseries" contributor_list[3]["comment"] = "Added gas load timeseries" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load_timeseries" __table_args__ = { @@ -612,7 +612,7 @@ class EgonPfHvCarrier(Base): contributor_list = contributors(["fw"]) contributor_list[0]["comment"] = "Added list of carriers" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_carrier" __table_args__ = { @@ -647,7 +647,7 @@ class EgonPfHvStorage(Base): "comment" ] = "Added battery and pumped hydro storage units" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage" __table_args__ = { @@ -698,7 +698,7 @@ class EgonPfHvStorageTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage_timeseries" __table_args__ = { @@ -748,7 +748,7 @@ class EgonPfHvStore(Base): contributor_list[3]["comment"] = "Add heat storage" contributor_list[4]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", @@ -804,7 +804,7 @@ class EgonPfHvStoreTimeseries(Base): contributor_list[0]["comment"] = "Add DSM storage" contributor_list[1]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store_timeseries" __table_args__ = { "schema": "grid", @@ -848,7 +848,7 @@ class EgonPfHvTransformer(Base): contributor_list[0]["comment"] = "Added transformes from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_transformer" __table_args__ = { @@ -899,7 +899,7 @@ class EgonPfHvTransformerTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_transformer_timeseries" __table_args__ = { diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index f4d489b2d..4daffe71d 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -389,7 +389,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "licenses": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), + "licenses": [license_ccby("Deutsche Energie-Agentur (dena, 2021)")], }, "era5": { "title": "ERA5 global reanalysis", @@ -513,7 +513,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "licenses": license_ccby("© DIW Berlin, 2017"), + "licenses": [license_ccby("© DIW Berlin, 2017")], }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -532,9 +532,9 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": license_ccby( + "licenses": [license_ccby( "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" - ), + ),] }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", From 928b611657054a98c1aa9db10b513b1e897d952f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:56:44 +0100 Subject: [PATCH 058/787] Change contributors of egon-data source --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 4daffe71d..d9fa5270e 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -379,7 +379,7 @@ def sources(): "path": "https://github.com/openego/eGon-data", "licenses": [ license_agpl( - "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte" + "© eGon development team" ) ], }, From 01df06fa766bbcb44c5894cae593e3d9b9726c8f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:58:23 +0100 Subject: [PATCH 059/787] Add era5 sources to line timeseries metadata --- src/egon/data/datasets/etrago_setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 0a79be0dd..ebbc1710e 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -382,6 +382,7 @@ class EgonPfHvLineTimeseries(Base): source_list = [ sources()["egon-data"], sources()["nep2021"], + sources()["era5"], ] contributor_list = contributors(["ce", "cb"]) From 884cce998ce591b537e7408bcba76688fde7aa1e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 17:16:46 +0100 Subject: [PATCH 060/787] Remove unused sources --- src/egon/data/datasets/etrago_setup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index ebbc1710e..92bb70441 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -789,11 +789,6 @@ class EgonPfHvStoreTimeseries(Base): source_dict = sources() # TODO: Add other sources for dsm source_list = [ - source_dict["bgr_inspee"], - source_dict["bgr_inspeeds"], - source_dict["bgr_inspeeds_data_bundle"], - source_dict["bgr_inspeeds_report"], - source_dict["SciGRID_gas"], sources()["technology-data"], sources()["dsm-heitkoetter"], sources()["schmidt"], From 191c319b0e82c88fe846deaa72cce31db6ce89ae Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 16 Mar 2023 07:48:16 +0100 Subject: [PATCH 061/787] add me to contributors function in metadata.py --- src/egon/data/metadata.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index f5b17d88d..5e76c82c1 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -417,11 +417,7 @@ def sources(): "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", - "licenses": [ - license_agpl( - "© eGon development team" - ) - ], + "licenses": [license_agpl("© eGon development team")], }, "Einspeiseatlas": { "title": "Einspeiseatlas", @@ -429,7 +425,9 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "licenses": [license_ccby("Deutsche Energie-Agentur (dena, 2021)")], + "licenses": [ + license_ccby("Deutsche Energie-Agentur (dena, 2021)") + ], }, "era5": { "title": "ERA5 global reanalysis", @@ -468,8 +466,11 @@ def sources(): "restrictions.", "path": "https://doi.org/10.1016/j.adapen.2020.100001", "licenses": [ - license_ccby("© 2020 German Aerospace Center (DLR), " - "Institute of Networked Energy Systems.")], + license_ccby( + "© 2020 German Aerospace Center (DLR), " + "Institute of Networked Energy Systems." + ) + ], }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", @@ -572,9 +573,11 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": [license_ccby( - "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" - ),] + "licenses": [ + license_ccby( + "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + ), + ], }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", @@ -682,6 +685,10 @@ def contributors(authorlist): "title": "Katharina Esterl", "email": "https://github.com/KathiEsterl", }, + "kh": { + "title": "Kilian Helfenbein", + "email": "https://github.com/khelfen", + }, "sg": { "title": "Stephan Günther", "email": "https://github.com/gnn", From 93508f4a087b1cc42c5b1fdfe7c7321023b6ca6f Mon Sep 17 00:00:00 2001 From: IlkaCu Date: Thu, 16 Mar 2023 12:22:04 +0100 Subject: [PATCH 062/787] Add data bundle as source --- src/egon/data/metadata.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 5e76c82c1..00ad12ed3 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -413,12 +413,18 @@ def sources(): "licenses": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { - "titel": "eGon-data", + "title": "eGon-data", "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [license_agpl("© eGon development team")], }, + "egon-data_bundle": { + "title": "Data bundle for egon-data", + "description": "Zenodo repository to provide several different input data sets for eGon-data", + "path": "https://sandbox.zenodo.org/record/1167119", + "licenses": [license_ccby("© eGon development team")], + }, "Einspeiseatlas": { "title": "Einspeiseatlas", "description": "Im Einspeiseatlas finden sie sich die Informationen " @@ -472,6 +478,7 @@ def sources(): ) ], }, + "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", From acdea7f1293fd3c49abed032f95b15243611c8b0 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:01:02 +0100 Subject: [PATCH 063/787] Update license for etrago tables --- src/egon/data/datasets/etrago_setup.py | 50 +++++--------------------- src/egon/data/metadata.py | 12 +++++++ 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 92bb70441..f852cb518 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -25,7 +25,13 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.metadata import context, contributors, meta_metadata, sources +from egon.data.metadata import ( + context, + contributors, + license_egon_data_odbl, + meta_metadata, + sources +) Base = declarative_base() metadata = Base.metadata @@ -70,7 +76,6 @@ def get_meta( component, description="TODO", source_list=[], - license_list=[], contributor_list=[], timeseries=False, ): @@ -102,7 +107,7 @@ def get_meta( "resolution": None, }, "sources": source_list, - "licenses": license_list, + "licenses": [license_egon_data_odbl()], "contributors": contributor_list, "resources": [ { @@ -158,7 +163,6 @@ class EgonPfHvBus(Base): contributor_list[3]["comment"] = "Added CH4 sector buses" contributor_list[4]["comment"] = "Added H2 sector buses" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_bus" __table_args__ = { @@ -167,7 +171,6 @@ class EgonPfHvBus(Base): "grid", "Bus", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -195,8 +198,6 @@ class EgonPfHvBusTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"][0] for data in source_list] - __tablename__ = "egon_etrago_bus_timeseries" __table_args__ = { "schema": "grid", @@ -204,7 +205,6 @@ class EgonPfHvBusTimeseries(Base): "grid", "Bus", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -236,7 +236,6 @@ class EgonPfHvGenerator(Base): contributor_list[3]["comment"] = "Added gas feedin generators" contributor_list[4]["comment"] = "Added pv ground mounted" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator" __table_args__ = { @@ -245,7 +244,6 @@ class EgonPfHvGenerator(Base): "grid", "Generator", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -298,7 +296,6 @@ class EgonPfHvGeneratorTimeseries(Base): "comment" ] = "Added p_max_pu timeseries for pv and wind" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator_timeseries" __table_args__ = { @@ -307,7 +304,6 @@ class EgonPfHvGeneratorTimeseries(Base): "grid", "Generator", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -334,8 +330,6 @@ class EgonPfHvLine(Base): contributor_list[0]["comment"] = "Added lines from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"][0] for data in source_list] - __tablename__ = "egon_etrago_line" __table_args__ = { "schema": "grid", @@ -343,7 +337,6 @@ class EgonPfHvLine(Base): "grid", "Line", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -389,8 +382,6 @@ class EgonPfHvLineTimeseries(Base): contributor_list[0]["comment"] = "Added s_max_pu timeseries" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"][0] for data in source_list] - __tablename__ = "egon_etrago_line_timeseries" __table_args__ = { "schema": "grid", @@ -398,7 +389,6 @@ class EgonPfHvLineTimeseries(Base): "grid", "Line", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -435,7 +425,6 @@ class EgonPfHvLink(Base): contributor_list[4]["comment"] = "Added H2 related links" contributor_list[5]["comment"] = "Added CH4 links" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_link" __table_args__ = { @@ -444,7 +433,6 @@ class EgonPfHvLink(Base): "grid", "Link", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -494,8 +482,6 @@ class EgonPfHvLinkTimeseries(Base): contributor_list[1]["comment"] = "Added dsm link timeseries" contributor_list[2]["comment"] = "Added e mobility link timeseries" - license_list = [data["licenses"][0] for data in source_list] - __tablename__ = "egon_etrago_link_timeseries" __table_args__ = { "schema": "grid", @@ -503,7 +489,6 @@ class EgonPfHvLinkTimeseries(Base): "grid", "Link", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -539,7 +524,6 @@ class EgonPfHvLoad(Base): contributor_list[2]["comment"] = "Added gas demands" contributor_list[3]["comment"] = "Added mobility demands" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load" __table_args__ = { @@ -548,7 +532,6 @@ class EgonPfHvLoad(Base): "grid", "Load", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -583,7 +566,6 @@ class EgonPfHvLoadTimeseries(Base): contributor_list[2]["comment"] = "Added e mobility load timeseries" contributor_list[3]["comment"] = "Added gas load timeseries" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load_timeseries" __table_args__ = { @@ -592,7 +574,6 @@ class EgonPfHvLoadTimeseries(Base): "grid", "Load", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -613,7 +594,6 @@ class EgonPfHvCarrier(Base): contributor_list = contributors(["fw"]) contributor_list[0]["comment"] = "Added list of carriers" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_carrier" __table_args__ = { @@ -622,7 +602,6 @@ class EgonPfHvCarrier(Base): "grid", "Carrier", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -648,7 +627,6 @@ class EgonPfHvStorage(Base): "comment" ] = "Added battery and pumped hydro storage units" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage" __table_args__ = { @@ -657,7 +635,6 @@ class EgonPfHvStorage(Base): "grid", "Storage", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -699,7 +676,6 @@ class EgonPfHvStorageTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage_timeseries" __table_args__ = { @@ -708,7 +684,6 @@ class EgonPfHvStorageTimeseries(Base): "grid", "Storage", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -749,7 +724,6 @@ class EgonPfHvStore(Base): contributor_list[3]["comment"] = "Add heat storage" contributor_list[4]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", @@ -757,7 +731,6 @@ class EgonPfHvStore(Base): "grid", "Store", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -800,7 +773,6 @@ class EgonPfHvStoreTimeseries(Base): contributor_list[0]["comment"] = "Add DSM storage" contributor_list[1]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store_timeseries" __table_args__ = { "schema": "grid", @@ -808,7 +780,6 @@ class EgonPfHvStoreTimeseries(Base): "grid", "Store", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), @@ -844,7 +815,6 @@ class EgonPfHvTransformer(Base): contributor_list[0]["comment"] = "Added transformes from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_transformer" __table_args__ = { @@ -853,7 +823,6 @@ class EgonPfHvTransformer(Base): "grid", "Transformer", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, ), } @@ -895,8 +864,6 @@ class EgonPfHvTransformerTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added meta data" - license_list = [data["licenses"][0] for data in source_list] - __tablename__ = "egon_etrago_transformer_timeseries" __table_args__ = { "schema": "grid", @@ -904,7 +871,6 @@ class EgonPfHvTransformerTimeseries(Base): "grid", "Transformer", source_list=source_list, - license_list=license_list, contributor_list=contributor_list, timeseries=True, ), diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 00ad12ed3..1da4d8679 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -251,6 +251,18 @@ def license_dedl(attribution): } +def license_egon_data_odbl(): + """ + ODbL license with eGon data attribution + + Returns + ------- + dict + OEP metadata conform data license information for eGon tables + """ + return license_odbl("© eGon development team") + + def generate_resource_fields_from_sqla_model(model): """Generate a template for the resource fields for metadata from a SQL Alchemy model. From 21d0f7aa2dfa3570ff31edeeb0a3616a1f9e4229 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:01:29 +0100 Subject: [PATCH 064/787] Fix metadata for scenario capacities --- src/egon/data/datasets/scenario_capacities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index a6d09939a..df2fcac7e 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -819,7 +819,7 @@ def add_metadata(): license_ccby( "© Übertragungsnetzbetreiber; " "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " - "© Statistische Ämter des Bundes und der Länder 2014", + "© Statistische Ämter des Bundes und der Länder 2014; " "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", ) ], From 3a925dc48b71ccdf523f897f1ae212efcc60df9a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:02:00 +0100 Subject: [PATCH 065/787] Delete quotation marks from metadata entry --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 1da4d8679..e57654016 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -559,7 +559,7 @@ def sources(): "water and process heat) buildings for the year 2015, were distributed using modelled, spatial " "statistics based floor areas in 100x100m grids and a population grid. " "For further information please see the documentation available on the Heat Roadmap Europe website, " - "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", + "in particular D2.3 report: Methodologies and assumptions used in the mapping.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [ license_ccby( From c39afdfb5bccd01c5baeae2b9078b18cf93abeec Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:11:48 +0100 Subject: [PATCH 066/787] Remove unused imports --- src/egon/data/datasets/district_heating_areas/__init__.py | 1 - src/egon/data/datasets/etrago_setup.py | 1 - src/egon/data/datasets/heat_demand/__init__.py | 2 -- src/egon/data/datasets/renewable_feedin.py | 1 - 4 files changed, 5 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 82ebde10c..5e768881a 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -35,7 +35,6 @@ meta_metadata, license_ccby, sources, - generate_resource_fields_from_sqla_model, ) import json diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index f852cb518..d3f4975cc 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -4,7 +4,6 @@ from geoalchemy2.types import Geometry from shapely.geometry import LineString -from sqlalchemy import schema # ??? from sqlalchemy import ( ARRAY, BigInteger, diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index ee9537483..a3a2369de 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -14,7 +14,6 @@ from pathlib import Path # for database import from urllib.request import urlretrieve -import datetime # for metadata creation import json @@ -41,7 +40,6 @@ ) from egon.data.metadata import ( context, - generate_resource_fields_from_sqla_model, license_ccby, meta_metadata, sources, diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 1ded14b72..fac72bbd9 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -17,7 +17,6 @@ from egon.data.datasets.scenario_parameters import get_sector_parameters from egon.data.metadata import ( context, - generate_resource_fields_from_sqla_model, license_ccby, meta_metadata, sources, From bfdb7c97289c3aadfddf8699d9f5630df983e6d8 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 15 Mar 2023 14:40:05 +0100 Subject: [PATCH 067/787] get deposit id from datasets.yml --- .../data/datasets/power_plants/mastr_db_classes.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index d00dff3a1..bf1b9ea66 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -307,6 +307,11 @@ def add_metadata(): "storage": EgonPowerPlantsStorage, } + deposit_id_data_bundle = config.datasets()["data-bundle"]["sources"][ + "zenodo" + ]["deposit_id"] + deposit_id_mastr = config.datasets()["mastr_new"]["deposit_id"] + for technology in technologies: target_table = target_tables[technology] @@ -353,7 +358,7 @@ def add_metadata(): ), "path": ( "https://sandbox.zenodo.org/record/" - "1167119#.Y_dWM4CZMVM" + f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" ), "licenses": [license_dedl(attribution="© Cußmann, Ilka")], }, @@ -365,7 +370,9 @@ def add_metadata(): "Data from Marktstammdatenregister (MaStR) data using " "the data dump from 2022-11-17 for eGon-data." ), - "path": "https://sandbox.zenodo.org/record/1132987", + "path": ( + f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + ), "licenses": [license_dedl(attribution="© Amme, Jonathan")], }, ], From edf2f8b475c9dae46d0bbc0f2650badadb0fbe36 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:15:33 +0100 Subject: [PATCH 068/787] Rename 'license' to 'licenses' --- src/egon/data/metadata.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 62533c978..179895721 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -360,7 +360,7 @@ def sources(): "salt structures: planning basis, selection criteria and estimation of the potential for the construction " 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", - "license": [license_geonutzv("© BGR, Hannover, 2015")], + "licenses": [license_geonutzv("© BGR, Hannover, 2015")], }, "bgr_inspeeds": { "title": "Flat layered salts in Germany", @@ -383,7 +383,7 @@ def sources(): "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_data_bundle": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -394,7 +394,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": [license_geonutzv("???")], + "licenses": [license_geonutzv("???")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -403,14 +403,14 @@ def sources(): "description": "The report includes availability of saltstructures for energy storage and energy " "storage potential accumulated per federal state in Germany.", "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", - "license": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "demandregio": { "title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " "zeitlichen Auflösung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", - "license": [license_ccby("© FZJ, TUB, FfE")], + "licenses": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { "titel": "eGon-data", @@ -429,7 +429,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "license": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), + "licenses": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), }, "era5": { "title": "ERA5 global reanalysis", @@ -441,7 +441,7 @@ def sources(): "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " "for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", - "license": [ + "licenses": [ { "name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", @@ -497,14 +497,14 @@ def sources(): "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", - "license": [license_ccby("© Übertragungsnetzbetreiber")], + "licenses": [license_ccby("© Übertragungsnetzbetreiber")], }, "openffe_gas": { "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " "More information at https://extremos.ffe.de/.", "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", - "license": [license_ccby("© FfE, eXtremOS Project")], + "licenses": [license_ccby("© FfE, eXtremOS Project")], }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", @@ -525,7 +525,7 @@ def sources(): "For further information please see the documentation available on the Heat Roadmap Europe website, " "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", - "license": [ + "licenses": [ license_ccby( "© Europa-Universität Flensburg, Halmstad University and Aalborg University" ) @@ -537,7 +537,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "license": license_ccby("© DIW Berlin, 2017"), + "licenses": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -556,7 +556,7 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "license": license_ccby( + "licenses": license_ccby( " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" ), }, @@ -576,7 +576,7 @@ def sources(): "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " "low carbon future is achieved.", "path": "https://tyndp.entsoe.eu/maps-data", - "license": [license_ccby("© ENTSO-E and ENTSOG")], + "licenses": [license_ccby("© ENTSO-E and ENTSOG")], }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", @@ -600,7 +600,7 @@ def sources(): "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", - "license": [ + "licenses": [ licenses_datenlizenz_deutschland( "© Statistische Ämter des Bundes und der Länder 2014" ) From 092e8250f5805ccaa299ed18d1930234d81d31b4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:15:48 +0100 Subject: [PATCH 069/787] Fix name --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 179895721..1753538ac 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -635,7 +635,7 @@ def contributors(authorlist): "title": "Guido Pleßmann", "email": "https://github.com/gplssm", }, - "ik": { + "ic": { "title": "Ilka Cußmann", "email": "https://github.com/IlkaCu", }, From b397d2fc2f1b86beb1f3e5d3999847d3d86fad7b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:16:33 +0100 Subject: [PATCH 070/787] Fill metadata for static tables --- src/egon/data/datasets/etrago_setup.py | 179 +++++++++++++++++++++++-- 1 file changed, 171 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 50b8c5c79..9ebf6568b 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -129,8 +129,32 @@ def __init__(self, dependencies): class EgonPfHvBus(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["peta"], + + ] + + contributor_list = contributors(["ic", "cb", "ke", "an"]) + contributor_list[0]["comment"] = "Added electricity substations" + contributor_list[1]["comment"] = "Added heat buses" + contributor_list[2]["comment"] = "Added DSM buses" + contributor_list[3]["comment"] = "Added gas sector buses" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_bus" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Bus")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Bus", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -156,10 +180,33 @@ class EgonPfHvBusTimeseries(Base): class EgonPfHvGenerator(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["mastr"], + sources()["nep2021"], + sources()["tyndp"], + ] + + contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) + contributor_list[0]["comment"] = "Added hydro and biomass plants" + contributor_list[1]["comment"] = "Added solar and geothermal plants" + contributor_list[2]["comment"] = "Added wind on- and offshore plants" + contributor_list[3]["comment"] = "Added gas feedin generators" + contributor_list[4]["comment"] = "Added pv ground mounted" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_generator" __table_args__ = { "schema": "grid", - "comment": get_meta("grid", "Generator"), + "comment": get_meta( + "grid", "Generator", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), } scn_name = Column(String, primary_key=True, nullable=False) @@ -213,8 +260,28 @@ class EgonPfHvGeneratorTimeseries(Base): class EgonPfHvLine(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb"]) + contributor_list[0]["comment"] = "Added lines from osmTGmod tables" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_line" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Line")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -256,6 +323,34 @@ class EgonPfHvLineTimeseries(Base): class EgonPfHvLink(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + sources()["nep2021"], + sources()["peta"], + sources()["mastr"], + ] + + contributor_list = contributors(["ic", "cb", "ke", "ja"]) + contributor_list[0]["comment"] = "Added DC lines from osmTGmod tables" + contributor_list[1]["comment"] = "Added CHPs and heat links" + contributor_list[2]["comment"] = "Added DSM links" + contributor_list[3]["comment"] = "Added e-Mobility links" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_link" + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Link", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } + __tablename__ = "egon_etrago_link" __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Link")} @@ -298,8 +393,35 @@ class EgonPfHvLinkTimeseries(Base): class EgonPfHvLoad(Base): + + source_list = [ + sources()["egon-data"], + sources()["demandregio"], + sources()["nep2021"], + sources()["peta"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb", "an", "ja"]) + contributor_list[0]["comment"] = "Added electrical demands" + contributor_list[1]["comment"] = "Added heat deands" + contributor_list[2]["comment"] = "Added gas demands" + contributor_list[3]["comment"] = "Added mobility demands" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_load" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Load")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Load", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) load_id = Column(BigInteger, primary_key=True, nullable=False) @@ -334,8 +456,28 @@ class EgonPfHvCarrier(Base): class EgonPfHvStorage(Base): + + source_list = [ + sources()["egon-data"], + sources()["nep2021"], + sources()["mastr"], + ] + + contributor_list = contributors(["ic"]) + contributor_list[0]["comment"] = "Added battery and pumped hydro storage units" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_storage" - __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Storage")} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", "Storage", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) @@ -391,10 +533,14 @@ class EgonPfHvStore(Base): source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], ] - contributor_list = contributors(["an", "fw"]) + contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" contributor_list[1]["comment"] = "Add CH4 storage" - license_list = [data["license"] for data in source_list] + contributor_list[2]["comment"] = "Add DSM storage" + contributor_list[3]["comment"] = "Add heat storage" + contributor_list[4]["comment"] = "Add e-mobility storage" + + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", @@ -455,10 +601,27 @@ class EgonPfHvTempResolution(Base): class EgonPfHvTransformer(Base): + + source_list = [ + sources()["egon-data"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["ic", "cb"]) + contributor_list[0]["comment"] = "Added transformes from osmTGmod tables" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_transformer" __table_args__ = { "schema": "grid", - "comment": get_meta("grid", "Transformer"), + "comment": get_meta( + "grid", "Transformer", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), } scn_name = Column(String, primary_key=True, nullable=False) From 7ae5374eff49c25958524fdf8937b28255e3e00e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 13 Mar 2023 16:17:30 +0100 Subject: [PATCH 071/787] Apply black and isort --- src/egon/data/datasets/etrago_setup.py | 48 +++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 9ebf6568b..e311e2c3a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -129,12 +129,11 @@ def __init__(self, dependencies): class EgonPfHvBus(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], sources()["peta"], - ] contributor_list = contributors(["ic", "cb", "ke", "an"]) @@ -142,14 +141,15 @@ class EgonPfHvBus(Base): contributor_list[1]["comment"] = "Added heat buses" contributor_list[2]["comment"] = "Added DSM buses" contributor_list[3]["comment"] = "Added gas sector buses" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_bus" __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Bus", + "grid", + "Bus", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -180,7 +180,7 @@ class EgonPfHvBusTimeseries(Base): class EgonPfHvGenerator(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -195,14 +195,15 @@ class EgonPfHvGenerator(Base): contributor_list[2]["comment"] = "Added wind on- and offshore plants" contributor_list[3]["comment"] = "Added gas feedin generators" contributor_list[4]["comment"] = "Added pv ground mounted" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_generator" __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Generator", + "grid", + "Generator", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -260,7 +261,7 @@ class EgonPfHvGeneratorTimeseries(Base): class EgonPfHvLine(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -276,7 +277,8 @@ class EgonPfHvLine(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Line", + "grid", + "Line", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -323,7 +325,7 @@ class EgonPfHvLineTimeseries(Base): class EgonPfHvLink(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -344,13 +346,14 @@ class EgonPfHvLink(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Link", + "grid", + "Link", source_list=source_list, license_list=license_list, contributor_list=contributor_list, ), } - + __tablename__ = "egon_etrago_link" __table_args__ = {"schema": "grid", "comment": get_meta("grid", "Link")} @@ -393,7 +396,7 @@ class EgonPfHvLinkTimeseries(Base): class EgonPfHvLoad(Base): - + source_list = [ sources()["egon-data"], sources()["demandregio"], @@ -416,7 +419,8 @@ class EgonPfHvLoad(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Load", + "grid", + "Load", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -456,7 +460,7 @@ class EgonPfHvCarrier(Base): class EgonPfHvStorage(Base): - + source_list = [ sources()["egon-data"], sources()["nep2021"], @@ -464,7 +468,9 @@ class EgonPfHvStorage(Base): ] contributor_list = contributors(["ic"]) - contributor_list[0]["comment"] = "Added battery and pumped hydro storage units" + contributor_list[0][ + "comment" + ] = "Added battery and pumped hydro storage units" license_list = [data["licenses"] for data in source_list] @@ -472,7 +478,8 @@ class EgonPfHvStorage(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Storage", + "grid", + "Storage", source_list=source_list, license_list=license_list, contributor_list=contributor_list, @@ -539,7 +546,7 @@ class EgonPfHvStore(Base): contributor_list[2]["comment"] = "Add DSM storage" contributor_list[3]["comment"] = "Add heat storage" contributor_list[4]["comment"] = "Add e-mobility storage" - + license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { @@ -601,7 +608,7 @@ class EgonPfHvTempResolution(Base): class EgonPfHvTransformer(Base): - + source_list = [ sources()["egon-data"], sources()["openstreetmap"], @@ -617,7 +624,8 @@ class EgonPfHvTransformer(Base): __table_args__ = { "schema": "grid", "comment": get_meta( - "grid", "Transformer", + "grid", + "Transformer", source_list=source_list, license_list=license_list, contributor_list=contributor_list, From 6cbe3b428a7f37d99cf3fceaaa398044ce34dd34 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 13 Mar 2023 17:56:45 +0100 Subject: [PATCH 072/787] Add gas sector sources and contributors --- src/egon/data/datasets/etrago_setup.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index e311e2c3a..3ab08e8a2 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -134,13 +134,16 @@ class EgonPfHvBus(Base): sources()["egon-data"], sources()["openstreetmap"], sources()["peta"], + sources()["SciGRID_gas"], + sources()["bgr_inspeeds_data_bundle"], ] - contributor_list = contributors(["ic", "cb", "ke", "an"]) + contributor_list = contributors(["ic", "cb", "ke", "an", "fw"]) contributor_list[0]["comment"] = "Added electricity substations" contributor_list[1]["comment"] = "Added heat buses" contributor_list[2]["comment"] = "Added DSM buses" - contributor_list[3]["comment"] = "Added gas sector buses" + contributor_list[3]["comment"] = "Added CH4 sector buses" + contributor_list[4]["comment"] = "Added H2 sector buses" license_list = [data["licenses"] for data in source_list] @@ -187,6 +190,8 @@ class EgonPfHvGenerator(Base): sources()["mastr"], sources()["nep2021"], sources()["tyndp"], + sources()["SciGRID_gas"], + sources()["Einspeiseatlas"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) @@ -332,13 +337,17 @@ class EgonPfHvLink(Base): sources()["nep2021"], sources()["peta"], sources()["mastr"], + sources()["SciGRID_gas"], + sources()["pipeline_classification"], ] - contributor_list = contributors(["ic", "cb", "ke", "ja"]) + contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) contributor_list[0]["comment"] = "Added DC lines from osmTGmod tables" contributor_list[1]["comment"] = "Added CHPs and heat links" contributor_list[2]["comment"] = "Added DSM links" contributor_list[3]["comment"] = "Added e-Mobility links" + contributor_list[4]["comment"] = "Added H2 related links" + contributor_list[5]["comment"] = "Added CH4 links" license_list = [data["licenses"] for data in source_list] @@ -405,6 +414,8 @@ class EgonPfHvLoad(Base): sources()["schmidt"], sources()["hotmaps_industrial_sites"], sources()["openstreetmap"], + sources()["openffe_gas"], + sources()["tyndp"], ] contributor_list = contributors(["ic", "cb", "an", "ja"]) @@ -537,8 +548,8 @@ class EgonPfHvStore(Base): source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], source_dict["bgr_inspeeds_data_bundle"], - source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], + source_dict["SciGRID_gas"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" From 98f10818321d9d060f033f74a7e610ed92f87b73 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Mon, 13 Mar 2023 17:57:21 +0100 Subject: [PATCH 073/787] Adjust metadata sources --- src/egon/data/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 1753538ac..1a20d2157 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -394,7 +394,7 @@ def sources(): " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " "the data.", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": [license_geonutzv("???")], + "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_report": { "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " @@ -537,7 +537,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "licenses": license_ccby("© DIW Berlin, 2017"), + "licenses": license_ccby("© DIW Berlin, 2017"), }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -557,7 +557,7 @@ def sources(): "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", "licenses": license_ccby( - " Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" ), }, "seenergies": { From 61d9419621029b091ba9fe99d04bc6b2c4f2b6c2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 14 Mar 2023 15:21:51 +0100 Subject: [PATCH 074/787] Add technology data and dsm source --- src/egon/data/datasets/etrago_setup.py | 7 ++++++ src/egon/data/metadata.py | 31 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 3ab08e8a2..cd5b27bfe 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -192,6 +192,7 @@ class EgonPfHvGenerator(Base): sources()["tyndp"], sources()["SciGRID_gas"], sources()["Einspeiseatlas"], + sources()["technology-data"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) @@ -339,6 +340,8 @@ class EgonPfHvLink(Base): sources()["mastr"], sources()["SciGRID_gas"], sources()["pipeline_classification"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], ] contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) @@ -476,6 +479,7 @@ class EgonPfHvStorage(Base): sources()["egon-data"], sources()["nep2021"], sources()["mastr"], + sources()["technology-data"], ] contributor_list = contributors(["ic"]) @@ -544,12 +548,15 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): source_dict = sources() + # TODO: Add other sources for dsm source_list = [ source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], source_dict["bgr_inspeeds_data_bundle"], source_dict["bgr_inspeeds_report"], source_dict["SciGRID_gas"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 1a20d2157..ca8fb1260 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -455,6 +455,22 @@ def sources(): }, ], }, + "dsm-heitkoetter": { + "title": "Assessment of the regionalised demand response potential " + "in Germany using an open source tool and dataset", + "description": "With the expansion of renewable energies in Germany, " + "imminent grid congestion events occur more often. One approach for " + "avoiding curtailment of renewable energies is to cover excess feed-in " + "by demand response. As curtailment is often a local phenomenon, in " + "this work we determine the regional demand response potential for " + "the 401 German administrative districts with a temporal resolution " + "of 15 min, including technical, socio-technical and economic " + "restrictions.", + "path": "https://doi.org/10.1016/j.adapen.2020.100001", + "licenses": [ + license_ccby("© 2020 German Aerospace Center (DLR), " + "Institute of Networked Energy Systems.")], + }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -567,6 +583,21 @@ def sources(): "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", "licenses": [license_ccby("© Europa-Universität Flensburg")], }, + "technology-data": { + "titel": "Energy System Technology Data v0.3.0", + "description": "This script compiles assumptions on energy system " + "technologies (such as costs, efficiencies, lifetimes, etc.) for " + "chosen years (e.g. [2020, 2030, 2050]) from a variety of sources " + "into CSV files to be read by energy system modelling software. " + "The merged outputs have standardized cost years, technology names, " + "units and source information.", + "path": "https://github.com/PyPSA/technology-data/tree/v0.3.0", + "licenses": [ + license_agpl( + "© Marta Victoria (Aarhus University), Kun Zhu (Aarhus University), Elisabeth Zeyen (TUB), Tom Brown (TUB)" + ) + ], + }, "tyndp": { "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. " From 0d1a9215b62f715a832dc31b19e1b45057d143ec Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 14 Mar 2023 16:10:27 +0100 Subject: [PATCH 075/787] Add metadata for generaotr and bus timeseries tables --- src/egon/data/datasets/etrago_setup.py | 212 ++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index cd5b27bfe..7501f303e 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -174,8 +174,94 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): + + metadata = { + "name": "grid.egon_etrago_bus_timeseries", + "title": "Bus Timeseries", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "TODO", + "language": [ + "en-EN" + ], + "publicationDate": "2023-03-14", + "context": context(), + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "" + }, + "sources": [ + sources()["egon-data"] + ], + "licenses": [ + sources()["egon-data"]["licenses"] + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "https://github.com/ClaraBuettner", + "comment": "Added meta data" + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_bus_timeseries", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "attribute": "bus_id", + "type": "int", + "unit": "", + "default": "", + "description": "Unique name", + "status": "Input (required)" + }, + { + "attribute": "v_mag_pu_set", + "type": "array", + "unit": "per unit", + "default": "1.", + "description": "Voltage magnitude set point, per unit of v_nom.", + "status": "Input (optional)" + }, + { + "attribute": "scn_name", + "type": "string", + "unit": "n/a", + "default": "n/a", + "description": "Name of the eGon scenario", + "status": "Input" + } + ], + "primaryKey": [ + "scn_name", + "bus_id" + ], + "foreignKeys": [] + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + __tablename__ = "egon_etrago_bus_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": metadata} scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -253,8 +339,130 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): + + metadata = { + "name": "grid.egon_etrago_generator_timeseries", + "title": "Generator Timeseries", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "TODO", + "language": [ + "en-EN" + ], + "publicationDate": "2023-03-14", + "context": context(), + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "" + }, + "sources": [ + sources()["egon-data"], + sources()["era5"] + ], + "licenses": [ + sources()["egon-data"]["licenses"][0], + sources()["era5"]["licenses"][0], + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "https://github.com/ClaraBuettner", + "comment": "Added meta data" + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_etrago_bus_timeseries", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "attribute": "generator_id", + "type": "int", + "unit": "", + "default": "", + "description": "Unique name", + }, + { + "attribute": "scn_name", + "type": "string", + "unit": "n/a", + "default": "n/a", + "description": "Name of the eGon scenario", + }, + { + "attribute": "temp_id", + "type": "integer", + "unit": "n/a", + "default": "n/a", + "description": "Unique identifyier of temporal index", + }, + { + "attribute": "p_min_pu", + "type": "array of floats", + "unit": "per unit", + "default": "0.", + "description": "The minimum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions and compulsory feed-in; for conventional generators it represents a minimal dispatch). Note that if comittable is False and p_min_pu > 0, this represents a must-run condition.", + "status": "Input (optional)" + }, + { + "attribute": "p_max_pu", + "type": "array of floats", + "unit": "per unit", + "default": "1.", + "description": "The maximum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions; for conventional generators it represents a maximum dispatch).", + }, + { + "attribute": "p_set", + "type": "array of floats", + "unit": "MW", + "default": "0.", + "description": "active power set point (for PF)", + }, + { + "attribute": "q_set", + "type": "array of floats", + "unit": "MVar", + "default": "0.", + "description": "reactive power set point (for PF)", + }, + { + "attribute": "marginal_cost", + "type": "array of floats", + "unit": "currency/MWh", + "default": "0.", + "description": "Marginal cost of production of 1 MWh.", + }, + ], + "primaryKey": [ + "scn_name", + "generator_id" + "temp_id" + ], + "foreignKeys": [] + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + } + } + __tablename__ = "egon_etrago_generator_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": metadata} scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) From b2b6bfbda2f030b2b2fcf4a851a7bf229187c718 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:32:53 +0100 Subject: [PATCH 076/787] Add time series meta data automised --- src/egon/data/datasets/etrago_setup.py | 460 +++++++++++++------------ 1 file changed, 241 insertions(+), 219 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 7501f303e..11f33f2b9 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -42,11 +42,24 @@ network.component_attrs["Storage"] = network.component_attrs["StorageUnit"] -def get_pypsa_field_descriptors(component): +def get_pypsa_field_descriptors(component, timeseries=False): ident = component.lower() + "_id" data = network.component_attrs[component].rename({"name": ident}) + data = data[data.status!="Output"] + + + if timeseries: + data = data[data['type'].str.contains('series')] + data.loc["temp_id"] = [ + "integer", + "n/a", + "n/a", + "Unique identifyier of temporal index", + "Input", + ] + data.loc[ident, "type"] = "int" data.loc["scn_name"] = [ "string", @@ -55,7 +68,6 @@ def get_pypsa_field_descriptors(component): "Name of the eGon scenario", "Input", ] - return data @@ -66,11 +78,15 @@ def get_meta( source_list=[], license_list=[], contributor_list=[], + timeseries=False, ): table = "egon_etrago_" + component.lower() + + if timeseries: + table = table + "_timeseries" fields = ( - get_pypsa_field_descriptors(component) + get_pypsa_field_descriptors(component, timeseries) .reset_index() .to_dict(orient="records") ) @@ -117,7 +133,6 @@ def get_meta( return meta_json - class EtragoSetup(Dataset): def __init__(self, dependencies): super().__init__( @@ -175,93 +190,28 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): - metadata = { - "name": "grid.egon_etrago_bus_timeseries", - "title": "Bus Timeseries", - "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "TODO", - "language": [ - "en-EN" - ], - "publicationDate": "2023-03-14", - "context": context(), - "spatial": { - "location": "", - "extent": "Germany", - "resolution": "" - }, - "sources": [ - sources()["egon-data"] - ], - "licenses": [ - sources()["egon-data"]["licenses"] - ], - "contributors": [ - { - "title": "Clara Büttner", - "email": "https://github.com/ClaraBuettner", - "comment": "Added meta data" - }, - ], - "resources": [ - { - "profile": "tabular-data-resource", - "name": "grid.egon_etrago_bus_timeseries", - "path": "", - "format": "PostgreSQL", - "encoding": "UTF-8", - "schema": { - "fields": [ - { - "attribute": "bus_id", - "type": "int", - "unit": "", - "default": "", - "description": "Unique name", - "status": "Input (required)" - }, - { - "attribute": "v_mag_pu_set", - "type": "array", - "unit": "per unit", - "default": "1.", - "description": "Voltage magnitude set point, per unit of v_nom.", - "status": "Input (optional)" - }, - { - "attribute": "scn_name", - "type": "string", - "unit": "n/a", - "default": "n/a", - "description": "Name of the eGon scenario", - "status": "Input" - } - ], - "primaryKey": [ - "scn_name", - "bus_id" - ], - "foreignKeys": [] - }, - "dialect": { - "delimiter": "", - "decimalSeparator": "." - } - } - ], - "metaMetadata": { - "metadataVersion": "OEP-1.4.1", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - } - } - + + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added metadata" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_bus_timeseries" - __table_args__ = {"schema": "grid", - "comment": metadata} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Bus", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) bus_id = Column(BigInteger, primary_key=True, nullable=False) @@ -340,129 +290,31 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): - metadata = { - "name": "grid.egon_etrago_generator_timeseries", - "title": "Generator Timeseries", - "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "TODO", - "language": [ - "en-EN" - ], - "publicationDate": "2023-03-14", - "context": context(), - "spatial": { - "location": "", - "extent": "Germany", - "resolution": "" - }, - "sources": [ + + source_list = [ sources()["egon-data"], - sources()["era5"] - ], - "licenses": [ - sources()["egon-data"]["licenses"][0], - sources()["era5"]["licenses"][0], - ], - "contributors": [ - { - "title": "Clara Büttner", - "email": "https://github.com/ClaraBuettner", - "comment": "Added meta data" - }, - ], - "resources": [ - { - "profile": "tabular-data-resource", - "name": "grid.egon_etrago_bus_timeseries", - "path": "", - "format": "PostgreSQL", - "encoding": "UTF-8", - "schema": { - "fields": [ - { - "attribute": "generator_id", - "type": "int", - "unit": "", - "default": "", - "description": "Unique name", - }, - { - "attribute": "scn_name", - "type": "string", - "unit": "n/a", - "default": "n/a", - "description": "Name of the eGon scenario", - }, - { - "attribute": "temp_id", - "type": "integer", - "unit": "n/a", - "default": "n/a", - "description": "Unique identifyier of temporal index", - }, - { - "attribute": "p_min_pu", - "type": "array of floats", - "unit": "per unit", - "default": "0.", - "description": "The minimum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions and compulsory feed-in; for conventional generators it represents a minimal dispatch). Note that if comittable is False and p_min_pu > 0, this represents a must-run condition.", - "status": "Input (optional)" - }, - { - "attribute": "p_max_pu", - "type": "array of floats", - "unit": "per unit", - "default": "1.", - "description": "The maximum output for each snapshot per unit of p_nom for the OPF (e.g. for variable renewable generators this can change due to weather conditions; for conventional generators it represents a maximum dispatch).", - }, - { - "attribute": "p_set", - "type": "array of floats", - "unit": "MW", - "default": "0.", - "description": "active power set point (for PF)", - }, - { - "attribute": "q_set", - "type": "array of floats", - "unit": "MVar", - "default": "0.", - "description": "reactive power set point (for PF)", - }, - { - "attribute": "marginal_cost", - "type": "array of floats", - "unit": "currency/MWh", - "default": "0.", - "description": "Marginal cost of production of 1 MWh.", - }, - ], - "primaryKey": [ - "scn_name", - "generator_id" - "temp_id" - ], - "foreignKeys": [] - }, - "dialect": { - "delimiter": "", - "decimalSeparator": "." - } - } - ], - "metaMetadata": { - "metadataVersion": "OEP-1.4.1", - "metadataLicense": { - "name": "CC0-1.0", - "title": "Creative Commons Zero v1.0 Universal", - "path": "https://creativecommons.org/publicdomain/zero/1.0/" - } - } - } - + sources()["era5"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added p_max_pu timeseries for pv and wind" + + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_generator_timeseries" - __table_args__ = {"schema": "grid", - "comment": metadata} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Generator", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } + scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) @@ -529,8 +381,29 @@ class EgonPfHvLine(Base): class EgonPfHvLineTimeseries(Base): + + source_list = [ + sources()["egon-data"], + sources()["nep2021"], + ] + + contributor_list = contributors(["ce", "cb"]) + contributor_list[0]["comment"] = "Added s_max_pu timeseries" + contributor_list[1]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_line_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = {"schema": "grid", + "comment": get_meta( + "grid", + "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -602,8 +475,36 @@ class EgonPfHvLink(Base): class EgonPfHvLinkTimeseries(Base): + source_list = [ + sources()["egon-data"], + sources()["era5"], + sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], + ] + + contributor_list = contributors(["cb", "ke", "ja"]) + contributor_list[0]["comment"] = "Added efficiency timeseries for heat pumps" + contributor_list[1]["comment"] = "Added dsm link timeseries" + contributor_list[2]["comment"] = "Added e mobility link timeseries" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_link_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Link", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) link_id = Column(BigInteger, primary_key=True, nullable=False) @@ -660,8 +561,40 @@ class EgonPfHvLoad(Base): class EgonPfHvLoadTimeseries(Base): + source_list = [ + sources()["egon-data"], + sources()["demandregio"], + sources()["nep2021"], + sources()["peta"], + sources()["openffe_gas"], + sources()["tyndp"], + sources()["era5"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + ] + + contributor_list = contributors(["cb", "ic", "ja", "an"]) + contributor_list[0]["comment"] = "Added heat load timeseries" + contributor_list[1]["comment"] = "Added electricity load timeseries" + contributor_list[2]["comment"] = "Added e mobility load timeseries" + contributor_list[3]["comment"] = "Added gas load timeseries" + + license_list = [data["licenses"] for data in source_list] + + __tablename__ = "egon_etrago_load_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Load", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) load_id = Column(BigInteger, primary_key=True, nullable=False) @@ -671,8 +604,27 @@ class EgonPfHvLoadTimeseries(Base): class EgonPfHvCarrier(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["fw"]) + contributor_list[0][ + "comment" + ] = "Added list of carriers" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_carrier" - __table_args__ = {"schema": "grid"} + __table_args__ = { "schema": "grid", + "comment": get_meta( + "grid", + "Carrier", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } name = Column(Text, primary_key=True, nullable=False) co2_emissions = Column(Float(53), server_default="0.") @@ -739,8 +691,30 @@ class EgonPfHvStorage(Base): class EgonPfHvStorageTimeseries(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0][ + "comment" + ] = "Added metadata" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_storage_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Storage", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } + scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) @@ -810,9 +784,38 @@ class EgonPfHvStore(Base): class EgonPfHvStoreTimeseries(Base): - __tablename__ = "egon_etrago_store_timeseries" - __table_args__ = {"schema": "grid"} + source_dict = sources() + # TODO: Add other sources for dsm + source_list = [ + source_dict["bgr_inspee"], + source_dict["bgr_inspeeds"], + source_dict["bgr_inspeeds_data_bundle"], + source_dict["bgr_inspeeds_report"], + source_dict["SciGRID_gas"], + sources()["technology-data"], + sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], + ] + contributor_list = contributors(["ke", "ja"]) + contributor_list[0]["comment"] = "Add DSM storage" + contributor_list[1]["comment"] = "Add e-mobility storage" + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_store_timeseries" + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Store", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) store_id = Column(BigInteger, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -888,8 +891,27 @@ class EgonPfHvTransformer(Base): class EgonPfHvTransformerTimeseries(Base): + source_list = [ + sources()["egon-data"], + ] + + contributor_list = contributors(["cb"]) + contributor_list[0]["comment"] = "Added meta data" + + license_list = [data["licenses"] for data in source_list] + __tablename__ = "egon_etrago_transformer_timeseries" - __table_args__ = {"schema": "grid"} + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Transformer", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True + ), + } scn_name = Column(String, primary_key=True, nullable=False) trafo_id = Column(BigInteger, primary_key=True, nullable=False) From 5722f8a74b4da0457c0cf28b8284367fff311972 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:33:13 +0100 Subject: [PATCH 077/787] Delete unused imports --- src/egon/data/datasets/etrago_setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 11f33f2b9..de184193a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -28,8 +28,6 @@ from egon.data.metadata import ( context, contributors, - generate_resource_fields_from_sqla_model, - license_ccby, meta_metadata, sources, ) From 962ba72e161a43eab20082f6184e891c55484af2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:33:24 +0100 Subject: [PATCH 078/787] Add dsm sources --- src/egon/data/datasets/etrago_setup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index de184193a..eb51103b2 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -421,6 +421,9 @@ class EgonPfHvLink(Base): sources()["pipeline_classification"], sources()["technology-data"], sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["demandregio"], ] contributor_list = contributors(["ic", "cb", "ke", "ja", "fw", "an"]) @@ -728,7 +731,7 @@ class EgonPfHvStorageTimeseries(Base): class EgonPfHvStore(Base): source_dict = sources() - # TODO: Add other sources for dsm + source_list = [ source_dict["bgr_inspee"], source_dict["bgr_inspeeds"], @@ -737,6 +740,10 @@ class EgonPfHvStore(Base): source_dict["SciGRID_gas"], sources()["technology-data"], sources()["dsm-heitkoetter"], + sources()["schmidt"], + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["demandregio"], ] contributor_list = contributors(["an", "fw", "ke", "cb", "ja"]) contributor_list[0]["comment"] = "Add H2 storage" From 379be4710b44fffa8e2d9f505cb4a0a4e680db16 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:34:03 +0100 Subject: [PATCH 079/787] Apply black and isort --- src/egon/data/datasets/etrago_setup.py | 100 +++++++++++-------------- 1 file changed, 45 insertions(+), 55 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index eb51103b2..45356c64a 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -25,12 +25,7 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.metadata import ( - context, - contributors, - meta_metadata, - sources, -) +from egon.data.metadata import context, contributors, meta_metadata, sources Base = declarative_base() metadata = Base.metadata @@ -45,11 +40,10 @@ def get_pypsa_field_descriptors(component, timeseries=False): ident = component.lower() + "_id" data = network.component_attrs[component].rename({"name": ident}) - data = data[data.status!="Output"] + data = data[data.status != "Output"] - - if timeseries: - data = data[data['type'].str.contains('series')] + if timeseries: + data = data[data["type"].str.contains("series")] data.loc["temp_id"] = [ "integer", "n/a", @@ -80,7 +74,7 @@ def get_meta( ): table = "egon_etrago_" + component.lower() - + if timeseries: table = table + "_timeseries" fields = ( @@ -131,6 +125,7 @@ def get_meta( return meta_json + class EtragoSetup(Dataset): def __init__(self, dependencies): super().__init__( @@ -187,7 +182,6 @@ class EgonPfHvBus(Base): class EgonPfHvBusTimeseries(Base): - source_list = [ sources()["egon-data"], @@ -287,16 +281,16 @@ class EgonPfHvGenerator(Base): class EgonPfHvGeneratorTimeseries(Base): - - + source_list = [ sources()["egon-data"], sources()["era5"], ] contributor_list = contributors(["cb"]) - contributor_list[0]["comment"] = "Added p_max_pu timeseries for pv and wind" - + contributor_list[0][ + "comment" + ] = "Added p_max_pu timeseries for pv and wind" license_list = [data["licenses"] for data in source_list] @@ -313,7 +307,6 @@ class EgonPfHvGeneratorTimeseries(Base): ), } - scn_name = Column(String, primary_key=True, nullable=False) generator_id = Column(Integer, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -379,7 +372,7 @@ class EgonPfHvLine(Base): class EgonPfHvLineTimeseries(Base): - + source_list = [ sources()["egon-data"], sources()["nep2021"], @@ -392,16 +385,17 @@ class EgonPfHvLineTimeseries(Base): license_list = [data["licenses"] for data in source_list] __tablename__ = "egon_etrago_line_timeseries" - __table_args__ = {"schema": "grid", - "comment": get_meta( - "grid", - "Line", - source_list=source_list, - license_list=license_list, - contributor_list=contributor_list, - timeseries=True - ), - } + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Line", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + timeseries=True, + ), + } scn_name = Column(String, primary_key=True, nullable=False) line_id = Column(BigInteger, primary_key=True, nullable=False) @@ -487,13 +481,14 @@ class EgonPfHvLinkTimeseries(Base): ] contributor_list = contributors(["cb", "ke", "ja"]) - contributor_list[0]["comment"] = "Added efficiency timeseries for heat pumps" + contributor_list[0][ + "comment" + ] = "Added efficiency timeseries for heat pumps" contributor_list[1]["comment"] = "Added dsm link timeseries" contributor_list[2]["comment"] = "Added e mobility link timeseries" license_list = [data["licenses"] for data in source_list] - - + __tablename__ = "egon_etrago_link_timeseries" __table_args__ = { "schema": "grid", @@ -562,7 +557,7 @@ class EgonPfHvLoad(Base): class EgonPfHvLoadTimeseries(Base): - source_list = [ + source_list = [ sources()["egon-data"], sources()["demandregio"], sources()["nep2021"], @@ -582,8 +577,7 @@ class EgonPfHvLoadTimeseries(Base): contributor_list[3]["comment"] = "Added gas load timeseries" license_list = [data["licenses"] for data in source_list] - - + __tablename__ = "egon_etrago_load_timeseries" __table_args__ = { "schema": "grid", @@ -610,22 +604,21 @@ class EgonPfHvCarrier(Base): ] contributor_list = contributors(["fw"]) - contributor_list[0][ - "comment" - ] = "Added list of carriers" - + contributor_list[0]["comment"] = "Added list of carriers" + license_list = [data["licenses"] for data in source_list] - + __tablename__ = "egon_etrago_carrier" - __table_args__ = { "schema": "grid", - "comment": get_meta( - "grid", - "Carrier", - source_list=source_list, - license_list=license_list, - contributor_list=contributor_list, - ), - } + __table_args__ = { + "schema": "grid", + "comment": get_meta( + "grid", + "Carrier", + source_list=source_list, + license_list=license_list, + contributor_list=contributor_list, + ), + } name = Column(Text, primary_key=True, nullable=False) co2_emissions = Column(Float(53), server_default="0.") @@ -697,9 +690,7 @@ class EgonPfHvStorageTimeseries(Base): ] contributor_list = contributors(["cb"]) - contributor_list[0][ - "comment" - ] = "Added metadata" + contributor_list[0]["comment"] = "Added metadata" license_list = [data["licenses"] for data in source_list] @@ -712,11 +703,10 @@ class EgonPfHvStorageTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } - scn_name = Column(String, primary_key=True, nullable=False) storage_id = Column(BigInteger, primary_key=True, nullable=False) temp_id = Column(Integer, primary_key=True, nullable=False) @@ -818,7 +808,7 @@ class EgonPfHvStoreTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } scn_name = Column(String, primary_key=True, nullable=False) @@ -914,7 +904,7 @@ class EgonPfHvTransformerTimeseries(Base): source_list=source_list, license_list=license_list, contributor_list=contributor_list, - timeseries=True + timeseries=True, ), } From b0edc9ce31bd0a42e1c58d1665e0e42a70ba2172 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:36:50 +0100 Subject: [PATCH 080/787] Add vg250 to generator sources --- src/egon/data/datasets/etrago_setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 45356c64a..dd57ee8a5 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -221,6 +221,7 @@ class EgonPfHvGenerator(Base): sources()["SciGRID_gas"], sources()["Einspeiseatlas"], sources()["technology-data"], + sources()["vg250"], ] contributor_list = contributors(["ic", "cb", "ce", "an", "ke"]) From 3f33ae0a505a5acb50c149632c79dd1e630ca1c9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:53:22 +0100 Subject: [PATCH 081/787] Update default values for meta data --- src/egon/data/datasets/etrago_setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index dd57ee8a5..7a7a10724 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -60,6 +60,8 @@ def get_pypsa_field_descriptors(component, timeseries=False): "Name of the eGon scenario", "Input", ] + data.unit.fillna("none", inplace=True) + data.default.fillna("n/a", inplace=True) return data @@ -114,7 +116,10 @@ def get_meta( "primaryKey": ["scn_name", component.lower() + "_id"], "foreignKeys": [], }, - "dialect": {"delimiter": None, "decimalSeparator": "."}, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + }, } ], "metaMetadata": meta_metadata(), From 3d9b1d3032a396ff59fe86e390b93f83f0f2ab20 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:53:49 +0100 Subject: [PATCH 082/787] Fix licenses list in metadata --- src/egon/data/datasets/etrago_setup.py | 34 +++++++++++++------------- src/egon/data/metadata.py | 8 +++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 7a7a10724..0a79be0dd 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -158,7 +158,7 @@ class EgonPfHvBus(Base): contributor_list[3]["comment"] = "Added CH4 sector buses" contributor_list[4]["comment"] = "Added H2 sector buses" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_bus" __table_args__ = { @@ -195,7 +195,7 @@ class EgonPfHvBusTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_bus_timeseries" __table_args__ = { @@ -236,7 +236,7 @@ class EgonPfHvGenerator(Base): contributor_list[3]["comment"] = "Added gas feedin generators" contributor_list[4]["comment"] = "Added pv ground mounted" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator" __table_args__ = { @@ -298,7 +298,7 @@ class EgonPfHvGeneratorTimeseries(Base): "comment" ] = "Added p_max_pu timeseries for pv and wind" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_generator_timeseries" __table_args__ = { @@ -334,7 +334,7 @@ class EgonPfHvLine(Base): contributor_list[0]["comment"] = "Added lines from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_line" __table_args__ = { @@ -388,7 +388,7 @@ class EgonPfHvLineTimeseries(Base): contributor_list[0]["comment"] = "Added s_max_pu timeseries" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_line_timeseries" __table_args__ = { @@ -434,7 +434,7 @@ class EgonPfHvLink(Base): contributor_list[4]["comment"] = "Added H2 related links" contributor_list[5]["comment"] = "Added CH4 links" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_link" __table_args__ = { @@ -493,7 +493,7 @@ class EgonPfHvLinkTimeseries(Base): contributor_list[1]["comment"] = "Added dsm link timeseries" contributor_list[2]["comment"] = "Added e mobility link timeseries" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_link_timeseries" __table_args__ = { @@ -538,7 +538,7 @@ class EgonPfHvLoad(Base): contributor_list[2]["comment"] = "Added gas demands" contributor_list[3]["comment"] = "Added mobility demands" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load" __table_args__ = { @@ -582,7 +582,7 @@ class EgonPfHvLoadTimeseries(Base): contributor_list[2]["comment"] = "Added e mobility load timeseries" contributor_list[3]["comment"] = "Added gas load timeseries" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_load_timeseries" __table_args__ = { @@ -612,7 +612,7 @@ class EgonPfHvCarrier(Base): contributor_list = contributors(["fw"]) contributor_list[0]["comment"] = "Added list of carriers" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_carrier" __table_args__ = { @@ -647,7 +647,7 @@ class EgonPfHvStorage(Base): "comment" ] = "Added battery and pumped hydro storage units" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage" __table_args__ = { @@ -698,7 +698,7 @@ class EgonPfHvStorageTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added metadata" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_storage_timeseries" __table_args__ = { @@ -748,7 +748,7 @@ class EgonPfHvStore(Base): contributor_list[3]["comment"] = "Add heat storage" contributor_list[4]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store" __table_args__ = { "schema": "grid", @@ -804,7 +804,7 @@ class EgonPfHvStoreTimeseries(Base): contributor_list[0]["comment"] = "Add DSM storage" contributor_list[1]["comment"] = "Add e-mobility storage" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_store_timeseries" __table_args__ = { "schema": "grid", @@ -848,7 +848,7 @@ class EgonPfHvTransformer(Base): contributor_list[0]["comment"] = "Added transformes from osmTGmod tables" contributor_list[1]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_transformer" __table_args__ = { @@ -899,7 +899,7 @@ class EgonPfHvTransformerTimeseries(Base): contributor_list = contributors(["cb"]) contributor_list[0]["comment"] = "Added meta data" - license_list = [data["licenses"] for data in source_list] + license_list = [data["licenses"][0] for data in source_list] __tablename__ = "egon_etrago_transformer_timeseries" __table_args__ = { diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index ca8fb1260..56101ae9c 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -429,7 +429,7 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "licenses": license_ccby("Deutsche Energie-Agentur (dena, 2021)"), + "licenses": [license_ccby("Deutsche Energie-Agentur (dena, 2021)")], }, "era5": { "title": "ERA5 global reanalysis", @@ -553,7 +553,7 @@ def sources(): "the whole documentation could is available at: " "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", "path": "https://zenodo.org/record/5743452", - "licenses": license_ccby("© DIW Berlin, 2017"), + "licenses": [license_ccby("© DIW Berlin, 2017")], }, "schmidt": { "title": "Supplementary material to the masters thesis: " @@ -572,9 +572,9 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": license_ccby( + "licenses": [license_ccby( "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" - ), + ),] }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", From fe77d98b333b0e64bf7ecde5541ef14c95e63afa Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:56:44 +0100 Subject: [PATCH 083/787] Change contributors of egon-data source --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 56101ae9c..f5b17d88d 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -419,7 +419,7 @@ def sources(): "path": "https://github.com/openego/eGon-data", "licenses": [ license_agpl( - "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte" + "© eGon development team" ) ], }, From 314b780315c46b50657d44eb804da9062d98109c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 16:58:23 +0100 Subject: [PATCH 084/787] Add era5 sources to line timeseries metadata --- src/egon/data/datasets/etrago_setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index 0a79be0dd..ebbc1710e 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -382,6 +382,7 @@ class EgonPfHvLineTimeseries(Base): source_list = [ sources()["egon-data"], sources()["nep2021"], + sources()["era5"], ] contributor_list = contributors(["ce", "cb"]) From 54e99b696ba00036a3fbd5a4f7630a54af699686 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 15 Mar 2023 17:16:46 +0100 Subject: [PATCH 085/787] Remove unused sources --- src/egon/data/datasets/etrago_setup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/egon/data/datasets/etrago_setup.py b/src/egon/data/datasets/etrago_setup.py index ebbc1710e..92bb70441 100755 --- a/src/egon/data/datasets/etrago_setup.py +++ b/src/egon/data/datasets/etrago_setup.py @@ -789,11 +789,6 @@ class EgonPfHvStoreTimeseries(Base): source_dict = sources() # TODO: Add other sources for dsm source_list = [ - source_dict["bgr_inspee"], - source_dict["bgr_inspeeds"], - source_dict["bgr_inspeeds_data_bundle"], - source_dict["bgr_inspeeds_report"], - source_dict["SciGRID_gas"], sources()["technology-data"], sources()["dsm-heitkoetter"], sources()["schmidt"], From c7f66d5dd2b8ce966014717f516d623754fabc81 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 16 Mar 2023 07:48:16 +0100 Subject: [PATCH 086/787] add me to contributors function in metadata.py --- src/egon/data/metadata.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index f5b17d88d..5e76c82c1 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -417,11 +417,7 @@ def sources(): "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", - "licenses": [ - license_agpl( - "© eGon development team" - ) - ], + "licenses": [license_agpl("© eGon development team")], }, "Einspeiseatlas": { "title": "Einspeiseatlas", @@ -429,7 +425,9 @@ def sources(): "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", "path": "https://www.biogaspartner.de/einspeiseatlas/", - "licenses": [license_ccby("Deutsche Energie-Agentur (dena, 2021)")], + "licenses": [ + license_ccby("Deutsche Energie-Agentur (dena, 2021)") + ], }, "era5": { "title": "ERA5 global reanalysis", @@ -468,8 +466,11 @@ def sources(): "restrictions.", "path": "https://doi.org/10.1016/j.adapen.2020.100001", "licenses": [ - license_ccby("© 2020 German Aerospace Center (DLR), " - "Institute of Networked Energy Systems.")], + license_ccby( + "© 2020 German Aerospace Center (DLR), " + "Institute of Networked Energy Systems." + ) + ], }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", @@ -572,9 +573,11 @@ def sources(): "stations, LNG terminals, storage, production sites, gas power " "plants, border points, and demand time series. ", "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": [license_ccby( - "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" - ),] + "licenses": [ + license_ccby( + "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" + ), + ], }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", @@ -682,6 +685,10 @@ def contributors(authorlist): "title": "Katharina Esterl", "email": "https://github.com/KathiEsterl", }, + "kh": { + "title": "Kilian Helfenbein", + "email": "https://github.com/khelfen", + }, "sg": { "title": "Stephan Günther", "email": "https://github.com/gnn", From c8fcad1d7570e14859074a2ab40d297c71c56ec0 Mon Sep 17 00:00:00 2001 From: AmeliaNadal Date: Thu, 16 Mar 2023 14:37:35 +0100 Subject: [PATCH 087/787] Adapt license to odbl --- src/egon/data/datasets/gas_areas.py | 10 ++++++++-- src/egon/data/datasets/hydrogen_etrago/bus.py | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 160bba978..6a2822072 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -11,7 +11,13 @@ from egon.data import db from egon.data.datasets import Dataset from egon.data.datasets.generate_voronoi import get_voronoi_geodataframe -from egon.data.metadata import context, contributors, meta_metadata, sources +from egon.data.metadata import ( + context, + contributors, + license_egon_data_odbl, + meta_metadata, + sources, +) class GasAreaseGon2035(Dataset): @@ -57,7 +63,7 @@ class EgonPfHvGasVoronoi(Base): "resolution": None, }, "sources": source_list, - "licenses": [data["licenses"] for data in source_list], + "licenses": [license_egon_data_odbl()], "contributors": contributors(["fw"]), "resources": [ { diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py index 66eaad900..61eebdd30 100755 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -13,7 +13,13 @@ finalize_bus_insertion, initialise_bus_insertion, ) -from egon.data.metadata import context, contributors, meta_metadata, sources +from egon.data.metadata import ( + context, + contributors, + license_egon_data_odbl, + meta_metadata, + sources, +) def insert_hydrogen_buses(scenario="eGon2035"): @@ -68,7 +74,7 @@ class EgonMapACH2(Base): "resolution": None, }, "sources": source_list, - "licenses": [data["licenses"] for data in source_list], + "licenses": [license_egon_data_odbl()], "contributors": contributors(["fw"]), "resources": [ { @@ -213,7 +219,7 @@ class EgonMapH2CH4(Base): "resolution": None, }, "sources": source_list, - "licenses": [data["licenses"] for data in source_list], + "licenses": [license_egon_data_odbl()], "contributors": contributors(["fw"]), "resources": [ { From 8e689204d72ec4f75818a888fc04c4355286e27c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:51:33 +0100 Subject: [PATCH 088/787] Add metadata --- .../data/datasets/heat_supply/__init__.py | 177 +++++++++++++++++- 1 file changed, 176 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index f12b151f9..476366517 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -2,6 +2,11 @@ """ +import datetime +import json +import time +import pandas as pd + from egon.data import db, config from egon.data.datasets.heat_supply.district_heating import ( @@ -18,6 +23,15 @@ from sqlalchemy.ext.declarative import declarative_base from geoalchemy2.types import Geometry from egon.data.datasets import Dataset +from egon.data.metadata import ( + context, + generate_resource_fields_from_sqla_model, + license_ccby, + license_egon_data_odbl, + meta_metadata, + sources, + +) # Will later be imported from another file. Base = declarative_base() @@ -166,12 +180,172 @@ def individual_heating(): if_exists="append", ) +def metadata(): + """Write metadata for heat supply tables + + Returns + ------- + None. + """ + + fields = generate_resource_fields_from_sqla_model( + EgonDistrictHeatingSupply) + + fields_df = pd.DataFrame(data=fields).set_index("name") + fields_df.loc["index", "description"] = "Unique identifyer" + fields_df.loc["district_heating_id", "description"] = "Index of the corresponding district heating grid" + fields_df.loc["carrier", "description"] = "Name of energy carrier" + fields_df.loc["category", "description"] = "Size-category of district heating grid" + fields_df.loc["capacity", "description"] = "Installed heating capacity" + fields_df.loc["geometry", "description"] = "Location of thermal power plant" + fields_df.loc["scenario", "description"] = "Name of corresponing scenario" + + fields_df.loc["capacity", "unit"] = "MW_th" + fields_df.unit.fillna("none", inplace=True) + + fields = fields_df.reset_index().to_dict(orient='records') + + meta_district = { + "name": "supply.egon_district_heating", + "title": "eGon heat supply for district heating grids", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Heat supply technologies for district heating grids", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + sources()["egon-data_bundle"], + sources()["openstreetmap"], + sources()["mastr"], + sources()["peta"] + ], + "licenses": [ + license_egon_data_odbl() + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_district_heating", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Add metadata as a comment to the table + db.submit_comment( + "'" + json.dumps(meta_district) + "'", + EgonDistrictHeatingSupply.__table__.schema, + EgonDistrictHeatingSupply.__table__.name, + ) + + fields = generate_resource_fields_from_sqla_model( + EgonIndividualHeatingSupply) + + fields_df = pd.DataFrame(data=fields).set_index("name") + fields_df.loc["index", "description"] = "Unique identifyer" + fields_df.loc["mv_grid_id", "description"] = "Index of the corresponding mv grid district" + fields_df.loc["carrier", "description"] = "Name of energy carrier" + fields_df.loc["category", "description"] = "Size-category" + fields_df.loc["capacity", "description"] = "Installed heating capacity" + fields_df.loc["geometry", "description"] = "Location of thermal power plant" + fields_df.loc["scenario", "description"] = "Name of corresponing scenario" + + fields_df.loc["capacity", "unit"] = "MW_th" + fields_df.unit.fillna("none", inplace=True) + + fields = fields_df.reset_index().to_dict(orient='records') + + meta_district = { + "name": "supply.egon_individual_heating", + "title": "eGon heat supply for individual supplied buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Heat supply technologies for individual supplied buildings", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + sources()["egon-data_bundle"], + sources()["openstreetmap"], + sources()["mastr"], + sources()["peta"] + ], + "licenses": [ + license_egon_data_odbl() + ], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_individual_heating", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Add metadata as a comment to the table + db.submit_comment( + "'" + json.dumps(meta_district) + "'", + EgonIndividualHeatingSupply.__table__.schema, + EgonIndividualHeatingSupply.__table__.name, + ) + class HeatSupply(Dataset): def __init__(self, dependencies): super().__init__( name="HeatSupply", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=( create_tables, @@ -180,5 +354,6 @@ def __init__(self, dependencies): individual_heating, potential_germany, }, + metadata, ), ) From 4ab049c1699a3c85f09c85cfbfb85277efa5b1de Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 14:52:06 +0100 Subject: [PATCH 089/787] Apply black and isort --- .../data/datasets/heat_supply/__init__.py | 93 ++++++++++--------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index 476366517..6e8415962 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -5,24 +5,24 @@ import datetime import json import time -import pandas as pd -from egon.data import db, config +from geoalchemy2.types import Geometry +from sqlalchemy import Column, Float, ForeignKey, Integer, String +from sqlalchemy.ext.declarative import declarative_base +import pandas as pd +from egon.data import config, db +from egon.data.datasets import Dataset +from egon.data.datasets.district_heating_areas import EgonDistrictHeatingAreas from egon.data.datasets.heat_supply.district_heating import ( - cascade_heat_supply, backup_gas_boilers, backup_resistive_heaters, + cascade_heat_supply, ) +from egon.data.datasets.heat_supply.geothermal import potential_germany from egon.data.datasets.heat_supply.individual_heating import ( cascade_heat_supply_indiv, ) -from egon.data.datasets.heat_supply.geothermal import potential_germany -from egon.data.datasets.district_heating_areas import EgonDistrictHeatingAreas -from sqlalchemy import Column, String, Float, Integer, ForeignKey -from sqlalchemy.ext.declarative import declarative_base -from geoalchemy2.types import Geometry -from egon.data.datasets import Dataset from egon.data.metadata import ( context, generate_resource_fields_from_sqla_model, @@ -30,7 +30,6 @@ license_egon_data_odbl, meta_metadata, sources, - ) # Will later be imported from another file. @@ -180,32 +179,40 @@ def individual_heating(): if_exists="append", ) + def metadata(): - """Write metadata for heat supply tables + """Write metadata for heat supply tables Returns ------- None. - """ - + """ + fields = generate_resource_fields_from_sqla_model( - EgonDistrictHeatingSupply) - + EgonDistrictHeatingSupply + ) + fields_df = pd.DataFrame(data=fields).set_index("name") fields_df.loc["index", "description"] = "Unique identifyer" - fields_df.loc["district_heating_id", "description"] = "Index of the corresponding district heating grid" + fields_df.loc[ + "district_heating_id", "description" + ] = "Index of the corresponding district heating grid" fields_df.loc["carrier", "description"] = "Name of energy carrier" - fields_df.loc["category", "description"] = "Size-category of district heating grid" + fields_df.loc[ + "category", "description" + ] = "Size-category of district heating grid" fields_df.loc["capacity", "description"] = "Installed heating capacity" - fields_df.loc["geometry", "description"] = "Location of thermal power plant" + fields_df.loc[ + "geometry", "description" + ] = "Location of thermal power plant" fields_df.loc["scenario", "description"] = "Name of corresponing scenario" - + fields_df.loc["capacity", "unit"] = "MW_th" fields_df.unit.fillna("none", inplace=True) - - fields = fields_df.reset_index().to_dict(orient='records') - + + fields = fields_df.reset_index().to_dict(orient="records") + meta_district = { "name": "supply.egon_district_heating", "title": "eGon heat supply for district heating grids", @@ -226,11 +233,9 @@ def metadata(): sources()["egon-data_bundle"], sources()["openstreetmap"], sources()["mastr"], - sources()["peta"] - ], - "licenses": [ - license_egon_data_odbl() + sources()["peta"], ], + "licenses": [license_egon_data_odbl()], "contributors": [ { "title": "Clara Büttner", @@ -257,31 +262,36 @@ def metadata(): ], "metaMetadata": meta_metadata(), } - + # Add metadata as a comment to the table db.submit_comment( "'" + json.dumps(meta_district) + "'", EgonDistrictHeatingSupply.__table__.schema, EgonDistrictHeatingSupply.__table__.name, ) - + fields = generate_resource_fields_from_sqla_model( - EgonIndividualHeatingSupply) - + EgonIndividualHeatingSupply + ) + fields_df = pd.DataFrame(data=fields).set_index("name") fields_df.loc["index", "description"] = "Unique identifyer" - fields_df.loc["mv_grid_id", "description"] = "Index of the corresponding mv grid district" + fields_df.loc[ + "mv_grid_id", "description" + ] = "Index of the corresponding mv grid district" fields_df.loc["carrier", "description"] = "Name of energy carrier" fields_df.loc["category", "description"] = "Size-category" fields_df.loc["capacity", "description"] = "Installed heating capacity" - fields_df.loc["geometry", "description"] = "Location of thermal power plant" + fields_df.loc[ + "geometry", "description" + ] = "Location of thermal power plant" fields_df.loc["scenario", "description"] = "Name of corresponing scenario" - + fields_df.loc["capacity", "unit"] = "MW_th" fields_df.unit.fillna("none", inplace=True) - - fields = fields_df.reset_index().to_dict(orient='records') - + + fields = fields_df.reset_index().to_dict(orient="records") + meta_district = { "name": "supply.egon_individual_heating", "title": "eGon heat supply for individual supplied buildings", @@ -302,11 +312,9 @@ def metadata(): sources()["egon-data_bundle"], sources()["openstreetmap"], sources()["mastr"], - sources()["peta"] - ], - "licenses": [ - license_egon_data_odbl() + sources()["peta"], ], + "licenses": [license_egon_data_odbl()], "contributors": [ { "title": "Clara Büttner", @@ -333,14 +341,15 @@ def metadata(): ], "metaMetadata": meta_metadata(), } - + # Add metadata as a comment to the table db.submit_comment( "'" + json.dumps(meta_district) + "'", EgonIndividualHeatingSupply.__table__.schema, EgonIndividualHeatingSupply.__table__.name, ) - + + class HeatSupply(Dataset): def __init__(self, dependencies): super().__init__( From e706d7e4c89711886d74cec6d5cbb3594a36feb5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 15:06:46 +0100 Subject: [PATCH 090/787] Add metadata --- .../heat_demand_timeseries/__init__.py | 92 ++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 80e9d8010..c51568594 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -1,4 +1,7 @@ -from datetime import datetime +import datetime +import json +import time + from pathlib import Path import os @@ -27,6 +30,13 @@ from egon.data.datasets.heat_demand_timeseries.service_sector import ( CTS_demand_scale, ) +from egon.data.metadata import ( + context, + license_egon_data_odbl, + meta_metadata, + sources, +) + import egon Base = declarative_base() @@ -1061,12 +1071,89 @@ def export_etrago_cts_heat_profiles(): df_etrago_cts_heat_profiles.to_dict(orient="records"), ) +def metadata(): + + fields = [ + { + "description": "Index of corresponding district heating area", + "name": "area_id", + "type": "integer", + "unit": "none", + }, + { + "description": "Name of scenario", + "name": "scenario", + "type": "str", + "unit": "none", + }, + { + "description": "Heat demand time series", + "name": "dist_aggregated_mw", + "type": "array of floats", + "unit": "MW", + }, + ] + + meta_district = { + "name": "demand.egon_timeseries_district_heating", + "title": "eGon heat demand time series for district heating grids", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Heat demand time series for district heating grids", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + sources()["egon-data_bundle"], + sources()["peta"], + ], + "licenses": [license_egon_data_odbl()], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_timeseries_district_heating", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Add metadata as a comment to the table + db.submit_comment( + "'" + json.dumps(meta_district) + "'", + EgonTimeseriesDistrictHeating.__table__.schema, + EgonTimeseriesDistrictHeating.__table__.name, + ) class HeatTimeSeries(Dataset): def __init__(self, dependencies): super().__init__( name="HeatTimeSeries", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=( { @@ -1077,6 +1164,7 @@ def __init__(self, dependencies): }, select, district_heating, + metadata, # store_national_profiles, ), ) From 227a735b3ff9b5c3ac93bf2bf7ac0ddd7a4dede5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 15:07:22 +0100 Subject: [PATCH 091/787] Apply black and isort --- .../data/datasets/heat_demand_timeseries/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index c51568594..ddd5d48de 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -1,9 +1,8 @@ +from pathlib import Path import datetime import json -import time - -from pathlib import Path import os +import time from sqlalchemy import ARRAY, Column, Float, Integer, String, Text from sqlalchemy.ext.declarative import declarative_base @@ -36,7 +35,6 @@ meta_metadata, sources, ) - import egon Base = declarative_base() @@ -1071,7 +1069,8 @@ def export_etrago_cts_heat_profiles(): df_etrago_cts_heat_profiles.to_dict(orient="records"), ) -def metadata(): + +def metadata(): fields = [ { @@ -1092,7 +1091,7 @@ def metadata(): "type": "array of floats", "unit": "MW", }, - ] + ] meta_district = { "name": "demand.egon_timeseries_district_heating", @@ -1149,6 +1148,7 @@ def metadata(): EgonTimeseriesDistrictHeating.__table__.name, ) + class HeatTimeSeries(Dataset): def __init__(self, dependencies): super().__init__( From abb5d11fc9e39ca382342592512f9bbc3426f6a4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 15:27:30 +0100 Subject: [PATCH 092/787] Add metadata --- src/egon/data/datasets/chp/__init__.py | 102 ++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 26c309578..a9c3f5863 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -2,6 +2,9 @@ The central module containing all code dealing with combined heat and power (CHP) plants. """ +import datetime +import json +import time from pathlib import Path @@ -32,6 +35,14 @@ filter_mastr_geometry, scale_prox2now, ) +from egon.data.metadata import ( + context, + generate_resource_fields_from_sqla_model, + license_egon_data_odbl, + meta_metadata, + sources, +) + Base = declarative_base() @@ -66,6 +77,94 @@ class EgonMaStRConventinalWithoutChp(Base): federal_state = Column(String) geometry = Column(Geometry("POINT", 4326)) +def metadata(): + """Write metadata for heat supply tables + + Returns + ------- + None. + + """ + + fields = generate_resource_fields_from_sqla_model( + EgonChp + ) + + fields_df = pd.DataFrame(data=fields).set_index("name") + fields_df.loc["id", "description"] = "Unique identifyer" + fields_df.loc["sources", "description"] = "List of sources" + fields_df.loc["source_id", "description"] = "Names of sources, e.g. MaStr_id" + fields_df.loc["carrier", "description"] = "Energy carrier" + fields_df.loc["district_heating", "description"] = "Used in district heating or not" + fields_df.loc["el_capacity", "description"] = "Installed electrical capacity" + fields_df.loc["th_capacity", "description"] = "Installed thermal capacity" + fields_df.loc["electrical_bus_id", "description"] = "Index of corresponding electricity bus" + fields_df.loc["district_heating_area_id", "description"] = "Index of corresponding district heating bus" + fields_df.loc["ch4_bus_id", "description"] = "Index of corresponding methane bus" + fields_df.loc["voltage_level", "description"] = "Voltage level" + fields_df.loc["scenario", "description"] = "Name of scenario" + fields_df.loc["geom", "description"] = "Location of CHP plant" + + fields_df.loc["el_capacity", "unit"] = "MW_el" + fields_df.loc["th_capacity", "unit"] = "MW_th" + fields_df.unit.fillna("none", inplace=True) + + fields = fields_df.reset_index().to_dict(orient="records") + + meta_district = { + "name": "supply.egon_chp_plants", + "title": "eGon combined heat and power plants", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Combined heat and power plants", + "language": ["EN"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": None, + "extent": "Germany", + "resolution": None, + }, + "sources": [ + sources()["vg250"], + sources()["egon-data"], + sources()["egon-data_bundle"], + sources()["openstreetmap"], + sources()["mastr"], + ], + "licenses": [license_egon_data_odbl()], + "contributors": [ + { + "title": "Clara Büttner", + "email": "http://github.com/ClaraBuettner", + "date": time.strftime("%Y-%m-%d"), + "object": None, + "comment": "Imported data", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_chp_plants", + "path": None, + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": fields, + "primaryKey": ["index"], + "foreignKeys": [], + }, + "dialect": {"delimiter": None, "decimalSeparator": "."}, + } + ], + "metaMetadata": meta_metadata(), + } + + # Add metadata as a comment to the table + db.submit_comment( + "'" + json.dumps(meta_district) + "'", + EgonChp.__table__.schema, + EgonChp.__table__.name, + ) def create_tables(): """Create tables for chp data @@ -532,12 +631,13 @@ class Chp(Dataset): def __init__(self, dependencies): super().__init__( name="Chp", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( create_tables, {insert_chp_egon2035, insert_chp_egon100re}, assign_heat_bus, extension, + metadata, ), ) From a39ce0cdb265c29819c5f3532da0671625248368 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 16 Mar 2023 15:27:52 +0100 Subject: [PATCH 093/787] Apply black and isort --- src/egon/data/datasets/chp/__init__.py | 36 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index a9c3f5863..63d071069 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -2,12 +2,11 @@ The central module containing all code dealing with combined heat and power (CHP) plants. """ +from pathlib import Path import datetime import json import time -from pathlib import Path - from geoalchemy2 import Geometry from shapely.ops import nearest_points from sqlalchemy import Boolean, Column, Float, Integer, Sequence, String @@ -43,7 +42,6 @@ sources, ) - Base = declarative_base() @@ -77,6 +75,7 @@ class EgonMaStRConventinalWithoutChp(Base): federal_state = Column(String) geometry = Column(Geometry("POINT", 4326)) + def metadata(): """Write metadata for heat supply tables @@ -86,25 +85,35 @@ def metadata(): """ - fields = generate_resource_fields_from_sqla_model( - EgonChp - ) + fields = generate_resource_fields_from_sqla_model(EgonChp) fields_df = pd.DataFrame(data=fields).set_index("name") fields_df.loc["id", "description"] = "Unique identifyer" fields_df.loc["sources", "description"] = "List of sources" - fields_df.loc["source_id", "description"] = "Names of sources, e.g. MaStr_id" + fields_df.loc[ + "source_id", "description" + ] = "Names of sources, e.g. MaStr_id" fields_df.loc["carrier", "description"] = "Energy carrier" - fields_df.loc["district_heating", "description"] = "Used in district heating or not" - fields_df.loc["el_capacity", "description"] = "Installed electrical capacity" + fields_df.loc[ + "district_heating", "description" + ] = "Used in district heating or not" + fields_df.loc[ + "el_capacity", "description" + ] = "Installed electrical capacity" fields_df.loc["th_capacity", "description"] = "Installed thermal capacity" - fields_df.loc["electrical_bus_id", "description"] = "Index of corresponding electricity bus" - fields_df.loc["district_heating_area_id", "description"] = "Index of corresponding district heating bus" - fields_df.loc["ch4_bus_id", "description"] = "Index of corresponding methane bus" + fields_df.loc[ + "electrical_bus_id", "description" + ] = "Index of corresponding electricity bus" + fields_df.loc[ + "district_heating_area_id", "description" + ] = "Index of corresponding district heating bus" + fields_df.loc[ + "ch4_bus_id", "description" + ] = "Index of corresponding methane bus" fields_df.loc["voltage_level", "description"] = "Voltage level" fields_df.loc["scenario", "description"] = "Name of scenario" fields_df.loc["geom", "description"] = "Location of CHP plant" - + fields_df.loc["el_capacity", "unit"] = "MW_el" fields_df.loc["th_capacity", "unit"] = "MW_th" fields_df.unit.fillna("none", inplace=True) @@ -166,6 +175,7 @@ def metadata(): EgonChp.__table__.name, ) + def create_tables(): """Create tables for chp data Returns From ca8e815e62d9b8371a0dd4e9249e11e97e876dc1 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 16 Mar 2023 16:42:40 +0100 Subject: [PATCH 094/787] add metadata to supply.egon_power_plants_pv_roof_building --- .../datasets/power_plants/mastr_db_classes.py | 3 + .../power_plants/pv_rooftop_buildings.py | 143 ++++++++++++++++++ src/egon/data/metadata.py | 16 +- 3 files changed, 155 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index bf1b9ea66..21fb54057 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -19,6 +19,7 @@ generate_resource_fields_from_db_table, license_dedl, meta_metadata, + sources, ) Base = declarative_base() @@ -375,6 +376,7 @@ def add_metadata(): ), "licenses": [license_dedl(attribution="© Amme, Jonathan")], }, + sources()["egon-data"], ], "licenses": [license_dedl(attribution="© eGon development team")], "contributors": [ @@ -400,6 +402,7 @@ def add_metadata(): "fields": generate_resource_fields_from_db_table( target_table.__table_args__["schema"], target_table.__tablename__, + geom_columns=["geom"], ), "primaryKey": "id", }, diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 9794b19dc..019c35be0 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -43,6 +43,8 @@ from collections import Counter from functools import wraps from time import perf_counter +import datetime +import json from geoalchemy2 import Geometry from loguru import logger @@ -62,6 +64,15 @@ from egon.data.datasets.power_plants.mastr_db_classes import EgonPowerPlantsPv from egon.data.datasets.scenario_capacities import EgonScenarioCapacities from egon.data.datasets.zensus_vg250 import Vg250Gem +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + license_dedl, + license_odbl, + licenses_datenlizenz_deutschland, + meta_metadata, + sources, +) engine = db.engine() Base = declarative_base() @@ -2103,6 +2114,136 @@ class EgonPowerPlantPvRoofBuilding(Base): weather_cell_id = Column(Integer) +def add_metadata(): + schema = "supply" + table = "egon_power_plants_pv_roof_building" + name = f"{schema}.{table}" + deposit_id_mastr = config.datasets()["mastr_new"]["deposit_id"] + deposit_id_data_bundle = config.datasets()["data-bundle"]["sources"][ + "zenodo" + ]["deposit_id"] + + meta = { + "name": name, + "title": "eGon power plants rooftop solar", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "eGon power plants rooftop solar systems allocated to buildings", + "language": "en-US", + "keywords": ["photovoltaik", "solar", "pv", "mastr", "status quo"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "building", + }, + "temporal": { + "referenceDate": ( + config.datasets()["mastr_new"]["egon2021_date_max"].split(" ")[ + 0 + ] + ), + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + { + "title": "Data bundle for egon-data", + "description": ( + "Data bundle for egon-data: A transparent and " + "reproducible data processing pipeline for energy " + "system modeling" + ), + "path": ( + "https://sandbox.zenodo.org/record/" + f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" + ), + "licenses": [license_dedl(attribution="© Cußmann, Ilka")], + }, + { + "title": ("open-MaStR power unit registry for eGo^n project"), + "description": ( + "Data from Marktstammdatenregister (MaStR) data using " + "the data dump from 2022-11-17 for eGon-data." + ), + "path": ( + f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + ), + "licenses": [license_dedl(attribution="© Amme, Jonathan")], + }, + sources()["openstreetmap"], + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + ], + "licenses": [license_odbl("© eGon development team")], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-16", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": name, + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + schema, + table, + ), + "primaryKey": "index", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github." + "com/OpenEnergyPlatform/oemetadata/blob/master/metadata/" + "v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + schema, + table, + ) + + def create_scenario_table(buildings_gdf): """Create mapping table pv_unit <-> building for scenario""" EgonPowerPlantPvRoofBuilding.__table__.drop(bind=engine, checkfirst=True) @@ -2116,6 +2257,8 @@ def create_scenario_table(buildings_gdf): index=False, ) + add_metadata() + def add_weather_cell_id(buildings_gdf: gpd.GeoDataFrame) -> gpd.GeoDataFrame: sql = """ diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 5e76c82c1..3ae8c0631 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -4,6 +4,8 @@ from egon.data.db import engine +EGON_ATTRIBUTION: str = "© eGon development team" + def context(): """ @@ -51,7 +53,7 @@ def meta_metadata(): } -def licenses_datenlizenz_deutschland(attribution): +def licenses_datenlizenz_deutschland(attribution=EGON_ATTRIBUTION): """ License information for Datenlizenz Deutschland @@ -99,7 +101,7 @@ def licenses_datenlizenz_deutschland(attribution): } -def license_odbl(attribution): +def license_odbl(attribution=EGON_ATTRIBUTION): """ License information for Open Data Commons Open Database License (ODbL-1.0) @@ -124,7 +126,7 @@ def license_odbl(attribution): } -def license_ccby(attribution): +def license_ccby(attribution=EGON_ATTRIBUTION): """ License information for Creative Commons Attribution 4.0 International (CC-BY-4.0) @@ -149,7 +151,7 @@ def license_ccby(attribution): } -def license_geonutzv(attribution): +def license_geonutzv(attribution=EGON_ATTRIBUTION): """ License information for GeoNutzV @@ -180,7 +182,7 @@ def license_geonutzv(attribution): } -def license_agpl(attribution): +def license_agpl(attribution=EGON_ATTRIBUTION): """ License information for GNU Affero General Public License v3.0 @@ -210,7 +212,7 @@ def license_agpl(attribution): } -def license_dedl(attribution): +def license_dedl(attribution=EGON_ATTRIBUTION): """ License information for Data licence Germany – attribution – version 2.0 @@ -417,7 +419,7 @@ def sources(): "description": "Workflow to download, process and generate data sets" "suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", - "licenses": [license_agpl("© eGon development team")], + "licenses": [license_agpl(EGON_ATTRIBUTION)], }, "Einspeiseatlas": { "title": "Einspeiseatlas", From 81561679d429e4dbe30a141ae51a1b3f3889b443 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 08:30:40 +0100 Subject: [PATCH 095/787] add ev metadata --- .../motorized_individual_travel/db_classes.py | 410 +++++++++++++++++- .../power_plants/pv_rooftop_buildings.py | 5 +- .../data/datasets/storages/home_batteries.py | 58 ++- 3 files changed, 446 insertions(+), 27 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 44cd97e19..32beac475 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -1,6 +1,8 @@ """ DB tables / SQLAlchemy ORM classes for motorized individual travel """ +import datetime +import json from sqlalchemy import ( Boolean, @@ -15,11 +17,21 @@ from sqlalchemy.dialects.postgresql import REAL from sqlalchemy.ext.declarative import declarative_base +from egon.data import db +from egon.data.datasets.emobility.motorized_individual_travel.helpers import ( + read_simbev_metadata_file, +) from egon.data.datasets.mv_grid_districts import MvGridDistricts from egon.data.datasets.scenario_parameters import EgonScenario - -# from sqlalchemy.orm import relationship - +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + license_agpl, + license_ccby, + license_odbl, + meta_metadata, + sources, +) Base = declarative_base() @@ -243,7 +255,7 @@ class EgonEvMetadata(Base): __tablename__ = "egon_ev_metadata" __table_args__ = {"schema": "demand"} - scenario = Column(String, primary_key=True) + scenario = Column(String, primary_key=True, index=True) eta_cp = Column(Float) stepsize = Column(Integer) start_date = Column(DateTime) @@ -251,3 +263,393 @@ class EgonEvMetadata(Base): soc_min = Column(Float) grid_timeseries = Column(Boolean) grid_timeseries_by_usecase = Column(Boolean) + + +def add_metadata(): + """ + Add metadata to tables egon_ev_metadata, egon_ev_mv_grid_district, + egon_ev_trip in schema demand + """ + # egon_ev_metadata + schema = "demand" + meta_run_config = read_simbev_metadata_file("eGon100RE", "config").loc[ + "basic" + ] + + table = "egon_ev_metadata" + name = f"{schema}.{table}" + + meta = { + "name": name, + "title": "eGon EV metadata", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": ( + "Metadata regarding the generation of EV trip profiles with SimBEV" + ), + "language": "en-US", + "keywords": ["ev", "mit", "simbev", "metadata", "parameters"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "none", + "resolution": "none", + }, + "temporal": { + "referenceDate": f"{meta_run_config.start_date}", + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + sources()["egon-data"], + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_ccby(attribution="© Reiner Lemoine Institut") + ], + }, + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_agpl(attribution="© Reiner Lemoine Institut") + ], + }, + ], + "licenses": [license_ccby()], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-17", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": name, + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + schema, + table, + ), + "primaryKey": "scenario", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github." + "com/OpenEnergyPlatform/oemetadata/blob/master/metadata/" + "v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + schema, + table, + ) + + table = "egon_ev_mv_grid_district" + name = f"{schema}.{table}" + + meta = { + "name": name, + "title": "eGon EV MV grid district", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": ("EV mapping to MV grids"), + "language": "en-US", + "keywords": ["ev", "mit", "simbev", "mv", "grid"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "Grid district", + }, + "temporal": { + "referenceDate": f"{meta_run_config.start_date}", + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + sources()["bgr_inspee"], + sources()["bgr_inspeeds"], + sources()["bgr_inspeeds_data_bundle"], + sources()["bgr_inspeeds_report"], + sources()["demandregio"], + sources()["dsm-heitkoetter"], + sources()["egon-data"], + sources()["era5"], + sources()["hotmaps_industrial_sites"], + sources()["mastr"], + sources()["nep2021"], + sources()["openffe_gas"], + sources()["openstreetmap"], + sources()["peta"], + sources()["pipeline_classification"], + sources()["SciGRID_gas"], + sources()["schmidt"], + sources()["technology-data"], + sources()["tyndp"], + sources()["vg250"], + sources()["zensus"], + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_ccby(attribution="© Reiner Lemoine Institut") + ], + }, + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_agpl(attribution="© Reiner Lemoine Institut") + ], + }, + ], + "licenses": [license_odbl()], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-17", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": name, + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + schema, + table, + ), + "primaryKey": "scenario", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github." + "com/OpenEnergyPlatform/oemetadata/blob/master/metadata/" + "v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + schema, + table, + ) + + table = "egon_ev_trip" + name = f"{schema}.{table}" + + meta = { + "name": name, + "title": "eGon EV trip profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": ("EV trip profiles generated with SimBEV"), + "language": "en-US", + "keywords": ["ev", "mit", "simbev", "trip", "profiles"], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "none", + }, + "temporal": { + "referenceDate": f"{meta_run_config.start_date}", + "timeseries": { + "start": "", + "end": "", + "resolution": "", + "alignment": "", + "aggregationType": "", + }, + }, + "sources": [ + sources()["bgr_inspee"], + sources()["bgr_inspeeds"], + sources()["bgr_inspeeds_data_bundle"], + sources()["bgr_inspeeds_report"], + sources()["demandregio"], + sources()["dsm-heitkoetter"], + sources()["egon-data"], + sources()["era5"], + sources()["hotmaps_industrial_sites"], + sources()["mastr"], + sources()["nep2021"], + sources()["openffe_gas"], + sources()["openstreetmap"], + sources()["peta"], + sources()["pipeline_classification"], + sources()["SciGRID_gas"], + sources()["schmidt"], + sources()["technology-data"], + sources()["tyndp"], + sources()["vg250"], + sources()["zensus"], + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_ccby(attribution="© Reiner Lemoine Institut") + ], + }, + { + "title": "SimBEV", + "description": ( + "Simulation of electric vehicle charging demand" + ), + "path": "https://github.com/rl-institut/simbev", + "licenses": [ + license_agpl(attribution="© Reiner Lemoine Institut") + ], + }, + ], + "licenses": [license_odbl()], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-17", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": name, + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + schema, + table, + ), + "primaryKey": "scenario", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://github." + "com/OpenEnergyPlatform/oemetadata/blob/master/metadata/" + "v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + schema, + table, + ) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 019c35be0..a574d01c6 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -69,7 +69,6 @@ generate_resource_fields_from_db_table, license_dedl, license_odbl, - licenses_datenlizenz_deutschland, meta_metadata, sources, ) @@ -2127,7 +2126,9 @@ def add_metadata(): "name": name, "title": "eGon power plants rooftop solar", "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "eGon power plants rooftop solar systems allocated to buildings", + "description": ( + "eGon power plants rooftop solar systems allocated to buildings" + ), "language": "en-US", "keywords": ["photovoltaik", "solar", "pv", "mastr", "status quo"], "publicationDate": datetime.date.today().isoformat(), diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index c8ed8e61c..e8a059f52 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -46,7 +46,10 @@ from egon.data.metadata import ( context, generate_resource_fields_from_db_table, + license_dedl, + license_odbl, meta_metadata, + sources, ) Base = declarative_base() @@ -203,6 +206,10 @@ def add_metadata(): Add metadata to table supply.egon_home_batteries """ targets = config.datasets()["home_batteries"]["targets"] + deposit_id_mastr = config.datasets()["mastr_new"]["deposit_id"] + deposit_id_data_bundle = config.datasets()["data-bundle"]["sources"][ + "zenodo" + ]["deposit_id"] meta = { "name": ( @@ -233,29 +240,38 @@ def add_metadata(): }, "sources": [ { - "title": "TODO", - "description": "TODO", - "path": "TODO", - "licenses": [ - { - "name": "TODO", - "title": "TODO", - "path": "TODO", - "instruction": "TODO", - "attribution": "TODO", - } - ], - } - ], - "licenses": [ + "title": "Data bundle for egon-data", + "description": ( + "Data bundle for egon-data: A transparent and " + "reproducible data processing pipeline for energy " + "system modeling" + ), + "path": ( + "https://sandbox.zenodo.org/record/" + f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" + ), + "licenses": [license_dedl(attribution="© Cußmann, Ilka")], + }, { - "name": "TODO", - "title": "TODO", - "path": "TODO", - "instruction": "TODO", - "attribution": "© eGon development team", - } + "title": ("open-MaStR power unit registry for eGo^n project"), + "description": ( + "Data from Marktstammdatenregister (MaStR) data using " + "the data dump from 2022-11-17 for eGon-data." + ), + "path": ( + f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + ), + "licenses": [license_dedl(attribution="© Amme, Jonathan")], + }, + sources()["openstreetmap"], + sources()["era5"], + sources()["vg250"], + sources()["egon-data"], + sources()["nep2021"], + sources()["mastr"], + sources()["technology-data"], ], + "licenses": [license_odbl("© eGon development team")], "contributors": [ { "title": "khelfen", From 1f8f27c4fa70c393c04c06919ea114389f2bd35c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 11:15:54 +0100 Subject: [PATCH 096/787] Add json metadata upload --- src/egon/data/airflow/dags/pipeline.py | 5 +++ src/egon/data/metadata.py | 44 +++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index d819e281b..1ee5b50a3 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -689,3 +689,8 @@ low_flex_scenario, ] ) + + # upload json metadata at the end + json_metadata = Json_Metadata( + dependencies=[sanity_checks] + ) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e57654016..da4a9d5a5 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -3,7 +3,11 @@ from sqlalchemy.dialects.postgresql.base import ischema_names from egon.data.db import engine - +import os +from omi.dialects import get_dialect +from pathlib import Path +from egon.data import db, logger +from egon.data.datasets import Dataset def context(): """ @@ -721,3 +725,41 @@ def contributors(authorlist): {key: value for key, value in contributors_dict[author].items()} for author in authorlist ] + + +def upload_json_metadata(): + """Upload json metadata into db from zenodo""" + + path = Path(".") / "data_bundle_egon_data" / "json_metadata" + v = "oep-v1.4" + + for file in os.listdir(path=path): + + if file.endswith(".json"): + split = file.split(".") + if len(split) != 3: + continue + schema = split[0] + table = split[1] + + dialect = get_dialect(v)() + + with open(file, "r") as infile: + obj = dialect.parse(infile.read()) + + meta_data_string = dialect.compile_and_render(obj) + meta_json = "'" + meta_data_string + "'" + db.submit_comment(meta_json, schema, table) + logger.info(f"{schema}.{table} uploaded!") + + +class Json_Metadata(Dataset): + def __init__(self, dependencies): + super().__init__( + name="JsonMetadata", + version="0.0.0", + dependencies=dependencies, + tasks={ + upload_json_metadata + }, + ) From 0397f5183cfd91ca664dde2cb6c54ee627fa2b58 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 11:22:09 +0100 Subject: [PATCH 097/787] Black&isort --- src/egon/data/metadata.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index da4a9d5a5..3bd3dafcd 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,13 +1,15 @@ +from pathlib import Path +import os + from geoalchemy2 import Geometry +from omi.dialects import get_dialect from sqlalchemy import MetaData, Table from sqlalchemy.dialects.postgresql.base import ischema_names -from egon.data.db import engine -import os -from omi.dialects import get_dialect -from pathlib import Path from egon.data import db, logger from egon.data.datasets import Dataset +from egon.data.db import engine + def context(): """ @@ -494,7 +496,6 @@ def sources(): ) ], }, - "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", @@ -759,7 +760,5 @@ def __init__(self, dependencies): name="JsonMetadata", version="0.0.0", dependencies=dependencies, - tasks={ - upload_json_metadata - }, + tasks={upload_json_metadata}, ) From 3692c2e4c901a2294958319193701b65e86eb529 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 12:03:17 +0100 Subject: [PATCH 098/787] Add alternative download and unzip --- src/egon/data/metadata.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 3bd3dafcd..06c736cad 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,4 +1,6 @@ from pathlib import Path +from urllib.request import urlretrieve +from zipfile import ZipFile import os from geoalchemy2 import Geometry @@ -731,10 +733,20 @@ def contributors(authorlist): def upload_json_metadata(): """Upload json metadata into db from zenodo""" - path = Path(".") / "data_bundle_egon_data" / "json_metadata" + path = Path(".") / "data_bundle_egon_data" / "json_metadata.zip" v = "oep-v1.4" - for file in os.listdir(path=path): + # TODO remove after json added to data_bundle issue #1110 + if not os.path.exists(path): + url = "https://wolke.rl-institut.de/s/HtLtKsiefz9XFqm" + os.makedirs(path.parent, exist_ok=True) + urlretrieve(url, path) + + with ZipFile(path, "r") as zip_ref: + path = str(path).rstrip(".zip") + zip_ref.extractall(path) + + for file in os.listdir(path=str(path)): if file.endswith(".json"): split = file.split(".") From b0554a2a972c15f5b1574581c6646a88019cc0ae Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 12:15:29 +0100 Subject: [PATCH 099/787] Add json metadata files to repo --- .../json_metadata/boundaries.egon_map_zensus_climate_zones.json | 1 + .../json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json | 1 + .../json_metadata/boundaries.egon_map_zensus_weather_cell.json | 1 + .../demand.egon_building_electricity_peak_loads.json | 1 + .../data/json_metadata/demand.egon_building_heat_peak_loads.json | 1 + .../demand.egon_cts_electricity_demand_building_share.json | 1 + .../demand.egon_cts_heat_demand_building_share.json | 1 + .../demand.egon_daily_heat_demand_per_climate_zone.json | 1 + .../data/json_metadata/demand.egon_etrago_electricity_cts.json | 1 + .../json_metadata/demand.egon_etrago_electricity_households.json | 1 + src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json | 1 + src/egon/data/json_metadata/demand.egon_heat_idp_pool.json | 1 + .../demand.egon_heat_timeseries_selected_profiles.json | 1 + ...demand.egon_household_electricity_profile_in_census_cell.json | 1 + .../demand.egon_household_electricity_profile_of_buildings.json | 1 + .../data/json_metadata/demand.iee_household_load_profiles.json | 1 + src/egon/data/json_metadata/grid.egon_mv_grid_district.json | 1 + .../data/json_metadata/openstreetmap.osm_buildings_fitered.json | 1 + .../json_metadata/openstreetmap.osm_buildings_synthetic.json | 1 + .../json_metadata/society.destatis_zensus_population_per_ha.json | 1 + ...gon_destatis_zensus_apartment_building_populaiton_per_ha.json | 1 + 21 files changed, 21 insertions(+) create mode 100644 src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json create mode 100644 src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json create mode 100644 src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json create mode 100644 src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json create mode 100644 src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json create mode 100644 src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json create mode 100644 src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json create mode 100644 src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json create mode 100644 src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json create mode 100644 src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json create mode 100644 src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json create mode 100644 src/egon/data/json_metadata/demand.egon_heat_idp_pool.json create mode 100644 src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json create mode 100644 src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json create mode 100644 src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json create mode 100644 src/egon/data/json_metadata/demand.iee_household_load_profiles.json create mode 100644 src/egon/data/json_metadata/grid.egon_mv_grid_district.json create mode 100644 src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json create mode 100644 src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json create mode 100644 src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json create mode 100644 src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json new file mode 100644 index 000000000..2ea58b9fe --- /dev/null +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json @@ -0,0 +1 @@ +{"name": "boundaries.egon_map_zensus_climate_zones", "title": "eGon map census cells to climate zones", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "spatial join of census cells and climate zones", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "100 m x 100 m"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\u00e4tzlich zur Zensusdatenbank CSV- und eilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\u00e4nder-, Kreis- und Gemeindeebene vor. Au\u00dferdem sind einzelne Ergebnisse f\u00fcr Gitterzellen verf\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig. Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere: (1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden. Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind: (1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe, der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie (3) einen Verweis auf den Datensatz (URI). Dies gilt nur soweit die datenhaltende Stelle die Angaben (1) bis (3) zum Quellenvermerk bereitstellt. Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2014"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_climate_zones", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "climate_zone", "description": "Name of the corresponding climate zone", "type": "str", "unit": "none"}, {"name": "zensus_population_id", "description": "Index of corresponding census cell (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}], "primaryKey": "zensus_population_id"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json new file mode 100644 index 000000000..1f0313b92 --- /dev/null +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json @@ -0,0 +1 @@ +{"name": "boundaries.egon_map_zensus_mvgd_buildings", "title": "eGon buildings mapping table", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for all used buildings via project internal building_id. Additional info about if it is a synthetic or a openstreetmap building, where it is located (census cell_id, mvgd_id), in which sector (residential, cts) the building is used, if there are heat or electricity profiles.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_mvgd_buildings", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "zensus_population_id", "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "electricity", "description": "True if respectives electricity demand profile exists", "type": "bool", "unit": "None"}, {"name": "heat", "description": "True if respectives heat demand profile exists", "type": "bool", "unit": "None"}, {"name": "osm", "description": "is OSM building if true else syntheticaly created", "type": "bool", "unit": "None"}], "primaryKey": "building_id, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json new file mode 100644 index 000000000..2a1519b6d --- /dev/null +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json @@ -0,0 +1 @@ +{"name": "boundaries.egon_map_zensus_climate_zones", "title": "Map census cells to era5 climate zones", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table of census cells to era5 climate zones", "language": "en-US", "keywords": [""], "publicationDate": "2022-08-06", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}], "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 eGon development team"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_weather_cell", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "zensus_population_id", "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}, {"name": "w_id", "description": "Weather cell id (reference to: supply.egon_era5_weather_cells)", "type": "Integer", "unit": "none"}], "primaryKey": "zensus_population_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json b/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json new file mode 100644 index 000000000..3c169a6f5 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json @@ -0,0 +1 @@ +{"name": "demand.egon_building_electricity_peak_loads", "title": "Electricity peak loads for egon buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Electricity peak load table of residential and cts buildings with voltage level for two scenarios ", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_building_electricity_peak_loads", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "peak_load_in_w", "description": "Peak load value", "type": "real", "unit": "W"}, {"name": "voltage_level", "description": "Voltage level of building connection after MitnetzStrom Classification", "type": "int", "unit": "None"}], "primaryKey": "building_id, scenario, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json b/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json new file mode 100644 index 000000000..3b777b6af --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json @@ -0,0 +1 @@ +{"name": "demand.egon_building_heat_peak_loads", "title": "Heat peak loads for egon buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Heat peak load table of residential and cts buildings for two scenarios ", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}, {"title": "Peta5 0 1 HD res", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_building_heat_peak_loads", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "peak_load_in_w", "description": "Peak load value", "type": "real", "unit": "W"}], "primaryKey": "building_id, scenario, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json b/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json new file mode 100644 index 000000000..88dd0dc83 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json @@ -0,0 +1 @@ +{"name": "demand.egon_cts_electricity_demand_building_share", "title": "Electricity demand profile share of egon cts buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Electricity demand profile share of egon cts buildings for two scenarios with bus_id", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_cts_electricity_demand_building_share", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035) (reference: demand.egon_etrago_electricity_cts.scn_name)", "type": "character varying", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus_id (reference to: demand.egon_etrago_electricity_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "profile_share", "description": "Profile share of MVGD elctricity profile", "type": "real", "unit": "None"}], "primaryKey": "building_id, scenario"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json b/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json new file mode 100644 index 000000000..abf9aa366 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json @@ -0,0 +1 @@ +{"name": "demand.egon_cts_heat_demand_building_share", "title": "Heat demand profile share of egon cts buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Heat demand profile share of egon cts buildings for two scenarios with bus_id", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}, {"title": "Peta5 0 1 HD res", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_cts_heat_demand_building_share", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus_id (reference to: demand.egon_etrago_heat_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "profile_share", "description": "Profile share of MVGD heat profile ", "type": "real", "unit": "None"}], "primaryKey": "building_id, scenario"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json b/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json new file mode 100644 index 000000000..3c36db60d --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json @@ -0,0 +1 @@ +{"name": "demand.egon_daily_heat_demand_per_climate_zone", "title": "eGon daily heat demand share per climate zone", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Share of daily heat demands per climate zone", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "climate zones"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_daily_heat_demand_per_climate_zone", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "climate_zone", "description": "Name of the corresponding climate zone", "type": "str", "unit": "none"}, {"name": "daily_demand_share", "description": "Share of annual heat demand for each day", "type": "double precision", "unit": "per unit"}, {"name": "day_of_year", "description": "Number of day in the year", "type": "integer", "unit": "none"}, {"name": "temperature_class", "description": "Temperature class (considering the mean outside temeperature during the day)", "type": "integer", "unit": "none"}], "primaryKey": "climate_zone"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json b/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json new file mode 100644 index 000000000..65e397eb0 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json @@ -0,0 +1 @@ +{"name": "demand.egon_etrago_electricity_cts", "title": "MV cts electricity demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated electricity demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "undefined", "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_electricity_cts", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name (reference: demand.egon_cts_electricity_demand_building_share.scenario)", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Cts electricity demand load timeseries for one year (8760 hours) in MWh", "type": "array of real", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json b/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json new file mode 100644 index 000000000..872d97ff9 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json @@ -0,0 +1 @@ +{"name": "demand.egon_etrago_electricity_households", "title": "MV residential electricity demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated electricity demand profile of residential sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "en-US", "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_electricity_households", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Residential electricity demand load timeseries for one year (8760 hours) in MWh", "type": "array of double precission", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json b/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json new file mode 100644 index 000000000..422fb057b --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json @@ -0,0 +1 @@ +{"name": "demand.egon_etrago_heat_cts", "title": "MV cts heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated heat demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "undefined", "keywords": [""], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_heat_cts", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_heat_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name (reference: demand.egon_cts_heat_demand_building_share.scenario)", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Cts heat demand load timeseries for one year (8760 hours) in MWh", "type": "array of real", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json new file mode 100644 index 000000000..d0b72c029 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json @@ -0,0 +1 @@ +{"name": "demand.egon_heat_idp_pool", "title": "eGon pool of residential intra-day heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Pool of individual, normlized intra-day heat demand profiles of residential buildings", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "none", "extent": "Germany", "resolution": ""}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {"start": "0 h", "end": "23 h", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "Europa-Universit\u00e4t Flensburg"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_heat_idp_pool", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "house", "description": "Type of residential house, either SFH (single family house) or MFH (multi family house)", "type": "str", "unit": "none"}, {"name": "idp", "description": "Normalized intra-day-profile", "type": "array of double precision", "unit": "per unit"}, {"name": "index", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "temperature_class", "description": "Temperature class (considering the mean outside temeperature during the day)", "type": "integer", "unit": "none"}], "primaryKey": "index"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json b/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json new file mode 100644 index 000000000..f488ebba2 --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json @@ -0,0 +1 @@ +{"name": "demand.egon_heat_timeseries_selected_profiles", "title": "eGon selected intra-day profiles per building", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "List of selected intra-day-profiles for each residential building in Germany", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "none", "extent": "Germany", "resolution": "buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at ''referenceDate''", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Europa-Universit\u00e4t Flensburg"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_heat_timeseries_selected_profiles", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Index of the corresponding building", "type": "integer", "unit": "none"}, {"name": "selected_idp_profiles", "description": "List of selected profiles for each day in the year", "type": "array of integer", "unit": "none"}, {"name": "zensus_population_id", "description": "Index of corresponding census cell", "type": "integer", "unit": "none"}], "primaryKey": "building_id"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json new file mode 100644 index 000000000..b7af0b5aa --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json @@ -0,0 +1 @@ +{"name": "demand.egon_household_electricity_profile_in_census_cell", "title": "eGon household electricity profiles in census cells", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for residential electricity profiles to census cell including scaling factors for two scenarios (eGon2035, eGon100RE).", "language": ["en-EN", "de-DE"], "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "100 m x 100 m"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_household_electricity_profile_in_census_cell", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "integer", "unit": "none"}, {"name": "grid_id", "description": "Descriptive ID of census cell given by Statistisches Bundesamt (Destatis)", "type": "character varying", "unit": "none"}, {"name": "cell_profile_ids", "description": "Household profile ids", "type": "array of integer", "unit": "none"}, {"name": "nuts3", "description": "NUTS-3 ID of the census cell", "type": "character varying", "unit": "none"}, {"name": "nuts1", "description": "NUTS-1 ID of the census cell", "type": "character varying", "unit": "none"}, {"name": "factor_2035", "description": "Scaling factor for all profiles in the respective census cell for scenario eGon2035", "type": "double precision", "unit": "none"}, {"name": "factor_2050", "description": "Scaling factor for all profiles in the respective census cell for scenario eGon100RE", "type": "double precision", "unit": "none"}], "primaryKey": "cell_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json new file mode 100644 index 000000000..ecb2c8bbf --- /dev/null +++ b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json @@ -0,0 +1 @@ +{"name": "demand.egon_household_electricity_profile_of_buildings", "title": "eGon household electricity profiles of buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for residential electricity profiles to buildings via project internal building_id and corresponding census cell_id. ", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_household_electricity_profile_of_buildings", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_residential.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "integer", "unit": "none"}, {"name": "profile_id", "description": "ID of iee household profiles (reference to: iee_household_load_profiles.type)", "type": "character varying", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/demand.iee_household_load_profiles.json b/src/egon/data/json_metadata/demand.iee_household_load_profiles.json new file mode 100644 index 000000000..11b158e81 --- /dev/null +++ b/src/egon/data/json_metadata/demand.iee_household_load_profiles.json @@ -0,0 +1 @@ +{"name": "demand.iee_household_load_profiles", "title": "eGon pool of electricity household load profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "100.000 annual profiles in hourly resolution of electricity demand of private households for different household types (singles, couples, other) with varying number of elderly and children. The profiles were created using a bottom-up load profile generator by Fraunhofer IEE developed in the Bachelors thesis \"Auswirkungen verschiedener Haushaltslastprofile auf PV-Batterie-Systeme\" by Jonas Haack, Fachhochschule Flensburg, December 2012. The columns are named as follows: \"a\", e.g. P2a0000 is the first profile of a couples household with 2 children. See publication below for the list of prefixes. Values are given in Wh.", "language": ["en-EN", "de-DE"], "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": ""}, "temporal": {"referenceDate": "2022-06-10", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.iee_household_load_profiles", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "type", "description": "Profile id", "type": "character(8)", "unit": "none"}, {"name": "load_in_wh", "description": "Residential demand load timeseries for one year (8760 hours) in Wh", "type": "array of real", "unit": "Wh"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/grid.egon_mv_grid_district.json b/src/egon/data/json_metadata/grid.egon_mv_grid_district.json new file mode 100644 index 000000000..747a171f1 --- /dev/null +++ b/src/egon/data/json_metadata/grid.egon_mv_grid_district.json @@ -0,0 +1 @@ +{"name": "grid.egon_mv_grid_district", "title": "eGon MV grid districts", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table of bus_id to polygons shapes for MV grid districts.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grids"}, "temporal": {}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut, \u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert), \u00a9 eGon-data developers"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "grid.egon_mv_grid_district", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "geom", "description": "Polygon of mv grid district (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "None"}, {"name": "area", "description": "Area covered by mvgd", "type": "double precision", "unit": "m^2"}], "primaryKey": "bus_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json b/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json new file mode 100644 index 000000000..d57f16bfc --- /dev/null +++ b/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json @@ -0,0 +1 @@ +{"name": "openstreetmap.osm_buildings_filtered", "title": "eGon filtered buildings from openstreetmap", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Tag filtered list of buildings from OpenStreetMap which might have electricity or heat demand - (c) OpenStreetMap contributors", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-01-01", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Created metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "openstreetmap.osm_buildings_filtered", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "osm_id", "description": "Openstreetmap identifier", "type": "bigint", "unit": "none"}, {"name": "amenitiy", "description": "Type of amenitiy if given", "type": "text", "unit": "none"}, {"name": "building", "description": "Type of building", "type": "text", "unit": "none"}, {"name": "name", "description": "Name of the building if given", "type": "text", "unit": "none"}, {"name": "geom_building", "description": "Polygon of the building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "area", "description": "Surface area of building", "type": "double precision", "unit": "m^2"}, {"name": "geom_point", "description": "Centroid of the building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "tags", "description": "Opensteetmap tags assigned to the building", "type": "hstore", "unit": "none"}, {"name": "id", "description": "Unique identifyer and project internal building id (reference to: demand.egon_hp_capacity_buildings.building_id, demand.egon_cts_heat_demand_building_share.building_id, demand.egon_cts_electricity_demand_building_share.building_id, demand.egon_household_electricity_profile_of_buildings.building_id, demand.egon_building_heat_peak_loads.building_id, demand.egon_building_electricity_peak_loads.building_id, boundaries.egon_map_zensus_mvgd_buildings.building_id)", "type": "integer", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json b/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json new file mode 100644 index 000000000..6c6a131a4 --- /dev/null +++ b/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json @@ -0,0 +1 @@ +{"name": "openstreetmap.osm_buildings_synthetic", "title": "eGon synthetic residential buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": " List of generated synthetic buildings ", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "openstreetmap.osm_buildings_synthetic", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifyer and project internal building id (reference to: openstreetmap.osm_buildings_residential.id, demand.egon_household_electricity_profile_of_buildings.building_id)", "type": "character varying", "unit": "none"}, {"name": "area", "description": "Surface area of building", "type": "real", "unit": "m^2"}, {"name": "building", "description": "Type of building (residential or cts)", "type": "character varying(11)", "unit": "none"}, {"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "character varying", "unit": "none"}, {"name": "geom_building", "description": "Polygon of building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "geom_point", "description": "Centroid of building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "n_amenities_inside", "description": "Number of amenities inside the building (always zero if not cts building)", "type": "integer", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json b/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json new file mode 100644 index 000000000..c26d9bb95 --- /dev/null +++ b/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json @@ -0,0 +1 @@ +{"name": "society.destatis_zensus_population_per_ha", "title": "DESTATIS - Zensus 2011 - Population per hectar", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "National census in Germany in 2011.", "language": "undefined", "keywords": [], "publicationDate": "2022-08-06", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}], "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "society.destatis_zensus_population_per_ha", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "grid_id", "description": "Grid number of source", "type": "string", "unit": "none"}, {"name": "population", "description": "Number of registred residents", "type": "integer", "unit": "resident"}, {"name": "geom_point", "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}, {"name": "geom", "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file diff --git a/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json b/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json new file mode 100644 index 000000000..ec3e0362c --- /dev/null +++ b/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json @@ -0,0 +1 @@ +{"name": "society.egon_destatis_zensus_apartment_building_population_per_ha", "title": "eGon - Zensus 2011 - Apartments, Buildings, Population per hectar", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Apartments, Buildings, Population from national census in Germany in 2011.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)", "name": "dl-by-de/2.0"}]}], "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "society.egon_destatis_zensus_apartment_building_population_per_ha", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "grid_id", "description": "Grid number of source", "type": "string", "unit": "none"}, {"name": "zensus_population_id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "building_count", "description": "Number of buildings within zensus cell ", "type": "smallint", "unit": "none"}, {"name": "apartment_count", "description": "Number of appartments within zensus cells", "type": "smallint", "unit": "none"}, {"name": "population", "description": "Number of registred residents", "type": "integer", "unit": "resident"}, {"name": "geom", "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}, {"name": "geom_point", "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}], "primaryKey": "none"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "review": {"path": "", "badge": ""}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file From 955e9eb9da8212acf77f78157ce9ce33182d2de4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 12:15:47 +0100 Subject: [PATCH 100/787] Adjust upload to files in repo --- src/egon/data/metadata.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 06c736cad..00e129d71 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -11,7 +11,7 @@ from egon.data import db, logger from egon.data.datasets import Dataset from egon.data.db import engine - +from egon.data import __path__ as data_path def context(): """ @@ -732,20 +732,10 @@ def contributors(authorlist): def upload_json_metadata(): """Upload json metadata into db from zenodo""" + path = Path(data_path[0]) / "json_metdata" - path = Path(".") / "data_bundle_egon_data" / "json_metadata.zip" v = "oep-v1.4" - # TODO remove after json added to data_bundle issue #1110 - if not os.path.exists(path): - url = "https://wolke.rl-institut.de/s/HtLtKsiefz9XFqm" - os.makedirs(path.parent, exist_ok=True) - urlretrieve(url, path) - - with ZipFile(path, "r") as zip_ref: - path = str(path).rstrip(".zip") - zip_ref.extractall(path) - for file in os.listdir(path=str(path)): if file.endswith(".json"): From 86a53bf649d2364c016b32c89bd421302966a7f0 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 13:09:33 +0100 Subject: [PATCH 101/787] some small fixes in ev metadata --- .../emobility/motorized_individual_travel/__init__.py | 2 ++ .../emobility/motorized_individual_travel/db_classes.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index fdf0b5fbe..23a981180 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -92,6 +92,7 @@ EgonEvMvGridDistrict, EgonEvPool, EgonEvTrip, + add_metadata, ) from egon.data.datasets.emobility.motorized_individual_travel.ev_allocation import ( # noqa: E501 allocate_evs_numbers, @@ -474,5 +475,6 @@ def generate_model_data_tasks(scenario_name): *generate_model_data_tasks(scenario_name="eGon2035"), *generate_model_data_tasks(scenario_name="eGon100RE"), }, + add_metadata, ), ) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 32beac475..b832f615e 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -482,7 +482,7 @@ def add_metadata(): schema, table, ), - "primaryKey": "scenario", + "primaryKey": "id", }, "dialect": {"delimiter": "", "decimalSeparator": ""}, } @@ -614,7 +614,7 @@ def add_metadata(): schema, table, ), - "primaryKey": "scenario", + "primaryKey": ["scenario", "event_id"], }, "dialect": {"delimiter": "", "decimalSeparator": ""}, } From e78ecde772470075c47c3a0d9bb38d15a2349cf5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 14:02:23 +0100 Subject: [PATCH 102/787] Adjust dependencies --- src/egon/data/airflow/dags/pipeline.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index 1ee5b50a3..d4aad0a74 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -692,5 +692,9 @@ # upload json metadata at the end json_metadata = Json_Metadata( - dependencies=[sanity_checks] + dependencies=[ + load_areas, + cts_demand_buildings, + heat_pumps_2050 + ] ) From bb63c72a5ae84cca69f2f4639f2443edace5f8d4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 14:06:34 +0100 Subject: [PATCH 103/787] Fix typo --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 00e129d71..ca26ff077 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -732,7 +732,7 @@ def contributors(authorlist): def upload_json_metadata(): """Upload json metadata into db from zenodo""" - path = Path(data_path[0]) / "json_metdata" + path = Path(data_path[0]) / "json_metadata" v = "oep-v1.4" From b44c012e7efd04b2e1ac4c947adac1a4f97a9d39 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 17 Mar 2023 14:08:46 +0100 Subject: [PATCH 104/787] Update imports --- src/egon/data/airflow/dags/pipeline.py | 2 +- src/egon/data/metadata.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index d4aad0a74..50210498d 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -4,6 +4,7 @@ import airflow from egon.data.config import set_numexpr_threads +from egon.data.metadata import Json_Metadata from egon.data.datasets import database from egon.data.datasets.calculate_dlr import Calculate_dlr from egon.data.datasets.ch4_prod import CH4Production @@ -95,7 +96,6 @@ from egon.data.datasets.zensus import ZensusMiscellaneous, ZensusPopulation from egon.data.datasets.zensus_mv_grid_districts import ZensusMvGridDistricts from egon.data.datasets.zensus_vg250 import ZensusVg250 - # Set number of threads used by numpy and pandas set_numexpr_threads() diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index ca26ff077..e1c26c3f3 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -1,6 +1,4 @@ from pathlib import Path -from urllib.request import urlretrieve -from zipfile import ZipFile import os from geoalchemy2 import Geometry From 9ac915d881a844b2ff540830390d027ac67dee8c Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 14:16:54 +0100 Subject: [PATCH 105/787] add basic structure for dsm metadata --- src/egon/data/datasets/DSM_cts_ind.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 06a791181..e44989fc8 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -79,7 +79,7 @@ def __init__(self, dependencies): name="DsmPotential", version="0.0.4", dependencies=dependencies, - tasks=(dsm_cts_ind_processing), + tasks=(dsm_cts_ind_processing,), ) @@ -164,6 +164,19 @@ class EgonSitesIndLoadCurvesIndividualDsmTimeseries(Base): e_min_pu = Column(ARRAY(Float)) +# def add_metadata(): +# targets = config.datasets()["DSM_CTS_industry"]["targets"] +# +# targets = { +# k: v for k, v in targets.items() if "dsm_timeseries" in v["table"] +# } +# +# for t_dict in targets.items(): +# schema = t_dict["schema"] +# table = t_dict["table"] +# name = f"{schema}.{table}" + + # Code def cts_data_import(cts_cool_vent_ac_share): """ @@ -959,8 +972,10 @@ def delete_dsm_entries(carrier): # buses - sql = f"""DELETE FROM {targets["bus"]["schema"]}.{targets["bus"]["table"]} b - WHERE (b.carrier LIKE '{carrier}');""" + sql = ( + f"DELETE FROM {targets['bus']['schema']}.{targets['bus']['table']} b" + f"WHERE (b.carrier LIKE '{carrier}');" + ) db.execute_sql(sql) # links From f767c38d4602f54434f22374ade402589a290918 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 17 Mar 2023 14:18:26 +0100 Subject: [PATCH 106/787] Add metadata for power plants table --- .../data/datasets/power_plants/__init__.py | 2 + .../data/datasets/power_plants/metadata.py | 266 ++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 src/egon/data/datasets/power_plants/metadata.py diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 8b2bdc533..4cc7524b1 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -34,6 +34,7 @@ ) import egon.data.config import egon.data.datasets.power_plants.assign_weather_data as assign_weather_data # noqa: E501 +import egon.data.datasets.power_plants.metadata as pp_metadata import egon.data.datasets.power_plants.pv_ground_mounted as pv_ground_mounted import egon.data.datasets.power_plants.wind_farms as wind_onshore import egon.data.datasets.power_plants.wind_offshore as wind_offshore @@ -79,6 +80,7 @@ def __init__(self, dependencies): }, wind_offshore.insert, assign_weather_data.weatherId_and_busId, + pp_metadata, ), ) diff --git a/src/egon/data/datasets/power_plants/metadata.py b/src/egon/data/datasets/power_plants/metadata.py new file mode 100644 index 000000000..91fe353e6 --- /dev/null +++ b/src/egon/data/datasets/power_plants/metadata.py @@ -0,0 +1,266 @@ +"""Metadata for power plants table +""" +import datetime +import json + +from egon.data import db +from egon.data.metadata import ( + license_agpl, + license_ccby, + licenses_datenlizenz_deutschland, +) + + +def metadata(): + """Add metdata to power plants table + + Returns + ------- + None. + + """ + meta = { + "name": "supply.egon_power_plants", + "title": "supply.egon_power_plants", + "id": "", + "description": "Database of powerplants ", + "language": "en-GB", + "keywords": [], + "publicationDate": datetime.date.today().isoformat(), + "context": { + "homepage": "https://ego-n.org/tools_data/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium für Wirtschaft und Energie", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg", + }, + "spatial": {"location": "", "extent": "Germany", "resolution": ""}, + "sources": [ + { + "title": '"open-MaStR power unit registry"', + "description": "Raw data download Marktstammdatenregister (MaStR) data using the webservice. All data from the Marktstammdatenregister is included. There are duplicates included. For further information read in the documentationg of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", + "path": "https://sandbox.zenodo.org/record/808086", + "licenses": [ + { + "name": licenses_datenlizenz_deutschland( + '"© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen"' + ), + "title": "", + "path": "", + "instruction": "", + "attribution": "eGon developers", + } + ], + }, + { + "title": '"ERA5 global reanalysis"', + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate " + "and weather for the past 4 to 7 decades. Currently data is available from 1950, " + "split into Climate Data Store entries for 1950-1978 (preliminary back extension) and f" + "rom 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. " + "See the online ERA5 documentation " + "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " + "for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "licenses": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. " + "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use " + "may include, but is not limited to: reproduction; distribution; communication to the public; " + "adaptation, modification and combination with other data and information; or any " + "combination of the foregoing", + "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", + }, + ], + }, + { + "title": '"Verwaltungsgebiete 1:250 000 (Ebenen)"', + "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der " + "hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden " + "mit ihren Grenzen, statistischen Schlüsselzahlen, Namen der " + "Verwaltungseinheit sowie die spezifische Bezeichnung der " + "Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": [ + licenses_datenlizenz_deutschland( + "© Bundesamt für Kartographie und Geodäsie " + "2020 (Daten verändert)" + ) + ], + }, + { + "title": '"eGon-data"', + "description": "Workflow to download, process and generate data sets" + "suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + license_agpl( + "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte" + ) + ], + }, + { + "title": '"Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf"', + "description": "Die vier deutschen Übertragungsnetzbetreiber zeigen mit " + "diesem ersten Entwurf des Netzentwicklungsplans 2035, Version 2021, den " + "benötigten Netzausbau für die nächsten Jahre auf. Der NEP-Bericht beschreibt " + "keine konkreten Trassenverläufe von Übertragungsleitungen, sondern er " + "dokumentiert den notwendigen Übertragungsbedarf zwischen Netzknoten. " + "Das heißt, es werden Anfangs- und Endpunkte von zukünftigen Leitungsverbindungen " + "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " + "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", + "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", + "licenses": [license_ccby("© Übertragungsnetzbetreiber")], + }, + { + "title": '"Data bundle for egon-data"', + "description": "Zenodo repository to provide several different input data sets for eGon-data", + "path": "https://sandbox.zenodo.org/record/1167119", + "licenses": [license_ccby("© eGon development team")], + }, + ], + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "eGon developers", + } + ], + "contributors": [ + { + "title": "Ilka Cußmann", + "email": "", + "object": "", + "comment": "Added hydro and biomass plants", + }, + { + "title": "Clara Büttner", + "email": "", + "object": "", + "comment": "Added table structure", + }, + { + "title": "Katharina Esterl", + "email": "", + "object": "", + "comment": "Add pv ground mounted", + }, + { + "title": "Carlos Epia", + "email": "", + "object": "", + "comment": "Added wind power plants", + }, + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "supply.egon_power_plants", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier for power plants", + "type": "Integer ", + "unit": "", + }, + { + "name": "sources", + "description": "sources of power plants", + "type": "Dictionary", + "unit": "", + }, + { + "name": "source_id", + "description": "Unique Identifier of sources ", + "type": "Dictionary", + "unit": "", + }, + { + "name": "carrier", + "description": "Energy carrier such as biomass, wind_onshore", + "type": "String", + "unit": "", + }, + { + "name": "el_capacity", + "description": "Installed electrical capacity in MW", + "type": "", + "unit": "MW", + }, + { + "name": "bus_id", + "description": "bus ID where the power plant is connected", + "type": "Integer", + "unit": "", + }, + { + "name": "voltage_level", + "description": "voltage level of power plant", + "type": "Integer", + "unit": "", + }, + { + "name": "weather_cell_id", + "description": "Unique identifier of the corresponding weather cell", + "type": "Integer", + "unit": "", + }, + { + "name": "scenario", + "description": "eGon scenario, for example eGon235 or eGon100RE", + "type": "String", + "unit": "", + }, + { + "name": "geometry", + "description": "geometry of the power plant", + "type": "String", + "unit": "", + }, + { + "name": "", + "description": "", + "type": "", + "unit": "", + }, + ], + "primaryKey": "", + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/", + }, + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + "'" + json.dumps(meta) + "'", "supply", "egon_power_plants" + ) From dd7f2dfd6099edda342801537aebfee02ca97cca Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 17 Mar 2023 14:34:57 +0100 Subject: [PATCH 107/787] Fix calling meta data function --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 9e9828a5d..2ae3fa7db 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -80,7 +80,7 @@ def __init__(self, dependencies): }, wind_offshore.insert, assign_weather_data.weatherId_and_busId, - pp_metadata, + pp_metadata.metadata, ), ) From 737c501e42d9ba9f66ee3b94d923bfc4b7a143d0 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 15:00:11 +0100 Subject: [PATCH 108/787] add metadata for dsm time series --- src/egon/data/datasets/DSM_cts_ind.py | 177 ++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 0503ce6b7..39a84eefd 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -8,6 +8,9 @@ sanity checks. See [#1120](https://github.com/openego/eGon-data/issues/1120) for updates. """ +import datetime +import json + from sqlalchemy import ARRAY, Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd @@ -18,6 +21,12 @@ from egon.data.datasets import Dataset from egon.data.datasets.electricity_demand.temporal import calc_load_curve from egon.data.datasets.industry.temporal import identify_bus +from egon.data.metadata import ( + context, + generate_resource_fields_from_db_table, + license_odbl, + meta_metadata, +) # CONSTANTS # TODO: move to datasets.yml @@ -166,17 +175,161 @@ class EgonSitesIndLoadCurvesIndividualDsmTimeseries(Base): e_min = Column(ARRAY(Float)) -# def add_metadata(): -# targets = config.datasets()["DSM_CTS_industry"]["targets"] -# -# targets = { -# k: v for k, v in targets.items() if "dsm_timeseries" in v["table"] -# } -# -# for t_dict in targets.items(): -# schema = t_dict["schema"] -# table = t_dict["table"] -# name = f"{schema}.{table}" +def add_metadata_individual(): + targets = config.datasets()["DSM_CTS_industry"]["targets"] + + targets = { + k: v for k, v in targets.items() if "dsm_timeseries" in v["table"] + } + + title_dict = { + "egon_etrago_electricity_cts_dsm_timeseries": ( + "DSM flexibility band time series for CTS" + ), + "egon_osm_ind_load_curves_individual_dsm_timeseries": ( + "DSM flexibility band time series for OSM industry sites" + ), + "egon_demandregio_sites_ind_electricity_dsm_timeseries": ( + "DSM flexibility band time series for demandregio industry sites" + ), + "egon_sites_ind_load_curves_individual_dsm_timeseries": ( + "DSM flexibility band time series for other industry sites" + ), + } + + description_dict = { + "egon_etrago_electricity_cts_dsm_timeseries": ( + "DSM flexibility band time series for CTS in 1 h resolution " + "including available store capacity and power potential" + ), + "egon_osm_ind_load_curves_individual_dsm_timeseries": ( + "DSM flexibility band time series for OSM industry sites in 1 h " + "resolution including available store capacity and power potential" + ), + "egon_demandregio_sites_ind_electricity_dsm_timeseries": ( + "DSM flexibility band time series for demandregio industry sites " + "in 1 h resolution including available store capacity and power " + "potential" + ), + "egon_sites_ind_load_curves_individual_dsm_timeseries": ( + "DSM flexibility band time series for other industry sites in 1 h " + "resolution including available store capacity and power potential" + ), + } + + keywords_dict = { + "egon_etrago_electricity_cts_dsm_timeseries": ["cts"], + "egon_osm_ind_load_curves_individual_dsm_timeseries": [ + "osm", + "industry", + ], + "egon_demandregio_sites_ind_electricity_dsm_timeseries": [ + "demandregio", + "industry", + ], + "egon_sites_ind_load_curves_individual_dsm_timeseries": ["industry"], + } + + primaryKey_dict = { + "egon_etrago_electricity_cts_dsm_timeseries": ["bus"], + "egon_osm_ind_load_curves_individual_dsm_timeseries": ["osm_id"], + "egon_demandregio_sites_ind_electricity_dsm_timeseries": [ + "industrial_sites_id", + ], + "egon_sites_ind_load_curves_individual_dsm_timeseries": ["site_id"], + } + + for t_dict in targets.items(): + schema = t_dict["schema"] + table = t_dict["table"] + name = f"{schema}.{table}" + + meta = { + "name": name, + "title": title_dict[table], + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": description_dict[table], + "language": "en-US", + "keywords": ["dsm", "timeseries"] + keywords_dict[table], + "publicationDate": datetime.date.today().isoformat(), + "context": context(), + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "none", + }, + "temporal": { + "referenceDate": "scenario-specific", + "timeseries": { + "start": "2011-01-01", + "end": "2011-12-31", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "average", + }, + }, + "sources": ["TODO"], + "licenses": [license_odbl("© eGon development team")], + "contributors": [ + { + "title": "khelfen", + "email": "Kilian.Helfenbein@rl-institut.de", + "date": "2023-03-17", + "object": "metadata", + "comment": "Create metadata", + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": name, + "path": "None", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": generate_resource_fields_from_db_table( + schema, + table, + ), + "primaryKey": ["scn_name"] + primaryKey_dict[table], + }, + "dialect": {"delimiter": "", "decimalSeparator": ""}, + } + ], + "review": {"path": "", "badge": ""}, + "metaMetadata": meta_metadata(), + "_comment": { + "metadata": ( + "Metadata documentation and explanation (https://" + "github.com/OpenEnergyPlatform/oemetadata/blob/master/" + "metadata/v141/metadata_key_description.md)" + ), + "dates": ( + "Dates and time must follow the ISO8601 including time " + "zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)" + ), + "units": "Use a space between numbers and units (100 m)", + "languages": ( + "Languages must follow the IETF (BCP47) format (en-GB, " + "en-US, de-DE)" + ), + "licenses": ( + "License name must follow the SPDX License List " + "(https://spdx.org/licenses/)" + ), + "review": ( + "Following the OEP Data Review (https://github.com/" + "OpenEnergyPlatform/data-preprocessing/wiki)" + ), + "none": "If not applicable use (none)", + }, + } + + db.submit_comment( + f"'{json.dumps(meta)}'", + schema, + table, + ) # Code @@ -1595,3 +1748,5 @@ def dsm_cts_ind_processing(): dsm_cts_ind() dsm_cts_ind_individual() + + add_metadata_individual() From 60c0f303bba2fbeaa5825550eb947ced94c57e93 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 16:12:07 +0100 Subject: [PATCH 109/787] fix single quote error --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 3ae8c0631..11af11b12 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -542,7 +542,7 @@ def sources(): "water and process heat) buildings for the year 2015, were distributed using modelled, spatial " "statistics based floor areas in 100x100m grids and a population grid. " "For further information please see the documentation available on the Heat Roadmap Europe website, " - "in particular D2.3 report 'Methodologies and assumptions used in the mapping'.", + "in particular D2.3 report: Methodologies and assumptions used in the mapping.", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [ license_ccby( From 01508a59c4454dedc39d0b8dc02fada26d361c14 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 16:15:50 +0100 Subject: [PATCH 110/787] fix single quote error --- src/egon/data/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 11af11b12..784fcf6af 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -232,7 +232,7 @@ def license_dedl(attribution=EGON_ATTRIBUTION): "path": "https://www.govdata.de/dl-de/by-2-0", "instruction": ( "Any use will be permitted provided it fulfils the requirements of" - " this 'Data licence Germany – attribution – Version 2.0'. The " + ' this "Data licence Germany – attribution – Version 2.0". The ' "data and meta-data provided may, for commercial and " "non-commercial use, in particular be copied, printed, presented, " "altered, processed and transmitted to third parties; be merged " @@ -241,8 +241,8 @@ def license_dedl(attribution=EGON_ATTRIBUTION): "external business processes, products and applications in public " "and non-public electronic networks. The user must ensure that the" " source note contains the following information: the name of the " - "provider, the annotation 'Data licence Germany – attribution – " - "Version 2.0' or 'dl-de/by-2-0' referring to the licence text " + 'provider, the annotation "Data licence Germany – attribution – ' + 'Version 2.0" or "dl-de/by-2-0" referring to the licence text ' "available at www.govdata.de/dl-de/by-2-0, and a reference to the " "dataset (URI). This applies only if the entity keeping the data " "provides the pieces of information 1-3 for the source note. " From e8052cbee744c7940acc068bc683fd3e225c2240 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 16:32:56 +0100 Subject: [PATCH 111/787] minor bug fix --- src/egon/data/datasets/DSM_cts_ind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 39a84eefd..43b2aa906 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -1127,7 +1127,7 @@ def delete_dsm_entries(carrier): # buses sql = ( - f"DELETE FROM {targets['bus']['schema']}.{targets['bus']['table']} b" + f"DELETE FROM {targets['bus']['schema']}.{targets['bus']['table']} b " f"WHERE (b.carrier LIKE '{carrier}');" ) db.execute_sql(sql) From 9343fbed643c347bdb075c4e68e7c9d8e11d9f6f Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 17 Mar 2023 16:41:53 +0100 Subject: [PATCH 112/787] small fix --- src/egon/data/datasets/DSM_cts_ind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 43b2aa906..6fec35e3c 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -239,7 +239,7 @@ def add_metadata_individual(): "egon_sites_ind_load_curves_individual_dsm_timeseries": ["site_id"], } - for t_dict in targets.items(): + for t_dict in targets.values(): schema = t_dict["schema"] table = t_dict["table"] name = f"{schema}.{table}" From 21e6c5920da259a47d28db27126f8ad51da6f429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 15:49:58 +0100 Subject: [PATCH 113/787] Run black on "heat_demand_timeseries/__init__.py" As of version 23.1.0, it removes those superfluous blank lines. --- .../datasets/heat_demand_timeseries/__init__.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index ddd5d48de..b00ff27d9 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -335,7 +335,6 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): ) if not selected_profiles.empty: - df = pd.merge( selected_profiles, daily_demand_shares, @@ -488,7 +487,6 @@ def create_individual_heat_per_mv_grid(scenario="eGon2035", mv_grid_id=1564): def calulate_peak_load(df, scenario): - # peat load in W_th data = ( df.groupby("building_id") @@ -513,7 +511,6 @@ def calulate_peak_load(df, scenario): def create_individual_heating_peak_loads(scenario="eGon2035"): - engine = db.engine() EgonIndividualHeatingPeakLoads.__table__.drop(bind=engine, checkfirst=True) @@ -572,7 +569,6 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): start_time = datetime.now() for grid in annual_demand.bus_id.unique(): - selected_profiles = db.select_dataframe( f""" SELECT a.zensus_population_id, building_id, c.climate_zone, @@ -623,7 +619,6 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): def create_individual_heating_profile_python_like(scenario="eGon2035"): - start_time = datetime.now() idp_df = db.select_dataframe( @@ -688,7 +683,6 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): start_time = datetime.now() for grid in annual_demand.bus_id.unique(): - selected_profiles = db.select_dataframe( f""" SELECT a.zensus_population_id, building_id, c.climate_zone, @@ -781,7 +775,6 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): def district_heating(method="python"): - engine = db.engine() EgonTimeseriesDistrictHeating.__table__.drop(bind=engine, checkfirst=True) EgonTimeseriesDistrictHeating.__table__.create( @@ -793,7 +786,6 @@ def district_heating(method="python"): create_district_heating_profile_python_like("eGon100RE") else: - CTS_demand_dist, CTS_demand_grid, CTS_demand_zensus = CTS_demand_scale( aggregation_level="district" ) @@ -869,7 +861,6 @@ def individual_heating_per_mv_grid_100(method="python"): def individual_heating_per_mv_grid(method="python"): - if method == "python": engine = db.engine() EgonEtragoTimeseriesIndividualHeating.__table__.drop( @@ -883,7 +874,6 @@ def individual_heating_per_mv_grid(method="python"): create_individual_heating_profile_python_like("eGon100RE") else: - engine = db.engine() EgonEtragoTimeseriesIndividualHeating.__table__.drop( bind=engine, checkfirst=True @@ -905,7 +895,6 @@ def individual_heating_per_mv_grid(method="python"): ) for index, row in ids.iterrows(): - for scenario in ["eGon2035", "eGon100RE"]: series = create_individual_heat_per_mv_grid( scenario, row.bus_id @@ -946,7 +935,6 @@ def individual_heating_per_mv_grid(method="python"): def store_national_profiles(): - scenario = "eGon100RE" df = db.select_dataframe( @@ -1071,7 +1059,6 @@ def export_etrago_cts_heat_profiles(): def metadata(): - fields = [ { "description": "Index of corresponding district heating area", From 53e43eefe101f5a24af7f9bc799954fc63f0ac59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:00:05 +0100 Subject: [PATCH 114/787] Remove unused imports At least that's what `flake8` is claiming, so let's hope it's right. Also, there should be no reason to ever import `egon`. --- .../data/datasets/heat_demand_timeseries/__init__.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index b00ff27d9..d92eee90f 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -6,20 +6,10 @@ from sqlalchemy import ARRAY, Column, Float, Integer, String, Text from sqlalchemy.ext.declarative import declarative_base -import geopandas as gpd import numpy as np import pandas as pd from egon.data import db -import egon.data.datasets.era5 as era - -try: - from disaggregator import temporal -except ImportError as e: - pass - -from math import ceil - from egon.data.datasets import Dataset from egon.data.datasets.heat_demand_timeseries.daily import ( daily_demand_shares_per_climate_zone, @@ -35,7 +25,6 @@ meta_metadata, sources, ) -import egon Base = declarative_base() From 7005675d75ab09665f0318336744c59ad6e4d0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:23:05 +0100 Subject: [PATCH 115/787] Wrap overly long lines PEP8 says 79 characters for normal code and 72 characters for free flowing text like e.g. multi line comments. I mean, SQL code is unreadable enough as it is... --- .../heat_demand_timeseries/__init__.py | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index d92eee90f..77359d396 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -84,7 +84,11 @@ def create_timeseries_for_building(building_id, scenario): SELECT building_demand * UNNEST(idp) as demand FROM ( - SELECT demand.demand / building.count * daily_demand.daily_demand_share as building_demand, daily_demand.day_of_year + SELECT + demand.demand + / building.count + * daily_demand.daily_demand_share as building_demand, + daily_demand.day_of_year FROM (SELECT demand FROM @@ -108,8 +112,12 @@ def create_timeseries_for_building(building_id, scenario): WHERE climate_zone = ( SELECT climate_zone FROM boundaries.egon_map_zensus_climate_zones WHERE zensus_population_id = - (SELECT zensus_population_id FROM demand.egon_heat_timeseries_selected_profiles - WHERE building_id = {building_id}))) as daily_demand) as daily_demand + ( + SELECT zensus_population_id + FROM demand.egon_heat_timeseries_selected_profiles + WHERE building_id = {building_id} + ) + )) as daily_demand) as daily_demand JOIN (SELECT b.idp, ordinality as day FROM demand.egon_heat_timeseries_selected_profiles a, @@ -175,7 +183,8 @@ def create_district_heating_profile(scenario, area_id): JOIN demand.egon_daily_heat_demand_per_climate_zone c ON c.climate_zone = b.climate_zone - JOIN (SELECT e.idp, ordinality as day, zensus_population_id, building_id + JOIN ( + SELECT e.idp, ordinality as day, zensus_population_id, building_id FROM demand.egon_heat_timeseries_selected_profiles d, UNNEST (d.selected_idp_profiles) WITH ORDINALITY as selected_idp JOIN demand.egon_heat_idp_pool e @@ -255,7 +264,12 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): annual_demand = db.select_dataframe( f""" - SELECT a.zensus_population_id, demand/c.count as per_building , area_id, demand as demand_total FROM + SELECT + a.zensus_population_id, + demand / c.count as per_building, + area_id, + demand as demand_total + FROM demand.egon_peta_heat a INNER JOIN ( SELECT * FROM demand.egon_map_zensus_district_heating_areas @@ -434,7 +448,9 @@ def create_individual_heat_per_mv_grid(scenario="eGon2035", mv_grid_id=1564): JOIN demand.egon_daily_heat_demand_per_climate_zone c ON c.climate_zone = b.climate_zone - JOIN (SELECT e.idp, ordinality as day, zensus_population_id, building_id + JOIN ( + SELECT + e.idp, ordinality as day, zensus_population_id, building_id FROM demand.egon_heat_timeseries_selected_profiles d, UNNEST (d.selected_idp_profiles) WITH ORDINALITY as selected_idp JOIN demand.egon_heat_idp_pool e @@ -541,7 +557,8 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): WHERE a.scenario = '{scenario}' AND a.sector = 'residential' AND a.zensus_population_id NOT IN ( - SELECT zensus_population_id FROM demand.egon_map_zensus_district_heating_areas + SELECT zensus_population_id + FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' ) @@ -570,7 +587,8 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp WHERE a.zensus_population_id NOT IN ( - SELECT zensus_population_id FROM demand.egon_map_zensus_district_heating_areas + SELECT zensus_population_id + FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' ) AND a.zensus_population_id IN ( @@ -619,7 +637,11 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): annual_demand = db.select_dataframe( f""" - SELECT a.zensus_population_id, demand/c.count as per_building, demand as demand_total, bus_id + SELECT + a.zensus_population_id, + demand / c.count as per_building, + demand as demand_total, + bus_id FROM demand.egon_peta_heat a @@ -641,7 +663,8 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): WHERE a.scenario = '{scenario}' AND a.sector = 'residential' AND a.zensus_population_id NOT IN ( - SELECT zensus_population_id FROM demand.egon_map_zensus_district_heating_areas + SELECT zensus_population_id + FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' ) @@ -684,7 +707,8 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp WHERE a.zensus_population_id NOT IN ( - SELECT zensus_population_id FROM demand.egon_map_zensus_district_heating_areas + SELECT zensus_population_id + FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' ) AND a.zensus_population_id IN ( @@ -954,7 +978,8 @@ def store_national_profiles(): JOIN demand.egon_daily_heat_demand_per_climate_zone c ON c.climate_zone = b.climate_zone - JOIN (SELECT e.idp, ordinality as day, zensus_population_id, building_id + JOIN ( + SELECT e.idp, ordinality as day, zensus_population_id, building_id FROM demand.egon_heat_timeseries_selected_profiles d, UNNEST (d.selected_idp_profiles) WITH ORDINALITY as selected_idp JOIN demand.egon_heat_idp_pool e From 0d09fd5b36bb109278db0511c42ff8b4445829d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:27:38 +0100 Subject: [PATCH 116/787] Replace hard tabs with spaces --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 77359d396..f80ee8ca4 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -209,7 +209,7 @@ def create_district_heating_profile(scenario, area_id): WHERE scenario = '{scenario}' AND area_id = {area_id} )) - GROUP BY zensus_population_id) building + GROUP BY zensus_population_id) building ON building.zensus_population_id = b.zensus_population_id, UNNEST(demand_profile.idp) WITH ORDINALITY as hourly_demand @@ -473,7 +473,7 @@ def create_individual_heat_per_mv_grid(scenario="eGon2035", mv_grid_id=1564): boundaries.egon_map_zensus_grid_districts WHERE bus_id = {mv_grid_id} )) - GROUP BY zensus_population_id) building + GROUP BY zensus_population_id) building ON building.zensus_population_id = b.zensus_population_id, UNNEST(demand_profile.idp) WITH ORDINALITY as hourly_demand @@ -994,7 +994,7 @@ def store_national_profiles(): SELECT zensus_population_id FROM demand.egon_heat_timeseries_selected_profiles ) - GROUP BY zensus_population_id) building + GROUP BY zensus_population_id) building ON building.zensus_population_id = b.zensus_population_id, UNNEST(demand_profile.idp) WITH ORDINALITY as hourly_demand From 83b03aa9122e071b9774792edb7797dc615b3510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:29:05 +0100 Subject: [PATCH 117/787] Remove trailing spaces --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index f80ee8ca4..67ae803ae 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -331,9 +331,9 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): WHERE scenario = '{scenario}' AND area_id = '{area}' ) b ON a.zensus_population_id = b.zensus_population_id , - + UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp - + """ ) From 0206131dce8c6d89941eb6a13879150af920992e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:30:03 +0100 Subject: [PATCH 118/787] Use normal strings when there is no substitution And don't use a triple quoted string, when the string fits on one line. --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 67ae803ae..fcb0b0309 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -629,9 +629,7 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): start_time = datetime.now() idp_df = db.select_dataframe( - f""" - SELECT index, idp FROM demand.egon_heat_idp_pool - """, + "SELECT index, idp FROM demand.egon_heat_idp_pool", index_col="index", ) @@ -673,7 +671,7 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): ) daily_demand_shares = db.select_dataframe( - f""" + """ SELECT climate_zone, day_of_year as day, daily_demand_share FROM demand.egon_daily_heat_demand_per_climate_zone """ From 4ad0ec3f579030cb6348a578b1409e0a56e1f480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:34:55 +0100 Subject: [PATCH 119/787] Merge printed expression into f-string This came up while shortening the strings to be within 79 characters. Within the substitutions in f-strings, you can evaluate complete Python expressions, not only single variables. So there's no need for two print statements here. --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index fcb0b0309..d1992b0ec 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -222,9 +222,9 @@ def create_district_heating_profile(scenario, area_id): ) print( - f"Time to create time series for district heating grid {scenario} {area_id}:" + f"Time to create time series for district heating grid {scenario}" + f" {area_id}:\n{datetime.now() - start_time}" ) - print(datetime.now() - start_time) return df @@ -687,9 +687,9 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): session = sessionmaker(bind=db.engine())() print( - f"Time to create overhead for time series for district heating scenario {scenario}" + "Time to create overhead for time series for district heating" + f" scenario {scenario}:\n{datetime.now() - start_time}" ) - print(datetime.now() - start_time) start_time = datetime.now() for grid in annual_demand.bus_id.unique(): From cef725e3a658a3c3e528872537e0c68168a2f113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:39:04 +0100 Subject: [PATCH 120/787] Fix docstring First, wrap the first line to be within 72 characters. The first line should actually be a bit shorter, as it's supposed to be a short, one-line summary akin to the first line of a git commit message. Longer details go into the extended description after the first line. As a courtesy to the reader, the parameter and return value descriptions can also be complete short sentences. For the description of the return value, the value doesn't need to be named. Only the type has to be given. Fix a typo in the type, which used a comma instead of a period. This also prompted the change from `pandas.DataFrame` to `pd.DataFrame` because `pandas` is imported as `pd` which means that `pd.DataFrame` can actually be linked when the "intersphinx" extensions gets configured later. --- .../datasets/heat_demand_timeseries/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index d1992b0ec..c933175dd 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -74,7 +74,7 @@ def create_timeseries_for_building(building_id, scenario): Returns ------- - pandas.DataFrame + pd.DataFrame Hourly heat demand timeseries in MW for the selected building """ @@ -131,20 +131,23 @@ def create_timeseries_for_building(building_id, scenario): def create_district_heating_profile(scenario, area_id): - """Create heat demand profile for district heating grid including demands of - households and service sector. + """Create a heat demand profile for a district heating grid. + + The created heat demand profile includes the demands of households + and the service sector. Parameters ---------- scenario : str - Name of the selected scenario. + The name of the selected scenario. area_id : int - Index of the selected district heating grid + The index of the selected district heating grid. Returns ------- - df : pandas,DataFrame - Hourly heat demand timeseries in MW for the selected district heating grid + pd.DataFrame + An hourly heat demand timeseries in MW for the selected district + heating grid. """ From cfa2e36198f3672fecee182134d3c063ece67e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:48:09 +0100 Subject: [PATCH 121/787] Fix assertion messages Due to trailing spaces, `flake8` pointed out these code locations. Triple quoted strings keep line breaks and indentation, so these messages would've looked really weird. Better to use the fact that Python implicitly joins adjacent strings for such cases. --- .../datasets/heat_demand_timeseries/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index c933175dd..b6a8cf094 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -375,10 +375,10 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): annual_demand[annual_demand.area_id == area].demand_total.sum() ) - assert ( - abs(diff) < 0.03 - ), f"""Deviation of residential heat demand time - series for district heating grid {str(area)} is {diff}""" + assert abs(diff) < 0.03, ( + "Deviation of residential heat demand time series for" + f" district heating grid {str(area)} is {diff}" + ) hh = np.concatenate( slice_df.groupby("day").sum()[range(24)].values @@ -754,10 +754,10 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): - annual_demand[annual_demand.bus_id == grid].demand_total.sum() ) / (annual_demand[annual_demand.bus_id == grid].demand_total.sum()) - assert ( - abs(diff) < 0.03 - ), f"""Deviation of residential heat demand time - series for mv grid {str(grid)} is {diff}""" + assert abs(diff) < 0.03, ( + "Deviation of residential heat demand time series for mv" + f" grid {grid} is {diff}" + ) if not (slice_df[hour].empty or cts.empty): entry = EgonEtragoTimeseriesIndividualHeating( From ad79e64f5f3a8b5de09c9a960d2751dfa33415b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sat, 18 Mar 2023 16:57:09 +0100 Subject: [PATCH 122/787] Fix `datetime` usage There where a lot of `datetime.now()` calls in the module. But `now` isn't a member of the `datetime` module, but a member of the `datetime` class inside the `datetime` module. This is why I don't like modules with members named exactly like the module. It's an accident waiting to happen. --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index b6a8cf094..c03ee2d98 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -1,5 +1,5 @@ +from datetime import date, datetime from pathlib import Path -import datetime import json import os import time @@ -1101,7 +1101,7 @@ def metadata(): "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Heat demand time series for district heating grids", "language": ["EN"], - "publicationDate": datetime.date.today().isoformat(), + "publicationDate": date.today().isoformat(), "context": context(), "spatial": { "location": None, From 3bc50ac44801b3e79b749641e0fbd7058d07988f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 16:11:41 +0100 Subject: [PATCH 123/787] Run `black` on "src/egon/data/metadata.py" Insert an additional blank line below the imports and remove a blank line at the beginning of an indented block. --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e1c26c3f3..aca06c29e 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -11,6 +11,7 @@ from egon.data.db import engine from egon.data import __path__ as data_path + def context(): """ Project context information for metadata @@ -735,7 +736,6 @@ def upload_json_metadata(): v = "oep-v1.4" for file in os.listdir(path=str(path)): - if file.endswith(".json"): split = file.split(".") if len(split) != 3: From 1294a0f7dc2efc2b47f35d2e0fa7398403350eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 17:07:25 +0100 Subject: [PATCH 124/787] Run `isort` on "src/egon/data/metadata.py" --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index aca06c29e..e292e46b1 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -6,10 +6,10 @@ from sqlalchemy import MetaData, Table from sqlalchemy.dialects.postgresql.base import ischema_names +from egon.data import __path__ as data_path from egon.data import db, logger from egon.data.datasets import Dataset from egon.data.db import engine -from egon.data import __path__ as data_path def context(): From c86f814b82851bbce68c51964ff1a1af5a2660f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 16:25:21 +0100 Subject: [PATCH 125/787] Move separating space to the beginning of the line Having spaces, and important separating characters in general, at the beginning of the line makes it easier to spot if one has been accidentally missed. While this wasn't a problem here, in the following commit I spotted at least four instances of a missing space between words, solely by putting the space at the beginning of continuation lines. --- src/egon/data/metadata.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e292e46b1..f4eef9352 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -492,8 +492,8 @@ def sources(): "path": "https://doi.org/10.1016/j.adapen.2020.100001", "licenses": [ license_ccby( - "© 2020 German Aerospace Center (DLR), " - "Institute of Networked Energy Systems." + "© 2020 German Aerospace Center (DLR)," + " Institute of Networked Energy Systems." ) ], }, @@ -647,8 +647,8 @@ def sources(): "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [ licenses_datenlizenz_deutschland( - "© Bundesamt für Kartographie und Geodäsie " - "2020 (Daten verändert)" + "© Bundesamt für Kartographie und Geodäsie" + " 2020 (Daten verändert)" ) ], }, From f10d76e450c15a7c445cbcc8a8ec6a1cf36ea780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 16:33:40 +0100 Subject: [PATCH 126/787] Make long dictionary string values more readable Use a parenthesized expression to break long string values in dictionaries into multiple lines, i.e. use ```python { "first-key": ( "-----------------------------------------------------" "\nA very long string value that has" " to be split over multiple lines." ), "second-key": "Did you spot the second dictionary entry?", } ``` in favour of ```python { "first-key": "-----------------------------------------------------" "\nA very long string value that has " "to be split over multiple lines.", "second-key": "Did you spot the second dictionary entry?", } ``` The first version separates keys and values more clearly, making it easier to spot all keys and to read the string value as a whole. Using the second version, it's harder to see on which line a new entry with a new key begins, especially if one doesn't start continuation lines with a space or other separating character. See the message of the previous commit for details on why to put spaces and other important separators at the beginning of continuation lines. Note also that, while most of the lines were within the 79 character limit, so not too long, they where reformatted because of the reasons above. And since they had to be touched anyways, they got wrapped at 72 characters, as that's what PEP8 suggests for free flowing text like comments and long strings. --- src/egon/data/metadata.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index f4eef9352..728a23367 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -592,11 +592,14 @@ def sources(): }, "SciGRID_gas": { "title": "SciGRID_gas IGGIELGN", - "description": "The SciGRID_gas dataset represents the European " - "gas transport network (pressure levels of 20 bars and higher) " - "including the geo-referenced transport pipelines, compressor " - "stations, LNG terminals, storage, production sites, gas power " - "plants, border points, and demand time series. ", + "description": ( + "The SciGRID_gas dataset represents the European gas" + " transport network (pressure levels of 20 bars and" + " higher) including the geo-referenced transport" + " pipelines, compressor stations, LNG terminals," + " storage, production sites, gas power plants, border" + " points, and demand time series." + ), "path": "https://dx.doi.org/10.5281/zenodo.4896526", "licenses": [ license_ccby( @@ -613,12 +616,15 @@ def sources(): }, "technology-data": { "titel": "Energy System Technology Data v0.3.0", - "description": "This script compiles assumptions on energy system " - "technologies (such as costs, efficiencies, lifetimes, etc.) for " - "chosen years (e.g. [2020, 2030, 2050]) from a variety of sources " - "into CSV files to be read by energy system modelling software. " - "The merged outputs have standardized cost years, technology names, " - "units and source information.", + "description": ( + "This script compiles assumptions on energy system" + " technologies (such as costs, efficiencies, lifetimes," + " etc.) for chosen years (e.g. [2020, 2030, 2050]) from" + " a variety of sources into CSV files to be read by" + " energy system modelling software. The merged outputs" + " have standardized cost years, technology names, units" + " and source information." + ), "path": "https://github.com/PyPSA/technology-data/tree/v0.3.0", "licenses": [ license_agpl( From 2045d841f37549e06d9304531df29d90bf0c0a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 21:14:18 +0100 Subject: [PATCH 127/787] Wrap long strings to 72 characters This is the length that PEP8 states for free flowing text like comments or long strings. Since most strings don't start at the beginning of the line, I employed some leeway to go a few characters over in favour of readability and sometimes I wrapped lines early for the same reason, mostly at sentence boundaries. See the previous two commits for details on this particular way of wrapping strings. --- src/egon/data/metadata.py | 499 +++++++++++++++++++++++++++----------- 1 file changed, 355 insertions(+), 144 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 728a23367..4221b4902 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -367,88 +367,166 @@ def sources(): return { "bgr_inspee": { "title": "Salt structures in Northern Germany", - "description": 'The application "Information System Salt Structures" provides information about the ' - "areal distribution of salt structures (stocks and pillows) in Northern Germany. With general structural " - "describing information, such as depth, secondary thickness, types of use or state of exploration, queries " - "can be conducted. Contours of the salt structures can be displayed at horizontal cross-sections at four " - "different depths up to a maximum depth of 2000 m below NN. A data sheet with information and further " - "reading is provided for every single salt structure. Taking into account the fact that this work was " - "undertaken at a scale for providing an overview and not for investigation of single structures, the scale " - "of display is limited to a minimum of 1:300.000. This web application is the product of a BMWi-funded " - 'research project "InSpEE" running from the year 2012 to 2015. The acronym stands for "Information system ' - "salt structures: planning basis, selection criteria and estimation of the potential for the construction " - 'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".', - "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2", + "description": ( + 'The application "Information System Salt Structures"' + " provides information about the areal distribution of" + " salt structures (stocks and pillows) in Northern" + " Germany. With general structural describing" + " information, such as depth, secondary thickness," + " types of use or state of exploration, queries can be" + " conducted. Contours of the salt structures can be" + " displayed at horizontal cross-sections at four" + " different depths up to a maximum depth of 2000 m" + " below NN. A data sheet with information and further" + " reading is provided for every single salt structure." + " Taking into account the fact that this work was" + " undertaken at a scale for providing an overview and" + " not for investigation of single structures, the scale" + " of display is limited to a minimum of 1:300.000." + " This web application is the product of a BMWi-funded" + ' research project "InSpEE" running from the year 2012' + ' to 2015. The acronym stands for "Information system' + " salt structures: planning basis, selection criteria" + " and estimation of the potential for the construction" + " of salt caverns for the storage of renewable energies" + ' (hydrogen and compressed air)".' + ), + "path": ( + "https://produktcenter.bgr.de/terraCatalog/DetailResult.do" + "?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2" + ), "licenses": [license_geonutzv("© BGR, Hannover, 2015")], }, "bgr_inspeeds": { "title": "Flat layered salts in Germany", - "description": "Which salt formations are suitable for storing hydrogen or compressed air? " - "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment " - "of suitable sites even if their exploration is still at an early stage and there is little knowledge of " - "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " - "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University " - "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for " - "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. " - "Such caverns could store renewable energy in the form of hydrogen or compressed air. While the previous " - "project InSpEE was limited to salt formations of great thickness in Northern Germany, salt horizons of " - "different ages have now been examined all over Germany. To estimate the potential, depth contour maps of " - "the top and the base as well as thickness maps of the respective stratigraphic units and reference " - "profiles were developed. Information on compressed air and hydrogen storage potential were given for the " - "identified areas and for the individual federal states. The web service " - '"Information system for flat layered salt" gives access to this data. The scale of display is limited ' - "to a minimum of 1:300.000. This geographic information is product of a BMWi-funded research project " - '"InSpEE-DS" running from the year 2015 to 2019. The acronym stands for "Information system salt: ' - "planning basis, selection criteria and estimation of the potential for the construction of salt caverns " - 'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".', - "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d", + "description": ( + "Which salt formations are suitable for storing" + " hydrogen or compressed air?" + " In the InSpEE-DS research project, scientists" + " developed requirements and criteria for the" + " assessment of suitable sites even if their" + " exploration is still at an early stage and there is" + " little knowledge of the salinaries' structures." + " Scientists at DEEP.KBB GmbH in Hanover, worked" + " together with their project partners at the Federal" + " Institute for Geosciences and Natural Resources and" + " the Leibniz University Hanover, Institute for" + " Geotechnics Hanover, to develop the planning basis" + " for the site selection and for the construction of" + " storage caverns in flat layered salt and multiple or" + " double saliniferous formations." + " Such caverns could store renewable energy in the form" + " of hydrogen or compressed air." + " While the previous project InSpEE was limited to salt" + " formations of great thickness in Northern Germany," + " salt horizons of different ages have now been" + " examined all over Germany. To estimate the potential," + " depth contour maps of the top and the base as well as" + " thickness maps of the respective stratigraphic units" + " and reference profiles were developed. Information on" + " compressed air and hydrogen storage potential were" + " given for the identified areas and for the individual" + " federal states. The web service" + ' "Information system for flat layered salt"' + " gives access to this data. The scale of display is" + " limited to a minimum of 1:300.000. This geographic" + " information is product of a BMWi-funded research" + ' project "InSpEE-DS" running from the year 2015 to' + " 2019. The acronym stands for" + ' "Information system salt: planning basis, selection' + " criteria and estimation of the potential for the" + " construction of salt caverns for the storage of" + " renewable energies (hydrogen and compressed air)" + ' - double saline and flat salt layers".' + ), + "path": ( + "https://produktcenter.bgr.de/terraCatalog/DetailResult.do" + "?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d" + ), "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_data_bundle": { - "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " - "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " - "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", - "description": "Shapefiles corresponding to the data provided in figure 7-1 " - "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state " - " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using " - "the data.", + "title": ( + "Informationssystem Salz: Planungsgrundlagen," + " Auswahlkriterien und Potenzialabschätzung für die" + " Errichtung von Salzkavernen zur Speicherung von" + " Erneuerbaren Energien (Wasserstoff und Druckluft)" + " – Doppelsalinare und flach lagernde Salzschichten." + " Teilprojekt Bewertungskriterien und" + " Potenzialabschätzung" + ), + "description": ( + "Shapefiles corresponding to the data provided in" + " figure 7-1 (Donadei, S., et al., 2020, p. 7-5)." + " The energy storage potential data are provided per" + " federal state in table 7-1" + " (Donadei, S., et al., 2020, p. 7-4)." + " Note: Please include all bgr data sources when using" + " the data." + ), "path": "https://dx.doi.org/10.5281/zenodo.4896526", "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "bgr_inspeeds_report": { - "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die " - "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – " - "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung", - "description": "The report includes availability of saltstructures for energy storage and energy " - "storage potential accumulated per federal state in Germany.", - "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3", + "title": ( + "Informationssystem Salz: Planungsgrundlagen," + " Auswahlkriterien und Potenzialabschätzung für die" + " Errichtung von Salzkavernen zur Speicherung von" + " Erneuerbaren Energien (Wasserstoff und Druckluft)" + " – Doppelsalinare und flach lagernde Salzschichten." + " Teilprojekt Bewertungskriterien und" + " Potenzialabschätzung" + ), + "description": ( + "The report includes availability of saltstructures for" + " energy storage and energy storage potential" + " accumulated per federal state in Germany." + ), + "path": ( + "https://www.bgr.bund.de/DE/Themen" + "/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads" + "/InSpeeDS_TP_Bewertungskriterien.pdf" + "?__blob=publicationFile&v=3" + ), "licenses": [license_geonutzv("© BGR, Hannover, 2021")], }, "demandregio": { "title": "DemandRegio", - "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und " - "zeitlichen Auflösung von Energienachfragen", + "description": ( + "Harmonisierung und Entwicklung von Verfahren zur" + " regionalen und zeitlichen Auflösung von" + " Energienachfragen" + ), "path": "https://doi.org/10.34805/ffe-119-20", "licenses": [license_ccby("© FZJ, TUB, FfE")], }, "egon-data": { "title": "eGon-data", - "description": "Workflow to download, process and generate data sets" - "suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "description": ( + "Workflow to download, process and generate data sets" + " suitable for the further research conducted in the" + " project eGon (https://ego-n.org/)" + ), "path": "https://github.com/openego/eGon-data", "licenses": [license_agpl("© eGon development team")], }, "egon-data_bundle": { "title": "Data bundle for egon-data", - "description": "Zenodo repository to provide several different input data sets for eGon-data", + "description": ( + "Zenodo repository to provide several different input" + " data sets for eGon-data" + ), "path": "https://sandbox.zenodo.org/record/1167119", "licenses": [license_ccby("© eGon development team")], }, "Einspeiseatlas": { "title": "Einspeiseatlas", - "description": "Im Einspeiseatlas finden sie sich die Informationen " - "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit " - "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.", + "description": ( + "Im Einspeiseatlas finden sie sich die Informationen zu" + " realisierten und geplanten Biomethanaufbereitungsanlagen" + " - mit und ohne Einspeisung ins Gasnetz -" + " in Deutschland und weltweit." + ), "path": "https://www.biogaspartner.de/einspeiseatlas/", "licenses": [ license_ccby("Deutsche Energie-Agentur (dena, 2021)") @@ -456,39 +534,69 @@ def sources(): }, "era5": { "title": "ERA5 global reanalysis", - "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate " - "and weather for the past 4 to 7 decades. Currently data is available from 1950, " - "split into Climate Data Store entries for 1950-1978 (preliminary back extension) and f" - "rom 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. " - "See the online ERA5 documentation " - "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) " - "for more information.", - "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "description": ( + "ERA5 is the fifth generation ECMWF reanalysis for the" + " global climate and weather for the past 4 to 7" + " decades. Currently data is available from 1950, split" + " into Climate Data Store entries for 1950-1978" + " (preliminary back extension) and from 1979 onwards" + " (final release plus timely updates, this page)." + " ERA5 replaces the ERA-Interim reanalysis." + " See the online ERA5 documentation (" + "https://confluence.ecmwf.int/display/CKB" + "/ERA5%3A+data+documentation" + "#ERA5:datadocumentation-Dataupdatefrequency)" + " for more information." + ), + "path": ( + "https://confluence.ecmwf.int/display/CKB" + "/ERA5%3A+data+documentation" + "#ERA5:datadocumentation-Dataupdatefrequency" + ), "licenses": [ { "name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", - "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", - "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. " - "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use " - "may include, but is not limited to: reproduction; distribution; communication to the public; " - "adaptation, modification and combination with other data and information; or any " - "combination of the foregoing", - "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store", + "path": ( + "https://cds.climate.copernicus.eu/api/v2/terms" + "/static/licence-to-use-copernicus-products.pdf" + ), + "instruction": ( + "This Licence is free of charge, worldwide," + " non-exclusive, royalty free and perpetual." + " Access to Copernicus Products is given for" + " any purpose in so far as it is lawful," + " whereas use may include, but is not limited" + " to: reproduction; distribution; communication" + " to the public; adaptation, modification and" + " combination with other data and information;" + " or any combination of the foregoing" + ), + "attribution": ( + "Copernicus Climate Change Service (C3S)" + " Climate Data Store" + ), }, ], }, "dsm-heitkoetter": { - "title": "Assessment of the regionalised demand response potential " - "in Germany using an open source tool and dataset", - "description": "With the expansion of renewable energies in Germany, " - "imminent grid congestion events occur more often. One approach for " - "avoiding curtailment of renewable energies is to cover excess feed-in " - "by demand response. As curtailment is often a local phenomenon, in " - "this work we determine the regional demand response potential for " - "the 401 German administrative districts with a temporal resolution " - "of 15 min, including technical, socio-technical and economic " - "restrictions.", + "title": ( + "Assessment of the regionalised demand response" + " potential in Germany using an open source tool and" + " dataset" + ), + "description": ( + "With the expansion of renewable energies in Germany," + " imminent grid congestion events occur more often. One" + " approach for avoiding curtailment of renewable" + " energies is to cover excess feed-in by demand" + " response." + " As curtailment is often a local phenomenon, in this" + " work we determine the regional demand response" + " potential for the 401 German administrative districts" + " with a temporal resolution of 15 min, including" + " technical, socio-technical and economic restrictions." + ), "path": "https://doi.org/10.1016/j.adapen.2020.100001", "licenses": [ license_ccby( @@ -499,94 +607,160 @@ def sources(): }, "hotmaps_industrial_sites": { "titel": "industrial_sites_Industrial_Database", - "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28", - "path": "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database", + "description": ( + "Georeferenced industrial sites of energy-intensive" + " industry sectors in EU28" + ), + "path": ( + "https://gitlab.com/hotmaps/industrial_sites" + "/industrial_sites_Industrial_Database" + ), "licenses": [ license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter") ], }, "hotmaps_scen_buildings": { "titel": "scen_current_building_demand", - "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario", + "description": ( + "Energy demand scenarios in buidlings until the year 2050" + " - current policy scenario" + ), "path": "https://gitlab.com/hotmaps/scen_current_building_demand", "licenses": [ license_ccby( - "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller" + "© 2016-2018: Michael Hartner" + ", Lukas Kranzl" + ", Sebastian Forthuber" + ", Sara Fritz" + ", Andreas Müller" ) ], }, "mastr": { "title": "open-MaStR power unit registry", - "description": "Raw data download Marktstammdatenregister (MaStR) data " - "using the webservice. All data from the Marktstammdatenregister is included." - "There are duplicates included. For further information read in the documentation" - "of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", + "description": ( + "Raw data download Marktstammdatenregister (MaStR) data" + " using the webservice. All data from the" + " Marktstammdatenregister is included. There are" + " duplicates included. For further information read in" + " the documentation of the original data source:" + " https://www.marktstammdatenregister.de/MaStRHilfe" + "/subpages/statistik.html" + ), "path": "https://sandbox.zenodo.org/record/808086", "licenses": [ licenses_datenlizenz_deutschland( - "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen" + "© 2021 Bundesnetzagentur für Elektrizität, Gas," + " Telekommunikation, Post und Eisenbahnen" ) ], }, "nep2021": { - "title": "Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf", - "description": "Die vier deutschen Übertragungsnetzbetreiber zeigen mit " - "diesem ersten Entwurf des Netzentwicklungsplans 2035, Version 2021, den " - "benötigten Netzausbau für die nächsten Jahre auf. Der NEP-Bericht beschreibt " - "keine konkreten Trassenverläufe von Übertragungsleitungen, sondern er " - "dokumentiert den notwendigen Übertragungsbedarf zwischen Netzknoten. " - "Das heißt, es werden Anfangs- und Endpunkte von zukünftigen Leitungsverbindungen " - "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze " - "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.", + "title": ( + "Netzentwicklungsplan Strom 2035, Version 2021, erster" + " Entwurf" + ), + "description": ( + "Die vier deutschen Übertragungsnetzbetreiber zeigen" + " mit diesem ersten Entwurf des Netzentwicklungsplans" + " 2035, Version 2021, den benötigten Netzausbau für die" + " nächsten Jahre auf. Der NEP-Bericht beschreibt keine" + " konkreten Trassenverläufe von Übertragungsleitungen," + " sondern er dokumentiert den notwendigen" + " Übertragungsbedarf zwischen Netzknoten." + " Das heißt, es werden Anfangs- und Endpunkte von" + " zukünftigen Leitungsverbindungen definiert sowie" + " konkrete Empfehlungen für den Aus- und Neubau der" + " Übertragungsnetze an Land und auf See in Deutschland" + " gemäß den Detailanforderungen im § 12 EnWG gegeben." + ), "path": "https://zenodo.org/record/5743452#.YbCoz7so8go", "licenses": [license_ccby("© Übertragungsnetzbetreiber")], }, "openffe_gas": { - "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)", - "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. " - "More information at https://extremos.ffe.de/.", - "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/", + "title": ( + "Load Curves of the Industry Sector" + " – eXtremOS solidEU Scenario (Europe NUTS-3)" + ), + "description": ( + "Load Curves of the Industry Sector for the eXtremOS" + " solidEU Scenario Scenario at NUTS-3-Level." + " More information at https://extremos.ffe.de/." + ), + "path": ( + "http://opendata.ffe.de/dataset" + "/load-curves-of-the-industry-sector-extremos-solideu" + "-scenario-europe-nuts-3/" + ), "licenses": [license_ccby("© FfE, eXtremOS Project")], }, "openstreetmap": { "title": "OpenStreetMap Data Extracts (Geofabrik)", - "description": "Full data extract of OpenStreetMap data for defined" - "spatial extent at ''referenceDate''", - "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "description": ( + "Full data extract of OpenStreetMap data for defined" + " spatial extent at ''referenceDate''" + ), + "path": ( + "https://download.geofabrik.de/europe/germany-210101.osm.pbf" + ), "licenses": [license_odbl("© OpenStreetMap contributors")], }, "peta": { "title": "Pan-European Thermal Atlas, Peta version 5.0.1", - "description": "Modelled Heat Demand distribution (in GJ per hectare grid cell) for residential and service " - "heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined " - "top-down bottom-up approach of HRE4. " - "National sector-specific heat demand data, derived by the FORECAST model in HRE4 for residential " - "(delivered energy, for space heating and hot water) and service-sector (delivered energy, for space heating, hot " - "water and process heat) buildings for the year 2015, were distributed using modelled, spatial " - "statistics based floor areas in 100x100m grids and a population grid. " - "For further information please see the documentation available on the Heat Roadmap Europe website, " - "in particular D2.3 report: Methodologies and assumptions used in the mapping.", + "description": ( + "Modelled Heat Demand distribution (in GJ per hectare" + " grid cell) for residential and service heat demands" + " for space heating and hot water for the year 2015" + " using HRE4 data and the combined top-down bottom-up" + " approach of HRE4. National sector-specific heat" + " demand data, derived by the FORECAST model in HRE4" + " for residential (delivered energy, for space heating" + " and hot water) and service-sector (delivered energy," + " for space heating, hot water and process heat)" + " buildings for the year 2015, were distributed using" + " modelled, spatial statistics based floor areas in" + " 100x100m grids and a population grid. For further" + " information please see the documentation available on" + " the Heat Roadmap Europe website, in particular D2.3" + " report: Methodologies and assumptions used in the" + " mapping." + ), "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [ license_ccby( - "© Europa-Universität Flensburg, Halmstad University and Aalborg University" + "© Europa-Universität Flensburg" + ", Halmstad University and Aalborg University" ) ], }, "pipeline_classification": { - "title": "Technical pipeline characteristics for high pressure pipelines", - "description": "Parameters for the classification of gas pipelines, " - "the whole documentation could is available at: " - "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf", + "title": ( + "Technical pipeline characteristics for high pressure" + " pipelines" + ), + "description": ( + "Parameters for the classification of gas pipelines," + " the whole documentation could is available at:" + " https://www.econstor.eu/bitstream/10419/173388/1" + "/1011162628.pdf" + ), "path": "https://zenodo.org/record/5743452", "licenses": [license_ccby("© DIW Berlin, 2017")], }, "schmidt": { - "title": "Supplementary material to the masters thesis: " - "NUTS-3 Regionalization of Industrial Load Shifting Potential in Germany using a Time-Resolved Model", - "description": "Supplementary material to the named masters thesis, containing data on industrial processes" - "for the estimation of NUTS-3 load shifting potential of suitable electrically powered industrial processes" - "(cement milling, mechanical pulping, paper production, air separation).", + "title": ( + "Supplementary material to the masters thesis:" + " NUTS-3 Regionalization of Industrial Load Shifting" + " Potential in Germany using a Time-Resolved Model" + ), + "description": ( + "Supplementary material to the named masters thesis," + " containing data on industrial processes for the" + " estimation of NUTS-3 load shifting potential of" + " suitable electrically powered industrial processes" + " (cement milling, mechanical pulping, paper" + " production, air separation)." + ), "path": "https://zenodo.org/record/3613767", "licenses": [license_ccby("© 2019 Danielle Schmidt")], }, @@ -609,9 +783,17 @@ def sources(): }, "seenergies": { "title": "D5 1 Industry Dataset With Demand Data", - "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data" - "within main sectors: Chemical industry, Iron and steel, Non-ferrous metals, Non-metallic minerals, Paper and printing, and Refineries.", - "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about", + "description": ( + "Georeferenced EU28 industrial sites with quantified" + " annual excess heat volumes and demand data within" + " main sectors: Chemical industry, Iron and steel," + " Non-ferrous metals, Non-metallic minerals, Paper and" + " printing, and Refineries." + ), + "path": ( + "https://s-eenergies-open-data-euf.hub.arcgis.com" + "/datasets/5e36c0af918040ed936b4e4c101f611d_0/about" + ), "licenses": [license_ccby("© Europa-Universität Flensburg")], }, "technology-data": { @@ -628,29 +810,45 @@ def sources(): "path": "https://github.com/PyPSA/technology-data/tree/v0.3.0", "licenses": [ license_agpl( - "© Marta Victoria (Aarhus University), Kun Zhu (Aarhus University), Elisabeth Zeyen (TUB), Tom Brown (TUB)" + "© Marta Victoria (Aarhus University)" + ", Kun Zhu (Aarhus University)" + ", Elisabeth Zeyen (TUB)" + ", Tom Brown (TUB)" ) ], }, "tyndp": { - "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios", - "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. " - "Scenarios are not forecasts; they set out a range of possible futures used by the ENTSOs to test future " - "electricity and gas infrastructure needs and projects. The scenarios are ambitious as they deliver " - "a low carbon energy system for Europe by 2050. The ENTSOs have developed credible scenarios that are " - "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European " - "low carbon future is achieved.", + "description": ( + "ENTSOs’ TYNDP 2020 Scenario Report describes possible" + " European energy futures up to 2050. Scenarios are not" + " forecasts; they set out a range of possible futures" + " used by the ENTSOs to test future electricity and gas" + " infrastructure needs and projects. The scenarios are" + " ambitious as they deliver a low carbon energy system" + " for Europe by 2050. The ENTSOs have developed" + " credible scenarios that are guided by technically" + " sound pathways, while reflecting country by country" + " specifics, so that a pan-European low carbon future" + " is achieved." + ), "path": "https://tyndp.entsoe.eu/maps-data", "licenses": [license_ccby("© ENTSO-E and ENTSOG")], }, "vg250": { "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", - "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der " - "hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden " - "mit ihren Grenzen, statistischen Schlüsselzahlen, Namen der " - "Verwaltungseinheit sowie die spezifische Bezeichnung der " - "Verwaltungsebene des jeweiligen Landes.", - "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "description": ( + "Der Datenbestand umfasst sämtliche Verwaltungseinheiten" + " der hierarchischen Verwaltungsebenen vom Staat bis zu" + " den Gemeinden mit ihren Grenzen, statistischen" + " Schlüsselzahlen, Namen der Verwaltungseinheit sowie" + " die spezifische Bezeichnung der Verwaltungsebene des" + " jeweiligen Landes." + ), + "path": ( + "https://daten.gdz.bkg.bund.de/produkte/vg" + "/vg250_ebenen_0101/2020" + "/vg250_01-01.geo84.shape.ebenen.zip" + ), "licenses": [ licenses_datenlizenz_deutschland( "© Bundesamt für Kartographie und Geodäsie" @@ -659,12 +857,25 @@ def sources(): ], }, "zensus": { - "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", - "description": "Als Download bieten wir Ihnen auf dieser Seite zusätzlich zur " - "Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- " - "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, " - "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.", - "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474", + "title": ( + "Statistisches Bundesamt (Destatis)" + " - Ergebnisse des Zensus 2011 zum Download" + ), + "description": ( + "Als Download bieten wir Ihnen auf dieser Seite" + " zusätzlich zur Zensusdatenbank CSV- und teilweise" + " Excel-Tabellen mit umfassenden Personen-, Haushalts-" + " und Familien- sowie Gebäude- und Wohnungs­merkmaln." + " Die Ergebnisse liegen auf Bundes-, Länder-, Kreis-" + " und Gemeinde­ebene vor. Außerdem sind einzele" + " Ergebnisse für Gitterzellen verfügbar." + ), + "path": ( + "https://www.zensus2011.de/SharedDocs/Aktuelles" + "/Ergebnisse/DemografischeGrunddaten.html" + ";jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380" + "?nn=3065474" + ), "licenses": [ licenses_datenlizenz_deutschland( "© Statistische Ämter des Bundes und der Länder 2014" From 31b3f505d4edb7618e4191e6b2b7e0cd9533141b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 21:34:04 +0100 Subject: [PATCH 128/787] Fix "zensus" URL The previous URL yields a 404 error, while the new one works. At least at the time of writing this. Noticed while trying to figure out whether the session id suffix and the "nn=" URL parameter where really necessary. --- src/egon/data/metadata.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 4221b4902..0ece12461 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -871,10 +871,8 @@ def sources(): " Ergebnisse für Gitterzellen verfügbar." ), "path": ( - "https://www.zensus2011.de/SharedDocs/Aktuelles" - "/Ergebnisse/DemografischeGrunddaten.html" - ";jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380" - "?nn=3065474" + "https://www.zensus2011.de/DE/Home/Aktuelles" + "/DemografischeGrunddaten.html" ), "licenses": [ licenses_datenlizenz_deutschland( From c0f3485980a8dfdf022e08aae2d37491069d94e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 21:52:39 +0100 Subject: [PATCH 129/787] Don't convert `Path` object to string The `os.listdir` function can handle `Path` objects just fine. --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 0ece12461..1ae8da3ca 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -950,7 +950,7 @@ def upload_json_metadata(): v = "oep-v1.4" - for file in os.listdir(path=str(path)): + for file in os.listdir(path=path): if file.endswith(".json"): split = file.split(".") if len(split) != 3: From 408efaa5940d1fbecd3de50510454d5c57c07deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 22:14:05 +0100 Subject: [PATCH 130/787] Invert `file.endswith(".json")` test Use this to save an indentation level. The rest of the code after the `continue` is exactly the same as before, just indented one level less. This isn't really important now, but since the code will change to get rid of the test altogether, it's a precursor to not mixing getting rid of an indentation level and other code changes into one commit later on. --- src/egon/data/metadata.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 1ae8da3ca..1cf48da6e 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -951,22 +951,23 @@ def upload_json_metadata(): v = "oep-v1.4" for file in os.listdir(path=path): - if file.endswith(".json"): - split = file.split(".") - if len(split) != 3: - continue - schema = split[0] - table = split[1] - - dialect = get_dialect(v)() - - with open(file, "r") as infile: - obj = dialect.parse(infile.read()) - - meta_data_string = dialect.compile_and_render(obj) - meta_json = "'" + meta_data_string + "'" - db.submit_comment(meta_json, schema, table) - logger.info(f"{schema}.{table} uploaded!") + if not file.endswith(".json"): + continue + split = file.split(".") + if len(split) != 3: + continue + schema = split[0] + table = split[1] + + dialect = get_dialect(v)() + + with open(file, "r") as infile: + obj = dialect.parse(infile.read()) + + meta_data_string = dialect.compile_and_render(obj) + meta_json = "'" + meta_data_string + "'" + db.submit_comment(meta_json, schema, table) + logger.info(f"{schema}.{table} uploaded!") class Json_Metadata(Dataset): From a8958441d722f5b6753a75e3652c2b5a27dcdc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 22:23:02 +0100 Subject: [PATCH 131/787] Make logging message more precise It's not the table that gets "uploaded", but the metadata comment. And things don't (always) get "uploaded" to a database, but they get stored in the database, because the database might be on the same machine. Last but not least, there's no reason to use use an exclamation mark in log messages. It just makes long streams of log messages harder to read, if they aren't terminated consistently. Log levels usually are enough to signify the importance of message. --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 1cf48da6e..e5803fcbd 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -967,7 +967,7 @@ def upload_json_metadata(): meta_data_string = dialect.compile_and_render(obj) meta_json = "'" + meta_data_string + "'" db.submit_comment(meta_json, schema, table) - logger.info(f"{schema}.{table} uploaded!") + logger.info(f"Metadata comment for {schema}.{table} stored.") class Json_Metadata(Dataset): From b84d5aca9f4320c196a1dce1ffd233e6aa6bcfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 22:42:50 +0100 Subject: [PATCH 132/787] Replace string concatenation with an f-string --- src/egon/data/metadata.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index e5803fcbd..6d36c33b1 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -964,9 +964,8 @@ def upload_json_metadata(): with open(file, "r") as infile: obj = dialect.parse(infile.read()) - meta_data_string = dialect.compile_and_render(obj) - meta_json = "'" + meta_data_string + "'" - db.submit_comment(meta_json, schema, table) + metadata = f"'{dialect.compile_and_render(obj)}'" + db.submit_comment(metadata, schema, table) logger.info(f"Metadata comment for {schema}.{table} stored.") From c0e244e48430c4963763b7cff53ade0e7082431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Sun, 19 Mar 2023 22:46:53 +0100 Subject: [PATCH 133/787] Fix incomplete file paths Prefix the results of the `os.listdir(path)` call with `path` because the call only returns a list of the names found under `path`, without the containing directory. --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 6d36c33b1..c4a064514 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -961,7 +961,7 @@ def upload_json_metadata(): dialect = get_dialect(v)() - with open(file, "r") as infile: + with open(path / file, "r") as infile: obj = dialect.parse(infile.read()) metadata = f"'{dialect.compile_and_render(obj)}'" From 77ceae317a95b83d1e45e2287e5bfb5cabba941e Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 20 Mar 2023 08:51:51 +0100 Subject: [PATCH 134/787] bug fix in metadata string --- src/egon/data/datasets/scenario_capacities.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index a6d09939a..0d80c17de 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -72,11 +72,15 @@ def __init__(self, dependencies): name="ScenarioCapacities", version="0.0.12", dependencies=dependencies, - tasks=(create_table, insert_data_nep, eGon100_capacities, add_metadata), + tasks=( + create_table, + insert_data_nep, + eGon100_capacities, + add_metadata, + ), ) - def create_table(): """Create input tables for scenario setup @@ -763,7 +767,6 @@ def eGon100_capacities(): ) - def add_metadata(): """Add metdata to supply.egon_scenario_capacities @@ -800,7 +803,9 @@ def add_metadata(): "name": "supply.egon_scenario_capacities", "title": "eGon scenario capacities", "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "Installed capacities of scenarios used in the eGon project", + "description": ( + "Installed capacities of scenarios used in the eGon project" + ), "language": ["de-DE"], "publicationDate": datetime.date.today().isoformat(), "context": context(), @@ -817,10 +822,11 @@ def add_metadata(): ], "licenses": [ license_ccby( - "© Übertragungsnetzbetreiber; " - "© Bundesamt für Kartographie und Geodäsie 2020 (Daten verändert); " - "© Statistische Ämter des Bundes und der Länder 2014", - "© Jonathan Amme, Clara Büttner, Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", + "© Übertragungsnetzbetreiber; © Bundesamt für Kartographie und" + " Geodäsie 2020 (Daten verändert); © Statistische Ämter des " + "Bundes und der Länder 2014; © Jonathan Amme, Clara Büttner, " + "Ilka Cußmann, Julian Endres, Carlos Epia, Stephan Günther, " + "Ulf Müller, Amélia Nadal, Guido Pleßmann, Francesco Witte", ) ], "contributors": [ From 48d3469cad4995293fb0cfe8ebef800acca6b6ec Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 20 Mar 2023 15:23:33 +0100 Subject: [PATCH 135/787] small bug fix single quote in sql string --- src/egon/data/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index 784fcf6af..b001841e3 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -369,7 +369,7 @@ def sources(): "description": "Which salt formations are suitable for storing hydrogen or compressed air? " "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment " "of suitable sites even if their exploration is still at an early stage and there is little knowledge of " - "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " + "the salinaries structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project " "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University " "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for " "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. " From d662bf6683536808533aade279e5008f972dc0ea Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 09:16:16 +0100 Subject: [PATCH 136/787] cleaned up pipeline --- src/egon/data/airflow/dags/pipeline_status_quo.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index ad5a6c778..54bd9f6c2 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -74,7 +74,6 @@ from egon.data.datasets.renewable_feedin import RenewableFeedin from egon.data.datasets.saltcavern import SaltcavernData from egon.data.datasets.sanity_checks import SanityChecks -from egon.data.datasets.scenario_capacities import ScenarioCapacities from egon.data.datasets.scenario_parameters import ScenarioParameters from egon.data.datasets.society_prognosis import SocietyPrognosis from egon.data.datasets.storages import Storages @@ -349,7 +348,7 @@ ) # Create gas voronoi eGon2035 TODO: adjust for SQ create_gas_polygons_egon2035 = GasAreaseGon2035( - dependencies=[setup_etrago, insert_hydrogen_buses, vg250] + dependencies=[setup_etrago, vg250] ) # Gas abroad @@ -358,8 +357,6 @@ gas_grid_insert_data, run_pypsaeursec, foreign_lines, - insert_hydrogen_buses, - create_gas_polygons_egon100RE, ] ) @@ -388,7 +385,6 @@ osm_landuse, mastr_data, mv_grid_districts, - scenario_capacities, ] ) @@ -401,7 +397,6 @@ mastr_data, mv_grid_districts, renewable_feedin, - scenario_capacities, scenario_parameters, setup, substation_extraction, @@ -435,7 +430,6 @@ mastr_data, mv_grid_districts, power_plants, - scenario_capacities, scenario_parameters, setup, vg250_mv_grid_districts, @@ -483,14 +477,9 @@ storage_etrago, hts_etrago_table, chp_etrago, - components_dsm, heat_etrago, fill_etrago_generators, create_ocgt, - insert_H2_storage, - insert_power_to_h2_installations, - insert_h2_to_ch4_grid_links, - create_gas_polygons_egon100RE, gas_production_insert_data, insert_data_ch4_storages, ] From dbd599d2731d5a8d6f88cd864969dc9cf0bbd601 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 09:32:04 +0100 Subject: [PATCH 137/787] changed 2019 scenario name to status2019 --- src/egon/data/datasets/demandregio/__init__.py | 6 +++--- src/egon/data/datasets/era5.py | 2 +- .../datasets/scenario_parameters/__init__.py | 18 ++++++++++++++++++ .../datasets/scenario_parameters/parameters.py | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index bb8235c44..380e57cfe 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -433,7 +433,7 @@ def disagg_households_power( ) # Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario - if scenario in ["2019", "eGon2021", "eGon2035"]: + if scenario in ["status2019", "eGon2021", "eGon2035"]: # chose demand per household size from survey including weighted DHW power_per_HH = demand_per_hh_size["weighted DWH"] / 1e3 @@ -600,7 +600,7 @@ def insert_household_demand(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in ["2019", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["status2019", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] @@ -629,7 +629,7 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in ["2019", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in ["status2019", "eGon2021", "eGon2035", "eGon100RE"]: year = scenario_parameters.global_settings(scn)["population_year"] diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index 0b44d6d93..940ee141c 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -69,7 +69,7 @@ def import_cutout(boundary="Europe"): Weather data stored in cutout """ - weather_year = get_sector_parameters("global", "2019")["weather_year"] + weather_year = get_sector_parameters("global", "status2019")["weather_year"] if boundary == "Europe": xs = slice(-12.0, 35.1) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 3c7ba45b9..a98e61f97 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -123,6 +123,24 @@ def insert_scenarios(): eGon2021.mobility_parameters = parameters.mobility(eGon2021.name) session.add(eGon2021) + + # Scenario status2019 + status2019 = EgonScenario(name="status2019") + + status2019.description = """ + Status quo ante scenario for 2019 for validation use within the project PoWerD. + """ + status2019.global_parameters = parameters.global_settings(status2019.name) + + status2019.electricity_parameters = parameters.electricity(status2019.name) + + status2019.gas_parameters = parameters.gas(status2019.name) + + status2019.heat_parameters = parameters.heat(status2019.name) + + status2019.mobility_parameters = parameters.mobility(status2019.name) + + session.add(status2019) session.commit() diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 80e65d14f..e85fe0578 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -125,7 +125,7 @@ def global_settings(scenario): "weather_year": 2011, "population_year": 2021, } - elif scenario == "2019": + elif scenario == "status2019": parameters = { "weather_year": 2019, "population_year": 2019, From 3add370f16cee44ec9b2b3571bc7a30c25e254b5 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 10:14:39 +0100 Subject: [PATCH 138/787] added a new datasets.yml and saved the old one as datasets_original.yml --- src/egon/data/datasets.yml | 8 ++++---- .../data/{datasets_sq2019.yml => datasets_original.yml} | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) mode change 100755 => 100644 src/egon/data/datasets.yml rename src/egon/data/{datasets_sq2019.yml => datasets_original.yml} (99%) mode change 100644 => 100755 diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml old mode 100755 new mode 100644 index 83d46126d..11998680e --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1,13 +1,13 @@ openstreetmap: original_data: source: - url: "https://download.geofabrik.de/europe/germany-220101.osm.pbf" - url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-220101.osm.pbf" + url: "https://download.geofabrik.de/europe/germany-200101.osm.pbf" + url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-200101.osm.pbf" stylefile: "oedb.style" target: table_prefix: "osm" - file: "germany-220101.osm.pbf" - file_testmode: "schleswig-holstein-220101.osm.pbf" + file: "germany-200101.osm.pbf" + file_testmode: "schleswig-holstein-200101.osm.pbf" processed: schema: "openstreetmap" tables: diff --git a/src/egon/data/datasets_sq2019.yml b/src/egon/data/datasets_original.yml old mode 100644 new mode 100755 similarity index 99% rename from src/egon/data/datasets_sq2019.yml rename to src/egon/data/datasets_original.yml index 11998680e..83d46126d --- a/src/egon/data/datasets_sq2019.yml +++ b/src/egon/data/datasets_original.yml @@ -1,13 +1,13 @@ openstreetmap: original_data: source: - url: "https://download.geofabrik.de/europe/germany-200101.osm.pbf" - url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-200101.osm.pbf" + url: "https://download.geofabrik.de/europe/germany-220101.osm.pbf" + url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-220101.osm.pbf" stylefile: "oedb.style" target: table_prefix: "osm" - file: "germany-200101.osm.pbf" - file_testmode: "schleswig-holstein-200101.osm.pbf" + file: "germany-220101.osm.pbf" + file_testmode: "schleswig-holstein-220101.osm.pbf" processed: schema: "openstreetmap" tables: From c1ffbc43e53aac35159b17512176ee84979965f7 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 11:36:19 +0100 Subject: [PATCH 139/787] Update __init__.py --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index a98e61f97..48188e59a 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -124,6 +124,8 @@ def insert_scenarios(): session.add(eGon2021) + session.commit() + # Scenario status2019 status2019 = EgonScenario(name="status2019") From fa3edc013292831afba6ac671c9d3793092ea4bd Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 11:36:50 +0100 Subject: [PATCH 140/787] Update datasets.yml --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 11998680e..7d84d3773 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -692,7 +692,7 @@ distributed_industrial_demand: demandregio: schema: 'demand' table: 'egon_demandregio_cts_ind' - scenarios: ["eGon2021", "eGon2035", "eGon100RE"] + scenarios: ["status2019","eGon2021", "eGon2035", "eGon100RE"] wz: schema: 'demand' table: 'egon_demandregio_wz' From 8af0f86b6ed667d2454308216df4099031b7b7c8 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 21 Mar 2023 12:49:57 +0100 Subject: [PATCH 141/787] Update parameters.py --- .../data/datasets/scenario_parameters/parameters.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index e85fe0578..4547da419 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -470,6 +470,9 @@ def electricity(scenario): elif scenario == "eGon2021": parameters = {} + + elif scenario == "status2019": + parameters = {} else: print(f"Scenario name {scenario} is not valid.") @@ -655,6 +658,9 @@ def gas(scenario): elif scenario == "eGon2021": parameters = {} + + elif scenario == "status2019": + parameters = {} else: print(f"Scenario name {scenario} is not valid.") @@ -739,6 +745,9 @@ def mobility(scenario): elif scenario == "eGon2021": parameters = {} + + elif scenario == "status2019": + parameters = {} else: print(f"Scenario name {scenario} is not valid.") @@ -852,6 +861,9 @@ def heat(scenario): elif scenario == "eGon2021": parameters = {} + + elif scenario == "status2019": + parameters = {} else: print(f"Scenario name {scenario} is not valid.") From 86fa23e63539c64aeed64ab9543801041a69b5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Wed, 22 Mar 2023 05:13:58 +0100 Subject: [PATCH 142/787] Reformat "json_metadata/*.json" files Reformat them via `python -m json.tool --indent=2`, with any Python version >= 3.9. The files where all in one line, which isn't exactly human readable or easy to edit. --- ...ndaries.egon_map_zensus_climate_zones.json | 152 +++++++++++- ...daries.egon_map_zensus_mvgd_buildings.json | 172 +++++++++++++- ...undaries.egon_map_zensus_weather_cell.json | 141 ++++++++++- ....egon_building_electricity_peak_loads.json | 202 +++++++++++++++- .../demand.egon_building_heat_peak_loads.json | 210 ++++++++++++++++- ...cts_electricity_demand_building_share.json | 196 +++++++++++++++- ...d.egon_cts_heat_demand_building_share.json | 182 ++++++++++++++- ...on_daily_heat_demand_per_climate_zone.json | 164 ++++++++++++- .../demand.egon_etrago_electricity_cts.json | 198 +++++++++++++++- ...nd.egon_etrago_electricity_households.json | 198 +++++++++++++++- .../demand.egon_etrago_heat_cts.json | 212 ++++++++++++++++- .../demand.egon_heat_idp_pool.json | 156 ++++++++++++- ...gon_heat_timeseries_selected_profiles.json | 158 ++++++++++++- ...ld_electricity_profile_in_census_cell.json | 219 +++++++++++++++++- ...hold_electricity_profile_of_buildings.json | 171 +++++++++++++- .../demand.iee_household_load_profiles.json | 159 ++++++++++++- .../grid.egon_mv_grid_district.json | 151 +++++++++++- .../openstreetmap.osm_buildings_fitered.json | 184 ++++++++++++++- ...openstreetmap.osm_buildings_synthetic.json | 189 ++++++++++++++- ...ety.destatis_zensus_population_per_ha.json | 143 +++++++++++- ..._apartment_building_populaiton_per_ha.json | 155 ++++++++++++- 21 files changed, 3691 insertions(+), 21 deletions(-) diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json index 2ea58b9fe..f3f5a56e6 100644 --- a/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json @@ -1 +1,151 @@ -{"name": "boundaries.egon_map_zensus_climate_zones", "title": "eGon map census cells to climate zones", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "spatial join of census cells and climate zones", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "100 m x 100 m"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\u00e4tzlich zur Zensusdatenbank CSV- und eilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\u00e4nder-, Kreis- und Gemeindeebene vor. Au\u00dferdem sind einzelne Ergebnisse f\u00fcr Gitterzellen verf\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig. Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere: (1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden. Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind: (1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe, der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie (3) einen Verweis auf den Datensatz (URI). Dies gilt nur soweit die datenhaltende Stelle die Angaben (1) bis (3) zum Quellenvermerk bereitstellt. Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2014"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_climate_zones", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "climate_zone", "description": "Name of the corresponding climate zone", "type": "str", "unit": "none"}, {"name": "zensus_population_id", "description": "Index of corresponding census cell (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}], "primaryKey": "zensus_population_id"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "boundaries.egon_map_zensus_climate_zones", + "title": "eGon map census cells to climate zones", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "spatial join of census cells and climate zones", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "100 m x 100 m" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\u00e4tzlich zur Zensusdatenbank CSV- und eilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\u00e4nder-, Kreis- und Gemeindeebene vor. Au\u00dferdem sind einzelne Ergebnisse f\u00fcr Gitterzellen verf\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig. Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere: (1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden. Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind: (1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe, der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie (3) einen Verweis auf den Datensatz (URI). Dies gilt nur soweit die datenhaltende Stelle die Angaben (1) bis (3) zum Quellenvermerk bereitstellt. Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", + "attribution": "\u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2014" + } + ] + } + ], + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "boundaries.egon_map_zensus_climate_zones", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "climate_zone", + "description": "Name of the corresponding climate zone", + "type": "str", + "unit": "none" + }, + { + "name": "zensus_population_id", + "description": "Index of corresponding census cell (reference to: society.destatis_zensus_population_per_ha.id)", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "zensus_population_id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json index 1f0313b92..e09cf47aa 100644 --- a/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json @@ -1 +1,171 @@ -{"name": "boundaries.egon_map_zensus_mvgd_buildings", "title": "eGon buildings mapping table", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for all used buildings via project internal building_id. Additional info about if it is a synthetic or a openstreetmap building, where it is located (census cell_id, mvgd_id), in which sector (residential, cts) the building is used, if there are heat or electricity profiles.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_mvgd_buildings", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "zensus_population_id", "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "electricity", "description": "True if respectives electricity demand profile exists", "type": "bool", "unit": "None"}, {"name": "heat", "description": "True if respectives heat demand profile exists", "type": "bool", "unit": "None"}, {"name": "osm", "description": "is OSM building if true else syntheticaly created", "type": "bool", "unit": "None"}], "primaryKey": "building_id, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "boundaries.egon_map_zensus_mvgd_buildings", + "title": "eGon buildings mapping table", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Mapping table for all used buildings via project internal building_id. Additional info about if it is a synthetic or a openstreetmap building, where it is located (census cell_id, mvgd_id), in which sector (residential, cts) the building is used, if there are heat or electricity profiles.", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "boundaries.egon_map_zensus_mvgd_buildings", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "sector", + "description": "Sector (cts, residential)", + "type": "characters varying", + "unit": "none" + }, + { + "name": "zensus_population_id", + "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "bus_id", + "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", + "type": "integer", + "unit": "none" + }, + { + "name": "electricity", + "description": "True if respectives electricity demand profile exists", + "type": "bool", + "unit": "None" + }, + { + "name": "heat", + "description": "True if respectives heat demand profile exists", + "type": "bool", + "unit": "None" + }, + { + "name": "osm", + "description": "is OSM building if true else syntheticaly created", + "type": "bool", + "unit": "None" + } + ], + "primaryKey": "building_id, sector" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json b/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json index 2a1519b6d..3026115aa 100644 --- a/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json +++ b/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json @@ -1 +1,140 @@ -{"name": "boundaries.egon_map_zensus_climate_zones", "title": "Map census cells to era5 climate zones", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table of census cells to era5 climate zones", "language": "en-US", "keywords": [""], "publicationDate": "2022-08-06", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}], "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 eGon development team"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "boundaries.egon_map_zensus_weather_cell", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "zensus_population_id", "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", "type": "integer", "unit": "none"}, {"name": "w_id", "description": "Weather cell id (reference to: supply.egon_era5_weather_cells)", "type": "Integer", "unit": "none"}], "primaryKey": "zensus_population_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "boundaries.egon_map_zensus_climate_zones", + "title": "Map census cells to era5 climate zones", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Mapping table of census cells to era5 climate zones", + "language": "en-US", + "keywords": [ + "" + ], + "publicationDate": "2022-08-06", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "1 ha" + }, + "temporal": {}, + "sources": [ + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "ERA5 global reanalysis", + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "licenses": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", + "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store" + } + ] + } + ], + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 eGon development team" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "boundaries.egon_map_zensus_weather_cell", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "zensus_population_id", + "description": "Zensus population id (reference to: society.destatis_zensus_population_per_ha.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "w_id", + "description": "Weather cell id (reference to: supply.egon_era5_weather_cells)", + "type": "Integer", + "unit": "none" + } + ], + "primaryKey": "zensus_population_id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json b/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json index 3c169a6f5..19d7b55cc 100644 --- a/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json +++ b/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json @@ -1 +1,201 @@ -{"name": "demand.egon_building_electricity_peak_loads", "title": "Electricity peak loads for egon buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Electricity peak load table of residential and cts buildings with voltage level for two scenarios ", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_building_electricity_peak_loads", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "peak_load_in_w", "description": "Peak load value", "type": "real", "unit": "W"}, {"name": "voltage_level", "description": "Voltage level of building connection after MitnetzStrom Classification", "type": "int", "unit": "None"}], "primaryKey": "building_id, scenario, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_building_electricity_peak_loads", + "title": "Electricity peak loads for egon buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Electricity peak load table of residential and cts buildings with voltage level for two scenarios ", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\u00a9 FZJ, TUB, FfE" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_building_electricity_peak_loads", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", + "type": "integer", + "unit": "none" + }, + { + "name": "scenario", + "description": "Scenario (eGon100RE, eGon2035)", + "type": "character varying", + "unit": "none" + }, + { + "name": "sector", + "description": "Sector (cts, residential)", + "type": "characters varying", + "unit": "none" + }, + { + "name": "peak_load_in_w", + "description": "Peak load value", + "type": "real", + "unit": "W" + }, + { + "name": "voltage_level", + "description": "Voltage level of building connection after MitnetzStrom Classification", + "type": "int", + "unit": "None" + } + ], + "primaryKey": "building_id, scenario, sector" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json b/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json index 3b777b6af..17f7dfee0 100644 --- a/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json +++ b/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json @@ -1 +1,209 @@ -{"name": "demand.egon_building_heat_peak_loads", "title": "Heat peak loads for egon buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Heat peak load table of residential and cts buildings for two scenarios ", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}, {"title": "Peta5 0 1 HD res", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_building_heat_peak_loads", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "sector", "description": "Sector (cts, residential)", "type": "characters varying", "unit": "none"}, {"name": "peak_load_in_w", "description": "Peak load value", "type": "real", "unit": "W"}], "primaryKey": "building_id, scenario, sector"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_building_heat_peak_loads", + "title": "Heat peak loads for egon buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Heat peak load table of residential and cts buildings for two scenarios ", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", + "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", + "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)" + } + ] + }, + { + "title": "ERA5 global reanalysis", + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "licenses": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", + "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store" + } + ] + }, + { + "title": "Peta5 0 1 HD res", + "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities" + } + ] + }, + { + "title": "Peta5 0 1 HD ser", + "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_building_heat_peak_loads", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", + "type": "integer", + "unit": "none" + }, + { + "name": "scenario", + "description": "Scenario (eGon100RE, eGon2035)", + "type": "character varying", + "unit": "none" + }, + { + "name": "sector", + "description": "Sector (cts, residential)", + "type": "characters varying", + "unit": "none" + }, + { + "name": "peak_load_in_w", + "description": "Peak load value", + "type": "real", + "unit": "W" + } + ], + "primaryKey": "building_id, scenario, sector" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json b/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json index 88dd0dc83..c7a60b34c 100644 --- a/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json +++ b/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json @@ -1 +1,195 @@ -{"name": "demand.egon_cts_electricity_demand_building_share", "title": "Electricity demand profile share of egon cts buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Electricity demand profile share of egon cts buildings for two scenarios with bus_id", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_cts_electricity_demand_building_share", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035) (reference: demand.egon_etrago_electricity_cts.scn_name)", "type": "character varying", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus_id (reference to: demand.egon_etrago_electricity_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "profile_share", "description": "Profile share of MVGD elctricity profile", "type": "real", "unit": "None"}], "primaryKey": "building_id, scenario"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_cts_electricity_demand_building_share", + "title": "Electricity demand profile share of egon cts buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Electricity demand profile share of egon cts buildings for two scenarios with bus_id", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\u00a9 FZJ, TUB, FfE" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_cts_electricity_demand_building_share", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", + "type": "integer", + "unit": "none" + }, + { + "name": "scenario", + "description": "Scenario (eGon100RE, eGon2035) (reference: demand.egon_etrago_electricity_cts.scn_name)", + "type": "character varying", + "unit": "none" + }, + { + "name": "bus_id", + "description": "MVGD bus_id (reference to: demand.egon_etrago_electricity_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", + "type": "integer", + "unit": "none" + }, + { + "name": "profile_share", + "description": "Profile share of MVGD elctricity profile", + "type": "real", + "unit": "None" + } + ], + "primaryKey": "building_id, scenario" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json b/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json index abf9aa366..0f9228270 100644 --- a/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json +++ b/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json @@ -1 +1,181 @@ -{"name": "demand.egon_cts_heat_demand_building_share", "title": "Heat demand profile share of egon cts buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Heat demand profile share of egon cts buildings for two scenarios with bus_id", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}, {"title": "Peta5 0 1 HD res", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_cts_heat_demand_building_share", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", "type": "integer", "unit": "none"}, {"name": "scenario", "description": "Scenario (eGon100RE, eGon2035)", "type": "character varying", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus_id (reference to: demand.egon_etrago_heat_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "profile_share", "description": "Profile share of MVGD heat profile ", "type": "real", "unit": "None"}], "primaryKey": "building_id, scenario"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_cts_heat_demand_building_share", + "title": "Heat demand profile share of egon cts buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Heat demand profile share of egon cts buildings for two scenarios with bus_id", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "Peta5 0 1 HD ser", + "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities" + } + ] + }, + { + "title": "Peta5 0 1 HD res", + "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for residential heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_cts_heat_demand_building_share", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id, boundaries.egon_map_zensus_mvgd_building)", + "type": "integer", + "unit": "none" + }, + { + "name": "scenario", + "description": "Scenario (eGon100RE, eGon2035)", + "type": "character varying", + "unit": "none" + }, + { + "name": "bus_id", + "description": "MVGD bus_id (reference to: demand.egon_etrago_heat_cts.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", + "type": "integer", + "unit": "none" + }, + { + "name": "profile_share", + "description": "Profile share of MVGD heat profile ", + "type": "real", + "unit": "None" + } + ], + "primaryKey": "building_id, scenario" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json b/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json index 3c36db60d..06d950eda 100644 --- a/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json +++ b/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json @@ -1 +1,163 @@ -{"name": "demand.egon_daily_heat_demand_per_climate_zone", "title": "eGon daily heat demand share per climate zone", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Share of daily heat demands per climate zone", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "climate zones"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_daily_heat_demand_per_climate_zone", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "climate_zone", "description": "Name of the corresponding climate zone", "type": "str", "unit": "none"}, {"name": "daily_demand_share", "description": "Share of annual heat demand for each day", "type": "double precision", "unit": "per unit"}, {"name": "day_of_year", "description": "Number of day in the year", "type": "integer", "unit": "none"}, {"name": "temperature_class", "description": "Temperature class (considering the mean outside temeperature during the day)", "type": "integer", "unit": "none"}], "primaryKey": "climate_zone"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_daily_heat_demand_per_climate_zone", + "title": "eGon daily heat demand share per climate zone", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Share of daily heat demands per climate zone", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "climate zones" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "ERA5 global reanalysis", + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "licenses": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", + "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store" + } + ] + } + ], + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_daily_heat_demand_per_climate_zone", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "climate_zone", + "description": "Name of the corresponding climate zone", + "type": "str", + "unit": "none" + }, + { + "name": "daily_demand_share", + "description": "Share of annual heat demand for each day", + "type": "double precision", + "unit": "per unit" + }, + { + "name": "day_of_year", + "description": "Number of day in the year", + "type": "integer", + "unit": "none" + }, + { + "name": "temperature_class", + "description": "Temperature class (considering the mean outside temeperature during the day)", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "climate_zone" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json b/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json index 65e397eb0..5db7cd176 100644 --- a/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json +++ b/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json @@ -1 +1,197 @@ -{"name": "demand.egon_etrago_electricity_cts", "title": "MV cts electricity demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated electricity demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "undefined", "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_electricity_cts", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name (reference: demand.egon_cts_electricity_demand_building_share.scenario)", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Cts electricity demand load timeseries for one year (8760 hours) in MWh", "type": "array of real", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_etrago_electricity_cts", + "title": "MV cts electricity demand profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Aggregated electricity demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", + "language": "undefined", + "keywords": [ + "" + ], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "MV Grid" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": { + "start": "2016-01-01", + "end": "2016-12-31", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + } + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\u00a9 FZJ, TUB, FfE" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_etrago_electricity_cts", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "bus_id", + "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", + "type": "integer", + "unit": "none" + }, + { + "name": "scn_name", + "description": "Scenario name (reference: demand.egon_cts_electricity_demand_building_share.scenario)", + "type": "character varying", + "unit": "none" + }, + { + "name": "p_set", + "description": "Cts electricity demand load timeseries for one year (8760 hours) in MWh", + "type": "array of real", + "unit": "MWh" + } + ], + "primaryKey": "id, scn_name" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json b/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json index 872d97ff9..b46c4b4ef 100644 --- a/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json +++ b/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json @@ -1 +1,197 @@ -{"name": "demand.egon_etrago_electricity_households", "title": "MV residential electricity demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated electricity demand profile of residential sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "en-US", "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_electricity_households", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Residential electricity demand load timeseries for one year (8760 hours) in MWh", "type": "array of double precission", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_etrago_electricity_households", + "title": "MV residential electricity demand profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Aggregated electricity demand profile of residential sector at mvgd bus level for two scenarios. Values are given in MWh.", + "language": "en-US", + "keywords": [ + "" + ], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "MV Grid" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": { + "start": "2016-01-01", + "end": "2016-12-31", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + } + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\u00a9 FZJ, TUB, FfE" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_etrago_electricity_households", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "bus_id", + "description": "MV bus_id (reference: demand.egon_cts_electricity_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id))", + "type": "integer", + "unit": "none" + }, + { + "name": "scn_name", + "description": "Scenario name", + "type": "character varying", + "unit": "none" + }, + { + "name": "p_set", + "description": "Residential electricity demand load timeseries for one year (8760 hours) in MWh", + "type": "array of double precission", + "unit": "MWh" + } + ], + "primaryKey": "id, scn_name" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json b/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json index 422fb057b..6fff2bd10 100644 --- a/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json +++ b/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json @@ -1 +1,211 @@ -{"name": "demand.egon_etrago_heat_cts", "title": "MV cts heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Aggregated heat demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", "language": "undefined", "keywords": [""], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grid"}, "temporal": {"referenceDate": "2023-03-13", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}, {"title": "ERA5 global reanalysis", "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", "licenses": [{"name": "Licence to use Copernicus Products", "title": "Licence to use Copernicus Products", "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store"}]}, {"title": "Peta5 0 1 HD ser", "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", "licenses": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_etrago_heat_cts", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "bus_id", "description": "MV bus_id (reference: demand.egon_cts_heat_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "scn_name", "description": "Scenario name (reference: demand.egon_cts_heat_demand_building_share.scenario)", "type": "character varying", "unit": "none"}, {"name": "p_set", "description": "Cts heat demand load timeseries for one year (8760 hours) in MWh", "type": "array of real", "unit": "MWh"}], "primaryKey": "id, scn_name"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_etrago_heat_cts", + "title": "MV cts heat demand profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Aggregated heat demand profile of cts sector at mvgd bus level for two scenarios. Values are given in MWh.", + "language": "undefined", + "keywords": [ + "" + ], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "MV Grid" + }, + "temporal": { + "referenceDate": "2023-03-13", + "timeseries": { + "start": "2016-01-01", + "end": "2016-12-31", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + } + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", + "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", + "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)" + } + ] + }, + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + }, + { + "title": "ERA5 global reanalysis", + "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate and weather for the past 4 to 7 decades. Currently data is available from 1950, split into Climate Data Store entries for 1950-1978 (preliminary back extension) and from 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. See the online ERA5 documentation (https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) for more information.", + "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency", + "licenses": [ + { + "name": "Licence to use Copernicus Products", + "title": "Licence to use Copernicus Products", + "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf", + "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use may include, but is not limited to: reproduction; distribution; communication to the public; adaptation, modification and combination with other data and information; or any combination of the foregoing", + "attribution": "\u00a9 Copernicus Climate Change Service (C3S) Climate Data Store" + } + ] + }, + { + "title": "Peta5 0 1 HD ser", + "description": "modelled Heat Demand distribution (in GJ per hectare grid cell) for service-sector heat demands for space heating, hot water and process heat for the year 2015 using HRE4 data and the combined top-down bottom-up approach of HRE4", + "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search", + "licenses": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\\u00a9 Flensburg, Halmstad and Aalborg universities" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_etrago_heat_cts", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "bus_id", + "description": "MV bus_id (reference: demand.egon_cts_heat_demand_building_share.bus_id, grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", + "type": "integer", + "unit": "none" + }, + { + "name": "scn_name", + "description": "Scenario name (reference: demand.egon_cts_heat_demand_building_share.scenario)", + "type": "character varying", + "unit": "none" + }, + { + "name": "p_set", + "description": "Cts heat demand load timeseries for one year (8760 hours) in MWh", + "type": "array of real", + "unit": "MWh" + } + ], + "primaryKey": "id, scn_name" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json index d0b72c029..c00a747c1 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json @@ -1 +1,155 @@ -{"name": "demand.egon_heat_idp_pool", "title": "eGon pool of residential intra-day heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Pool of individual, normlized intra-day heat demand profiles of residential buildings", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "none", "extent": "Germany", "resolution": ""}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {"start": "0 h", "end": "23 h", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}], "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "Europa-Universit\u00e4t Flensburg"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_heat_idp_pool", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "house", "description": "Type of residential house, either SFH (single family house) or MFH (multi family house)", "type": "str", "unit": "none"}, {"name": "idp", "description": "Normalized intra-day-profile", "type": "array of double precision", "unit": "per unit"}, {"name": "index", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "temperature_class", "description": "Temperature class (considering the mean outside temeperature during the day)", "type": "integer", "unit": "none"}], "primaryKey": "index"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_heat_idp_pool", + "title": "eGon pool of residential intra-day heat demand profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Pool of individual, normlized intra-day heat demand profiles of residential buildings", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": { + "start": "0 h", + "end": "23 h", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + } + }, + "sources": [ + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + } + ], + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "Europa-Universit\u00e4t Flensburg" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_heat_idp_pool", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "house", + "description": "Type of residential house, either SFH (single family house) or MFH (multi family house)", + "type": "str", + "unit": "none" + }, + { + "name": "idp", + "description": "Normalized intra-day-profile", + "type": "array of double precision", + "unit": "per unit" + }, + { + "name": "index", + "description": "Unique identifier", + "type": "integer", + "unit": "none" + }, + { + "name": "temperature_class", + "description": "Temperature class (considering the mean outside temeperature during the day)", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "index" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json b/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json index f488ebba2..ff1b05742 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json +++ b/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json @@ -1 +1,157 @@ -{"name": "demand.egon_heat_timeseries_selected_profiles", "title": "eGon selected intra-day profiles per building", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "List of selected intra-day-profiles for each residential building in Germany", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "none", "extent": "Germany", "resolution": "buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at ''referenceDate''", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Europa-Universit\u00e4t Flensburg"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_heat_timeseries_selected_profiles", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Index of the corresponding building", "type": "integer", "unit": "none"}, {"name": "selected_idp_profiles", "description": "List of selected profiles for each day in the year", "type": "array of integer", "unit": "none"}, {"name": "zensus_population_id", "description": "Index of corresponding census cell", "type": "integer", "unit": "none"}], "primaryKey": "building_id"}, "dialect": {"delimiter": "", "decimalSeparator": ""}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_heat_timeseries_selected_profiles", + "title": "eGon selected intra-day profiles per building", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "List of selected intra-day-profiles for each residential building in Germany", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "none", + "extent": "Germany", + "resolution": "buildings" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at ''referenceDate''", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Europa-Universit\u00e4t Flensburg" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_heat_timeseries_selected_profiles", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Index of the corresponding building", + "type": "integer", + "unit": "none" + }, + { + "name": "selected_idp_profiles", + "description": "List of selected profiles for each day in the year", + "type": "array of integer", + "unit": "none" + }, + { + "name": "zensus_population_id", + "description": "Index of corresponding census cell", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "building_id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "" + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json index b7af0b5aa..3e0696b84 100644 --- a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json +++ b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json @@ -1 +1,218 @@ -{"name": "demand.egon_household_electricity_profile_in_census_cell", "title": "eGon household electricity profiles in census cells", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for residential electricity profiles to census cell including scaling factors for two scenarios (eGon2035, eGon100RE).", "language": ["en-EN", "de-DE"], "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "100 m x 100 m"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}, {"title": "DemandRegio", "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", "path": "https://doi.org/10.34805/ffe-119-20", "license": [{"name": "Creative Commons Attribution 4.0 International", "title": "CC BY 4.0", "path": "https://creativecommons.org/licenses/by/4.0/", "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", "attribution": "\u00a9 FZJ, TUB, FfE"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_household_electricity_profile_in_census_cell", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "integer", "unit": "none"}, {"name": "grid_id", "description": "Descriptive ID of census cell given by Statistisches Bundesamt (Destatis)", "type": "character varying", "unit": "none"}, {"name": "cell_profile_ids", "description": "Household profile ids", "type": "array of integer", "unit": "none"}, {"name": "nuts3", "description": "NUTS-3 ID of the census cell", "type": "character varying", "unit": "none"}, {"name": "nuts1", "description": "NUTS-1 ID of the census cell", "type": "character varying", "unit": "none"}, {"name": "factor_2035", "description": "Scaling factor for all profiles in the respective census cell for scenario eGon2035", "type": "double precision", "unit": "none"}, {"name": "factor_2050", "description": "Scaling factor for all profiles in the respective census cell for scenario eGon100RE", "type": "double precision", "unit": "none"}], "primaryKey": "cell_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_household_electricity_profile_in_census_cell", + "title": "eGon household electricity profiles in census cells", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Mapping table for residential electricity profiles to census cell including scaling factors for two scenarios (eGon2035, eGon100RE).", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [ + "" + ], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "100 m x 100 m" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", + "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", + "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + }, + { + "title": "DemandRegio", + "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und zeitlichen Aufl\u00f6sung von Energienachfragen", + "path": "https://doi.org/10.34805/ffe-119-20", + "license": [ + { + "name": "Creative Commons Attribution 4.0 International", + "title": "CC BY 4.0", + "path": "https://creativecommons.org/licenses/by/4.0/", + "instruction": "You are free: To Share, To Adapt; As long as you: Attribute!", + "attribution": "\u00a9 FZJ, TUB, FfE" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2022-09-12", + "object": "metadata", + "comment": "Updated metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_household_electricity_profile_in_census_cell", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "cell_id", + "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "grid_id", + "description": "Descriptive ID of census cell given by Statistisches Bundesamt (Destatis)", + "type": "character varying", + "unit": "none" + }, + { + "name": "cell_profile_ids", + "description": "Household profile ids", + "type": "array of integer", + "unit": "none" + }, + { + "name": "nuts3", + "description": "NUTS-3 ID of the census cell", + "type": "character varying", + "unit": "none" + }, + { + "name": "nuts1", + "description": "NUTS-1 ID of the census cell", + "type": "character varying", + "unit": "none" + }, + { + "name": "factor_2035", + "description": "Scaling factor for all profiles in the respective census cell for scenario eGon2035", + "type": "double precision", + "unit": "none" + }, + { + "name": "factor_2050", + "description": "Scaling factor for all profiles in the respective census cell for scenario eGon100RE", + "type": "double precision", + "unit": "none" + } + ], + "primaryKey": "cell_id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json index ecb2c8bbf..f302d0a27 100644 --- a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json +++ b/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json @@ -1 +1,170 @@ -{"name": "demand.egon_household_electricity_profile_of_buildings", "title": "eGon household electricity profiles of buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table for residential electricity profiles to buildings via project internal building_id and corresponding census cell_id. ", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.egon_household_electricity_profile_of_buildings", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_residential.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "integer", "unit": "none"}, {"name": "profile_id", "description": "ID of iee household profiles (reference to: iee_household_load_profiles.type)", "type": "character varying", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.egon_household_electricity_profile_of_buildings", + "title": "eGon household electricity profiles of buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Mapping table for residential electricity profiles to buildings via project internal building_id and corresponding census cell_id. ", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2022-09-12", + "object": "metadata", + "comment": "Updated metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.egon_household_electricity_profile_of_buildings", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "integer", + "unit": "none" + }, + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_residential.id, openstreetmap.osm_buildings_synthetic.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "cell_id", + "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "profile_id", + "description": "ID of iee household profiles (reference to: iee_household_load_profiles.type)", + "type": "character varying", + "unit": "none" + } + ], + "primaryKey": "id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/demand.iee_household_load_profiles.json b/src/egon/data/json_metadata/demand.iee_household_load_profiles.json index 11b158e81..093fc47dd 100644 --- a/src/egon/data/json_metadata/demand.iee_household_load_profiles.json +++ b/src/egon/data/json_metadata/demand.iee_household_load_profiles.json @@ -1 +1,158 @@ -{"name": "demand.iee_household_load_profiles", "title": "eGon pool of electricity household load profiles", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "100.000 annual profiles in hourly resolution of electricity demand of private households for different household types (singles, couples, other) with varying number of elderly and children. The profiles were created using a bottom-up load profile generator by Fraunhofer IEE developed in the Bachelors thesis \"Auswirkungen verschiedener Haushaltslastprofile auf PV-Batterie-Systeme\" by Jonas Haack, Fachhochschule Flensburg, December 2012. The columns are named as follows: \"a\", e.g. P2a0000 is the first profile of a couples household with 2 children. See publication below for the list of prefixes. Values are given in Wh.", "language": ["en-EN", "de-DE"], "keywords": [""], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": ""}, "temporal": {"referenceDate": "2022-06-10", "timeseries": {"start": "2016-01-01", "end": "2016-12-31", "resolution": "1 h", "alignment": "left", "aggregationType": "sum"}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "demand.iee_household_load_profiles", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "type", "description": "Profile id", "type": "character(8)", "unit": "none"}, {"name": "load_in_wh", "description": "Residential demand load timeseries for one year (8760 hours) in Wh", "type": "array of real", "unit": "Wh"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "demand.iee_household_load_profiles", + "title": "eGon pool of electricity household load profiles", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "100.000 annual profiles in hourly resolution of electricity demand of private households for different household types (singles, couples, other) with varying number of elderly and children. The profiles were created using a bottom-up load profile generator by Fraunhofer IEE developed in the Bachelors thesis \"Auswirkungen verschiedener Haushaltslastprofile auf PV-Batterie-Systeme\" by Jonas Haack, Fachhochschule Flensburg, December 2012. The columns are named as follows: \"a\", e.g. P2a0000 is the first profile of a couples household with 2 children. See publication below for the list of prefixes. Values are given in Wh.", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [ + "" + ], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "" + }, + "temporal": { + "referenceDate": "2022-06-10", + "timeseries": { + "start": "2016-01-01", + "end": "2016-12-31", + "resolution": "1 h", + "alignment": "left", + "aggregationType": "sum" + } + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2022-09-12", + "object": "metadata", + "comment": "Updated metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "demand.iee_household_load_profiles", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "integer", + "unit": "none" + }, + { + "name": "type", + "description": "Profile id", + "type": "character(8)", + "unit": "none" + }, + { + "name": "load_in_wh", + "description": "Residential demand load timeseries for one year (8760 hours) in Wh", + "type": "array of real", + "unit": "Wh" + } + ], + "primaryKey": "id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/grid.egon_mv_grid_district.json b/src/egon/data/json_metadata/grid.egon_mv_grid_district.json index 747a171f1..a8eb56501 100644 --- a/src/egon/data/json_metadata/grid.egon_mv_grid_district.json +++ b/src/egon/data/json_metadata/grid.egon_mv_grid_district.json @@ -1 +1,150 @@ -{"name": "grid.egon_mv_grid_district", "title": "eGon MV grid districts", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Mapping table of bus_id to polygons shapes for MV grid districts.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "MV Grids"}, "temporal": {}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "Verwaltungsgebiete 1:250 000 (Ebenen)", "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut, \u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert), \u00a9 eGon-data developers"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "grid.egon_mv_grid_district", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "building_id", "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", "type": "integer", "unit": "none"}, {"name": "bus_id", "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", "type": "integer", "unit": "none"}, {"name": "geom", "description": "Polygon of mv grid district (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "None"}, {"name": "area", "description": "Area covered by mvgd", "type": "double precision", "unit": "m^2"}], "primaryKey": "bus_id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "grid.egon_mv_grid_district", + "title": "eGon MV grid districts", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Mapping table of bus_id to polygons shapes for MV grid districts.", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "MV Grids" + }, + "temporal": {}, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "Verwaltungsgebiete 1:250 000 (Ebenen)", + "description": "Der Datenbestand umfasst s\u00e4mtliche Verwaltungseinheiten der hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden mit ihren Grenzen, statistischen Schl\u00fcsselzahlen, Namen der Verwaltungseinheit sowie die spezifische Bezeichnung der Verwaltungsebene des jeweiligen Landes.", + "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\u00e4ssig.Die bereitgestellten Daten und Metadaten d\u00fcrfen f\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\u00e4ltigt, ausgedruckt, pr\u00e4sentiert, ver\u00e4ndert, bearbeitet sowie an Dritte \u00fcbermittelt werden; (2) mit eigenen Daten und Daten Anderer zusammengef\u00fchrt und zu selbst\u00e4ndigen neuen Datens\u00e4tzen verbunden werden; (3) in interne und externe Gesch\u00e4ftsprozesse, Produkte und Anwendungen in \u00f6ffentlichen und nicht \u00f6ffentlichen elektronischen Netzwerken eingebunden werden.Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:(1) Bezeichnung des Bereitstellers nach dessen Ma\u00dfgabe,(2) der Vermerk Datenlizenz Deutschland \u2013 Namensnennung \u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.Ver\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\u00e4ndert wurden.", + "attribution": "\u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert)" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut, \u00a9 Bundesamt f\u00fcr Kartographie und Geod\u00e4sie 2020 (Daten ver\u00e4ndert), \u00a9 eGon-data developers" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "grid.egon_mv_grid_district", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "building_id", + "description": "Building id (reference to: openstreetmap.osm_buildings_filtered.id, openstreetmap.osm_buildings_synthetic.id)", + "type": "integer", + "unit": "none" + }, + { + "name": "bus_id", + "description": "MVGD bus id (reference to: grid.egon_hvmv_substation.bus_id, grid.egon_mv_grid_district.bus_id)", + "type": "integer", + "unit": "none" + }, + { + "name": "geom", + "description": "Polygon of mv grid district (CRS: ERTS89/EPSG:3035)", + "type": "geometry", + "unit": "None" + }, + { + "name": "area", + "description": "Area covered by mvgd", + "type": "double precision", + "unit": "m^2" + } + ], + "primaryKey": "bus_id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json b/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json index d57f16bfc..519c87941 100644 --- a/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json +++ b/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json @@ -1 +1,183 @@ -{"name": "openstreetmap.osm_buildings_filtered", "title": "eGon filtered buildings from openstreetmap", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Tag filtered list of buildings from OpenStreetMap which might have electricity or heat demand - (c) OpenStreetMap contributors", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-01-01", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Created metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "openstreetmap.osm_buildings_filtered", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "osm_id", "description": "Openstreetmap identifier", "type": "bigint", "unit": "none"}, {"name": "amenitiy", "description": "Type of amenitiy if given", "type": "text", "unit": "none"}, {"name": "building", "description": "Type of building", "type": "text", "unit": "none"}, {"name": "name", "description": "Name of the building if given", "type": "text", "unit": "none"}, {"name": "geom_building", "description": "Polygon of the building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "area", "description": "Surface area of building", "type": "double precision", "unit": "m^2"}, {"name": "geom_point", "description": "Centroid of the building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "tags", "description": "Opensteetmap tags assigned to the building", "type": "hstore", "unit": "none"}, {"name": "id", "description": "Unique identifyer and project internal building id (reference to: demand.egon_hp_capacity_buildings.building_id, demand.egon_cts_heat_demand_building_share.building_id, demand.egon_cts_electricity_demand_building_share.building_id, demand.egon_household_electricity_profile_of_buildings.building_id, demand.egon_building_heat_peak_loads.building_id, demand.egon_building_electricity_peak_loads.building_id, boundaries.egon_map_zensus_mvgd_buildings.building_id)", "type": "integer", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "openstreetmap.osm_buildings_filtered", + "title": "eGon filtered buildings from openstreetmap", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Tag filtered list of buildings from OpenStreetMap which might have electricity or heat demand - (c) OpenStreetMap contributors", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2022-01-01", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Created metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "openstreetmap.osm_buildings_filtered", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "osm_id", + "description": "Openstreetmap identifier", + "type": "bigint", + "unit": "none" + }, + { + "name": "amenitiy", + "description": "Type of amenitiy if given", + "type": "text", + "unit": "none" + }, + { + "name": "building", + "description": "Type of building", + "type": "text", + "unit": "none" + }, + { + "name": "name", + "description": "Name of the building if given", + "type": "text", + "unit": "none" + }, + { + "name": "geom_building", + "description": "Polygon of the building (CRS: ERTS89/EPSG:3035)", + "type": "geometry", + "unit": "none" + }, + { + "name": "area", + "description": "Surface area of building", + "type": "double precision", + "unit": "m^2" + }, + { + "name": "geom_point", + "description": "Centroid of the building (CRS: ERTS89/EPSG:3035)", + "type": "geometry", + "unit": "none" + }, + { + "name": "tags", + "description": "Opensteetmap tags assigned to the building", + "type": "hstore", + "unit": "none" + }, + { + "name": "id", + "description": "Unique identifyer and project internal building id (reference to: demand.egon_hp_capacity_buildings.building_id, demand.egon_cts_heat_demand_building_share.building_id, demand.egon_cts_electricity_demand_building_share.building_id, demand.egon_household_electricity_profile_of_buildings.building_id, demand.egon_building_heat_peak_loads.building_id, demand.egon_building_electricity_peak_loads.building_id, boundaries.egon_map_zensus_mvgd_buildings.building_id)", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json b/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json index 6c6a131a4..5957f61f3 100644 --- a/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json +++ b/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json @@ -1 +1,188 @@ -{"name": "openstreetmap.osm_buildings_synthetic", "title": "eGon synthetic residential buildings", "id": "WILL_BE_SET_AT_PUBLICATION", "description": " List of generated synthetic buildings ", "language": ["en-EN", "de-DE"], "keywords": [], "publicationDate": "2022-09-14", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "Buildings"}, "temporal": {"referenceDate": "2022-09-14", "timeseries": {}}, "sources": [{"title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", "path": "https://doi.org/10.5281/zenodo.6630616", "licenses": [{"name": "CC-BY-4.0", "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021"}]}, {"title": "eGon-data", "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", "path": "https://github.com/openego/eGon-data", "licenses": [{"name": "AGPL-3.0 License", "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", "attribution": "\u00a9 eGon-data developers"}]}, {"title": "OpenStreetMap Data Extracts (Geofabrik)", "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 OpenStreetMap contributors"}]}], "licenses": [{"name": "ODbL-1.0", "title": "Open Data Commons Open Database License 1.0", "path": "https://opendatacommons.org/licenses/odbl/1.0/", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", "attribution": "\u00a9 Reiner Lemoine Institut"}], "contributors": [{"title": "ClaraBuettner", "email": "https://github.com/ClaraBuettner", "date": "2022-09-12", "object": "metadata", "comment": "Create metadata"}, {"title": "nailend", "email": "https://github.com/nailend", "date": "2022-09-12", "object": "metadata", "comment": "Updated metadata"}, {"title": "nesnoj", "email": "https://github.com/nesnoj", "date": "2022-09-14", "object": "metadata", "comment": "Update metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "openstreetmap.osm_buildings_synthetic", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifyer and project internal building id (reference to: openstreetmap.osm_buildings_residential.id, demand.egon_household_electricity_profile_of_buildings.building_id)", "type": "character varying", "unit": "none"}, {"name": "area", "description": "Surface area of building", "type": "real", "unit": "m^2"}, {"name": "building", "description": "Type of building (residential or cts)", "type": "character varying(11)", "unit": "none"}, {"name": "cell_id", "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", "type": "character varying", "unit": "none"}, {"name": "geom_building", "description": "Polygon of building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "geom_point", "description": "Centroid of building (CRS: ERTS89/EPSG:3035)", "type": "geometry", "unit": "none"}, {"name": "n_amenities_inside", "description": "Number of amenities inside the building (always zero if not cts building)", "type": "integer", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "openstreetmap.osm_buildings_synthetic", + "title": "eGon synthetic residential buildings", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": " List of generated synthetic buildings ", + "language": [ + "en-EN", + "de-DE" + ], + "keywords": [], + "publicationDate": "2022-09-14", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgencyLogo": "https://commons.wikimedia.org/wiki/File:BMWi_Logo_2021.svg#/media/File:BMWi_Logo_2021.svg", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "Buildings" + }, + "temporal": { + "referenceDate": "2022-09-14", + "timeseries": {} + }, + "sources": [ + { + "title": "Data bundle for egon-data: A transparent and reproducible data processing pipeline for energy system modeling", + "description": "egon-data provides a transparent and reproducible open data based data processing pipeline for generating data models suitable for energy system modeling. The data is customized for the requirements of the research project eGon. The research project aims to develop tools for an open and cross-sectoral planning of transmission and distribution grids. For further information please visit the eGon project website or its Github repository. egon-data retrieves and processes data from several different external input sources. As not all data dependencies can be downloaded automatically from external sources we provide a data bundle to be downloaded by egon-data.", + "path": "https://doi.org/10.5281/zenodo.6630616", + "licenses": [ + { + "name": "CC-BY-4.0", + "title": "Creative Commons Attribution 4.0 International", + "path": "https://creativecommons.org/licenses/by/4.0/legalcode", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", + "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + } + ] + }, + { + "title": "eGon-data", + "description": "Workflow to download, process and generate data sets suitable for the further research conducted in the project eGon (https://ego-n.org/)", + "path": "https://github.com/openego/eGon-data", + "licenses": [ + { + "name": "AGPL-3.0 License", + "title": "GNU Affero General Public License v3.0", + "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", + "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", + "attribution": "\u00a9 eGon-data developers" + } + ] + }, + { + "title": "OpenStreetMap Data Extracts (Geofabrik)", + "description": "Full data extract of OpenStreetMap data for defined spatial extent at 2022-01-01", + "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf", + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 OpenStreetMap contributors" + } + ] + } + ], + "licenses": [ + { + "name": "ODbL-1.0", + "title": "Open Data Commons Open Database License 1.0", + "path": "https://opendatacommons.org/licenses/odbl/1.0/", + "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!", + "attribution": "\u00a9 Reiner Lemoine Institut" + } + ], + "contributors": [ + { + "title": "ClaraBuettner", + "email": "https://github.com/ClaraBuettner", + "date": "2022-09-12", + "object": "metadata", + "comment": "Create metadata" + }, + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2022-09-12", + "object": "metadata", + "comment": "Updated metadata" + }, + { + "title": "nesnoj", + "email": "https://github.com/nesnoj", + "date": "2022-09-14", + "object": "metadata", + "comment": "Update metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "openstreetmap.osm_buildings_synthetic", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifyer and project internal building id (reference to: openstreetmap.osm_buildings_residential.id, demand.egon_household_electricity_profile_of_buildings.building_id)", + "type": "character varying", + "unit": "none" + }, + { + "name": "area", + "description": "Surface area of building", + "type": "real", + "unit": "m^2" + }, + { + "name": "building", + "description": "Type of building (residential or cts)", + "type": "character varying(11)", + "unit": "none" + }, + { + "name": "cell_id", + "description": "Census cell id (reference to: society.destatis_zensus_population_per_ha_inside_germany.id)", + "type": "character varying", + "unit": "none" + }, + { + "name": "geom_building", + "description": "Polygon of building (CRS: ERTS89/EPSG:3035)", + "type": "geometry", + "unit": "none" + }, + { + "name": "geom_point", + "description": "Centroid of building (CRS: ERTS89/EPSG:3035)", + "type": "geometry", + "unit": "none" + }, + { + "name": "n_amenities_inside", + "description": "Number of amenities inside the building (always zero if not cts building)", + "type": "integer", + "unit": "none" + } + ], + "primaryKey": "id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json b/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json index c26d9bb95..5e20057a6 100644 --- a/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json +++ b/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json @@ -1 +1,142 @@ -{"name": "society.destatis_zensus_population_per_ha", "title": "DESTATIS - Zensus 2011 - Population per hectar", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "National census in Germany in 2011.", "language": "undefined", "keywords": [], "publicationDate": "2022-08-06", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)"}]}], "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "society.destatis_zensus_population_per_ha", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "grid_id", "description": "Grid number of source", "type": "string", "unit": "none"}, {"name": "population", "description": "Number of registred residents", "type": "integer", "unit": "resident"}, {"name": "geom_point", "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}, {"name": "geom", "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}], "primaryKey": "id"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "review": {"path": "", "badge": ""}, "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "society.destatis_zensus_population_per_ha", + "title": "DESTATIS - Zensus 2011 - Population per hectar", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "National census in Germany in 2011.", + "language": "undefined", + "keywords": [], + "publicationDate": "2022-08-06", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "1 ha" + }, + "temporal": {}, + "sources": [ + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)" + } + ] + } + ], + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "society.destatis_zensus_population_per_ha", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "id", + "description": "Unique identifier", + "type": "integer", + "unit": "none" + }, + { + "name": "grid_id", + "description": "Grid number of source", + "type": "string", + "unit": "none" + }, + { + "name": "population", + "description": "Number of registred residents", + "type": "integer", + "unit": "resident" + }, + { + "name": "geom_point", + "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", + "type": "Geometry", + "unit": "none" + }, + { + "name": "geom", + "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", + "type": "Geometry", + "unit": "none" + } + ], + "primaryKey": "id" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "review": { + "path": "", + "badge": "" + }, + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} diff --git a/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json b/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json index ec3e0362c..a48513071 100644 --- a/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json +++ b/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json @@ -1 +1,154 @@ -{"name": "society.egon_destatis_zensus_apartment_building_population_per_ha", "title": "eGon - Zensus 2011 - Apartments, Buildings, Population per hectar", "id": "WILL_BE_SET_AT_PUBLICATION", "description": "Apartments, Buildings, Population from national census in Germany in 2011.", "language": "undefined", "keywords": [], "publicationDate": "2023-03-13", "context": {"homepage": "https://ego-n.org/", "documentation": "https://egon-data.readthedocs.io/en/latest/", "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg"}, "spatial": {"location": "", "extent": "Germany", "resolution": "1 ha"}, "temporal": {}, "sources": [{"title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014"}]}, {"title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", "licenses": [{"title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)", "name": "dl-by-de/2.0"}]}], "licenses": [{"name": "dl-by-de/2.0", "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", "path": "www.govdata.de/dl-de/by-2-0", "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)"}], "contributors": [{"title": "nailend", "email": "https://github.com/nailend", "date": "2023-03-13", "object": "metadata", "comment": "Create metadata"}], "resources": [{"profile": "tabular-data-resource", "name": "society.egon_destatis_zensus_apartment_building_population_per_ha", "path": "", "format": "PostgreSQL", "encoding": "UTF-8", "schema": {"fields": [{"name": "grid_id", "description": "Grid number of source", "type": "string", "unit": "none"}, {"name": "zensus_population_id", "description": "Unique identifier", "type": "integer", "unit": "none"}, {"name": "building_count", "description": "Number of buildings within zensus cell ", "type": "smallint", "unit": "none"}, {"name": "apartment_count", "description": "Number of appartments within zensus cells", "type": "smallint", "unit": "none"}, {"name": "population", "description": "Number of registred residents", "type": "integer", "unit": "resident"}, {"name": "geom", "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}, {"name": "geom_point", "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", "type": "Geometry", "unit": "none"}], "primaryKey": "none"}, "dialect": {"delimiter": "", "decimalSeparator": "."}}], "metaMetadata": {"metadataVersion": "OEP-1.4.1", "metadataLicense": {"name": "CC0-1.0", "title": "Creative Commons Zero v1.0 Universal", "path": "https://creativecommons.org/publicdomain/zero/1.0/"}}, "review": {"path": "", "badge": ""}, "_comment": {"metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)"}} \ No newline at end of file +{ + "name": "society.egon_destatis_zensus_apartment_building_population_per_ha", + "title": "eGon - Zensus 2011 - Apartments, Buildings, Population per hectar", + "id": "WILL_BE_SET_AT_PUBLICATION", + "description": "Apartments, Buildings, Population from national census in Germany in 2011.", + "language": "undefined", + "keywords": [], + "publicationDate": "2023-03-13", + "context": { + "homepage": "https://ego-n.org/", + "documentation": "https://egon-data.readthedocs.io/en/latest/", + "sourceCode": "https://github.com/openego/eGon-data", + "contact": "https://ego-n.org/partners/", + "grantNo": "03EI1002", + "fundingAgency": "Bundesministerium f\\u00fcr Wirtschaft und Energie", + "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", + "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" + }, + "spatial": { + "location": "", + "extent": "Germany", + "resolution": "1 ha" + }, + "temporal": {}, + "sources": [ + { + "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download", + "description": "Als Download bieten wir Ihnen auf dieser Seite zus\\u00e4tzlich zur Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- und Familien- sowie Geb\\u00e4ude- und Wohnungsmerkmalen. Die Ergebnisse liegen auf Bundes-, L\\u00e4nder-, Kreis- und Gemeindeebene vor. Au\\u00dferdem sind einzelne Ergebnisse f\\u00fcr Gitterzellen verf\\u00fcgbar.", + "path": "https://www.zensus2011.de/DE/Home/Aktuelles/DemografischeGrunddaten.html", + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014" + } + ] + }, + { + "title": "Dokumentation - Zensus 2011 - Methoden und Verfahren", + "description": "Diese Publikation beschreibt ausf\\u00fchrlich die Methoden und Verfahren des registergest\\u00fctzten Zensus 2011; von der Datengewinnung und -aufbereitung bis hin zur Ergebniserstellung und Geheimhaltung. Der vorliegende Band wurde von den Statistischen \\u00c4mtern des Bundes und der L\\u00e4nder im Juni 2015 ver\\u00f6ffentlicht.", + "path": "https://www.destatis.de/DE/Publikationen/Thematisch/Bevoelkerung/Zensus/ZensusBuLaMethodenVerfahren5121105119004.pdf?__blob=publicationFile", + "licenses": [ + { + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (im Auftrag der Herausgebergemeinschaft)", + "name": "dl-by-de/2.0" + } + ] + } + ], + "licenses": [ + { + "name": "dl-by-de/2.0", + "title": "Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0", + "path": "www.govdata.de/dl-de/by-2-0", + "instruction": "Jede Nutzung ist unter den Bedingungen dieser \\u201eDatenlizenz Deutschland - Namensnennung - Version 2.0 zul\\u00e4ssig.\\nDie bereitgestellten Daten und Metadaten d\\u00fcrfen f\\u00fcr die kommerzielle und nicht kommerzielle Nutzung insbesondere:(1) vervielf\\u00e4ltigt, ausgedruckt, pr\\u00e4sentiert, ver\\u00e4ndert, bearbeitet sowie an Dritte \\u00fcbermittelt werden;\\n (2) mit eigenen Daten und Daten Anderer zusammengef\\u00fchrt und zu selbst\\u00e4ndigen neuen Datens\\u00e4tzen verbunden werden;\\n (3) in interne und externe Gesch\\u00e4ftsprozesse, Produkte und Anwendungen in \\u00f6ffentlichen und nicht \\u00f6ffentlichen elektronischen Netzwerken eingebunden werden.\\nBei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:\\n(1) Bezeichnung des Bereitstellers nach dessen Ma\\u00dfgabe,\\n(2) der Vermerk Datenlizenz Deutschland \\u2013 Namensnennung \\u2013 Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie\\n(3) einen Verweis auf den Datensatz (URI).Dies gilt nur soweit die datenhaltende Stelle die Angaben(1) bis (3) zum Quellenvermerk bereitstellt.\\nVer\\u00e4nderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten ge\\u00e4ndert wurden.", + "attribution": "\\u00a9 Statistische \\u00c4mter des Bundes und der L\\u00e4nder 2014; \\u00a9 Statistisches Bundesamt, Wiesbaden 2015 (Daten ver\\u00e4ndert)" + } + ], + "contributors": [ + { + "title": "nailend", + "email": "https://github.com/nailend", + "date": "2023-03-13", + "object": "metadata", + "comment": "Create metadata" + } + ], + "resources": [ + { + "profile": "tabular-data-resource", + "name": "society.egon_destatis_zensus_apartment_building_population_per_ha", + "path": "", + "format": "PostgreSQL", + "encoding": "UTF-8", + "schema": { + "fields": [ + { + "name": "grid_id", + "description": "Grid number of source", + "type": "string", + "unit": "none" + }, + { + "name": "zensus_population_id", + "description": "Unique identifier", + "type": "integer", + "unit": "none" + }, + { + "name": "building_count", + "description": "Number of buildings within zensus cell ", + "type": "smallint", + "unit": "none" + }, + { + "name": "apartment_count", + "description": "Number of appartments within zensus cells", + "type": "smallint", + "unit": "none" + }, + { + "name": "population", + "description": "Number of registred residents", + "type": "integer", + "unit": "resident" + }, + { + "name": "geom", + "description": "Geometry of zensus cell (CRS: ERTS89/EPSG:3035)", + "type": "Geometry", + "unit": "none" + }, + { + "name": "geom_point", + "description": "Geometry centroid of zensus cell (CRS: ERTS89/EPSG:3035)", + "type": "Geometry", + "unit": "none" + } + ], + "primaryKey": "none" + }, + "dialect": { + "delimiter": "", + "decimalSeparator": "." + } + } + ], + "metaMetadata": { + "metadataVersion": "OEP-1.4.1", + "metadataLicense": { + "name": "CC0-1.0", + "title": "Creative Commons Zero v1.0 Universal", + "path": "https://creativecommons.org/publicdomain/zero/1.0/" + } + }, + "review": { + "path": "", + "badge": "" + }, + "_comment": { + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "units": "Use a space between numbers and units (100 m)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", + "none": "If not applicable use (none)" + } +} From 9ae851c2ab126fedc2592877db44c909c6e5d2d3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 24 Mar 2023 12:07:50 +0100 Subject: [PATCH 143/787] Removed parts of metadata which lead to omi error I didnt find a proper solution to set start and end of temporal:timeseries as its 24h timeseries of random days, not having a specific date. --- .../demand.egon_heat_idp_pool.json | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json index c00a747c1..433009b8f 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json @@ -2,11 +2,8 @@ "name": "demand.egon_heat_idp_pool", "title": "eGon pool of residential intra-day heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "Pool of individual, normlized intra-day heat demand profiles of residential buildings", - "language": [ - "en-EN", - "de-DE" - ], + "description": "Pool of individual, normalized intra-day heat demand profiles of residential buildings", + "language": "undefined", "keywords": [], "publicationDate": "2022-09-14", "context": { @@ -15,7 +12,7 @@ "sourceCode": "https://github.com/openego/eGon-data", "contact": "https://ego-n.org/partners/", "grantNo": "03EI1002", - "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz", + "fundingAgency": "Bundesministerium für Wirtschaft und Klimaschutz", "fundingAgencyLogo": "https://www.innovation-beratung-foerderung.de/INNO/Redaktion/DE/Bilder/Titelbilder/titel_foerderlogo_bmwi.jpg?__blob=normal&v=3", "publisherLogo": "https://ego-n.org/images/eGon_logo_noborder_transbg.svg" }, @@ -27,8 +24,8 @@ "temporal": { "referenceDate": "2022-09-14", "timeseries": { - "start": "0 h", - "end": "23 h", + "start": "", + "end": "", "resolution": "1 h", "alignment": "left", "aggregationType": "sum" @@ -45,7 +42,7 @@ "title": "GNU Affero General Public License v3.0", "path": "https://www.gnu.org/licenses/agpl-3.0.de.html", "instruction": "Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.", - "attribution": "\u00a9 eGon-data developers" + "attribution": "© eGon-data developers" } ] }, @@ -59,7 +56,7 @@ "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", - "attribution": "\u00a9 eGon-data developers, \u00a9 Leibniz Institute for Applied Geophysics, \u00a9 Fraunhofer IEE, \u00a9 BGR Hannover, \u00a9 Danielle Schmidt, \u00a9 \u00dcbertragungsnetzbetreiber, \u00a9 DIW Berlin, \u00a9 Reiner Lemoine Institut, \u00a9 Statistisches Bundesamt, Wiesbaden 2008, \u00a9 Statistische \u00c4mter des Bundes und der L\u00e4nder 2021" + "attribution": "© eGon-data developers, © Leibniz Institute for Applied Geophysics, © Fraunhofer IEE, © BGR Hannover, © Danielle Schmidt, © Übertragungsnetzbetreiber, © DIW Berlin, © Reiner Lemoine Institut, © Statistisches Bundesamt, Wiesbaden 2008, © Statistische Ämter des Bundes und der Länder 2021" } ] } @@ -70,7 +67,7 @@ "title": "Creative Commons Attribution 4.0 International", "path": "https://creativecommons.org/licenses/by/4.0/legalcode", "instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute.", - "attribution": "Europa-Universit\u00e4t Flensburg" + "attribution": "Europa-Universität Flensburg" } ], "contributors": [ @@ -145,11 +142,11 @@ }, "_comment": { "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata/blob/master/metadata/v141/metadata_key_description.md)", - "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss±hh)", "units": "Use a space between numbers and units (100 m)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)" } -} +} \ No newline at end of file From 4d53166f5d116da2b46a99f3123362fa15d8a3a4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 24 Mar 2023 13:54:14 +0100 Subject: [PATCH 144/787] Readd start and end information --- src/egon/data/json_metadata/demand.egon_heat_idp_pool.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json index 433009b8f..65de83df4 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json @@ -24,8 +24,8 @@ "temporal": { "referenceDate": "2022-09-14", "timeseries": { - "start": "", - "end": "", + "start": "0 h", + "end": "23 h", "resolution": "1 h", "alignment": "left", "aggregationType": "sum" From 1275fa8d12fe64dea2ba1a1bede93b0f708d1b92 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 24 Mar 2023 14:19:17 +0100 Subject: [PATCH 145/787] Replace start and end with isodates for the whole year --- src/egon/data/json_metadata/demand.egon_heat_idp_pool.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json index 65de83df4..1fe9eb59d 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json @@ -2,7 +2,7 @@ "name": "demand.egon_heat_idp_pool", "title": "eGon pool of residential intra-day heat demand profiles", "id": "WILL_BE_SET_AT_PUBLICATION", - "description": "Pool of individual, normalized intra-day heat demand profiles of residential buildings", + "description": "Pool of individual, normalized intra-day heat demand profiles of residential buildings. Timeseries only represent one day but are used to be merged for a whole year ", "language": "undefined", "keywords": [], "publicationDate": "2022-09-14", @@ -24,8 +24,8 @@ "temporal": { "referenceDate": "2022-09-14", "timeseries": { - "start": "0 h", - "end": "23 h", + "start": "2011-01-01 00:00", + "end": "2011-01-01 00:00", "resolution": "1 h", "alignment": "left", "aggregationType": "sum" From 06fc0834c01a4af1bff22455f6527dfa0f199cb8 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 24 Mar 2023 16:21:36 +0100 Subject: [PATCH 146/787] correct contributors field --- src/egon/data/datasets/DSM_cts_ind.py | 21 ++++++---- .../motorized_individual_travel/db_classes.py | 41 +++++++------------ .../db_classes.py | 21 ++++++---- .../datasets/power_plants/mastr_db_classes.py | 21 ++++++---- .../power_plants/pv_rooftop_buildings.py | 21 ++++++---- .../data/datasets/storages/home_batteries.py | 21 ++++++---- 6 files changed, 74 insertions(+), 72 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 6fec35e3c..3efc21021 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -23,6 +23,7 @@ from egon.data.datasets.industry.temporal import identify_bus from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_odbl, meta_metadata, @@ -239,6 +240,16 @@ def add_metadata_individual(): "egon_sites_ind_load_curves_individual_dsm_timeseries": ["site_id"], } + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-17" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + for t_dict in targets.values(): schema = t_dict["schema"] table = t_dict["table"] @@ -270,15 +281,7 @@ def add_metadata_individual(): }, "sources": ["TODO"], "licenses": [license_odbl("© eGon development team")], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-17", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index b832f615e..8a725f4ee 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -25,6 +25,7 @@ from egon.data.datasets.scenario_parameters import EgonScenario from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_agpl, license_ccby, @@ -276,6 +277,16 @@ def add_metadata(): "basic" ] + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-17" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + table = "egon_ev_metadata" name = f"{schema}.{table}" @@ -329,15 +340,7 @@ def add_metadata(): }, ], "licenses": [license_ccby()], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-17", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", @@ -461,15 +464,7 @@ def add_metadata(): }, ], "licenses": [license_odbl()], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-17", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", @@ -593,15 +588,7 @@ def add_metadata(): }, ], "licenses": [license_odbl()], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-17", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index f28a966a5..4eae21916 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -12,6 +12,7 @@ from egon.data import config, db from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_odbl, meta_metadata, @@ -43,6 +44,16 @@ def add_metadata(): """ Add metadata to table grid.egon_emob_charging_infrastructure """ + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-14" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + meta = { "name": "grid.egon_emob_charging_infrastructure", "title": "eGon Electromobility Charging Infrastructure", @@ -91,15 +102,7 @@ def add_metadata(): "licenses": [ license_odbl(attribution="© eGon development team"), ], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-14", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index 21fb54057..6812c91b5 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -16,6 +16,7 @@ from egon.data import config, db from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_dedl, meta_metadata, @@ -313,6 +314,16 @@ def add_metadata(): ]["deposit_id"] deposit_id_mastr = config.datasets()["mastr_new"]["deposit_id"] + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-15" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + for technology in technologies: target_table = target_tables[technology] @@ -379,15 +390,7 @@ def add_metadata(): sources()["egon-data"], ], "licenses": [license_dedl(attribution="© eGon development team")], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-15", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 7c6ad1784..32d9c5196 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -66,6 +66,7 @@ from egon.data.datasets.zensus_vg250 import Vg250Gem from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_dedl, license_odbl, @@ -2122,6 +2123,16 @@ def add_metadata(): "zenodo" ]["deposit_id"] + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-16" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + meta = { "name": name, "title": "eGon power plants rooftop solar", @@ -2183,15 +2194,7 @@ def add_metadata(): sources()["egon-data"], ], "licenses": [license_odbl("© eGon development team")], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-16", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index e8a059f52..81bf990cb 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -45,6 +45,7 @@ from egon.data import config, db from egon.data.metadata import ( context, + contributors, generate_resource_fields_from_db_table, license_dedl, license_odbl, @@ -211,6 +212,16 @@ def add_metadata(): "zenodo" ]["deposit_id"] + contris = contributors(["kh", "kh"]) + + contris[0]["date"] = "2023-03-15" + + contris[0]["object"] = "metadata" + contris[1]["object"] = "dataset" + + contris[0]["comment"] = "add metadata to dataset." + contris[1]["comment"] = "Add worflow to generate dataset." + meta = { "name": ( f"{targets['home_batteries']['schema']}." @@ -272,15 +283,7 @@ def add_metadata(): sources()["technology-data"], ], "licenses": [license_odbl("© eGon development team")], - "contributors": [ - { - "title": "khelfen", - "email": "Kilian.Helfenbein@rl-institut.de", - "date": "2023-03-15", - "object": "metadata", - "comment": "Create metadata", - } - ], + "contributors": contris, "resources": [ { "profile": "tabular-data-resource", From c5766ae7b640e10cb3981f1f3626e4dbdacbb306 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 24 Mar 2023 17:00:21 +0100 Subject: [PATCH 147/787] added metadata check with omi --- src/egon/data/datasets/DSM_cts_ind.py | 6 +++ .../motorized_individual_travel/db_classes.py | 38 +++++++++---------- .../db_classes.py | 14 +++---- .../datasets/power_plants/mastr_db_classes.py | 14 +++---- .../power_plants/pv_rooftop_buildings.py | 14 +++---- .../data/datasets/storages/home_batteries.py | 14 +++---- src/egon/data/metadata.py | 13 +++++++ 7 files changed, 64 insertions(+), 49 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 3efc21021..af18afd4f 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -11,6 +11,7 @@ import datetime import json +from omi.dialects import get_dialect from sqlalchemy import ARRAY, Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd @@ -27,6 +28,7 @@ generate_resource_fields_from_db_table, license_odbl, meta_metadata, + oep_metadata_version, ) # CONSTANTS @@ -328,6 +330,10 @@ def add_metadata_individual(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", schema, diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 8a725f4ee..914370e2a 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -4,6 +4,7 @@ import datetime import json +from omi.dialects import get_dialect from sqlalchemy import ( Boolean, Column, @@ -31,6 +32,7 @@ license_ccby, license_odbl, meta_metadata, + oep_metadata_version, sources, ) @@ -308,13 +310,7 @@ def add_metadata(): }, "temporal": { "referenceDate": f"{meta_run_config.start_date}", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ sources()["egon-data"], @@ -387,6 +383,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", schema, @@ -412,13 +412,7 @@ def add_metadata(): }, "temporal": { "referenceDate": f"{meta_run_config.start_date}", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ sources()["bgr_inspee"], @@ -511,6 +505,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", schema, @@ -536,13 +534,7 @@ def add_metadata(): }, "temporal": { "referenceDate": f"{meta_run_config.start_date}", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ sources()["bgr_inspee"], @@ -635,6 +627,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", schema, diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index 4eae21916..ce5d560a3 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -6,6 +6,7 @@ import json from geoalchemy2 import Geometry +from omi.dialects import get_dialect from sqlalchemy import Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base @@ -16,6 +17,7 @@ generate_resource_fields_from_db_table, license_odbl, meta_metadata, + oep_metadata_version, ) Base = declarative_base() @@ -79,13 +81,7 @@ def add_metadata(): }, "temporal": { "referenceDate": "2022-04-21", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ { @@ -153,6 +149,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", DATASET_CFG["targets"]["charging_infrastructure"]["schema"], diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index 6812c91b5..f7ba92d44 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -2,6 +2,7 @@ import json from geoalchemy2 import Geometry +from omi.dialects import get_dialect from sqlalchemy import ( Boolean, Column, @@ -20,6 +21,7 @@ generate_resource_fields_from_db_table, license_dedl, meta_metadata, + oep_metadata_version, sources, ) @@ -352,13 +354,7 @@ def add_metadata(): " " )[0] ), - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ { @@ -441,6 +437,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", target_table.__table_args__["schema"], diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 32d9c5196..25eedd1e0 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -49,6 +49,7 @@ from geoalchemy2 import Geometry from loguru import logger from numpy.random import RandomState, default_rng +from omi.dialects import get_dialect from pyproj.crs.crs import CRS from sqlalchemy import BigInteger, Column, Float, Integer, String from sqlalchemy.dialects.postgresql import HSTORE @@ -71,6 +72,7 @@ license_dedl, license_odbl, meta_metadata, + oep_metadata_version, sources, ) @@ -2155,13 +2157,7 @@ def add_metadata(): 0 ] ), - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ { @@ -2241,6 +2237,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", schema, diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 81bf990cb..4b804fbcd 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -37,6 +37,7 @@ from loguru import logger from numpy.random import RandomState +from omi.dialects import get_dialect from sqlalchemy import Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base import numpy as np @@ -50,6 +51,7 @@ license_dedl, license_odbl, meta_metadata, + oep_metadata_version, sources, ) @@ -241,13 +243,7 @@ def add_metadata(): }, "temporal": { "referenceDate": "2021-12-31", - "timeseries": { - "start": "", - "end": "", - "resolution": "", - "alignment": "", - "aggregationType": "", - }, + "timeseries": {}, }, "sources": [ { @@ -333,6 +329,10 @@ def add_metadata(): }, } + dialect = get_dialect(oep_metadata_version())() + + meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) + db.submit_comment( f"'{json.dumps(meta)}'", targets["home_batteries"]["schema"], diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index b001841e3..f5a503044 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -7,6 +7,19 @@ EGON_ATTRIBUTION: str = "© eGon development team" +def oep_metadata_version(): + """ + Get OEP metadata version string. + + Returns + ------- + str + OEP metadata version string + + """ + return "oep-v1.4" + + def context(): """ Project context information for metadata From 7267a8dd823e3cdd0fdaeee92fd9dfbff196f757 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 27 Mar 2023 14:08:58 +0200 Subject: [PATCH 148/787] add status2019 to insert_cts_ind_demand() without adjustments --- src/egon/data/datasets/demandregio/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 380e57cfe..f022dd495 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -647,6 +647,7 @@ def insert_cts_ind_demands(): "eGon100RE": {"CTS": (1 - (5.96 + 6.13) / 154.64) * 125183.403}, # no adjustments for status quo "eGon2021": {}, + "status2019": {}, } insert_cts_ind(scn, year, engine, target_values) From 00dbefdeee5d4ff8bb30f74cf4f17d007b426eb6 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 27 Mar 2023 14:26:24 +0200 Subject: [PATCH 149/787] started debugging fix_ehv_subnetworks #2 still has to be tackled --- src/egon/data/datasets/fix_ehv_subnetworks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index eca901938..cae018648 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -379,3 +379,4 @@ def fix_subnetworks(scn_name): def run(): fix_subnetworks("eGon2035") fix_subnetworks("eGon100RE") + fix_subnetworks("status2019") From af7ed7c90055bc4cb27d85e3f78c05654313dadc Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 28 Mar 2023 11:15:15 +0200 Subject: [PATCH 150/787] quick and dirty solution for #9 --- src/egon/data/datasets.yml | 1 + src/egon/data/datasets/power_plants/mastr.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index dba83debc..66d0fe06a 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -306,6 +306,7 @@ mastr_new: file_basename: "bnetza_mastr" deposit_id: 1132987 egon2021_date_max: "2021-12-31 23:59:00" + status2019_date_max: "2019-12-31 23:59:00" re_potential_areas: target: diff --git a/src/egon/data/datasets/power_plants/mastr.py b/src/egon/data/datasets/power_plants/mastr.py index 2402fc36d..9eda90703 100644 --- a/src/egon/data/datasets/power_plants/mastr.py +++ b/src/egon/data/datasets/power_plants/mastr.py @@ -317,7 +317,7 @@ def voltage_levels(p: float) -> int: # (eGon2021 scenario) len_old = len(units) ts = pd.Timestamp( - egon.data.config.datasets()["mastr_new"]["egon2021_date_max"] + egon.data.config.datasets()["mastr_new"]["status2019_date_max"] ) units = units.loc[pd.to_datetime(units.Inbetriebnahmedatum) <= ts] print( From c5205b597aeb0fe88c02af21e07a139438ccb29d Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 28 Mar 2023 11:51:23 +0200 Subject: [PATCH 151/787] adapt changes from orginal pipeline to status quo pipeline plus skipping fix_ehv_subnetworks until #2 is done --- .../data/airflow/dags/pipeline_status_quo.py | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 54bd9f6c2..daace4135 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -39,9 +39,9 @@ from egon.data.datasets.era5 import WeatherData from egon.data.datasets.etrago_setup import EtragoSetup from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen -from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks +# from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks from egon.data.datasets.gas_areas import GasAreaseGon100RE, GasAreaseGon2035 -from egon.data.datasets.gas_grid import GasNodesandPipes +from egon.data.datasets.gas_grid import GasNodesAndPipes from egon.data.datasets.gas_neighbours import GasNeighbours from egon.data.datasets.heat_demand import HeatDemandImport from egon.data.datasets.heat_demand_europe import HeatDemandEurope @@ -49,6 +49,11 @@ from egon.data.datasets.heat_etrago import HeatEtrago from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable from egon.data.datasets.heat_supply import HeatSupply +from egon.data.datasets.heat_supply.individual_heating import ( + HeatPumps2035, + HeatPumps2050, + HeatPumpsPypsaEurSec, +) from egon.data.datasets.hydrogen_etrago import ( HydrogenBusEtrago, HydrogenGridEtrago, @@ -58,6 +63,7 @@ ) from egon.data.datasets.industrial_gas_demand import ( IndustrialGasDemand, + IndustrialGasDemandeGon100RE, IndustrialGasDemandeGon2035, ) from egon.data.datasets.industrial_sites import MergeIndustrialSites @@ -173,7 +179,7 @@ ) # Fix eHV subnetworks in Germany manually - fix_subnetworks = FixEhvSubnetworks(dependencies=[osmtgmod]) + # fix_subnetworks = FixEhvSubnetworks(dependencies=[osmtgmod]) # Retrieve MaStR (Marktstammdatenregister) data mastr_data = mastr_data_setup(dependencies=[setup]) @@ -218,7 +224,7 @@ # TODO: What does "trans" stand for? # Calculate dynamic line rating for HV (high voltage) trans lines dlr = Calculate_dlr( - dependencies=[data_bundle, osmtgmod, weather_data, fix_subnetworks] + dependencies=[data_bundle, osmtgmod, weather_data] # , fix_subnetworks] ) # Map zensus grid districts @@ -318,6 +324,24 @@ ] ) + cts_demand_buildings = CtsDemandBuildings( + dependencies=[ + osm_buildings_streets, + cts_electricity_demand_annual, + hh_demand_buildings_setup, + tasks["heat_demand_timeseries.export-etrago-cts-heat-profiles"], + ] + ) + + # Minimum heat pump capacity for pypsa-eur-sec + heat_pumps_pypsa_eur_sec = HeatPumpsPypsaEurSec( + dependencies=[ + cts_demand_buildings, + DistrictHeatingAreas, + heat_time_series, + ] + ) + # run pypsa-eur-sec run_pypsaeursec = PypsaEurSec( dependencies=[ @@ -328,6 +352,7 @@ data_bundle, electrical_load_etrago, heat_time_series, + heat_pumps_pypsa_eur_sec, ] ) @@ -337,7 +362,7 @@ ) # Import gas grid - gas_grid_insert_data = GasNodesandPipes( + gas_grid_insert_data = GasNodesAndPipes( dependencies=[ data_bundle, foreign_lines, From 00b2195dab0577d35a5b210525651566c14fc8bc Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 28 Mar 2023 14:22:30 +0200 Subject: [PATCH 152/787] added status2019 for gas_grid and gas_areas --- .../data/airflow/dags/pipeline_status_quo.py | 7 +- src/egon/data/datasets/gas_areas.py | 35 ++++++ src/egon/data/datasets/gas_grid.py | 111 +++++++++++++++--- 3 files changed, 132 insertions(+), 21 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index daace4135..1f60a1331 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -371,9 +371,9 @@ tasks["etrago_setup.create-tables"], ] ) - # Create gas voronoi eGon2035 TODO: adjust for SQ - create_gas_polygons_egon2035 = GasAreaseGon2035( - dependencies=[setup_etrago, vg250] + # Create gas voronoi status2019 + create_gas_polygons_status2019 = GasAreasstatus2019( + dependencies=[setup_etrago, vg250, gas_grid_insert_data, substation_voronoi] ) # Gas abroad @@ -382,6 +382,7 @@ gas_grid_insert_data, run_pypsaeursec, foreign_lines, + create_gas_polygons_status2019, ] ) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 103090ae8..436012248 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -69,6 +69,34 @@ def __init__(self, dependencies): ) +class GasAreasstatus2019(Dataset): + """Create the gas voronoi table and the gas voronoi areas for status2019 + + *Dependencies* + * :py:class:`EtragoSetup ` + * :py:class:`Vg250 ` + * :py:class:`GasNodesAndPipes ` + + *Resulting tables* + * :py:class:`EgonPfHvGasVoronoi ` + + """ + + #: + name: str = "GasAreasstatus2019" + #: + version: str = "0.0.1" + + def __init__(self, dependencies): + super().__init__( + name=self.name, + version=self.version, + dependencies=dependencies, + tasks=(create_gas_voronoi_table, voronoi_status2019), + ) + + + Base = declarative_base() @@ -113,6 +141,13 @@ def voronoi_egon100RE(): """ for carrier in ["CH4", "H2_grid", "H2_saltcavern"]: create_voronoi("eGon100RE", carrier) + +def voronoi_status2019(): + """ + Create voronoi polygons for all gas carriers in status2019 scenario + """ + for carrier in ["CH4"]: + create_voronoi("status2019", carrier) def create_voronoi(scn_name, carrier): diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 27af06b4f..99038a8d1 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -41,7 +41,7 @@ class GasNodesAndPipes(Dataset): Insert the CH4 buses and links into the database. Insert the CH4 buses and links, which for the case of gas represent - pipelines, into the database for the scenarios eGon2035 and eGon100RE + pipelines, into the database for the scenarios status2019, eGon2035 and eGon100RE with the functions :py:func:`insert_gas_data` and :py:func:`insert_gas_data_eGon100RE`. *Dependencies* @@ -67,7 +67,7 @@ def __init__(self, dependencies): name=self.name, version=self.version, dependencies=dependencies, - tasks=(insert_gas_data, insert_gas_data_eGon100RE), + tasks=(insert_gas_data, insert_gas_data_eGon2035, insert_gas_data_eGon100RE), ) @@ -194,14 +194,14 @@ def ch4_nodes_number_G(gas_nodes_list): def insert_CH4_nodes_list(gas_nodes_list): """ - Insert list of German CH4 nodes into the database for eGon2035 + Insert list of German CH4 nodes into the database for status2019 Insert the list of German CH4 nodes into the database by executing the following steps: * Receive the buses as parameter (from SciGRID_gas IGGIELGN data) * Add the missing information: scn_name and carrier * Clean the database table grid.egon_etrago_bus of the - CH4 buses of the specific scenario (eGon2035) in Germany + CH4 buses of the specific scenario (status2019) in Germany * Insert the buses in the table grid.egon_etrago_bus Parameters @@ -256,7 +256,7 @@ def insert_CH4_nodes_list(gas_nodes_list): # A completer avec nodes related to pipelines which have an end in the selected area et evt deplacer ds define_gas_nodes_list # Add missing columns - c = {"scn_name": "eGon2035", "carrier": "CH4"} + c = {"scn_name": "status2019", "carrier": "CH4"} gas_nodes_list = gas_nodes_list.assign(**c) gas_nodes_list = geopandas.GeoDataFrame( @@ -294,11 +294,11 @@ def insert_CH4_nodes_list(gas_nodes_list): ) -def insert_gas_buses_abroad(scn_name="eGon2035"): +def insert_gas_buses_abroad(scn_name="status2019"): """ - Insert CH4 buses in neighbouring countries to database for eGon2035 + Insert CH4 buses in neighbouring countries to database for status2019 - For the scenario eGon2035, insert central CH4 buses in foreign + For the scenario status2019, insert central CH4 buses in foreign countries to the database. The considered foreign countries are the direct neighbouring countries, with the addition of Russia that is considered as a source of fossil CH4. @@ -312,7 +312,7 @@ def insert_gas_buses_abroad(scn_name="eGon2035"): * Addition of the missing information: scn_name and carrier * Attribution of an id to each bus * Cleaning of the database table grid.egon_etrago_bus of the - CH4 buses of the specific scenario (eGon2035) out of Germany + CH4 buses of the specific scenario (status2019) out of Germany * Insertion of the neighbouring buses in the table grid.egon_etrago_bus. Returns @@ -354,7 +354,7 @@ def insert_gas_buses_abroad(scn_name="eGon2035"): "geom", ] ) - gdf_abroad_buses["scn_name"] = "eGon2035" + gdf_abroad_buses["scn_name"] = "status2019" gdf_abroad_buses["carrier"] = main_gas_carrier gdf_abroad_buses["bus_id"] = range(new_id, new_id + len(gdf_abroad_buses)) @@ -410,14 +410,14 @@ def insert_gas_buses_abroad(scn_name="eGon2035"): def insert_gas_pipeline_list( - gas_nodes_list, abroad_gas_nodes_list, scn_name="eGon2035" + gas_nodes_list, abroad_gas_nodes_list, scn_name="status2019" ): """ Insert list of gas pipelines into the database The gas pipelines, modelled as Pypsa links are red from the IGGIELGN_PipeSegments csv file previously downloded in the function :py:func:`download_SciGRID_gas_data`, - adapted and inserted in the database for the eGon2035 scenario. + adapted and inserted in the database for the status2019 scenario. The manual corrections allows to: * Delete gas pipelines disconnected of the rest of the gas grid * Connect one pipeline (also connected to Norway) disconnected of @@ -826,7 +826,7 @@ def insert_gas_pipeline_list( def remove_isolated_gas_buses(): """ - Delete CH4 buses which are disconnected of the CH4 grid for the eGon2035 scenario + Delete CH4 buses which are disconnected of the CH4 grid for the status2019 scenario This function deletes directly in the database and has no return. @@ -837,15 +837,15 @@ def remove_isolated_gas_buses(): f""" DELETE FROM {targets['buses']['schema']}.{targets['buses']['table']} WHERE "carrier" = 'CH4' - AND scn_name = 'eGon2035' + AND scn_name = 'status2019' AND country = 'DE' AND "bus_id" NOT IN (SELECT bus0 FROM {targets['links']['schema']}.{targets['links']['table']} - WHERE scn_name = 'eGon2035' + WHERE scn_name = 'status2019' AND carrier = 'CH4') AND "bus_id" NOT IN (SELECT bus1 FROM {targets['links']['schema']}.{targets['links']['table']} - WHERE scn_name = 'eGon2035' + WHERE scn_name = 'status2019' AND carrier = 'CH4'); """ ) @@ -853,10 +853,10 @@ def remove_isolated_gas_buses(): def insert_gas_data(): """ - Overall function for importing methane data for eGon2035 + Overall function for importing methane data for status2019 This function import the methane data (buses and pipelines) for - eGon2035, by executing the following steps: + status2019, by executing the following steps: * Download the SciGRID_gas datasets with the function :py:func:`download_SciGRID_gas_data` * Define CH4 buses with the function :py:func:`define_gas_nodes_list` * Insert the CH4 buses in Germany into the database with the @@ -882,6 +882,79 @@ def insert_gas_data(): remove_isolated_gas_buses() + +def insert_gas_data_eGon2035(): + """ + Overall function for importing methane data for eGon100RE + + This function import the methane data (buses and pipelines) for + eGon2035, by copying the CH4 buses from the status2019 scenario using + the function :py:func:`copy_and_modify_buses ` + from the module :py:mod:`etrago_helpers `. The methane + pipelines are also copied and their capacities are adapted: one + share of the methane grid is retroffited into an hydrogen grid, so + the methane pieplines nominal capacities are reduced from this share + (calculated in the pyspa-eur-sec run). + + This function inserts data into the database and has no return. + + """ + # copy buses + copy_and_modify_buses("status2019", "eGon100RE", {"carrier": ["CH4"]}) + + # get CH4 pipelines and modify their nominal capacity with the + # retrofitting factor + gdf = db.select_geodataframe( + f""" + SELECT * FROM grid.egon_etrago_link + WHERE carrier = 'CH4' AND scn_name = 'status2019' AND + bus0 IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = 'status2019' AND country = 'DE' + ) AND bus1 IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = 'status2019' AND country = 'DE' + ); + """, + epsg=4326, + geom_col="topo", + ) + + # Update scenario specific information + scn_name = "eGon2035" + gdf["scn_name"] = scn_name + scn_params = get_sector_parameters("gas", scn_name) + + for param in ["capital_cost", "marginal_cost", "efficiency"]: + try: + gdf.loc[:, param] = scn_params[param]["CH4"] + except KeyError: + pass + + # delete old entries + db.execute_sql( + f""" + DELETE FROM grid.egon_etrago_link + WHERE carrier = 'CH4' AND scn_name = '{scn_name}' AND + bus0 NOT IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' AND country != 'DE' + ) AND bus1 NOT IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' AND country != 'DE' + ); + """ + ) + + gdf.to_postgis( + "egon_etrago_link", + schema="grid", + if_exists="append", + con=db.engine(), + index=False, + dtype={"geom": Geometry(), "topo": Geometry()}, + ) + def insert_gas_data_eGon100RE(): """ Overall function for importing methane data for eGon100RE @@ -958,3 +1031,5 @@ def insert_gas_data_eGon100RE(): index=False, dtype={"geom": Geometry(), "topo": Geometry()}, ) + + From dfe1d8ea28d6dcacef15604cab57289500d50c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 18:55:30 +0200 Subject: [PATCH 153/787] Move duplicate metadata entries into variables --- src/egon/data/metadata.py | 40 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata.py index c4a064514..8607961f7 100755 --- a/src/egon/data/metadata.py +++ b/src/egon/data/metadata.py @@ -364,6 +364,16 @@ def generate_resource_fields_from_db_table(schema, table, geom_columns=None): def sources(): + shared_licenses = [license_geonutzv("© BGR, Hannover, 2021")] + shared_path = "https://dx.doi.org/10.5281/zenodo.4896526" + shared_title = ( + "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien" + " und Potenzialabschätzung für die Errichtung von Salzkavernen" + " zur Speicherung von Erneuerbaren Energien" + " (Wasserstoff und Druckluft)" + " – Doppelsalinare und flach lagernde Salzschichten." + " Teilprojekt Bewertungskriterien und Potenzialabschätzung" + ) return { "bgr_inspee": { "title": "Salt structures in Northern Germany", @@ -443,18 +453,10 @@ def sources(): "https://produktcenter.bgr.de/terraCatalog/DetailResult.do" "?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d" ), - "licenses": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": shared_licenses, }, "bgr_inspeeds_data_bundle": { - "title": ( - "Informationssystem Salz: Planungsgrundlagen," - " Auswahlkriterien und Potenzialabschätzung für die" - " Errichtung von Salzkavernen zur Speicherung von" - " Erneuerbaren Energien (Wasserstoff und Druckluft)" - " – Doppelsalinare und flach lagernde Salzschichten." - " Teilprojekt Bewertungskriterien und" - " Potenzialabschätzung" - ), + "title": shared_title, "description": ( "Shapefiles corresponding to the data provided in" " figure 7-1 (Donadei, S., et al., 2020, p. 7-5)." @@ -464,19 +466,11 @@ def sources(): " Note: Please include all bgr data sources when using" " the data." ), - "path": "https://dx.doi.org/10.5281/zenodo.4896526", - "licenses": [license_geonutzv("© BGR, Hannover, 2021")], + "path": shared_path, + "licenses": shared_licenses, }, "bgr_inspeeds_report": { - "title": ( - "Informationssystem Salz: Planungsgrundlagen," - " Auswahlkriterien und Potenzialabschätzung für die" - " Errichtung von Salzkavernen zur Speicherung von" - " Erneuerbaren Energien (Wasserstoff und Druckluft)" - " – Doppelsalinare und flach lagernde Salzschichten." - " Teilprojekt Bewertungskriterien und" - " Potenzialabschätzung" - ), + "title": shared_title, "description": ( "The report includes availability of saltstructures for" " energy storage and energy storage potential" @@ -488,7 +482,7 @@ def sources(): "/InSpeeDS_TP_Bewertungskriterien.pdf" "?__blob=publicationFile&v=3" ), - "licenses": [license_geonutzv("© BGR, Hannover, 2021")], + "licenses": shared_licenses, }, "demandregio": { "title": "DemandRegio", @@ -774,7 +768,7 @@ def sources(): " storage, production sites, gas power plants, border" " points, and demand time series." ), - "path": "https://dx.doi.org/10.5281/zenodo.4896526", + "path": shared_path, "licenses": [ license_ccby( "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)" From 7a2a21d693981ab64817df21ed9934c36ea2dee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 19:22:36 +0200 Subject: [PATCH 154/787] Convert 'egon.data.metadata' into a package This doesn't change the way it's imported but now we can put data files into the package's directory. --- src/egon/data/{metadata.py => metadata/__init__.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/egon/data/{metadata.py => metadata/__init__.py} (100%) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata/__init__.py similarity index 100% rename from src/egon/data/metadata.py rename to src/egon/data/metadata/__init__.py From ceec82f8d3d4f61f05118bf54098927a6972d422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 19:41:05 +0200 Subject: [PATCH 155/787] Move JSON metadata files to the "metadata" package Get rid of the hardcoded "json_metadata" directory name and instead use `__name__` to get the name of the current module, which now is also a package, then use `importlib_resources.files` to get a `Path` to the files inside the package, then use `.glob("*.json")` to get all the files ending with ".json" below that path. This simplifies the code because we no longer have to: - import `Path`, `os` or `egon.data`'s `__path__`, - generate the path to the files by hardcoding their directory, - filter for files ending in ".json" and - manually prefix the filenames with the path under which they where found. There is one important change though: since `.glob("*.json")` returns a generator of `Path` objects, the filename component has to be pulled out of the `Path` via the `name` attribute before `split`ting on `"."`. Last but not least, add a missing newline at the end of "src/egon/data/datasets/zensus_vg250.py", courtesy of the `end-of-file-fixer` pre-commit hook. --- src/egon/data/metadata/__init__.py | 15 ++++----------- .../boundaries.egon_map_zensus_climate_zones.json | 0 ...boundaries.egon_map_zensus_mvgd_buildings.json | 0 .../boundaries.egon_map_zensus_weather_cell.json | 0 ...mand.egon_building_electricity_peak_loads.json | 0 .../demand.egon_building_heat_peak_loads.json | 0 ...gon_cts_electricity_demand_building_share.json | 0 ...emand.egon_cts_heat_demand_building_share.json | 0 ...d.egon_daily_heat_demand_per_climate_zone.json | 0 .../demand.egon_etrago_electricity_cts.json | 0 ...demand.egon_etrago_electricity_households.json | 0 .../demand.egon_etrago_heat_cts.json | 0 .../demand.egon_heat_idp_pool.json | 2 +- ...nd.egon_heat_timeseries_selected_profiles.json | 0 ...sehold_electricity_profile_in_census_cell.json | 0 ...ousehold_electricity_profile_of_buildings.json | 0 .../demand.iee_household_load_profiles.json | 0 .../grid.egon_mv_grid_district.json | 0 .../openstreetmap.osm_buildings_fitered.json | 0 .../openstreetmap.osm_buildings_synthetic.json | 0 ...society.destatis_zensus_population_per_ha.json | 0 ...nsus_apartment_building_populaiton_per_ha.json | 0 22 files changed, 5 insertions(+), 12 deletions(-) rename src/egon/data/{json_metadata => metadata}/boundaries.egon_map_zensus_climate_zones.json (100%) rename src/egon/data/{json_metadata => metadata}/boundaries.egon_map_zensus_mvgd_buildings.json (100%) rename src/egon/data/{json_metadata => metadata}/boundaries.egon_map_zensus_weather_cell.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_building_electricity_peak_loads.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_building_heat_peak_loads.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_cts_electricity_demand_building_share.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_cts_heat_demand_building_share.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_daily_heat_demand_per_climate_zone.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_etrago_electricity_cts.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_etrago_electricity_households.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_etrago_heat_cts.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_heat_idp_pool.json (99%) rename src/egon/data/{json_metadata => metadata}/demand.egon_heat_timeseries_selected_profiles.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_household_electricity_profile_in_census_cell.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.egon_household_electricity_profile_of_buildings.json (100%) rename src/egon/data/{json_metadata => metadata}/demand.iee_household_load_profiles.json (100%) rename src/egon/data/{json_metadata => metadata}/grid.egon_mv_grid_district.json (100%) rename src/egon/data/{json_metadata => metadata}/openstreetmap.osm_buildings_fitered.json (100%) rename src/egon/data/{json_metadata => metadata}/openstreetmap.osm_buildings_synthetic.json (100%) rename src/egon/data/{json_metadata => metadata}/society.destatis_zensus_population_per_ha.json (100%) rename src/egon/data/{json_metadata => metadata}/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json (100%) diff --git a/src/egon/data/metadata/__init__.py b/src/egon/data/metadata/__init__.py index 8607961f7..1f88c2172 100755 --- a/src/egon/data/metadata/__init__.py +++ b/src/egon/data/metadata/__init__.py @@ -1,12 +1,9 @@ -from pathlib import Path -import os - from geoalchemy2 import Geometry from omi.dialects import get_dialect from sqlalchemy import MetaData, Table from sqlalchemy.dialects.postgresql.base import ischema_names +import importlib_resources -from egon.data import __path__ as data_path from egon.data import db, logger from egon.data.datasets import Dataset from egon.data.db import engine @@ -940,14 +937,10 @@ def contributors(authorlist): def upload_json_metadata(): """Upload json metadata into db from zenodo""" - path = Path(data_path[0]) / "json_metadata" - v = "oep-v1.4" - for file in os.listdir(path=path): - if not file.endswith(".json"): - continue - split = file.split(".") + for path in importlib_resources.files(__name__).glob("*.json"): + split = path.name.split(".") if len(split) != 3: continue schema = split[0] @@ -955,7 +948,7 @@ def upload_json_metadata(): dialect = get_dialect(v)() - with open(path / file, "r") as infile: + with open(path, "r") as infile: obj = dialect.parse(infile.read()) metadata = f"'{dialect.compile_and_render(obj)}'" diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json b/src/egon/data/metadata/boundaries.egon_map_zensus_climate_zones.json similarity index 100% rename from src/egon/data/json_metadata/boundaries.egon_map_zensus_climate_zones.json rename to src/egon/data/metadata/boundaries.egon_map_zensus_climate_zones.json diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json b/src/egon/data/metadata/boundaries.egon_map_zensus_mvgd_buildings.json similarity index 100% rename from src/egon/data/json_metadata/boundaries.egon_map_zensus_mvgd_buildings.json rename to src/egon/data/metadata/boundaries.egon_map_zensus_mvgd_buildings.json diff --git a/src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json b/src/egon/data/metadata/boundaries.egon_map_zensus_weather_cell.json similarity index 100% rename from src/egon/data/json_metadata/boundaries.egon_map_zensus_weather_cell.json rename to src/egon/data/metadata/boundaries.egon_map_zensus_weather_cell.json diff --git a/src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json b/src/egon/data/metadata/demand.egon_building_electricity_peak_loads.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_building_electricity_peak_loads.json rename to src/egon/data/metadata/demand.egon_building_electricity_peak_loads.json diff --git a/src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json b/src/egon/data/metadata/demand.egon_building_heat_peak_loads.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_building_heat_peak_loads.json rename to src/egon/data/metadata/demand.egon_building_heat_peak_loads.json diff --git a/src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json b/src/egon/data/metadata/demand.egon_cts_electricity_demand_building_share.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_cts_electricity_demand_building_share.json rename to src/egon/data/metadata/demand.egon_cts_electricity_demand_building_share.json diff --git a/src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json b/src/egon/data/metadata/demand.egon_cts_heat_demand_building_share.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_cts_heat_demand_building_share.json rename to src/egon/data/metadata/demand.egon_cts_heat_demand_building_share.json diff --git a/src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json b/src/egon/data/metadata/demand.egon_daily_heat_demand_per_climate_zone.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_daily_heat_demand_per_climate_zone.json rename to src/egon/data/metadata/demand.egon_daily_heat_demand_per_climate_zone.json diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json b/src/egon/data/metadata/demand.egon_etrago_electricity_cts.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_etrago_electricity_cts.json rename to src/egon/data/metadata/demand.egon_etrago_electricity_cts.json diff --git a/src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json b/src/egon/data/metadata/demand.egon_etrago_electricity_households.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_etrago_electricity_households.json rename to src/egon/data/metadata/demand.egon_etrago_electricity_households.json diff --git a/src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json b/src/egon/data/metadata/demand.egon_etrago_heat_cts.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_etrago_heat_cts.json rename to src/egon/data/metadata/demand.egon_etrago_heat_cts.json diff --git a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json b/src/egon/data/metadata/demand.egon_heat_idp_pool.json similarity index 99% rename from src/egon/data/json_metadata/demand.egon_heat_idp_pool.json rename to src/egon/data/metadata/demand.egon_heat_idp_pool.json index 1fe9eb59d..012e3fe0e 100644 --- a/src/egon/data/json_metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/metadata/demand.egon_heat_idp_pool.json @@ -149,4 +149,4 @@ "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/wiki)", "none": "If not applicable use (none)" } -} \ No newline at end of file +} diff --git a/src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json b/src/egon/data/metadata/demand.egon_heat_timeseries_selected_profiles.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_heat_timeseries_selected_profiles.json rename to src/egon/data/metadata/demand.egon_heat_timeseries_selected_profiles.json diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json b/src/egon/data/metadata/demand.egon_household_electricity_profile_in_census_cell.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_household_electricity_profile_in_census_cell.json rename to src/egon/data/metadata/demand.egon_household_electricity_profile_in_census_cell.json diff --git a/src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json b/src/egon/data/metadata/demand.egon_household_electricity_profile_of_buildings.json similarity index 100% rename from src/egon/data/json_metadata/demand.egon_household_electricity_profile_of_buildings.json rename to src/egon/data/metadata/demand.egon_household_electricity_profile_of_buildings.json diff --git a/src/egon/data/json_metadata/demand.iee_household_load_profiles.json b/src/egon/data/metadata/demand.iee_household_load_profiles.json similarity index 100% rename from src/egon/data/json_metadata/demand.iee_household_load_profiles.json rename to src/egon/data/metadata/demand.iee_household_load_profiles.json diff --git a/src/egon/data/json_metadata/grid.egon_mv_grid_district.json b/src/egon/data/metadata/grid.egon_mv_grid_district.json similarity index 100% rename from src/egon/data/json_metadata/grid.egon_mv_grid_district.json rename to src/egon/data/metadata/grid.egon_mv_grid_district.json diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json b/src/egon/data/metadata/openstreetmap.osm_buildings_fitered.json similarity index 100% rename from src/egon/data/json_metadata/openstreetmap.osm_buildings_fitered.json rename to src/egon/data/metadata/openstreetmap.osm_buildings_fitered.json diff --git a/src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json b/src/egon/data/metadata/openstreetmap.osm_buildings_synthetic.json similarity index 100% rename from src/egon/data/json_metadata/openstreetmap.osm_buildings_synthetic.json rename to src/egon/data/metadata/openstreetmap.osm_buildings_synthetic.json diff --git a/src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json b/src/egon/data/metadata/society.destatis_zensus_population_per_ha.json similarity index 100% rename from src/egon/data/json_metadata/society.destatis_zensus_population_per_ha.json rename to src/egon/data/metadata/society.destatis_zensus_population_per_ha.json diff --git a/src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json b/src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json similarity index 100% rename from src/egon/data/json_metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json rename to src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json From 43c6420d259cf33cb396622b26c2a78ce1381471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 20:13:15 +0200 Subject: [PATCH 156/787] Move dialect creation out of the loop No need to create a new dialect instance for every file. --- src/egon/data/metadata/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egon/data/metadata/__init__.py b/src/egon/data/metadata/__init__.py index 1f88c2172..dff660905 100755 --- a/src/egon/data/metadata/__init__.py +++ b/src/egon/data/metadata/__init__.py @@ -937,7 +937,7 @@ def contributors(authorlist): def upload_json_metadata(): """Upload json metadata into db from zenodo""" - v = "oep-v1.4" + dialect = get_dialect("oep-v1.4")() for path in importlib_resources.files(__name__).glob("*.json"): split = path.name.split(".") @@ -946,8 +946,6 @@ def upload_json_metadata(): schema = split[0] table = split[1] - dialect = get_dialect(v)() - with open(path, "r") as infile: obj = dialect.parse(infile.read()) From 15e675354753791a53442aeef7f04e70e07e75fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 20:27:21 +0200 Subject: [PATCH 157/787] Fix typo in filename: "populaiton" -> "population" --- ...gon_destatis_zensus_apartment_building_population_per_ha.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/egon/data/metadata/{society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json => society.egon_destatis_zensus_apartment_building_population_per_ha.json} (100%) diff --git a/src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json b/src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_population_per_ha.json similarity index 100% rename from src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_populaiton_per_ha.json rename to src/egon/data/metadata/society.egon_destatis_zensus_apartment_building_population_per_ha.json From 7b8abe0b0b3e3e24c8ac10793418181089b84d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 28 Mar 2023 20:30:11 +0200 Subject: [PATCH 158/787] Fix typo in filename: "fitered" -> "filtered" --- ...ngs_fitered.json => openstreetmap.osm_buildings_filtered.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/egon/data/metadata/{openstreetmap.osm_buildings_fitered.json => openstreetmap.osm_buildings_filtered.json} (100%) diff --git a/src/egon/data/metadata/openstreetmap.osm_buildings_fitered.json b/src/egon/data/metadata/openstreetmap.osm_buildings_filtered.json similarity index 100% rename from src/egon/data/metadata/openstreetmap.osm_buildings_fitered.json rename to src/egon/data/metadata/openstreetmap.osm_buildings_filtered.json From 7c83cb2825fa6e3e636f3a15a15e99378761b84a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 29 Mar 2023 11:33:18 +0200 Subject: [PATCH 159/787] Fix end timestep --- src/egon/data/metadata/demand.egon_heat_idp_pool.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/metadata/demand.egon_heat_idp_pool.json b/src/egon/data/metadata/demand.egon_heat_idp_pool.json index 012e3fe0e..5f597c7f8 100644 --- a/src/egon/data/metadata/demand.egon_heat_idp_pool.json +++ b/src/egon/data/metadata/demand.egon_heat_idp_pool.json @@ -25,7 +25,7 @@ "referenceDate": "2022-09-14", "timeseries": { "start": "2011-01-01 00:00", - "end": "2011-01-01 00:00", + "end": "2011-12-31 23:00", "resolution": "1 h", "alignment": "left", "aggregationType": "sum" From 07b234136f3cffa3352611e22a9f32e2db54090b Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 3 Apr 2023 11:02:37 +0200 Subject: [PATCH 160/787] fix date string --- src/egon/data/datasets/DSM_cts_ind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index af18afd4f..2691b6034 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -272,7 +272,7 @@ def add_metadata_individual(): "resolution": "none", }, "temporal": { - "referenceDate": "scenario-specific", + "referenceDate": "2011-01-01", "timeseries": { "start": "2011-01-01", "end": "2011-12-31", From f1ed5f0b278d2796968cb9266257b23aff0fbca5 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 3 Apr 2023 11:16:23 +0200 Subject: [PATCH 161/787] minor fix --- src/egon/data/datasets/DSM_cts_ind.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 2691b6034..45a086ea7 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -281,7 +281,7 @@ def add_metadata_individual(): "aggregationType": "average", }, }, - "sources": ["TODO"], + "sources": [], "licenses": [license_odbl("© eGon development team")], "contributors": contris, "resources": [ From 7459135ef97573ea63ed5680f1cf112b840a8948 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 3 Apr 2023 14:08:31 +0200 Subject: [PATCH 162/787] some gas stuff and commenting out dlr --- .../data/airflow/dags/pipeline_status_quo.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 1f60a1331..9fc4b5b36 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -40,7 +40,7 @@ from egon.data.datasets.etrago_setup import EtragoSetup from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen # from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks -from egon.data.datasets.gas_areas import GasAreaseGon100RE, GasAreaseGon2035 +from egon.data.datasets.gas_areas import GasAreasstatus2019 from egon.data.datasets.gas_grid import GasNodesAndPipes from egon.data.datasets.gas_neighbours import GasNeighbours from egon.data.datasets.heat_demand import HeatDemandImport @@ -223,9 +223,9 @@ # TODO: What does "trans" stand for? # Calculate dynamic line rating for HV (high voltage) trans lines - dlr = Calculate_dlr( - dependencies=[data_bundle, osmtgmod, weather_data] # , fix_subnetworks] - ) + # dlr = Calculate_dlr( + # dependencies=[data_bundle, osmtgmod, weather_data] # , fix_subnetworks] + #) # Map zensus grid districts zensus_mv_grid_districts = ZensusMvGridDistricts( @@ -388,23 +388,23 @@ # Import gas production gas_production_insert_data = CH4Production( - dependencies=[create_gas_polygons_egon2035] + dependencies=[create_gas_polygons_status2019] ) # Import CH4 storages insert_data_ch4_storages = CH4Storages( - dependencies=[create_gas_polygons_egon2035] + dependencies=[create_gas_polygons_status2019] ) # Assign industrial gas demand eGon2035 TODO: adjust for SQ IndustrialGasDemandeGon2035( - dependencies=[create_gas_polygons_egon2035, industrial_gas_demand] + dependencies=[create_gas_polygons_status2019, industrial_gas_demand] ) # CHP locations chp = Chp( dependencies=[ - create_gas_polygons_egon2035, + create_gas_polygons_status2019, demand_curves_industry, district_heating_areas, industrial_sites, @@ -433,7 +433,7 @@ ) create_ocgt = OpenCycleGasTurbineEtrago( - dependencies=[create_gas_polygons_egon2035, power_plants] + dependencies=[create_gas_polygons_status2019, power_plants] ) # Fill eTraGo generators tables @@ -517,7 +517,7 @@ # eMobility: heavy duty transport TODO: adjust for SQ heavy_duty_transport = HeavyDutyTransport( - dependencies=[vg250, setup_etrago, create_gas_polygons_egon2035] + dependencies=[vg250, setup_etrago, create_gas_polygons_status2019] ) cts_demand_buildings = CtsDemandBuildings( From b180ab44e7c4a3441baaa120424dcf49b5a6ef95 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Apr 2023 14:18:55 +0200 Subject: [PATCH 163/787] Change weather year from 2011 to 2019 --- src/egon/data/datasets/heat_demand_timeseries/daily.py | 4 ++-- .../data/datasets/heat_demand_timeseries/service_sector.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/daily.py b/src/egon/data/datasets/heat_demand_timeseries/daily.py index 9217bd9f8..aeef26ef0 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/daily.py +++ b/src/egon/data/datasets/heat_demand_timeseries/daily.py @@ -321,7 +321,7 @@ def temp_interval(): Hourly temperature intrerval of all 15 TRY Climate station#s temperature profile """ - index = pd.date_range(datetime(2011, 1, 1, 0), periods=8760, freq="H") + index = pd.date_range(datetime(2019, 1, 1, 0), periods=8760, freq="H") temperature_interval = pd.DataFrame() temp_profile = temperature_profile_extract() @@ -348,7 +348,7 @@ def h_value(): Extracted from demandlib. """ - index = pd.date_range(datetime(2011, 1, 1, 0), periods=8760, freq="H") + index = pd.date_range(datetime(2019, 1, 1, 0), periods=8760, freq="H") a = 3.0469695 diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index 2d93d6f50..954315d9d 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -74,7 +74,7 @@ def cts_demand_per_aggregation_level(aggregation_level, scenario): df_CTS_gas_2011 = df_CTS_gas_2011.asfreq("H") else: df_CTS_gas_2011 = temporal.disagg_temporal_gas_CTS( - use_nuts3code=True, year=2011 + use_nuts3code=True, year=2019 ) df_CTS_gas_2011.to_csv("CTS_heat_demand_profile_nuts3.csv") From c98a8090457a9ddd048ed90bf06f4d04fde8ebae Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 11 Apr 2023 14:32:07 +0200 Subject: [PATCH 164/787] should deal with #3 --- src/egon/data/datasets.yml | 6 +++--- .../motorized_individual_travel/ev_allocation.py | 5 ++--- .../datasets/scenario_parameters/parameters.py | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 66d0fe06a..9dd077016 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1108,9 +1108,9 @@ emobility_mit: file_processed: "regiostar-referenzdateien_preprocessed.csv" sheet: "ReferenzGebietsstand2020" KBA: - url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2021.xlsx?__blob=publicationFile&v=2" - file: "fz1_2021.xlsx" - file_processed: "fz1_2021_preprocessed.csv" + url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2020_xlsx.xlsx?__blob=publicationFile&v=2" + file: "fz1_2020_xlsx.xlsx" + file_processed: "fz1_2020_preprocessed.csv" sheet: "FZ1.1" columns: "D, J:N" skiprows: 8 diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index a64ed1c50..029f1bdfe 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -423,7 +423,7 @@ def allocate_evs_numbers(): kba_data = read_kba_data() rs7_data = read_rs7_data() - for scenario_name in ["eGon2035", "eGon100RE"]: + for scenario_name in ["eGon2035", "eGon100RE", "status2019"]: # Load scenario params scenario_parameters = get_sector_parameters( "mobility", scenario=scenario_name @@ -438,7 +438,6 @@ def allocate_evs_numbers(): ) in scenario_parameters.items(): print(f" SCENARIO VARIATION: {scenario_variation_name}") - # Get EV target ev_target = scenario_variation_parameters["ev_count"] @@ -541,7 +540,7 @@ def get_random_evs(row): .ev_id.to_list() ) - for scenario_name in ["eGon2035", "eGon100RE"]: + for scenario_name in ["eGon2035", "eGon100RE", "status2019"]: print(f"SCENARIO: {scenario_name}") # Load EVs per grid district diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index bb37664c2..ce4785587 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -768,7 +768,21 @@ def mobility(scenario): parameters = {} elif scenario == "status2019": - parameters = {} + parameters = { + "motorized_individual_travel": { + "status2019": { + "ev_count": 200000, + "bev_mini_share": 0.1589, + "bev_medium_share": 0.3533, + "bev_luxury_share": 0.1053, + "phev_mini_share": 0.0984, + "phev_medium_share": 0.2189, + "phev_luxury_share": 0.0652, + "model_parameters": {}, + } + } + } + else: print(f"Scenario name {scenario} is not valid.") From 424805a72832a3370094777daabfe25c3bc65a66 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Apr 2023 16:52:29 +0200 Subject: [PATCH 165/787] Add heat demand sceanrio parameters for status2019 --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- src/egon/data/datasets/scenario_parameters/parameters.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 48188e59a..1819863d3 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -243,7 +243,7 @@ class ScenarioParameters(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioParameters", - version="0.0.12", + version="0.0.13", dependencies=dependencies, tasks=( create_table, diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index bb37664c2..e3e75e68a 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -884,7 +884,11 @@ def heat(scenario): parameters = {} elif scenario == "status2019": - parameters = {} + parameters = { + "DE_demand_residential_TJ": 1658400+383300, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) + "DE_demand_service_TJ": 567300+71500, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) + "DE_district_heating_share": 228008/(1658400+383300+567300+71500), # [TJ], source: AG Energiebilanzen 2019 + } else: print(f"Scenario name {scenario} is not valid.") From ee449cdec66083ebbd6edb292f390474b12e3b82 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Apr 2023 16:53:15 +0200 Subject: [PATCH 166/787] Add heat demand for status2019 --- src/egon/data/datasets/heat_demand/__init__.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index a7abdc53a..ae1794cc3 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -48,7 +48,7 @@ def __init__(self, dependencies): super().__init__( name="heat-demands", # version=self.target_files + "_0.0", - version="0.0.1", # maybe rethink the naming + version="0.0.2", # maybe rethink the naming dependencies=dependencies, tasks=(scenario_data_import), ) @@ -56,6 +56,7 @@ def __init__(self, dependencies): Base = declarative_base() + # class for the final dataset in the database class EgonPetaHeat(Base): __tablename__ = "egon_peta_heat" @@ -346,6 +347,17 @@ def future_heat_demand_germany(scenario_name): if scenario_name == "eGon2015": res_hd_reduction = 1 ser_hd_reduction = 1 + + elif scenario_name == "status2019": + heat_parameters = get_sector_parameters("heat", scenario=scenario_name) + + # Calculate reduction share based on final energy demand and overall demand from Peta for 2015 + res_hd_reduction = ( + heat_parameters["DE_demand_residential_TJ"] / 3600 / 443.788483 + ) + ser_hd_reduction = ( + heat_parameters["DE_demand_service_TJ"] / 3600 / 226.588158 + ) else: heat_parameters = get_sector_parameters("heat", scenario=scenario_name) @@ -463,7 +475,6 @@ def heat_demand_to_db_table(): db.execute_sql("DELETE FROM demand.egon_peta_heat;") for source in sources: - if not "2015" in source.stem: # Create a temporary table and fill the final table using the sql script rasters = f"heat_demand_rasters_{source.stem.lower()}" @@ -836,10 +847,12 @@ def scenario_data_import(): unzip_peta5_0_1_heat_demands() cutout_heat_demand_germany() # Specifiy the scenario names for loading factors from csv file + future_heat_demand_germany("status2019") future_heat_demand_germany("eGon2035") future_heat_demand_germany("eGon100RE") # future_heat_demand_germany("eGon2015") heat_demand_to_db_table() + adjust_residential_heat_to_zensus("status2019") adjust_residential_heat_to_zensus("eGon2035") adjust_residential_heat_to_zensus("eGon100RE") # future_heat_demand_germany("eGon2015") From aa7eba9089ded88118d9b62ddf726912e7ba8e5b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Apr 2023 16:55:26 +0200 Subject: [PATCH 167/787] Add district heating areas for status2019 --- .../datasets/district_heating_areas/__init__.py | 17 ++++++++++++++--- .../datasets/district_heating_areas/plot.py | 4 +++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 339152765..4e3759c28 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -140,7 +140,7 @@ def create_tables(): # https://geopandas.org/docs/user_guide/geometric_manipulations.html -def load_census_data(): +def load_census_data(minimum_connection_rate=0.3): """ Load the heating type information from the census database table. @@ -220,7 +220,7 @@ def load_census_data(): # district_heat.head # district_heat['connection_rate'].describe() - district_heat = district_heat[district_heat["connection_rate"] >= 0.3] + district_heat = district_heat[district_heat["connection_rate"] >= minimum_connection_rate] # district_heat.columns return district_heat, heating_type @@ -499,6 +499,7 @@ def district_heating_areas(scenario_name, plotting=False): """ + # Load district heating shares from the scenario table if scenario_name == "eGon2015": district_heating_share = 0.08 @@ -507,6 +508,13 @@ def district_heating_areas(scenario_name, plotting=False): district_heating_share = heat_parameters["DE_district_heating_share"] + minimum_connection_rate=0.3 + + # Adjust minimum connection rate for status2019, + # otherwise the existing district heating grids would have too much demand + if scenario_name=="status2019": + minimum_connection_rate=0.6 + # heat_demand is scenario specific heat_demand_cells = load_heat_demands(scenario_name) @@ -515,7 +523,7 @@ def district_heating_areas(scenario_name, plotting=False): # by the area grouping function), load only the first returned result: [0] min_hd_census = 10000 / 3.6 # in MWh - census_plus_heat_demand = load_census_data()[0].copy() + census_plus_heat_demand = load_census_data(minimum_connection_rate=minimum_connection_rate)[0].copy() census_plus_heat_demand[ "residential_and_service_demand" ] = heat_demand_cells.loc[ @@ -1131,6 +1139,9 @@ def demarcation(plotting=True): heat_density_per_scenario = {} # scenario specific district heating areas + heat_density_per_scenario["status2019"] = district_heating_areas( + "status2019", plotting + ) heat_density_per_scenario["eGon2035"] = district_heating_areas( "eGon2035", plotting ) diff --git a/src/egon/data/datasets/district_heating_areas/plot.py b/src/egon/data/datasets/district_heating_areas/plot.py index ff1f83521..c0c81f3e5 100644 --- a/src/egon/data/datasets/district_heating_areas/plot.py +++ b/src/egon/data/datasets/district_heating_areas/plot.py @@ -53,13 +53,15 @@ def plot_heat_density_sorted(heat_denisty_per_scenario, scenario_name=None): fig, ax = plt.subplots(1, 1) colors = pd.DataFrame( - columns=["share", "curve"], index=["eGon2035", "eGon100RE"] + columns=["share", "curve"], index=["status2019", "eGon2035", "eGon100RE"] ) colors["share"]["eGon2035"] = "darkblue" colors["curve"]["eGon2035"] = "blue" colors["share"]["eGon100RE"] = "red" colors["curve"]["eGon100RE"] = "orange" + colors["share"]["status2019"] = "darkgreen" + colors["curve"]["status2019"] = "green" for scenario in heat_denisty_per_scenario.keys(): From f142f3540eeabe6f60205875d9d2f8eefe605488 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Apr 2023 16:55:48 +0200 Subject: [PATCH 168/787] Create district heating timeseries for status2019 --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 80e9d8010..f1415459d 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -781,6 +781,7 @@ def district_heating(method="python"): ) if method == "python": + create_district_heating_profile_python_like("status2019") create_district_heating_profile_python_like("eGon2035") create_district_heating_profile_python_like("eGon100RE") From d66dd3eb3bcb3f6884d27d2d2cf6f298f9566664 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 09:51:29 +0200 Subject: [PATCH 169/787] Add main gas carrier for status2019 --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- src/egon/data/datasets/scenario_parameters/parameters.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 48188e59a..1819863d3 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -243,7 +243,7 @@ class ScenarioParameters(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioParameters", - version="0.0.12", + version="0.0.13", dependencies=dependencies, tasks=( create_table, diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index bb37664c2..cd4730a01 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -681,7 +681,9 @@ def gas(scenario): parameters = {} elif scenario == "status2019": - parameters = {} + parameters = { + "main_gas_carrier": "CH4", + } else: print(f"Scenario name {scenario} is not valid.") From f19961b395dc772d91e1eb7699985b1e9d1fa4b7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 09:52:18 +0200 Subject: [PATCH 170/787] Update scenario name --- src/egon/data/datasets/gas_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 99038a8d1..663d3581c 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -900,7 +900,7 @@ def insert_gas_data_eGon2035(): """ # copy buses - copy_and_modify_buses("status2019", "eGon100RE", {"carrier": ["CH4"]}) + copy_and_modify_buses("status2019", "eGon2035", {"carrier": ["CH4"]}) # get CH4 pipelines and modify their nominal capacity with the # retrofitting factor From 7517daccc52cdbe673b67b85db013a8dd44a2380 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 13:23:48 +0200 Subject: [PATCH 171/787] Add status2019 scenario for CTS heat demand --- src/egon/data/datasets/heat_demand_timeseries/service_sector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index 2d93d6f50..ad1e1e1bd 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -215,7 +215,7 @@ def CTS_demand_scale(aggregation_level): Profiles scaled up to annual demand """ - scenarios = ["eGon2035", "eGon100RE"] + scenarios = ["status2019", "eGon2035", "eGon100RE"] CTS_district = pd.DataFrame() CTS_grid = pd.DataFrame() From f567d393b8104823d8cfca3d840de32f99c048ba Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 13:27:26 +0200 Subject: [PATCH 172/787] First try --- src/egon/data/datasets.yml | 1 + src/egon/data/datasets/chp/__init__.py | 29 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 9dd077016..07582e7f7 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -303,6 +303,7 @@ mastr_new: - "hydro" - "solar" - "biomass" + - "combustion" file_basename: "bnetza_mastr" deposit_id: 1132987 egon2021_date_max: "2021-12-31 23:59:00" diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 26c309578..4d850099c 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -309,7 +309,36 @@ def insert_biomass_chp(scenario): session.add(entry) session.commit() +def insert_chp_statusquo(baseyear=2019): + # import data for MaStR + mastr = pd.read_csv( + "/home/clara/test-powerd-data/bnetza_mastr/dump_2022-11-17/bnetza_mastr_combustion_cleaned.csv" + + ) + + mastr = mastr.loc[mastr.ThermischeNutzleistung > 0] + + mastr = mastr.loc[mastr.Energietraeger.isin([ + 'Erdgas', 'Mineralölprodukte', 'andere Gase', + 'nicht biogener Abfall', 'Braunkohle', 'Steinkohle', + ])] + + mastr.Inbetriebnahmedatum = pd.to_datetime(mastr.Inbetriebnahmedatum) + mastr.DatumEndgueltigeStilllegung = pd.to_datetime(mastr.DatumEndgueltigeStilllegung) + mastr = mastr.loc[mastr.Inbetriebnahmedatum<="2019-12-31"] + + mastr = mastr.loc[(mastr.DatumEndgueltigeStilllegung>="2019-12-31") + |(mastr.DatumEndgueltigeStilllegung.isnull())] + + mastr.groupby("Energietraeger").Nettonennleistung.sum().mul(1e-6) + + mastr_no_location = mastr[mastr.Laengengrad.isnull()] + + mastr_location = mastr[~mastr.Laengengrad.isnull()] + + + def insert_chp_egon2035(): """Insert CHP plants for eGon2035 considering NEP and MaStR data From be7b8dccb5a54709dcbf1bcb9933d27a6706cb39 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 17:13:32 +0200 Subject: [PATCH 173/787] Add cli parameter for scenarios --- src/egon/data/cli.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index eee6ceec3..79cfee53e 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -162,6 +162,17 @@ ), show_default=True, ) + +@click.option( + "--scenarios", + default=["status2019", "eGon2035"], + metavar="SCENARIOS", + help=( + "List of scenario names." + ), + show_default=True, +) + @click.version_option(version=egon.data.__version__) @click.pass_context def egon_data(context, **kwargs): From f3d3b63d9c88dde06fdbd9fea87eb91617cbd6c9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 17:13:46 +0200 Subject: [PATCH 174/787] Access cli parameters for scenarios in demandregio --- src/egon/data/datasets/demandregio/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index f022dd495..d287179d0 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -600,7 +600,7 @@ def insert_household_demand(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in ["status2019", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in egon.data.config.settings()["egon-data"]["scenarios"]: year = scenario_parameters.global_settings(scn)["population_year"] @@ -629,7 +629,7 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in ["status2019", "eGon2021", "eGon2035", "eGon100RE"]: + for scn in egon.data.config.settings()["egon-data"]["scenarios"]: year = scenario_parameters.global_settings(scn)["population_year"] From 310ca4ffdec2bad51d1a573a0c5b551dc07ac29c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Apr 2023 17:14:09 +0200 Subject: [PATCH 175/787] Access cli parameter for scenarios in heat_demand --- src/egon/data/datasets/heat_demand/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index a7abdc53a..dd41c864f 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -836,12 +836,14 @@ def scenario_data_import(): unzip_peta5_0_1_heat_demands() cutout_heat_demand_germany() # Specifiy the scenario names for loading factors from csv file - future_heat_demand_germany("eGon2035") - future_heat_demand_germany("eGon100RE") + for scenario in egon.data.config.settings()["egon-data"]["scenarios"]: + future_heat_demand_germany(scenario) + # future_heat_demand_germany("eGon2015") heat_demand_to_db_table() - adjust_residential_heat_to_zensus("eGon2035") - adjust_residential_heat_to_zensus("eGon100RE") + for scenario in egon.data.config.settings()["egon-data"]["scenarios"]: + adjust_residential_heat_to_zensus(scenario) + # future_heat_demand_germany("eGon2015") add_metadata() From 990e54451c493f030ef78092297b2ae717d9e8d8 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 13 Apr 2023 17:19:08 +0200 Subject: [PATCH 176/787] add sources to dsm time series tables metadata --- src/egon/data/datasets/DSM_cts_ind.py | 33 +++++++++++++++++-- .../motorized_individual_travel/db_classes.py | 4 +-- .../db_classes.py | 4 +-- .../datasets/power_plants/mastr_db_classes.py | 4 +-- .../power_plants/pv_rooftop_buildings.py | 4 +-- .../data/datasets/storages/home_batteries.py | 4 +-- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 45a086ea7..9a66cd85b 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -29,6 +29,7 @@ license_odbl, meta_metadata, oep_metadata_version, + sources, ) # CONSTANTS @@ -242,6 +243,27 @@ def add_metadata_individual(): "egon_sites_ind_load_curves_individual_dsm_timeseries": ["site_id"], } + sources_dict = { + "egon_etrago_electricity_cts_dsm_timeseries": [ + sources()["nep2021"], + sources()["zensus"], + ], + "egon_osm_ind_load_curves_individual_dsm_timeseries": [ + sources()["hotmaps_industrial_sites"], + sources()["schmidt"], + sources()["seenergies"], + ], + "egon_demandregio_sites_ind_electricity_dsm_timeseries": [ + sources()["openstreetmap"], + ], + "egon_sites_ind_load_curves_individual_dsm_timeseries": [ + sources()["hotmaps_industrial_sites"], + sources()["openstreetmap"], + sources()["schmidt"], + sources()["seenergies"], + ], + } + contris = contributors(["kh", "kh"]) contris[0]["date"] = "2023-03-17" @@ -249,8 +271,8 @@ def add_metadata_individual(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." for t_dict in targets.values(): schema = t_dict["schema"] @@ -281,7 +303,12 @@ def add_metadata_individual(): "aggregationType": "average", }, }, - "sources": [], + "sources": [ + sources()["egon-data"], + sources()["vg250"], + sources()["demandregio"], + ] + + sources_dict[table], "licenses": [license_odbl("© eGon development team")], "contributors": contris, "resources": [ diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 914370e2a..5f9bff10b 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -286,8 +286,8 @@ def add_metadata(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." table = "egon_ev_metadata" name = f"{schema}.{table}" diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index ce5d560a3..a6e368fe4 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -53,8 +53,8 @@ def add_metadata(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." meta = { "name": "grid.egon_emob_charging_infrastructure", diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index f7ba92d44..38872b6ed 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -323,8 +323,8 @@ def add_metadata(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." for technology in technologies: target_table = target_tables[technology] diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 25eedd1e0..872a85754 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2132,8 +2132,8 @@ def add_metadata(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." meta = { "name": name, diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 4b804fbcd..087a7f94f 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -221,8 +221,8 @@ def add_metadata(): contris[0]["object"] = "metadata" contris[1]["object"] = "dataset" - contris[0]["comment"] = "add metadata to dataset." - contris[1]["comment"] = "Add worflow to generate dataset." + contris[0]["comment"] = "Add metadata to dataset." + contris[1]["comment"] = "Add workflow to generate dataset." meta = { "name": ( From 0adc2bf93640167ce4916216845d174e220c7721 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 21 Apr 2023 11:27:42 +0200 Subject: [PATCH 177/787] Add source for district heating share --- src/egon/data/datasets/scenario_parameters/parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 560bd9188..0fee56661 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -903,7 +903,7 @@ def heat(scenario): parameters = { "DE_demand_residential_TJ": 1658400+383300, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) "DE_demand_service_TJ": 567300+71500, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) - "DE_district_heating_share": 228008/(1658400+383300+567300+71500), # [TJ], source: AG Energiebilanzen 2019 + "DE_district_heating_share": (189760+38248)/(1658400+383300+567300+71500), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) } else: From 551d9318200219a487637e212bda58579dfdd298 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 27 Apr 2023 11:29:08 +0200 Subject: [PATCH 178/787] Add all carriers of new MaStr dataset to list of carriers to map --- src/egon/data/datasets/scenario_capacities.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 3b674d697..b53659312 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -383,8 +383,11 @@ def map_carrier(): "Braunkohle": "lignite", "Waerme": "others", "Mineraloelprodukte": "oil", + "Mineralölprodukte": "oil", "NichtBiogenerAbfall": "others", + "nicht biogener Abfall": "others", "AndereGase": "gas", + "andere Gase": "gas", "Sonstige_Energietraeger": "others", "Kernenergie": "nuclear", "Pumpspeicher": "pumped_hydro", From 075f7c3ca909599b0aae15090aabe1b96423e298 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 27 Apr 2023 11:30:02 +0200 Subject: [PATCH 179/787] Add function to insert status quo CHP from new MaStR dataset --- src/egon/data/datasets/chp/__init__.py | 85 ++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 4d850099c..0815fc8c3 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -17,7 +17,7 @@ from egon.data import config, db from egon.data.datasets import Dataset -from egon.data.datasets.chp.match_nep import insert_large_chp +from egon.data.datasets.chp.match_nep import insert_large_chp, map_carrier from egon.data.datasets.chp.small_chp import ( assign_use_case, existing_chp_smaller_10mw, @@ -25,7 +25,7 @@ extension_to_areas, select_target, ) -from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD +from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD, WORKING_DIR_MASTR_NEW from egon.data.datasets.power_plants import ( assign_bus_id, assign_voltage_level, @@ -309,11 +309,13 @@ def insert_biomass_chp(scenario): session.add(entry) session.commit() -def insert_chp_statusquo(baseyear=2019): +def insert_chp_statusquo(): + + cfg = config.datasets()["chp_location"] # import data for MaStR mastr = pd.read_csv( - "/home/clara/test-powerd-data/bnetza_mastr/dump_2022-11-17/bnetza_mastr_combustion_cleaned.csv" + WORKING_DIR_MASTR_NEW/"bnetza_mastr_combustion_cleaned.csv" ) @@ -332,11 +334,82 @@ def insert_chp_statusquo(baseyear=2019): |(mastr.DatumEndgueltigeStilllegung.isnull())] mastr.groupby("Energietraeger").Nettonennleistung.sum().mul(1e-6) + + geom_municipalities = db.select_geodataframe( + """ + SELECT gen, ST_UNION(geometry) as geom + FROM boundaries.vg250_gem + GROUP BY gen + """ + ).set_index("gen") + + # Assing Laengengrad and Breitengrad to chps without location data + # based on the centroid of the municipaltiy + idx_no_location = mastr[(mastr.Laengengrad.isnull()) & + (mastr.Gemeinde.isin(geom_municipalities.index))].index + + mastr.loc[idx_no_location, "Laengengrad"] = ( + geom_municipalities.to_crs(epsg='4326').centroid.x.loc[ + mastr.Gemeinde[idx_no_location] + ] + ).values + + mastr.loc[idx_no_location, "Breitengrad"] = ( + geom_municipalities.to_crs(epsg='4326').centroid.y.loc[ + mastr.Gemeinde[idx_no_location] + ] + ).values + + if ( + config.settings()["egon-data"]["--dataset-boundary"] + == "Schleswig-Holstein" + ): + dropped_capacity = mastr[(mastr.Laengengrad.isnull())&(mastr.Bundesland=='SchleswigHolstein')].Nettonennleistung.sum() + + else: + + dropped_capacity = mastr[(mastr.Laengengrad.isnull())].Nettonennleistung.sum() + + + print(f""" + CHPs with a total installed electrical capacity of {dropped_capacity} kW are dropped + because of missing or wrong location data + """) - mastr_no_location = mastr[mastr.Laengengrad.isnull()] + + mastr = mastr[~mastr.Laengengrad.isnull()] + mastr = filter_mastr_geometry(mastr).set_geometry("geometry") - mastr_location = mastr[~mastr.Laengengrad.isnull()] + # Assign bus_id + if len(mastr) > 0: + mastr["voltage_level"] = assign_voltage_level( + mastr, cfg, WORKING_DIR_MASTR_NEW + ) + mastr = assign_bus_id(mastr, cfg) + mastr = assign_use_case(mastr, cfg["sources"]) + # Insert entries with location + session = sessionmaker(bind=db.engine())() + for i, row in mastr.iterrows(): + if row.ThermischeNutzleistung > 0: + entry = EgonChp( + sources={ + "chp": "MaStR", + "el_capacity": "MaStR", + "th_capacity": "MaStR", + }, + source_id={"MastrNummer": row.EinheitMastrNummer}, + carrier=map_carrier().loc[row.Energietraeger], + el_capacity=row.Nettonennleistung, + th_capacity=row.ThermischeNutzleistung / 1000, + scenario="status2019", + district_heating=row.district_heating, + electrical_bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", + ) + session.add(entry) + session.commit() def insert_chp_egon2035(): From ec0f0388dfddd7ab20356686cf65b1ca99b96dc9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 27 Apr 2023 11:30:27 +0200 Subject: [PATCH 180/787] Update function to assign heat bus id for status2019 --- src/egon/data/datasets/chp/__init__.py | 167 +++++++++++++------------ 1 file changed, 84 insertions(+), 83 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 0815fc8c3..8ed78dc81 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -132,7 +132,7 @@ def nearest( return value -def assign_heat_bus(scenario="eGon2035"): +def assign_heat_bus(): """Selects heat_bus for chps used in district heating. Parameters @@ -147,88 +147,89 @@ def assign_heat_bus(scenario="eGon2035"): """ sources = config.datasets()["chp_location"]["sources"] target = config.datasets()["chp_location"]["targets"]["chp_table"] - - # Select CHP with use_case = 'district_heating' - chp = db.select_geodataframe( - f""" - SELECT * FROM - {target['schema']}.{target['table']} - WHERE scenario = '{scenario}' - AND district_heating = True - """, - index_col="id", - epsg=4326, - ) - - # Select district heating areas and their centroid - district_heating = db.select_geodataframe( - f""" - SELECT area_id, ST_Centroid(geom_polygon) as geom - FROM - {sources['district_heating_areas']['schema']}. - {sources['district_heating_areas']['table']} - WHERE scenario = '{scenario}' - """, - epsg=4326, - ) - - # Assign district heating area_id to district_heating_chp - # According to nearest centroid of district heating area - chp["district_heating_area_id"] = chp.apply( - nearest, - df=district_heating, - row_geom_col="geom", - df_geom_col="geom", - centroid=True, - src_column="area_id", - axis=1, - ) - - # Drop district heating CHP without heat_bus_id - db.execute_sql( - f""" - DELETE FROM {target['schema']}.{target['table']} - WHERE scenario = '{scenario}' - AND district_heating = True - """ - ) - - # Insert district heating CHP with heat_bus_id - session = sessionmaker(bind=db.engine())() - for i, row in chp.iterrows(): - if row.carrier != "biomass": - entry = EgonChp( - id=i, - sources=row.sources, - source_id=row.source_id, - carrier=row.carrier, - el_capacity=row.el_capacity, - th_capacity=row.th_capacity, - electrical_bus_id=row.electrical_bus_id, - ch4_bus_id=row.ch4_bus_id, - district_heating_area_id=row.district_heating_area_id, - district_heating=row.district_heating, - voltage_level=row.voltage_level, - scenario=scenario, - geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", - ) - else: - entry = EgonChp( - id=i, - sources=row.sources, - source_id=row.source_id, - carrier=row.carrier, - el_capacity=row.el_capacity, - th_capacity=row.th_capacity, - electrical_bus_id=row.electrical_bus_id, - district_heating_area_id=row.district_heating_area_id, - district_heating=row.district_heating, - voltage_level=row.voltage_level, - scenario=scenario, - geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", - ) - session.add(entry) - session.commit() + + for scenario in ["status2019"]: + # Select CHP with use_case = 'district_heating' + chp = db.select_geodataframe( + f""" + SELECT * FROM + {target['schema']}.{target['table']} + WHERE scenario = '{scenario}' + AND district_heating = True + """, + index_col="id", + epsg=4326, + ) + + # Select district heating areas and their centroid + district_heating = db.select_geodataframe( + f""" + SELECT area_id, ST_Centroid(geom_polygon) as geom + FROM + {sources['district_heating_areas']['schema']}. + {sources['district_heating_areas']['table']} + WHERE scenario = '{scenario}' + """, + epsg=4326, + ) + + # Assign district heating area_id to district_heating_chp + # According to nearest centroid of district heating area + chp["district_heating_area_id"] = chp.apply( + nearest, + df=district_heating, + row_geom_col="geom", + df_geom_col="geom", + centroid=True, + src_column="area_id", + axis=1, + ) + + # Drop district heating CHP without heat_bus_id + db.execute_sql( + f""" + DELETE FROM {target['schema']}.{target['table']} + WHERE scenario = '{scenario}' + AND district_heating = True + """ + ) + + # Insert district heating CHP with heat_bus_id + session = sessionmaker(bind=db.engine())() + for i, row in chp.iterrows(): + if row.carrier != "biomass": + entry = EgonChp( + id=i, + sources=row.sources, + source_id=row.source_id, + carrier=row.carrier, + el_capacity=row.el_capacity, + th_capacity=row.th_capacity, + electrical_bus_id=row.electrical_bus_id, + ch4_bus_id=row.ch4_bus_id, + district_heating_area_id=row.district_heating_area_id, + district_heating=row.district_heating, + voltage_level=row.voltage_level, + scenario=scenario, + geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", + ) + else: + entry = EgonChp( + id=i, + sources=row.sources, + source_id=row.source_id, + carrier=row.carrier, + el_capacity=row.el_capacity, + th_capacity=row.th_capacity, + electrical_bus_id=row.electrical_bus_id, + district_heating_area_id=row.district_heating_area_id, + district_heating=row.district_heating, + voltage_level=row.voltage_level, + scenario=scenario, + geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", + ) + session.add(entry) + session.commit() def insert_biomass_chp(scenario): From 401f38f0fb12b67dfccc3669e61c64490993ed34 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 27 Apr 2023 11:31:18 +0200 Subject: [PATCH 181/787] Apply black --- src/egon/data/datasets/chp/__init__.py | 110 +++++++++++++++---------- 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 8ed78dc81..82c7cf876 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -25,7 +25,10 @@ extension_to_areas, select_target, ) -from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD, WORKING_DIR_MASTR_NEW +from egon.data.datasets.mastr import ( + WORKING_DIR_MASTR_OLD, + WORKING_DIR_MASTR_NEW, +) from egon.data.datasets.power_plants import ( assign_bus_id, assign_voltage_level, @@ -147,8 +150,8 @@ def assign_heat_bus(): """ sources = config.datasets()["chp_location"]["sources"] target = config.datasets()["chp_location"]["targets"]["chp_table"] - - for scenario in ["status2019"]: + + for scenario in ["status2019"]: # Select CHP with use_case = 'district_heating' chp = db.select_geodataframe( f""" @@ -160,7 +163,7 @@ def assign_heat_bus(): index_col="id", epsg=4326, ) - + # Select district heating areas and their centroid district_heating = db.select_geodataframe( f""" @@ -172,7 +175,7 @@ def assign_heat_bus(): """, epsg=4326, ) - + # Assign district heating area_id to district_heating_chp # According to nearest centroid of district heating area chp["district_heating_area_id"] = chp.apply( @@ -184,7 +187,7 @@ def assign_heat_bus(): src_column="area_id", axis=1, ) - + # Drop district heating CHP without heat_bus_id db.execute_sql( f""" @@ -193,7 +196,7 @@ def assign_heat_bus(): AND district_heating = True """ ) - + # Insert district heating CHP with heat_bus_id session = sessionmaker(bind=db.engine())() for i, row in chp.iterrows(): @@ -310,30 +313,41 @@ def insert_biomass_chp(scenario): session.add(entry) session.commit() -def insert_chp_statusquo(): +def insert_chp_statusquo(): cfg = config.datasets()["chp_location"] # import data for MaStR mastr = pd.read_csv( - WORKING_DIR_MASTR_NEW/"bnetza_mastr_combustion_cleaned.csv" - + WORKING_DIR_MASTR_NEW / "bnetza_mastr_combustion_cleaned.csv" ) mastr = mastr.loc[mastr.ThermischeNutzleistung > 0] - - mastr = mastr.loc[mastr.Energietraeger.isin([ - 'Erdgas', 'Mineralölprodukte', 'andere Gase', - 'nicht biogener Abfall', 'Braunkohle', 'Steinkohle', - ])] - + + mastr = mastr.loc[ + mastr.Energietraeger.isin( + [ + "Erdgas", + "Mineralölprodukte", + "andere Gase", + "nicht biogener Abfall", + "Braunkohle", + "Steinkohle", + ] + ) + ] + mastr.Inbetriebnahmedatum = pd.to_datetime(mastr.Inbetriebnahmedatum) - mastr.DatumEndgueltigeStilllegung = pd.to_datetime(mastr.DatumEndgueltigeStilllegung) - mastr = mastr.loc[mastr.Inbetriebnahmedatum<="2019-12-31"] - - mastr = mastr.loc[(mastr.DatumEndgueltigeStilllegung>="2019-12-31") - |(mastr.DatumEndgueltigeStilllegung.isnull())] - + mastr.DatumEndgueltigeStilllegung = pd.to_datetime( + mastr.DatumEndgueltigeStilllegung + ) + mastr = mastr.loc[mastr.Inbetriebnahmedatum <= "2019-12-31"] + + mastr = mastr.loc[ + (mastr.DatumEndgueltigeStilllegung >= "2019-12-31") + | (mastr.DatumEndgueltigeStilllegung.isnull()) + ] + mastr.groupby("Energietraeger").Nettonennleistung.sum().mul(1e-6) geom_municipalities = db.select_geodataframe( @@ -342,45 +356,51 @@ def insert_chp_statusquo(): FROM boundaries.vg250_gem GROUP BY gen """ - ).set_index("gen") + ).set_index("gen") # Assing Laengengrad and Breitengrad to chps without location data - # based on the centroid of the municipaltiy - idx_no_location = mastr[(mastr.Laengengrad.isnull()) & - (mastr.Gemeinde.isin(geom_municipalities.index))].index + # based on the centroid of the municipaltiy + idx_no_location = mastr[ + (mastr.Laengengrad.isnull()) + & (mastr.Gemeinde.isin(geom_municipalities.index)) + ].index mastr.loc[idx_no_location, "Laengengrad"] = ( - geom_municipalities.to_crs(epsg='4326').centroid.x.loc[ + geom_municipalities.to_crs(epsg="4326").centroid.x.loc[ mastr.Gemeinde[idx_no_location] - ] + ] ).values - mastr.loc[idx_no_location, "Breitengrad"] = ( - geom_municipalities.to_crs(epsg='4326').centroid.y.loc[ + mastr.loc[idx_no_location, "Breitengrad"] = ( + geom_municipalities.to_crs(epsg="4326").centroid.y.loc[ mastr.Gemeinde[idx_no_location] - ] + ] ).values - + if ( config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein" ): - dropped_capacity = mastr[(mastr.Laengengrad.isnull())&(mastr.Bundesland=='SchleswigHolstein')].Nettonennleistung.sum() - + dropped_capacity = mastr[ + (mastr.Laengengrad.isnull()) + & (mastr.Bundesland == "SchleswigHolstein") + ].Nettonennleistung.sum() + else: - - dropped_capacity = mastr[(mastr.Laengengrad.isnull())].Nettonennleistung.sum() - - - print(f""" + dropped_capacity = mastr[ + (mastr.Laengengrad.isnull()) + ].Nettonennleistung.sum() + + print( + f""" CHPs with a total installed electrical capacity of {dropped_capacity} kW are dropped because of missing or wrong location data - """) - - + """ + ) + mastr = mastr[~mastr.Laengengrad.isnull()] mastr = filter_mastr_geometry(mastr).set_geometry("geometry") - + # Assign bus_id if len(mastr) > 0: mastr["voltage_level"] = assign_voltage_level( @@ -411,8 +431,8 @@ def insert_chp_statusquo(): ) session.add(entry) session.commit() - - + + def insert_chp_egon2035(): """Insert CHP plants for eGon2035 considering NEP and MaStR data From be9317584c06f720bdca7949214daeeb6fe50b58 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 27 Apr 2023 11:32:49 +0200 Subject: [PATCH 182/787] Add task to dataset and update version number --- src/egon/data/datasets/chp/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 82c7cf876..b815b4b4d 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -655,11 +655,15 @@ class Chp(Dataset): def __init__(self, dependencies): super().__init__( name="Chp", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( create_tables, - {insert_chp_egon2035, insert_chp_egon100re}, + { + insert_chp_statusquo, + insert_chp_egon2035, + insert_chp_egon100re, + }, assign_heat_bus, extension, ), From 15121b146762bda6d5b16ec98e82c7c3df619000 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 27 Apr 2023 15:11:32 +0200 Subject: [PATCH 183/787] update deleted and added components --- src/egon/data/datasets/fix_ehv_subnetworks.py | 274 ++++++++++-------- 1 file changed, 148 insertions(+), 126 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index cae018648..53544a7cd 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -197,25 +197,25 @@ def fix_subnetworks(scn_name): add_line( 10.760835327266625, # Lübeck Siems 53.90974536547805, - 10.640952461335745, # Umspannwerk Lübeck - 53.91944427801032, + 10.641467804496818, # Umspannwerk Lübeck + 53.91916269128779, 220, scn_name, 3, ) - # Missing 220kV line from Audorf to Kiel - add_line( - # Audorf - 9.726992766257577, - 54.291420962253234, - # Kiel - 9.9572075, - 54.321589, - 220, - scn_name, - 6, - ) + # # Missing 220kV line from Audorf to Kiel + # add_line( + # # Audorf + # 9.726992766257577, + # 54.291420962253234, + # # Kiel + # 9.9572075, + # 54.321589, + # 220, + # scn_name, + # 6, + # ) if settings()["egon-data"]["--dataset-boundary"] == "Everything": @@ -229,58 +229,80 @@ def fix_subnetworks(scn_name): scn_name, 6, ) - - # Missing 380kV line near Elsfleth + + # Missing line from Umspannwerk Plottling to Gänsdorf UW add_line( - # Line - 8.419326700000001, - 53.229867000000006, - # Schaltanlage Elsfleth/West - 8.402976949446648, - 53.2371468322213, + 12,853318030996972, # Umspannwerk Plottling + 48,76508569478315, + 12,769768646403532, # Gänsdorf UW + 48,80533685376445, 380, scn_name, - 6, + 3, ) - - # Missing 380kV line near Magdala + + # Missing line inside Ottstedt add_line( - # Line north south - 11.4298432, - 50.9117467, - # Line east - 11.4295305, - 50.9115176, + 11,4295305, # Ottstedt + 50,9115176, + 11,4299277, # Ottstedt + 50,9114496, 380, scn_name, 3, ) - # Missing 220kV line near Frimmersdorf - add_line( - # Line west - 6.585418000000001, - 51.0495723, - # Line east - 6.5867616, - 51.0520915, - 220, - scn_name, - 6, - ) + # # Missing 380kV line near Elsfleth + # add_line( + # # Line + # 8.419326700000001, + # 53.229867000000006, + # # Schaltanlage Elsfleth/West + # 8.402976949446648, + # 53.2371468322213, + # 380, + # scn_name, + # 6, + # ) + + # # Missing 380kV line near Magdala + # add_line( + # # Line north south + # 11.4298432, + # 50.9117467, + # # Line east + # 11.4295305, + # 50.9115176, + # 380, + # scn_name, + # 3, + # ) - # Missing 220kV line from Wolmirstedt to Stendal - add_line( - # Wolmirstedt - 11.637225336209951, - 52.26707328151311, - # Stendal - 11.7689, - 52.505533, - 220, - scn_name, - 6, - ) + # Missing 220kV line near Frimmersdorf + # add_line( + # # Line west + # 6.585418000000001, + # 51.0495723, + # # Line east + # 6.5867616, + # 51.0520915, + # 220, + # scn_name, + # 6, + # ) + + # # Missing 220kV line from Wolmirstedt to Stendal + # add_line( + # # Wolmirstedt + # 11.637225336209951, + # 52.26707328151311, + # # Stendal + # 11.7689, + # 52.505533, + # 220, + # scn_name, + # 6, + # ) # Plattling # Update way for osmTGmod in @@ -297,82 +319,82 @@ def fix_subnetworks(scn_name): # 12.85444925633996 48.76422235417385, # 12.853289544662 48.76616304929393)' - # Lamspringe 380kV lines - drop_line( - 9.988215035677026, - 51.954230057487926, - 9.991477300000001, - 51.939711, - 380, - scn_name, - ) - - drop_line( - 9.995589, - 51.969716000000005, - 9.988215035677026, - 51.954230057487926, - 380, - scn_name, - ) - - drop_line( - 9.982829, - 51.985980000000005, - 9.995589, - 51.969716000000005, - 380, - scn_name, - ) - - drop_line( - 10.004865, - 51.999120000000005, - 9.982829, - 51.985980000000005, - 380, - scn_name, - ) - - drop_line( - 10.174395, - 52.036448, - 9.988215035677026, - 51.954230057487926, - 380, - scn_name, - ) - - drop_line( - 10.195144702845797, - 52.079851837273964, - 10.174395, - 52.036448, - 380, - scn_name, - ) - - drop_trafo(9.988215035677026, 51.954230057487926, 110, 380, scn_name) - - drop_bus(9.988215035677026, 51.954230057487926, 380, scn_name) - drop_bus(9.991477300000001, 51.939711, 380, scn_name) - drop_bus(9.995589, 51.969716000000005, 380, scn_name) - drop_bus(9.982829, 51.985980000000005, 380, scn_name) - drop_bus(10.174395, 52.036448, 380, scn_name) - drop_bus(10.195144702845797, 52.079851837273964, 380, scn_name) - - drop_bus(10.004865, 51.999120000000005, 380, scn_name) + # # Lamspringe 380kV lines + # drop_line( + # 9.988215035677026, + # 51.954230057487926, + # 9.991477300000001, + # 51.939711, + # 380, + # scn_name, + # ) + + # drop_line( + # 9.995589, + # 51.969716000000005, + # 9.988215035677026, + # 51.954230057487926, + # 380, + # scn_name, + # ) + + # drop_line( + # 9.982829, + # 51.985980000000005, + # 9.995589, + # 51.969716000000005, + # 380, + # scn_name, + # ) + + # drop_line( + # 10.004865, + # 51.999120000000005, + # 9.982829, + # 51.985980000000005, + # 380, + # scn_name, + # ) + + # drop_line( + # 10.174395, + # 52.036448, + # 9.988215035677026, + # 51.954230057487926, + # 380, + # scn_name, + # ) + + # drop_line( + # 10.195144702845797, + # 52.079851837273964, + # 10.174395, + # 52.036448, + # 380, + # scn_name, + # ) + + # drop_trafo(9.988215035677026, 51.954230057487926, 110, 380, scn_name) + + # drop_bus(9.988215035677026, 51.954230057487926, 380, scn_name) + # drop_bus(9.991477300000001, 51.939711, 380, scn_name) + # drop_bus(9.995589, 51.969716000000005, 380, scn_name) + # drop_bus(9.982829, 51.985980000000005, 380, scn_name) + # drop_bus(10.174395, 52.036448, 380, scn_name) + # drop_bus(10.195144702845797, 52.079851837273964, 380, scn_name) + + # drop_bus(10.004865, 51.999120000000005, 380, scn_name) # Umspannwerk Vieselbach # delete isolated bus and trafo - drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) - drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) + # drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) + # drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) - # Umspannwerk Waldlaubersheim - # delete isolated bus and trafo - drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) - drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) + # # Umspannwerk Waldlaubersheim + # # delete isolated bus and trafo + # drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) + # drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) From c0530d42301dc975f10a8a6dbd5e4e531272cb20 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 28 Apr 2023 08:22:11 +0200 Subject: [PATCH 184/787] include fix_eHV into pipeline again --- src/egon/data/airflow/dags/pipeline_status_quo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 9fc4b5b36..982d5eba1 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -39,7 +39,7 @@ from egon.data.datasets.era5 import WeatherData from egon.data.datasets.etrago_setup import EtragoSetup from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen -# from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks +from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks from egon.data.datasets.gas_areas import GasAreasstatus2019 from egon.data.datasets.gas_grid import GasNodesAndPipes from egon.data.datasets.gas_neighbours import GasNeighbours @@ -179,7 +179,7 @@ ) # Fix eHV subnetworks in Germany manually - # fix_subnetworks = FixEhvSubnetworks(dependencies=[osmtgmod]) + fix_subnetworks = FixEhvSubnetworks(dependencies=[osmtgmod]) # Retrieve MaStR (Marktstammdatenregister) data mastr_data = mastr_data_setup(dependencies=[setup]) From f20a350aa5e067b900b03a1ad76d6da801f1894b Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 28 Apr 2023 12:00:50 +0200 Subject: [PATCH 185/787] add scn parameters for status2019 --- .../scenario_parameters/parameters.py | 191 +++++++++++++++++- 1 file changed, 190 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index cb4a6ca3a..ef7d6e741 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -129,6 +129,25 @@ def global_settings(scenario): parameters = { "weather_year": 2019, "population_year": 2019, + "fuel_costs": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 39, table 6 + "oil": 73.8, # [EUR/MWh] + "gas": 25.6, # [EUR/MWh] + "coal": 20.2, # [EUR/MWh] + "lignite": 4.0, # [EUR/MWh] + "nuclear": 1.7, # [EUR/MWh] + "biomass": 40, # Dummyvalue, ToDo: Find a suitable source + }, + "co2_costs": 76.5, # [EUR/t_CO2] + "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 + "waste": 0.165, # [t_CO2/MW_th] + "lignite": 0.393, # [t_CO2/MW_th] + "gas": 0.201, # [t_CO2/MW_th] + "nuclear": 0.0, # [t_CO2/MW_th] + "oil": 0.288, # [t_CO2/MW_th] + "coal": 0.335, # [t_CO2/MW_th] + "other_non_renewable": 0.268, # [t_CO2/MW_th] + }, + "interest_rate": 0.05, # [p.u.] } else: @@ -472,7 +491,177 @@ def electricity(scenario): parameters = {} elif scenario == "status2019": - parameters = {} + + costs = read_csv(2020) + + parameters = {"grid_topology": "Status Quo"} + # Insert effciencies in p.u. + parameters["efficiency"] = { + "oil": read_costs(costs, "oil", "efficiency"), + "battery": { + "store": read_costs(costs, "battery inverter", "efficiency") + ** 0.5, + "dispatch": read_costs(costs, "battery inverter", "efficiency") + ** 0.5, + "standing_loss": 0, + "max_hours": 6, + }, + "pumped_hydro": { + "store": read_costs(costs, "PHS", "efficiency") ** 0.5, + "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5, + "standing_loss": 0, + "max_hours": 6, + }, + } + # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data! + parameters["electrical_parameters"] = { + "ac_line_110kV": { + "s_nom": 260, # [MVA] + "R": 0.109, # [Ohm/km] + "L": 1.2, # [mH/km] + }, + "ac_cable_110kV": { + "s_nom": 280, # [MVA] + "R": 0.0177, # [Ohm/km] + "L": 0.3, # [mH/km] + }, + "ac_line_220kV": { + "s_nom": 520, # [MVA] + "R": 0.109, # [Ohm/km] + "L": 1.0, # [mH/km] + }, + "ac_cable_220kV": { + "s_nom": 550, # [MVA] + "R": 0.0176, # [Ohm/km] + "L": 0.3, # [mH/km] + }, + "ac_line_380kV": { + "s_nom": 1790, # [MVA] + "R": 0.028, # [Ohm/km] + "L": 0.8, # [mH/km] + }, + "ac_cable_380kV": { + "s_nom": 925, # [MVA] + "R": 0.0175, # [Ohm/km] + "L": 0.3, # [mH/km] + }, + } + + # Insert overnight investment costs + # Source for eHV grid costs: Netzentwicklungsplan Strom 2035, Version 2021, 2. Entwurf + # Source for HV lines and cables: Dena Verteilnetzstudie 2021, p. 146 + parameters["overnight_cost"] = { + "ac_ehv_overhead_line": 2.5e6 + / ( + 2 + * parameters["electrical_parameters"]["ac_line_380kV"]["s_nom"] + ), # [EUR/km/MW] + "ac_ehv_cable": 11.5e6 + / ( + 2 + * parameters["electrical_parameters"]["ac_cable_380kV"][ + "s_nom" + ] + ), # [EUR/km/MW] + "ac_hv_overhead_line": 0.06e6 + / parameters["electrical_parameters"]["ac_line_110kV"][ + "s_nom" + ], # [EUR/km/MW] + "ac_hv_cable": 0.8e6 + / parameters["electrical_parameters"]["ac_cable_110kV"][ + "s_nom" + ], # [EUR/km/MW] + "dc_overhead_line": 0.5e3, # [EUR/km/MW] + "dc_cable": 3.25e3, # [EUR/km/MW] + "dc_inverter": 0.3e6, # [EUR/MW] + "transformer_380_110": 17.33e3, # [EUR/MVA] + "transformer_380_220": 13.33e3, # [EUR/MVA] + "transformer_220_110": 17.5e3, # [EUR/MVA] + "battery inverter": read_costs( + costs, "battery inverter", "investment" + ), + "battery storage": read_costs( + costs, "battery storage", "investment" + ), + } + + parameters["lifetime"] = { + "ac_ehv_overhead_line": read_costs( + costs, "HVAC overhead", "lifetime" + ), + "ac_ehv_cable": read_costs(costs, "HVAC overhead", "lifetime"), + "ac_hv_overhead_line": read_costs( + costs, "HVAC overhead", "lifetime" + ), + "ac_hv_cable": read_costs(costs, "HVAC overhead", "lifetime"), + "dc_overhead_line": read_costs(costs, "HVDC overhead", "lifetime"), + "dc_cable": read_costs(costs, "HVDC overhead", "lifetime"), + "dc_inverter": read_costs(costs, "HVDC inverter pair", "lifetime"), + "transformer_380_110": read_costs( + costs, "HVAC overhead", "lifetime" + ), + "transformer_380_220": read_costs( + costs, "HVAC overhead", "lifetime" + ), + "transformer_220_110": read_costs( + costs, "HVAC overhead", "lifetime" + ), + "battery inverter": read_costs( + costs, "battery inverter", "lifetime" + ), + "battery storage": read_costs( + costs, "battery storage", "lifetime" + ), + } + # Insert annualized capital costs + # lines in EUR/km/MW/a + # transfermer, inverter, battery in EUR/MW/a + parameters["capital_cost"] = {} + + for comp in parameters["overnight_cost"].keys(): + parameters["capital_cost"][comp] = annualize_capital_costs( + parameters["overnight_cost"][comp], + parameters["lifetime"][comp], + global_settings("status2019")["interest_rate"], + ) + + parameters["capital_cost"]["battery"] = ( + parameters["capital_cost"]["battery inverter"] + + parameters["efficiency"]["battery"]["max_hours"] + * parameters["capital_cost"]["battery storage"] + ) + + # Insert marginal_costs in EUR/MWh + # marginal cost can include fuel, C02 and operation and maintenance costs + parameters["marginal_cost"] = { + "oil": global_settings(scenario)["fuel_costs"]["oil"] + + read_costs(costs, "oil", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["oil"], + "other_non_renewable": global_settings(scenario)["fuel_costs"][ + "gas" + ] + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"][ + "other_non_renewable" + ], + "lignite": global_settings(scenario)["fuel_costs"]["lignite"] + + read_costs(costs, "lignite", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["lignite"], + "coal": global_settings(scenario)["fuel_costs"]["coal"] + + read_costs(costs, "coal", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["coal"], + "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] + + read_costs(costs, "nuclear", "VOM"), + "biomass": global_settings(scenario)["fuel_costs"]["biomass"] + + read_costs(costs, "biomass CHP", "VOM"), + "wind_offshore": read_costs(costs, "offwind", "VOM"), + "wind_onshore": read_costs(costs, "onwind", "VOM"), + "solar": read_costs(costs, "solar", "VOM"), + } + else: print(f"Scenario name {scenario} is not valid.") From 0fc8120f9d3d0ad3b360ff0f035e5395f7635296 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 28 Apr 2023 14:51:40 +0200 Subject: [PATCH 186/787] include status2019 in osmtgmod --- src/egon/data/datasets/osmtgmod/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index eed93bc76..8a325ba2c 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -520,7 +520,7 @@ def to_pypsa(): """ ) - for scenario_name in ["'eGon2035'", "'eGon100RE'"]: + for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: capital_cost = get_sector_parameters( "electricity", scenario_name.replace("'", "") From d78bc2b91ecd740366db505bbbf4b7462eb23850 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 28 Apr 2023 15:53:25 +0200 Subject: [PATCH 187/787] Adjust district heating supply for status2019 --- .../datasets/heat_supply/district_heating.py | 71 +++++++++++-------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/district_heating.py b/src/egon/data/datasets/heat_supply/district_heating.py index a2d2501e6..abc466505 100644 --- a/src/egon/data/datasets/heat_supply/district_heating.py +++ b/src/egon/data/datasets/heat_supply/district_heating.py @@ -161,9 +161,13 @@ def select_district_heating_areas(scenario): def cascade_per_technology( - areas, technologies, capacity_per_category, size_dh, max_geothermal_costs=2 + scenario, + areas, + technologies, + capacity_per_category, + size_dh, + max_geothermal_costs=2, ): - """Add plants of one technology suppliing district heating Parameters @@ -196,7 +200,6 @@ def cascade_per_technology( # Assign CHP plants inside district heating area # TODO: This has to be updaten when all chp plants are available! if tech.index == "CHP": - # Select chp plants from database gdf_chp = db.select_geodataframe( f"""SELECT a.geom, th_capacity as capacity, c.area_id @@ -206,8 +209,8 @@ def cascade_per_technology( {sources['district_heating_areas']['table']} c WHERE a.district_heating = True AND a.district_heating_area_id = c.area_id - AND a.scenario = 'eGon2035' - AND c.scenario = 'eGon2035' + AND a.scenario = '{scenario}' + AND c.scenario = '{scenario}' """ ) @@ -227,7 +230,6 @@ def cascade_per_technology( "heat_pump", "geo_thermal", ]: - if tech.index == "geo_thermal": # Select areas with geothermal potential considering costs gdf_geothermal = calc_geothermal_costs(max_geothermal_costs) @@ -305,26 +307,38 @@ def cascade_heat_supply(scenario, plotting=True): district_heating_areas = select_district_heating_areas(scenario) # Select technolgies per district heating size - map_dh_technologies = { - "small": [ - "CHP", - "solar_thermal_collector", - "heat_pump", - "resistive_heater", - ], - "medium": [ - "CHP", - "solar_thermal_collector", - "heat_pump", - "resistive_heater", - ], - "large": ["CHP", "geo_thermal", "heat_pump", "resistive_heater"], - } + if scenario != "status2019": + map_dh_technologies = { + "small": [ + "CHP", + "solar_thermal_collector", + "heat_pump", + "resistive_heater", + ], + "medium": [ + "CHP", + "solar_thermal_collector", + "heat_pump", + "resistive_heater", + ], + "large": ["CHP", "geo_thermal", "heat_pump", "resistive_heater"], + } - # Assign capacities per district heating category - capacity_per_category = capacity_per_district_heating_category( - district_heating_areas, scenario - ) + # Assign capacities per district heating category + capacity_per_category = capacity_per_district_heating_category( + district_heating_areas, scenario + ) + else: + map_dh_technologies = { + "small": [ + "CHP", + ], + "medium": [ + "CHP", + ], + "large": ["CHP"], + } + capacity_per_category = pd.DataFrame() # Initalize Dataframe for results resulting_capacities = pd.DataFrame( @@ -335,7 +349,6 @@ def cascade_heat_supply(scenario, plotting=True): technology_data = set_technology_data() for size_dh in ["small", "medium", "large"]: - # Select areas in size-category areas = district_heating_areas[ district_heating_areas.category == size_dh @@ -350,9 +363,8 @@ def cascade_heat_supply(scenario, plotting=True): # Assign new supply technologies to district heating areas # as long as the demand is not covered and there are technologies left while (len(technologies) > 0) and (len(areas) > 0): - areas, technologies, append_df = cascade_per_technology( - areas, technologies, capacity_per_category, size_dh + scenario, areas, technologies, capacity_per_category, size_dh ) resulting_capacities = resulting_capacities.append( @@ -392,7 +404,7 @@ def backup_gas_boilers(scenario): return gpd.GeoDataFrame( data={ "district_heating_id": district_heating_areas.index, - "capacity": district_heating_areas.demand.div(8000), + "capacity": district_heating_areas.demand.div(100), "carrier": "gas_boiler", "category": district_heating_areas.category, "geometry": district_heating_areas.geom.centroid, @@ -460,7 +472,6 @@ def backup_resistive_heaters(scenario): def plot_heat_supply(resulting_capacities): - from matplotlib import pyplot as plt district_heating_areas = select_district_heating_areas("eGon2035") From 63b868c678120080f254e90452fa616c816505be Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 28 Apr 2023 15:54:30 +0200 Subject: [PATCH 188/787] Adjust inidvidual heat supply for status2019 --- .../heat_supply/individual_heating.py | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 608a73a7e..9905b9d2c 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -208,7 +208,7 @@ write_table_to_postgres, ) from egon.data.datasets.emobility.motorized_individual_travel.helpers import ( - reduce_mem_usage + reduce_mem_usage, ) from egon.data.datasets.heat_demand import EgonPetaHeat from egon.data.datasets.heat_demand_timeseries.daily import ( @@ -385,7 +385,6 @@ def cascade_per_technology( distribution_level, max_size_individual_chp=0.05, ): - """Add plants for individual heat. Currently only on mv grid district level. @@ -415,7 +414,6 @@ def cascade_per_technology( # Distribute heat pumps linear to remaining demand. if tech.index == "heat_pump": - if distribution_level == "federal_state": # Select target values per federal state target = db.select_dataframe( @@ -467,7 +465,6 @@ def cascade_per_technology( ) elif tech.index == "gas_boiler": - append_df = pd.DataFrame( data={ "capacity": heat_per_mv.remaining_demand.div( @@ -557,11 +554,18 @@ def cascade_heat_supply_indiv(scenario, distribution_level, plotting=True): # Set technology data according to # http://www.wbzu.de/seminare/infopool/infopool-bhkw # TODO: Add gas boilers and solar themal (eGon100RE) - technologies = pd.DataFrame( - index=["heat_pump", "gas_boiler"], - columns=["estimated_flh", "priority"], - data={"estimated_flh": [4000, 8000], "priority": [2, 1]}, - ) + if scenario == "eGon2035": + technologies = pd.DataFrame( + index=["heat_pump", "gas_boiler"], + columns=["estimated_flh", "priority"], + data={"estimated_flh": [4000, 8000], "priority": [2, 1]}, + ) + elif scenario == "status2019": + technologies = pd.DataFrame( + index=["heat_pump"], + columns=["estimated_flh", "priority"], + data={"estimated_flh": [4000], "priority": [2]}, + ) # In the beginning, the remaining demand equals demand heat_per_mv["remaining_demand"] = heat_per_mv["demand"] @@ -816,8 +820,10 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): left=df_peta_demand, right=df_profiles_ids, on="zensus_population_id" ) - df_profile_merge.demand = df_profile_merge.demand.div(df_profile_merge.buildings) - df_profile_merge.drop('buildings', axis='columns', inplace=True) + df_profile_merge.demand = df_profile_merge.demand.div( + df_profile_merge.buildings + ) + df_profile_merge.drop("buildings", axis="columns", inplace=True) # Merge daily demand to daily profile ids by zensus_population_id and day df_profile_merge = pd.merge( @@ -826,8 +832,9 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): on=["zensus_population_id", "day_of_year"], ) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.daily_demand_share) - df_profile_merge.drop('daily_demand_share', axis='columns', inplace=True) + df_profile_merge.daily_demand_share + ) + df_profile_merge.drop("daily_demand_share", axis="columns", inplace=True) df_profile_merge = reduce_mem_usage(df_profile_merge) # Merge daily profiles by profile id @@ -840,10 +847,13 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): df_profile_merge = reduce_mem_usage(df_profile_merge) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.idp.astype(float)) - df_profile_merge.drop('idp', axis='columns', inplace=True) + df_profile_merge.idp.astype(float) + ) + df_profile_merge.drop("idp", axis="columns", inplace=True) - df_profile_merge.rename({'demand': 'demand_ts'}, axis='columns', inplace=True) + df_profile_merge.rename( + {"demand": "demand_ts"}, axis="columns", inplace=True + ) df_profile_merge = reduce_mem_usage(df_profile_merge) @@ -851,7 +861,6 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): def plot_heat_supply(resulting_capacities): - from matplotlib import pyplot as plt mv_grids = db.select_geodataframe( @@ -1425,7 +1434,6 @@ def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): ) if hp_cap_grid > 0.0: - # get buildings with decentral heating systems building_ids = get_buildings_with_decentral_heat_demand_in_mv_grid( mv_grid_id, scenario="eGon100RE" @@ -1486,7 +1494,6 @@ def determine_hp_cap_buildings_eGon100RE(): ) for mvgd_id in mvgd_ids: - logger.info(f"MVGD={mvgd_id} | Start") hp_cap_per_building_100RE = ( @@ -1638,9 +1645,7 @@ def export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec): os.mkdir(folder) if not file.is_file(): logger.info(f"Create {file}") - df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( - file, mode="w", header=True - ) + df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv(file, mode="w", header=True) else: df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( file, mode="a", header=False @@ -1713,7 +1718,6 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -1847,7 +1851,6 @@ def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): df_hp_min_cap_mv_grid_pypsa_eur_sec = pd.Series(dtype="float64") for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### From 355ea78b2b85608122146506385ee7f3351e7af3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 28 Apr 2023 15:55:38 +0200 Subject: [PATCH 189/787] Add status2019 to list of scenarios for heat supply --- .../data/datasets/heat_supply/__init__.py | 133 ++++++++++-------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index f12b151f9..5011beb05 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -82,59 +82,64 @@ def district_heating(): """ ) - supply_2035 = cascade_heat_supply("eGon2035", plotting=False) + for scenario in ["status2019", "eGon2035"]: + supply = cascade_heat_supply(scenario, plotting=False) - supply_2035["scenario"] = "eGon2035" + supply["scenario"] = scenario - supply_2035.to_postgis( - targets["district_heating_supply"]["table"], - schema=targets["district_heating_supply"]["schema"], - con=db.engine(), - if_exists="append", - ) - - # Compare target value with sum of distributed heat supply - df_check = db.select_dataframe( - f""" - SELECT a.carrier, - (SUM(a.capacity) - b.capacity) / SUM(a.capacity) as deviation - FROM {targets['district_heating_supply']['schema']}. - {targets['district_heating_supply']['table']} a, - {sources['scenario_capacities']['schema']}. - {sources['scenario_capacities']['table']} b - WHERE a.scenario = 'eGon2035' - AND b.scenario_name = 'eGon2035' - AND b.carrier = CONCAT('urban_central_', a.carrier) - GROUP BY (a.carrier, b.capacity); - """ - ) - # If the deviation is > 1%, throw an error - assert ( - df_check.deviation.abs().max() < 1 - ), f"""Unexpected deviation between target value and distributed - heat supply: {df_check} - """ - - # Add gas boilers as conventional backup capacities - backup = backup_gas_boilers("eGon2035") - - backup.to_postgis( - targets["district_heating_supply"]["table"], - schema=targets["district_heating_supply"]["schema"], - con=db.engine(), - if_exists="append", - ) - - backup_rh = backup_resistive_heaters("eGon2035") + supply.to_postgis( + targets["district_heating_supply"]["table"], + schema=targets["district_heating_supply"]["schema"], + con=db.engine(), + if_exists="append", + ) - if not backup_rh.empty: - backup_rh.to_postgis( + # Do not check data for status2019 as is it not listed in the table + if scenario != "status2019": + # Compare target value with sum of distributed heat supply + df_check = db.select_dataframe( + f""" + SELECT a.carrier, + (SUM(a.capacity) - b.capacity) / SUM(a.capacity) as deviation + FROM {targets['district_heating_supply']['schema']}. + {targets['district_heating_supply']['table']} a, + {sources['scenario_capacities']['schema']}. + {sources['scenario_capacities']['table']} b + WHERE a.scenario = '{scenario}' + AND b.scenario_name = '{scenario}' + AND b.carrier = CONCAT('urban_central_', a.carrier) + GROUP BY (a.carrier, b.capacity); + """ + ) + # If the deviation is > 1%, throw an error + assert ( + df_check.deviation.abs().max() < 1 + ), f"""Unexpected deviation between target value and distributed + heat supply: {df_check} + """ + + # Add gas boilers as conventional backup capacities + backup = backup_gas_boilers(scenario) + + backup.to_postgis( targets["district_heating_supply"]["table"], schema=targets["district_heating_supply"]["schema"], con=db.engine(), if_exists="append", ) + # Insert resistive heaters which are not available in status2019 + if scenario != "status2019": + backup_rh = backup_resistive_heaters(scenario) + + if not backup_rh.empty: + backup_rh.to_postgis( + targets["district_heating_supply"]["table"], + schema=targets["district_heating_supply"]["schema"], + con=db.engine(), + if_exists="append", + ) + def individual_heating(): """Insert supply for individual heating @@ -146,32 +151,38 @@ def individual_heating(): """ targets = config.datasets()["heat_supply"]["targets"] - db.execute_sql( - f""" - DELETE FROM {targets['individual_heating_supply']['schema']}. - {targets['individual_heating_supply']['table']} - """ - ) + for scenario in ["status2019", "eGon2035"]: + db.execute_sql( + f""" + DELETE FROM {targets['individual_heating_supply']['schema']}. + {targets['individual_heating_supply']['table']} + WHERE scenario = '{scenario}' + """ + ) + if scenario == "eGon2035": + distribution_level = "federal_states" + else: + distribution_level = "national" - supply_2035 = cascade_heat_supply_indiv( - "eGon2035", distribution_level="federal_states", plotting=False - ) + supply = cascade_heat_supply_indiv( + scenario, distribution_level=distribution_level, plotting=False + ) - supply_2035["scenario"] = "eGon2035" + supply["scenario"] = scenario - supply_2035.to_postgis( - targets["individual_heating_supply"]["table"], - schema=targets["individual_heating_supply"]["schema"], - con=db.engine(), - if_exists="append", - ) + supply.to_postgis( + targets["individual_heating_supply"]["table"], + schema=targets["individual_heating_supply"]["schema"], + con=db.engine(), + if_exists="append", + ) class HeatSupply(Dataset): def __init__(self, dependencies): super().__init__( name="HeatSupply", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=( create_tables, From de82c530abd2060454d859e3b28a7a0999a3184d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 28 Apr 2023 15:58:39 +0200 Subject: [PATCH 190/787] Add rural heat pump capacity for status2019 --- src/egon/data/datasets/scenario_capacities.py | 56 +++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index b53659312..7f8790410 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -61,9 +61,14 @@ class ScenarioCapacities(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioCapacities", - version="0.0.12", + version="0.0.13", dependencies=dependencies, - tasks=(create_table, insert_data_nep, eGon100_capacities), + tasks=( + create_table, + insert_capacities_status2019, + insert_data_nep, + eGon100_capacities, + ), ) @@ -85,7 +90,6 @@ def create_table(): def nuts_mapping(): - nuts_mapping = { "BW": "DE1", "NW": "DEA", @@ -108,6 +112,50 @@ def nuts_mapping(): return nuts_mapping +def insert_capacities_status2019(): + """Insert capacity of rural heat pumps for status2019 + + Returns + ------- + None. + + """ + + targets = egon.data.config.datasets()["scenario_input"]["targets"] + + # Delete rows if already exist + db.execute_sql( + f""" + DELETE FROM + {targets['scenario_capacities']['schema']}. + {targets['scenario_capacities']['table']} + WHERE scenario_name = 'status2019' + """ + ) + + # Rural heat capacity for 2019 according to NEP 2035, version 2021 + rural_heat_capacity = 1e6 * 5e-3 + + if settings()["egon-data"]["--dataset-boundary"] != "Everything": + rural_heat_capacity *= population_share() + + db.execute_sql( + f""" + INSERT INTO + {targets['scenario_capacities']['schema']}. + {targets['scenario_capacities']['table']} + (component, carrier, capacity, nuts, scenario_name) + VALUES ( + 'link', + 'residential_rural_heat_pump', + {rural_heat_capacity}, + 'DE', + 'status2019' + ) + """ + ) + + def insert_capacities_per_federal_state_nep(): """Inserts installed capacities per federal state accordning to NEP 2035 (version 2021), scenario 2035 C @@ -176,7 +224,6 @@ def insert_capacities_per_federal_state_nep(): # df_windoff_fs for state in index_list: - df.at["Wind offshore", state] = ( df_windoff_fs.at[state, "C 2035"] / 1000 ) @@ -221,7 +268,6 @@ def insert_capacities_per_federal_state_nep(): ] for bl in map_nuts.index: - data = pd.DataFrame(df[bl]) # if distribution to federal states is not provided, From fb09fe2013ecc957e6e428ba4491b40600faa5e8 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 3 May 2023 09:30:28 +0200 Subject: [PATCH 191/787] use Black, Flake8 and isort --- src/egon/data/datasets/fix_ehv_subnetworks.py | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 53544a7cd..6282f8c10 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -21,7 +21,6 @@ def __init__(self, dependencies): def select_bus_id(x, y, v_nom, scn_name, carrier): - bus_id = db.select_dataframe( f""" SELECT bus_id @@ -65,7 +64,7 @@ def add_bus(x, y, v_nom, scn_name): def drop_bus(x, y, v_nom, scn_name): bus = select_bus_id(x, y, v_nom, scn_name, carrier="AC") - if bus != None: + if bus is not None: db.execute_sql( f""" DELETE FROM grid.egon_etrago_bus @@ -121,7 +120,7 @@ def drop_line(x0, y0, x1, y1, v_nom, scn_name): bus0 = select_bus_id(x0, y0, v_nom, scn_name, carrier="AC") bus1 = select_bus_id(x1, y1, v_nom, scn_name, carrier="AC") - if (bus0 != None) and (bus1 != None): + if (bus0 is not None) and (bus1 is not None): db.execute_sql( f""" DELETE FROM grid.egon_etrago_line @@ -135,7 +134,6 @@ def drop_line(x0, y0, x1, y1, v_nom, scn_name): def add_trafo(x, y, v_nom0, v_nom1, scn_name, n=1): - bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC") bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC") @@ -169,11 +167,10 @@ def add_trafo(x, y, v_nom0, v_nom1, scn_name, n=1): def drop_trafo(x, y, v_nom0, v_nom1, scn_name): - bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC") bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC") - if (bus0 != None) and (bus1 != None): + if (bus0 is not None) and (bus1 is not None): db.execute_sql( f""" DELETE FROM grid.egon_etrago_transformer @@ -186,7 +183,6 @@ def drop_trafo(x, y, v_nom0, v_nom1, scn_name): def fix_subnetworks(scn_name): - # Missing 220kV line to Lübeck Siems # add 220kV bus at substation Lübeck Siems add_bus(10.760835327266625, 53.90974536547805, 220, scn_name) @@ -218,7 +214,6 @@ def fix_subnetworks(scn_name): # ) if settings()["egon-data"]["--dataset-boundary"] == "Everything": - # Missing line from USW Uchtelfangen to 'Kraftwerk Weiher' add_line( 7.032657738999395, # Kraftwerk Weiher @@ -229,24 +224,32 @@ def fix_subnetworks(scn_name): scn_name, 6, ) - + # Missing line from Umspannwerk Plottling to Gänsdorf UW add_line( - 12,853318030996972, # Umspannwerk Plottling - 48,76508569478315, - 12,769768646403532, # Gänsdorf UW - 48,80533685376445, + 12, + 853318030996972, # Umspannwerk Plottling + 48, + 76508569478315, + 12, + 769768646403532, # Gänsdorf UW + 48, + 80533685376445, 380, scn_name, 3, ) - + # Missing line inside Ottstedt add_line( - 11,4295305, # Ottstedt - 50,9115176, - 11,4299277, # Ottstedt - 50,9114496, + 11, + 4295305, # Ottstedt + 50, + 9115176, + 11, + 4299277, # Ottstedt + 50, + 9114496, 380, scn_name, 3, @@ -390,14 +393,12 @@ def fix_subnetworks(scn_name): # drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) # drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) - # # Umspannwerk Waldlaubersheim # # delete isolated bus and trafo # drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) # drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) - def run(): fix_subnetworks("eGon2035") fix_subnetworks("eGon100RE") From 0a47261ab73b28a2bf00062edaf231967275d02f Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 3 May 2023 13:48:58 +0200 Subject: [PATCH 192/787] Add a few words for better understanding --- src/egon/data/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index 79cfee53e..10922ce05 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -168,7 +168,7 @@ default=["status2019", "eGon2035"], metavar="SCENARIOS", help=( - "List of scenario names." + "List of scenario names for which a data model shall be created." ), show_default=True, ) From c4dfc62e088ec41fdf97ed2b0cb3a8c4cd7301d4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 3 May 2023 14:56:28 +0200 Subject: [PATCH 193/787] Access 'Inbetriebnahmedatum' from mastr_new parameters --- src/egon/data/datasets/chp/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index b815b4b4d..001fc146e 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -341,10 +341,16 @@ def insert_chp_statusquo(): mastr.DatumEndgueltigeStilllegung = pd.to_datetime( mastr.DatumEndgueltigeStilllegung ) - mastr = mastr.loc[mastr.Inbetriebnahmedatum <= "2019-12-31"] + mastr = mastr.loc[ + mastr.Inbetriebnahmedatum + <= config.datasets()["mastr_new"]["status2019_date_max"] + ] mastr = mastr.loc[ - (mastr.DatumEndgueltigeStilllegung >= "2019-12-31") + ( + mastr.DatumEndgueltigeStilllegung + >= config.datasets()["mastr_new"]["status2019_date_max"] + ) | (mastr.DatumEndgueltigeStilllegung.isnull()) ] From 6d108a7255c757678dd4a154c4d83e28249afe91 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 3 May 2023 16:51:02 +0200 Subject: [PATCH 194/787] Fix key name for scenarios in cli parameters --- src/egon/data/datasets/demandregio/__init__.py | 4 ++-- src/egon/data/datasets/heat_demand/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index d287179d0..1ebc4bbc0 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -600,7 +600,7 @@ def insert_household_demand(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in egon.data.config.settings()["egon-data"]["scenarios"]: + for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: year = scenario_parameters.global_settings(scn)["population_year"] @@ -629,7 +629,7 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in egon.data.config.settings()["egon-data"]["scenarios"]: + for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: year = scenario_parameters.global_settings(scn)["population_year"] diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index dd41c864f..6cf9ab8d6 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -836,12 +836,12 @@ def scenario_data_import(): unzip_peta5_0_1_heat_demands() cutout_heat_demand_germany() # Specifiy the scenario names for loading factors from csv file - for scenario in egon.data.config.settings()["egon-data"]["scenarios"]: + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: future_heat_demand_germany(scenario) # future_heat_demand_germany("eGon2015") heat_demand_to_db_table() - for scenario in egon.data.config.settings()["egon-data"]["scenarios"]: + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: adjust_residential_heat_to_zensus(scenario) # future_heat_demand_germany("eGon2015") From a4dd369747b662e5d2eb5b4ff3bc84f6097a0f4d Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 4 May 2023 08:56:54 +0200 Subject: [PATCH 195/787] fix incorrect points format and delete comments --- src/egon/data/datasets/fix_ehv_subnetworks.py | 181 +----------------- 1 file changed, 8 insertions(+), 173 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 6282f8c10..396deb8cf 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -200,19 +200,6 @@ def fix_subnetworks(scn_name): 3, ) - # # Missing 220kV line from Audorf to Kiel - # add_line( - # # Audorf - # 9.726992766257577, - # 54.291420962253234, - # # Kiel - # 9.9572075, - # 54.321589, - # 220, - # scn_name, - # 6, - # ) - if settings()["egon-data"]["--dataset-boundary"] == "Everything": # Missing line from USW Uchtelfangen to 'Kraftwerk Weiher' add_line( @@ -227,14 +214,10 @@ def fix_subnetworks(scn_name): # Missing line from Umspannwerk Plottling to Gänsdorf UW add_line( - 12, - 853318030996972, # Umspannwerk Plottling - 48, - 76508569478315, - 12, - 769768646403532, # Gänsdorf UW - 48, - 80533685376445, + 12.853318030996972, # Umspannwerk Plottling + 48.76508569478315, + 12.769768646403532, # Gänsdorf UW + 48.80533685376445, 380, scn_name, 3, @@ -242,163 +225,15 @@ def fix_subnetworks(scn_name): # Missing line inside Ottstedt add_line( - 11, - 4295305, # Ottstedt - 50, - 9115176, - 11, - 4299277, # Ottstedt - 50, - 9114496, + 11.4295305, # Ottstedt + 50.9115176, + 11.4299277, # Ottstedt + 50.9114496, 380, scn_name, 3, ) - # # Missing 380kV line near Elsfleth - # add_line( - # # Line - # 8.419326700000001, - # 53.229867000000006, - # # Schaltanlage Elsfleth/West - # 8.402976949446648, - # 53.2371468322213, - # 380, - # scn_name, - # 6, - # ) - - # # Missing 380kV line near Magdala - # add_line( - # # Line north south - # 11.4298432, - # 50.9117467, - # # Line east - # 11.4295305, - # 50.9115176, - # 380, - # scn_name, - # 3, - # ) - - # Missing 220kV line near Frimmersdorf - # add_line( - # # Line west - # 6.585418000000001, - # 51.0495723, - # # Line east - # 6.5867616, - # 51.0520915, - # 220, - # scn_name, - # 6, - # ) - - # # Missing 220kV line from Wolmirstedt to Stendal - # add_line( - # # Wolmirstedt - # 11.637225336209951, - # 52.26707328151311, - # # Stendal - # 11.7689, - # 52.505533, - # 220, - # scn_name, - # 6, - # ) - - # Plattling - # Update way for osmTGmod in - # 'LINESTRING (12.85328076018362 48.76616932172957, - # 12.85221826521118 48.76597882857125, - # 12.85092755963579 48.76451816626182, - # 12.85081583430311 48.76336597271223, - # 12.85089191559093 48.76309793961921, - # 12.85171674549663 48.76313124988151, - # 12.85233496021983 48.76290980724934, - # 12.85257485139349 48.76326650768988, - # 12.85238077788078 48.76354965879587, - # 12.85335698387775 48.76399030383004, - # 12.85444925633996 48.76422235417385, - # 12.853289544662 48.76616304929393)' - - # # Lamspringe 380kV lines - # drop_line( - # 9.988215035677026, - # 51.954230057487926, - # 9.991477300000001, - # 51.939711, - # 380, - # scn_name, - # ) - - # drop_line( - # 9.995589, - # 51.969716000000005, - # 9.988215035677026, - # 51.954230057487926, - # 380, - # scn_name, - # ) - - # drop_line( - # 9.982829, - # 51.985980000000005, - # 9.995589, - # 51.969716000000005, - # 380, - # scn_name, - # ) - - # drop_line( - # 10.004865, - # 51.999120000000005, - # 9.982829, - # 51.985980000000005, - # 380, - # scn_name, - # ) - - # drop_line( - # 10.174395, - # 52.036448, - # 9.988215035677026, - # 51.954230057487926, - # 380, - # scn_name, - # ) - - # drop_line( - # 10.195144702845797, - # 52.079851837273964, - # 10.174395, - # 52.036448, - # 380, - # scn_name, - # ) - - # drop_trafo(9.988215035677026, 51.954230057487926, 110, 380, scn_name) - - # drop_bus(9.988215035677026, 51.954230057487926, 380, scn_name) - # drop_bus(9.991477300000001, 51.939711, 380, scn_name) - # drop_bus(9.995589, 51.969716000000005, 380, scn_name) - # drop_bus(9.982829, 51.985980000000005, 380, scn_name) - # drop_bus(10.174395, 52.036448, 380, scn_name) - # drop_bus(10.195144702845797, 52.079851837273964, 380, scn_name) - - # drop_bus(10.004865, 51.999120000000005, 380, scn_name) - - # Umspannwerk Vieselbach - # delete isolated bus and trafo - # drop_trafo(11.121774798935334, 51.00038603925895, 220, 380, scn_name) - # drop_bus(11.121774798935334, 51.00038603925895, 380, scn_name) - - # # Umspannwerk Waldlaubersheim - # # delete isolated bus and trafo - # drop_trafo(7.815993836091339, 49.92211102637183, 110, 380, scn_name) - # drop_bus(7.815993836091339, 49.92211102637183, 380, scn_name) - - def run(): fix_subnetworks("eGon2035") fix_subnetworks("eGon100RE") From bbb6aaeff58eb52e627c2be87bec658e03396b95 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 4 May 2023 12:07:11 +0200 Subject: [PATCH 196/787] delete unnecessary data in scenario parameters --- .../scenario_parameters/parameters.py | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index ef7d6e741..552bc8cf5 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -129,24 +129,6 @@ def global_settings(scenario): parameters = { "weather_year": 2019, "population_year": 2019, - "fuel_costs": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 39, table 6 - "oil": 73.8, # [EUR/MWh] - "gas": 25.6, # [EUR/MWh] - "coal": 20.2, # [EUR/MWh] - "lignite": 4.0, # [EUR/MWh] - "nuclear": 1.7, # [EUR/MWh] - "biomass": 40, # Dummyvalue, ToDo: Find a suitable source - }, - "co2_costs": 76.5, # [EUR/t_CO2] - "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 - "waste": 0.165, # [t_CO2/MW_th] - "lignite": 0.393, # [t_CO2/MW_th] - "gas": 0.201, # [t_CO2/MW_th] - "nuclear": 0.0, # [t_CO2/MW_th] - "oil": 0.288, # [t_CO2/MW_th] - "coal": 0.335, # [t_CO2/MW_th] - "other_non_renewable": 0.268, # [t_CO2/MW_th] - }, "interest_rate": 0.05, # [p.u.] } @@ -631,38 +613,6 @@ def electricity(scenario): * parameters["capital_cost"]["battery storage"] ) - # Insert marginal_costs in EUR/MWh - # marginal cost can include fuel, C02 and operation and maintenance costs - parameters["marginal_cost"] = { - "oil": global_settings(scenario)["fuel_costs"]["oil"] - + read_costs(costs, "oil", "VOM") - + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["oil"], - "other_non_renewable": global_settings(scenario)["fuel_costs"][ - "gas" - ] - + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"][ - "other_non_renewable" - ], - "lignite": global_settings(scenario)["fuel_costs"]["lignite"] - + read_costs(costs, "lignite", "VOM") - + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["lignite"], - "coal": global_settings(scenario)["fuel_costs"]["coal"] - + read_costs(costs, "coal", "VOM") - + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["coal"], - "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] - + read_costs(costs, "nuclear", "VOM"), - "biomass": global_settings(scenario)["fuel_costs"]["biomass"] - + read_costs(costs, "biomass CHP", "VOM"), - "wind_offshore": read_costs(costs, "offwind", "VOM"), - "wind_onshore": read_costs(costs, "onwind", "VOM"), - "solar": read_costs(costs, "solar", "VOM"), - } - - else: print(f"Scenario name {scenario} is not valid.") From 26c65c4541b946d15b8a9235b3a667d822946f48 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 4 May 2023 14:23:55 +0200 Subject: [PATCH 197/787] created to functions to retrieve demand and generation data from entso-e transparency platform --- setup.py | 3 + .../data/datasets/electrical_neighbours.py | 82 +++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/setup.py b/setup.py index c073ae376..a70d87d64 100755 --- a/setup.py +++ b/setup.py @@ -86,11 +86,13 @@ def read(*names, **kwargs): "atlite==0.2.5", "cdsapi", "click", + "entsoe-py >=0.3.1", "geopandas>=0.10.0,<0.11.0", "geopy", "geovoronoi==0.3.0", "importlib-resources", "loguru", + "logging", "markupsafe<2.1.0", # MarkupSafe>=2.1.0 breaks WTForms<3 "matplotlib", "netcdf4", @@ -104,6 +106,7 @@ def read(*names, **kwargs): "pyaml", "pypsa==0.17.1", "rasterio", + "requests", "rioxarray", "rtree", "saio", diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b1fa1ccb3..7e09d8ec5 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -3,6 +3,10 @@ import zipfile +import entsoe +import requests +import logging + import geopandas as gpd import pandas as pd from shapely.geometry import LineString @@ -15,6 +19,7 @@ from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.scenario_parameters import get_sector_parameters +logger = logging.getLogger(__name__) class ElectricalNeighbours(Dataset): def __init__(self, dependencies): @@ -1276,3 +1281,80 @@ def tyndp_demand(): session.add(entry) session.add(entry_ts) session.commit() + +def entsoe_historic_generation_capacities(entsoe_token=None, year_start="20190101", year_end="20200101"): + client = entsoe.EntsoePandasClient(api_key=entsoe_token) + + start = pd.Timestamp(year_start, tz="Europe/Brussels") + end = pd.Timestamp(year_end, tz="Europe/Brussels") + start_gb = pd.Timestamp(year_start, tz="Europe/London") + end_gb = pd.Timestamp(year_end, tz="Europe/London") + countries= ["LU", "AT", "FR", "NL", + "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] + + + + # todo: define wanted countries + + + not_retrieved = [] + dfs = [] + for country in countries: + if country == 'GB': + kwargs = dict(start=start_gb, end=end_gb) + else: + kwargs = dict(start=start, end=end) + try: + dfs.append( + client.query_installed_generation_capacity(country, **kwargs) + ) + + except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): + not_retrieved.append(country) + pass + + if not_retrieved: + logger.warning( + f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." + ) + df = pd.concat(dfs) + df['country']=countries + df.set_index('country', inplace=True) + df.fillna(0, inplace=True) + return df + +def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="20200101"): + client = entsoe.EntsoePandasClient(api_key=entsoe_token) + + start = pd.Timestamp(year_start, tz="Europe/Brussels") + end = pd.Timestamp(year_end, tz="Europe/Brussels") + start_gb = pd.Timestamp(year_start, tz="Europe/London") + end_gb = pd.Timestamp(year_end, tz="Europe/London") + countries= ["LU", "AT", "FR", "NL", + "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] + + + + # todo: define wanted countries + + + not_retrieved = [] + dfs = [] + for country in countries: + if country == 'GB': + kwargs = dict(start=start_gb, end=end_gb) + else: + kwargs = dict(start=start, end=end) + try: + dfs.append(client.query_load(country, **kwargs)) + except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): + not_retrieved.append(country) + pass + if not_retrieved: + logger.warning( + f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." + ) + df = pd.concat(dfs, axis=1) + df.columns = countries + df.fillna(0, inplace=True) + return df From 4638536eeb19efbeabae664ab5ae0f7581fb2ea7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 15:20:59 +0200 Subject: [PATCH 198/787] Add status2019 to etrago_heat dataset --- .../data/datasets/heat_etrago/__init__.py | 59 +++++++++---------- .../datasets/heat_etrago/power_to_heat.py | 47 +++++++-------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/egon/data/datasets/heat_etrago/__init__.py b/src/egon/data/datasets/heat_etrago/__init__.py index 9004de2d3..137e57ff8 100644 --- a/src/egon/data/datasets/heat_etrago/__init__.py +++ b/src/egon/data/datasets/heat_etrago/__init__.py @@ -183,10 +183,10 @@ def insert_store(scenario, carrier): "bus0": dh_bus.bus_id, "bus1": water_tank_bus.bus_id, "carrier": carrier + "_store_charger", - "efficiency": get_sector_parameters("heat", "eGon2035")[ + "efficiency": get_sector_parameters("heat", scenario)[ "efficiency" ]["water_tank_charger"], - "marginal_cost": get_sector_parameters("heat", "eGon2035")[ + "marginal_cost": get_sector_parameters("heat", scenario)[ "marginal_cost" ]["water_tank_charger"], "p_nom_extendable": True, @@ -211,10 +211,10 @@ def insert_store(scenario, carrier): "bus0": water_tank_bus.bus_id, "bus1": dh_bus.bus_id, "carrier": carrier + "_store_discharger", - "efficiency": get_sector_parameters("heat", "eGon2035")[ + "efficiency": get_sector_parameters("heat", scenario)[ "efficiency" ]["water_tank_discharger"], - "marginal_cost": get_sector_parameters("heat", "eGon2035")[ + "marginal_cost": get_sector_parameters("heat", scenario)[ "marginal_cost" ]["water_tank_discharger"], "p_nom_extendable": True, @@ -238,10 +238,10 @@ def insert_store(scenario, carrier): "scn_name": scenario, "bus": water_tank_bus.bus_id, "carrier": carrier + "_store", - "capital_cost": get_sector_parameters("heat", "eGon2035")[ + "capital_cost": get_sector_parameters("heat", scenario)[ "capital_cost" ][f"{carrier.split('_')[0]}_water_tank"], - "lifetime": get_sector_parameters("heat", "eGon2035")["lifetime"][ + "lifetime": get_sector_parameters("heat", scenario)["lifetime"][ f"{carrier.split('_')[0]}_water_tank" ], "e_nom_extendable": True, @@ -266,13 +266,13 @@ def store(): insert_store("eGon2035", "rural_heat") -def insert_central_direct_heat(scenario="eGon2035"): +def insert_central_direct_heat(scenario): """Insert renewable heating technologies (solar and geo thermal) Parameters ---------- - scenario : str, optional - Name of the scenario The default is 'eGon2035'. + scenario : str + Name of the scenario Returns ------- @@ -405,13 +405,13 @@ def insert_central_direct_heat(scenario="eGon2035"): ) -def insert_central_gas_boilers(scenario="eGon2035"): +def insert_central_gas_boilers(scenario): """Inserts gas boilers for district heating to eTraGo-table Parameters ---------- - scenario : str, optional - Name of the scenario. The default is 'eGon2035'. + scenario : str + Name of the scenario. Returns ------- @@ -456,11 +456,11 @@ def insert_central_gas_boilers(scenario="eGon2035"): central_boilers = link_geom_from_buses(central_boilers, scenario) # Add efficiency and marginal costs of gas boilers - central_boilers["efficiency"] = get_sector_parameters("heat", "eGon2035")[ + central_boilers["efficiency"] = get_sector_parameters("heat", scenario)[ "efficiency" ]["central_gas_boiler"] central_boilers["marginal_cost"] = get_sector_parameters( - "heat", "eGon2035" + "heat", scenario )["marginal_cost"]["central_gas_boiler"] # Transform thermal capacity to CH4 installed capacity @@ -486,13 +486,13 @@ def insert_central_gas_boilers(scenario="eGon2035"): ) -def insert_rural_gas_boilers(scenario="eGon2035"): +def insert_rural_gas_boilers(scenario): """Inserts gas boilers for individual heating to eTraGo-table Parameters ---------- - scenario : str, optional - Name of the scenario. The default is 'eGon2035'. + scenario : str + Name of the scenario. Returns ------- @@ -549,7 +549,7 @@ def insert_rural_gas_boilers(scenario="eGon2035"): rural_boilers = link_geom_from_buses(rural_boilers, scenario) # Add efficiency of gas boilers - rural_boilers["efficiency"] = get_sector_parameters("heat", "eGon2035")[ + rural_boilers["efficiency"] = get_sector_parameters("heat", scenario)[ "efficiency" ]["rural_gas_boiler"] @@ -587,11 +587,9 @@ def buses(): None. """ - - insert_buses("central_heat", scenario="eGon2035") - insert_buses("rural_heat", scenario="eGon2035") - insert_buses("central_heat", scenario="eGon100RE") - insert_buses("rural_heat", scenario="eGon100RE") + for scenario in ["status2019", "eGon2035", "eGon100RE"]: + insert_buses("central_heat", scenario) + insert_buses("rural_heat", scenario) def supply(): @@ -606,19 +604,20 @@ def supply(): """ - insert_central_direct_heat(scenario="eGon2035") - insert_central_power_to_heat(scenario="eGon2035") - insert_individual_power_to_heat(scenario="eGon2035") - - # insert_rural_gas_boilers(scenario="eGon2035") - insert_central_gas_boilers(scenario="eGon2035") + for scenario in ["status2019", "eGon2035", "eGon100RE"]: + # There is no direct heat in status2019 scenario + if scenario != "status2019": + insert_central_direct_heat(scenario) + insert_central_power_to_heat(scenario) + insert_individual_power_to_heat(scenario) + insert_central_gas_boilers(scenario) class HeatEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="HeatEtrago", - version="0.0.10", + version="0.0.11", dependencies=dependencies, tasks=(buses, supply, store), ) diff --git a/src/egon/data/datasets/heat_etrago/power_to_heat.py b/src/egon/data/datasets/heat_etrago/power_to_heat.py index d32f09459..70b696f1e 100644 --- a/src/egon/data/datasets/heat_etrago/power_to_heat.py +++ b/src/egon/data/datasets/heat_etrago/power_to_heat.py @@ -9,13 +9,13 @@ from egon.data.datasets.scenario_parameters import get_sector_parameters -def insert_individual_power_to_heat(scenario="eGon2035"): +def insert_individual_power_to_heat(scenario): """Insert power to heat into database Parameters ---------- scenario : str, optional - Name of the scenario The default is 'eGon2035'. + Name of the scenario. Returns ------- @@ -90,7 +90,7 @@ def insert_individual_power_to_heat(scenario="eGon2035"): heat_pumps["voltage_level"] = 7 # Set marginal_cost - heat_pumps["marginal_cost"] = get_sector_parameters("heat", "eGon2035")[ + heat_pumps["marginal_cost"] = get_sector_parameters("heat", scenario)[ "marginal_cost" ]["rural_heat_pump"] @@ -99,17 +99,17 @@ def insert_individual_power_to_heat(scenario="eGon2035"): heat_pumps, carrier="rural_heat_pump", multiple_per_mv_grid=False, - scenario="eGon2035", + scenario=scenario, ) -def insert_central_power_to_heat(scenario="eGon2035"): +def insert_central_power_to_heat(scenario): """Insert power to heat in district heating areas into database Parameters ---------- - scenario : str, optional - Name of the scenario The default is 'eGon2035'. + scenario : str + Name of the scenario. Returns ------- @@ -182,7 +182,7 @@ def insert_central_power_to_heat(scenario="eGon2035"): # Set marginal_cost central_heat_pumps["marginal_cost"] = get_sector_parameters( - "heat", "eGon2035" + "heat", scenario )["marginal_cost"]["central_heat_pump"] # Insert heatpumps in mv and below @@ -190,14 +190,14 @@ def insert_central_power_to_heat(scenario="eGon2035"): insert_power_to_heat_per_level( central_heat_pumps[central_heat_pumps.voltage_level > 3], multiple_per_mv_grid=False, - scenario="eGon2035", + scenario=scenario, ) # Insert heat pumps in hv grid # (as many hvmv substations as intersect with district heating grid) insert_power_to_heat_per_level( central_heat_pumps[central_heat_pumps.voltage_level < 3], multiple_per_mv_grid=True, - scenario="eGon2035", + scenario=scenario, ) # Delete existing entries @@ -242,7 +242,7 @@ def insert_central_power_to_heat(scenario="eGon2035"): # Set efficiency central_resistive_heater["efficiency"] = get_sector_parameters( - "heat", "eGon2035" + "heat", scenario )["efficiency"]["central_resistive_heater"] # Insert heatpumps in mv and below @@ -261,7 +261,7 @@ def insert_central_power_to_heat(scenario="eGon2035"): ], multiple_per_mv_grid=False, carrier="central_resistive_heater", - scenario="eGon2035", + scenario=scenario, ) # Insert heat pumps in hv grid # (as many hvmv substations as intersect with district heating grid) @@ -269,15 +269,15 @@ def insert_central_power_to_heat(scenario="eGon2035"): central_resistive_heater[central_resistive_heater.voltage_level < 3], multiple_per_mv_grid=True, carrier="central_resistive_heater", - scenario="eGon2035", + scenario=scenario, ) def insert_power_to_heat_per_level( heat_pumps, multiple_per_mv_grid, - carrier="central_heat_pump", - scenario="eGon2035", + carrier, + scenario, ): """Insert power to heat plants per grid level @@ -287,8 +287,8 @@ def insert_power_to_heat_per_level( Heat pumps in selected grid level multiple_per_mv_grid : boolean Choose if one district heating areas is supplied by one hvmv substation - scenario : str, optional - Name of the scenario The default is 'eGon2035'. + scenario : str + Name of the scenario. Returns ------- @@ -300,7 +300,8 @@ def insert_power_to_heat_per_level( if "central" in carrier: # Calculate heat pumps per electrical bus - gdf = assign_electrical_bus(heat_pumps, carrier, multiple_per_mv_grid) + gdf = assign_electrical_bus( + heat_pumps, carrier, scenario, multiple_per_mv_grid) else: gdf = heat_pumps.copy() @@ -433,7 +434,7 @@ def assign_voltage_level(heat_pumps, carrier="heat_pump"): return heat_pumps -def assign_electrical_bus(heat_pumps, carrier, multiple_per_mv_grid=False): +def assign_electrical_bus(heat_pumps, carrier, scenario, multiple_per_mv_grid=False): """Calculates heat pumps per electrical bus Parameters @@ -464,8 +465,8 @@ def assign_electrical_bus(heat_pumps, carrier, multiple_per_mv_grid=False): {sources['district_heating_areas']['table']} ON ST_Transform(ST_Centroid(geom_polygon), 4326) = geom WHERE carrier = 'central_heat' - AND scenario='eGon2035' - AND scn_name = 'eGon2035' + AND scenario='{scenario}' + AND scn_name = '{scenario}' """, index_col="id", ) @@ -495,8 +496,8 @@ def assign_electrical_bus(heat_pumps, carrier, multiple_per_mv_grid=False): JOIN society.destatis_zensus_population_per_ha ON society.destatis_zensus_population_per_ha.id = a.zensus_population_id - WHERE a.scenario = 'eGon2035' - AND b.scenario = 'eGon2035' + WHERE a.scenario = '{scenario}' + AND b.scenario = '{scenario}' GROUP BY (area_id, a.zensus_population_id, geom_point) """, epsg=4326, From a177e5ca3445aebad88b61b9debd47d134f526a9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 15:21:35 +0200 Subject: [PATCH 199/787] Add heat demand data for status2019 --- .../data/datasets/heat_etrago/hts_etrago.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/heat_etrago/hts_etrago.py b/src/egon/data/datasets/heat_etrago/hts_etrago.py index 7777baa41..add44421c 100644 --- a/src/egon/data/datasets/heat_etrago/hts_etrago.py +++ b/src/egon/data/datasets/heat_etrago/hts_etrago.py @@ -7,11 +7,10 @@ import numpy as np -def hts_to_etrago(): +def hts_to_etrago(scenario): sources = config.datasets()["etrago_heat"]["sources"] targets = config.datasets()["etrago_heat"]["targets"] - scenario = "eGon2035" carriers = ["central_heat", "rural_heat", "rural_gas_boiler"] for carrier in carriers: @@ -90,7 +89,7 @@ def hts_to_etrago(): else: - efficiency_gas_boiler = get_sector_parameters("heat", "eGon2035")[ + efficiency_gas_boiler = get_sector_parameters("heat", scenario)[ "efficiency" ]["rural_gas_boiler"] @@ -209,12 +208,22 @@ def hts_to_etrago(): index=False, ) +def demand(): + """ Insert demand timeseries for heat into eTraGo tables + + Returns + ------- + None. + + """ + for scenario in ["status2019", "eGon2035", "eGon100RE"]: + hts_to_etrago(scenario) class HtsEtragoTable(Dataset): def __init__(self, dependencies): super().__init__( name="HtsEtragoTable", - version="0.0.6", + version="0.0.7", dependencies=dependencies, - tasks=(hts_to_etrago,), + tasks=(demand), ) From e2a97964ba1c08203c921df36a12adc4f5800164 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 15:22:45 +0200 Subject: [PATCH 200/787] Add heat supply parameters for status2019 --- .../scenario_parameters/parameters.py | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 0fee56661..f2edefc1c 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -7,7 +7,6 @@ def read_csv(year): - source = egon.data.config.datasets()["pypsa-technology-data"]["targets"][ "data_dir" ] @@ -16,7 +15,6 @@ def read_csv(year): def read_costs(df, technology, parameter, value_only=True): - result = df.loc[ (df.technology == technology) & (df.parameter == parameter) ].squeeze() @@ -153,7 +151,6 @@ def electricity(scenario): """ if scenario == "eGon2035": - costs = read_csv(2035) parameters = {"grid_topology": "Status Quo"} @@ -325,7 +322,6 @@ def electricity(scenario): } elif scenario == "eGon100RE": - costs = read_csv(2050) parameters = {"grid_topology": "Status Quo"} @@ -470,7 +466,7 @@ def electricity(scenario): elif scenario == "eGon2021": parameters = {} - + elif scenario == "status2019": parameters = {} @@ -496,7 +492,6 @@ def gas(scenario): """ if scenario == "eGon2035": - costs = read_csv(2035) parameters = { @@ -572,7 +567,6 @@ def gas(scenario): } elif scenario == "eGon100RE": - costs = read_csv(2050) interest_rate = 0.07 # [p.u.] @@ -650,14 +644,12 @@ def gas(scenario): parameters["capital_cost"] = {} for comp in parameters["overnight_cost"].keys(): - parameters["capital_cost"][comp] = ( - annualize_capital_costs( - parameters["overnight_cost"][comp], - parameters["lifetime"][comp], - interest_rate, - ) - + parameters["overnight_cost"][comp] - * (parameters["FOM"][comp] / 100) + parameters["capital_cost"][comp] = annualize_capital_costs( + parameters["overnight_cost"][comp], + parameters["lifetime"][comp], + interest_rate, + ) + parameters["overnight_cost"][comp] * ( + parameters["FOM"][comp] / 100 ) for comp in ["H2_to_power", "H2_to_CH4"]: @@ -679,7 +671,7 @@ def gas(scenario): elif scenario == "eGon2021": parameters = {} - + elif scenario == "status2019": parameters = { "main_gas_carrier": "CH4", @@ -768,7 +760,7 @@ def mobility(scenario): elif scenario == "eGon2021": parameters = {} - + elif scenario == "status2019": parameters = { "motorized_individual_travel": { @@ -785,7 +777,6 @@ def mobility(scenario): } } - else: print(f"Scenario name {scenario} is not valid.") parameters = dict() @@ -809,7 +800,6 @@ def heat(scenario): """ if scenario == "eGon2035": - costs = read_csv(2035) parameters = { @@ -898,12 +888,35 @@ def heat(scenario): elif scenario == "eGon2021": parameters = {} - + elif scenario == "status2019": parameters = { - "DE_demand_residential_TJ": 1658400+383300, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) - "DE_demand_service_TJ": 567300+71500, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) - "DE_district_heating_share": (189760+38248)/(1658400+383300+567300+71500), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) + "DE_demand_residential_TJ": 1658400 + + 383300, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) + "DE_demand_service_TJ": 567300 + + 71500, # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf) + "DE_district_heating_share": (189760 + 38248) + / ( + 1658400 + 383300 + 567300 + 71500 + ), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) + } + + costs = read_csv(2020) + + # Insert marginal_costs in EUR/MWh + # marginal cost can include fuel, C02 and operation and maintenance costs + parameters["marginal_cost"] = { + "central_heat_pump": read_costs( + costs, "central air-sourced heat pump", "VOM" + ), + "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"), + "central_gas_boiler": read_costs( + costs, "central gas boiler", "VOM" + ), + "central_resistive_heater": read_costs( + costs, "central resistive heater", "VOM" + ), + "rural_heat_pump": 0, # Danish Energy Agency, Technology Data for Individual Heating Plants } else: From e052dae0714e3b8988bc429c777e79a0423cef6d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 17:17:30 +0200 Subject: [PATCH 201/787] Update weather yearo --- src/egon/data/datasets/heat_etrago/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_etrago/__init__.py b/src/egon/data/datasets/heat_etrago/__init__.py index 137e57ff8..a3161f45c 100644 --- a/src/egon/data/datasets/heat_etrago/__init__.py +++ b/src/egon/data/datasets/heat_etrago/__init__.py @@ -372,7 +372,7 @@ def insert_central_direct_heat(scenario): FROM {sources['feedin_timeseries']['schema']}. {sources['feedin_timeseries']['table']} WHERE carrier = 'solar_thermal' - AND weather_year = 2011 + AND weather_year = 2019 """, index_col="w_id", ) From 1e814ccaae70ed246d08af064898e5d64dd9c77b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 17:17:58 +0200 Subject: [PATCH 202/787] Add missing carrier parameter --- src/egon/data/datasets/heat_etrago/power_to_heat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/heat_etrago/power_to_heat.py b/src/egon/data/datasets/heat_etrago/power_to_heat.py index 70b696f1e..8d7cc3bb5 100644 --- a/src/egon/data/datasets/heat_etrago/power_to_heat.py +++ b/src/egon/data/datasets/heat_etrago/power_to_heat.py @@ -190,6 +190,7 @@ def insert_central_power_to_heat(scenario): insert_power_to_heat_per_level( central_heat_pumps[central_heat_pumps.voltage_level > 3], multiple_per_mv_grid=False, + carrier = "central_heat_pump", scenario=scenario, ) # Insert heat pumps in hv grid @@ -197,6 +198,7 @@ def insert_central_power_to_heat(scenario): insert_power_to_heat_per_level( central_heat_pumps[central_heat_pumps.voltage_level < 3], multiple_per_mv_grid=True, + carrier = "central_heat_pump", scenario=scenario, ) From f46f3fd5cd0b5f52eed20dc4984400db8bc307d9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 17:18:55 +0200 Subject: [PATCH 203/787] Add parameters for gas boilers --- src/egon/data/datasets/scenario_parameters/parameters.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index f2edefc1c..38ac7da2f 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -919,6 +919,13 @@ def heat(scenario): "rural_heat_pump": 0, # Danish Energy Agency, Technology Data for Individual Heating Plants } + # Insert efficiency in p.u. + parameters["efficiency"] = { + "central_gas_boiler": read_costs( + costs, "central gas boiler", "efficiency" + ), + } + else: print(f"Scenario name {scenario} is not valid.") From b9f1f75a456d0590d46b2713910ef8f28003fd84 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 4 May 2023 17:20:50 +0200 Subject: [PATCH 204/787] Update etrago_chp for status2019 --- src/egon/data/datasets/chp_etrago.py | 117 ++++++++++++++++----------- 1 file changed, 71 insertions(+), 46 deletions(-) diff --git a/src/egon/data/datasets/chp_etrago.py b/src/egon/data/datasets/chp_etrago.py index 822efe550..80d730af8 100644 --- a/src/egon/data/datasets/chp_etrago.py +++ b/src/egon/data/datasets/chp_etrago.py @@ -15,7 +15,7 @@ class ChpEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="ChpEtrago", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=(insert), ) @@ -127,18 +127,7 @@ def insert_egon100re(): ) -def insert(): - """Insert combined heat and power plants into eTraGo tables. - - Gas CHP plants are modeled as links to the gas grid, - biomass CHP plants (only in eGon2035) are modeled as generators - - Returns - ------- - None. - - """ - +def insert_scenario(scenario): sources = config.datasets()["chp_etrago"]["sources"] targets = config.datasets()["chp_etrago"]["targets"] @@ -147,16 +136,16 @@ def insert(): f""" DELETE FROM {targets['link']['schema']}.{targets['link']['table']} WHERE carrier LIKE '%%CHP%%' - AND scn_name = 'eGon2035' + AND scn_name = '{scenario}' AND bus0 IN (SELECT bus_id FROM {sources['etrago_buses']['schema']}.{sources['etrago_buses']['table']} - WHERE scn_name = 'eGon2035' + WHERE scn_name = '{scenario}' AND country = 'DE') AND bus1 IN (SELECT bus_id FROM {sources['etrago_buses']['schema']}.{sources['etrago_buses']['table']} - WHERE scn_name = 'eGon2035' + WHERE scn_name = '{scenario}' AND country = 'DE') """ ) @@ -164,7 +153,7 @@ def insert(): f""" DELETE FROM {targets['generator']['schema']}.{targets['generator']['table']} WHERE carrier LIKE '%%CHP%%' - AND scn_name = 'eGon2035' + AND scn_name = '{scenario}' """ ) # Select all CHP plants used in district heating @@ -181,9 +170,9 @@ def insert(): JOIN grid.egon_etrago_bus c ON ST_Transform(ST_Centroid(b.geom_polygon), 4326) = c.geom - WHERE a.scenario='eGon2035' - AND b.scenario = 'eGon2035' - AND c.scn_name = 'eGon2035' + WHERE a.scenario='{scenario}' + AND b.scenario = '{scenario}' + AND c.scn_name = '{scenario}' AND c.carrier = 'central_heat' AND NOT district_heating_area_id IS NULL GROUP BY ( @@ -191,15 +180,15 @@ def insert(): """ ) # Divide into biomass and gas CHP which are modelled differently - chp_link_dh = chp_dh[chp_dh.carrier != "biomass"].index - chp_generator_dh = chp_dh[chp_dh.carrier == "biomass"].index + chp_link_dh = chp_dh[chp_dh.carrier == "gas"].index + chp_generator_dh = chp_dh[chp_dh.carrier != "gas"].index # Create geodataframes for gas CHP plants chp_el = link_geom_from_buses( gpd.GeoDataFrame( index=chp_link_dh, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus0": chp_dh.loc[chp_link_dh, "ch4_bus_id"].astype(int), "bus1": chp_dh.loc[chp_link_dh, "electrical_bus_id"].astype( int @@ -216,7 +205,7 @@ def insert(): ) # Add marginal cost which is only VOM in case of gas chp - chp_el["marginal_cost"] = get_sector_parameters("gas", "eGon2035")[ + chp_el["marginal_cost"] = get_sector_parameters("gas", scenario)[ "marginal_cost" ]["chp_gas"] @@ -233,7 +222,7 @@ def insert(): gpd.GeoDataFrame( index=chp_link_dh, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus0": chp_dh.loc[chp_link_dh, "ch4_bus_id"].astype(int), "bus1": chp_dh.loc[chp_link_dh, "heat_bus_id"].astype(int), "p_nom": chp_dh.loc[chp_link_dh, "th_capacity"], @@ -254,17 +243,17 @@ def insert(): if_exists="append", ) - # Insert biomass CHP as generators + # Insert biomass, coal, oil and other CHP as generators # Create geodataframes for CHP plants chp_el_gen = pd.DataFrame( index=chp_generator_dh, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus": chp_dh.loc[chp_generator_dh, "electrical_bus_id"].astype( int ), "p_nom": chp_dh.loc[chp_generator_dh, "el_capacity"], - "carrier": "central_biomass_CHP", + "carrier": chp_dh.loc[chp_generator_dh, "carrier"], }, ) @@ -274,9 +263,17 @@ def insert(): ) # Add marginal cost - chp_el_gen["marginal_cost"] = get_sector_parameters( - "electricity", "eGon2035" - )["marginal_cost"]["biomass"] + chp_el_gen["marginal_cost"] = ( + pd.Series( + get_sector_parameters("electricity", scenario)["marginal_cost"] + ) + .rename({"other_non_renewable": "others"}) + .loc[chp_el_gen["carrier"]] + ) + + chp_el_gen["carrier"] = ( + "central_" + chp_dh.loc[chp_generator_dh, "carrier"] + "_CHP" + ) chp_el_gen.to_sql( targets["generator"]["table"], @@ -289,10 +286,12 @@ def insert(): chp_heat_gen = pd.DataFrame( index=chp_generator_dh, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus": chp_dh.loc[chp_generator_dh, "heat_bus_id"].astype(int), "p_nom": chp_dh.loc[chp_generator_dh, "th_capacity"], - "carrier": "central_biomass_CHP_heat", + "carrier": "central_" + + chp_dh.loc[chp_generator_dh, "carrier"] + + "_CHP_heat", }, ) @@ -314,20 +313,20 @@ def insert(): SELECT electrical_bus_id, ch4_bus_id, carrier, SUM(el_capacity) AS el_capacity, SUM(th_capacity) AS th_capacity FROM {sources['chp_table']['schema']}.{sources['chp_table']['table']} - WHERE scenario='eGon2035' + WHERE scenario='{scenario}' AND district_heating_area_id IS NULL GROUP BY (electrical_bus_id, ch4_bus_id, carrier) """ ) - chp_link_ind = chp_industry[chp_industry.carrier != "biomass"].index + chp_link_ind = chp_industry[chp_industry.carrier == "gas"].index - chp_generator_ind = chp_industry[chp_industry.carrier == "biomass"].index + chp_generator_ind = chp_industry[chp_industry.carrier != "gas"].index chp_el_ind = link_geom_from_buses( gpd.GeoDataFrame( index=chp_link_ind, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus0": chp_industry.loc[chp_link_ind, "ch4_bus_id"].astype( int ), @@ -338,7 +337,7 @@ def insert(): "carrier": "industrial_gas_CHP", }, ), - "eGon2035", + scenario, ) chp_el_ind["link_id"] = range( @@ -346,7 +345,7 @@ def insert(): ) # Add marginal cost which is only VOM in case of gas chp - chp_el_ind["marginal_cost"] = get_sector_parameters("gas", "eGon2035")[ + chp_el_ind["marginal_cost"] = get_sector_parameters("gas", scenario)[ "marginal_cost" ]["chp_gas"] @@ -361,12 +360,12 @@ def insert(): chp_el_ind_gen = pd.DataFrame( index=chp_generator_ind, data={ - "scn_name": "eGon2035", + "scn_name": scenario, "bus": chp_industry.loc[ chp_generator_ind, "electrical_bus_id" ].astype(int), "p_nom": chp_industry.loc[chp_generator_ind, "el_capacity"], - "carrier": "industrial_biomass_CHP", + "carrier": chp_industry.loc[chp_generator_ind, "carrier"], }, ) @@ -374,11 +373,19 @@ def insert(): db.next_etrago_id("generator"), len(chp_el_ind_gen) + db.next_etrago_id("generator"), ) - # Add marginal cost - chp_el_ind_gen["marginal_cost"] = get_sector_parameters( - "electricity", "eGon2035" - )["marginal_cost"]["biomass"] + chp_el_ind_gen["marginal_cost"] = ( + pd.Series( + get_sector_parameters("electricity", scenario)["marginal_cost"] + ) + .rename({"other_non_renewable": "others"}) + .loc[chp_el_ind_gen["carrier"]] + ) + + # Update carrier + chp_el_ind_gen["carrier"] = ( + "industrial_" + chp_el_ind_gen.loc[chp_el_ind_gen, "carrier"] + "_CHP" + ) chp_el_ind_gen.to_sql( targets["generator"]["table"], @@ -388,4 +395,22 @@ def insert(): index=False, ) - insert_egon100re() + +def insert(): + """Insert combined heat and power plants into eTraGo tables. + + Gas CHP plants are modeled as links to the gas grid, + biomass CHP plants (only in eGon2035) are modeled as generators + + Returns + ------- + None. + + """ + + for scenario in ["status2019"]: + if scenario != "eGon100RE": + insert_scenario(scenario) + + else: + insert_egon100re() From b401514b91253010170afd34507cf840171c3ca7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:24:25 +0200 Subject: [PATCH 205/787] Add gas bus id to chps --- src/egon/data/datasets/chp/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 001fc146e..92e555b85 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -412,7 +412,13 @@ def insert_chp_statusquo(): mastr["voltage_level"] = assign_voltage_level( mastr, cfg, WORKING_DIR_MASTR_NEW ) + + gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus + mastr = assign_bus_id(mastr, cfg) + + mastr["gas_bus_id"] = gas_bus_id + mastr = assign_use_case(mastr, cfg["sources"]) # Insert entries with location @@ -432,6 +438,7 @@ def insert_chp_statusquo(): scenario="status2019", district_heating=row.district_heating, electrical_bus_id=row.bus_id, + ch4_bus_id=row.gas_bus_id, voltage_level=row.voltage_level, geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", ) From aefed6394524cf4a1492c34087254b5cf63f8bab Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:24:42 +0200 Subject: [PATCH 206/787] Create CHP per scenarios --- src/egon/data/datasets/chp/__init__.py | 72 +++++++++++++++----------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 92e555b85..8ca4921eb 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -151,7 +151,7 @@ def assign_heat_bus(): sources = config.datasets()["chp_location"]["sources"] target = config.datasets()["chp_location"]["targets"]["chp_table"] - for scenario in ["status2019"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: # Select CHP with use_case = 'district_heating' chp = db.select_geodataframe( f""" @@ -637,31 +637,45 @@ def insert_chp_egon100re(): ) -# Add one task per federal state for small CHP extension -if ( - config.settings()["egon-data"]["--dataset-boundary"] - == "Schleswig-Holstein" -): - extension = extension_SH -else: - extension = { - extension_BW, - extension_BY, - extension_HB, - extension_BB, - extension_HE, - extension_MV, - extension_NS, - extension_NW, - extension_SH, - extension_HH, - extension_RP, - extension_SL, - extension_SN, - extension_ST, - extension_TH, - extension_BE, - } +insert_per_scenario = set() + +if "status2019" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_statusquo) + +if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_egon2035) + +if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_egon100re) + +extension = set() + +if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + # Add one task per federal state for small CHP extension + if ( + config.settings()["egon-data"]["--dataset-boundary"] + == "Schleswig-Holstein" + ): + extension = extension_SH + else: + extension = { + extension_BW, + extension_BY, + extension_HB, + extension_BB, + extension_HE, + extension_MV, + extension_NS, + extension_NW, + extension_SH, + extension_HH, + extension_RP, + extension_SL, + extension_SN, + extension_ST, + extension_TH, + extension_BE, + } class Chp(Dataset): @@ -672,11 +686,7 @@ def __init__(self, dependencies): dependencies=dependencies, tasks=( create_tables, - { - insert_chp_statusquo, - insert_chp_egon2035, - insert_chp_egon100re, - }, + insert_per_scenario, assign_heat_bus, extension, ), From f121d9cd27f3a02ea4ca8af3f8bb998a133ecf34 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:25:43 +0200 Subject: [PATCH 207/787] Add gas parameters for status 2019 --- .../data/datasets/scenario_parameters/parameters.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 38ac7da2f..13b2bdeb2 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -673,10 +673,20 @@ def gas(scenario): parameters = {} elif scenario == "status2019": + costs = read_csv(2020) parameters = { "main_gas_carrier": "CH4", } + parameters["marginal_cost"] = { + "CH4": global_settings(scenario)["fuel_costs"]["gas"] + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["gas"], + "OCGT": read_costs(costs, "OCGT", "VOM"), + "biogas": global_settings(scenario)["fuel_costs"]["gas"], + "chp_gas": read_costs(costs, "central gas CHP", "VOM"), + } + else: print(f"Scenario name {scenario} is not valid.") From 74b87d852d2418e9bfc9aec893dfb662581ed41c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:26:30 +0200 Subject: [PATCH 208/787] Fix small bugs --- src/egon/data/datasets/chp_etrago.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/chp_etrago.py b/src/egon/data/datasets/chp_etrago.py index 80d730af8..a86b8f01a 100644 --- a/src/egon/data/datasets/chp_etrago.py +++ b/src/egon/data/datasets/chp_etrago.py @@ -197,7 +197,7 @@ def insert_scenario(scenario): "carrier": "central_gas_CHP", }, ), - "eGon2035", + scenario, ) # Set index chp_el["link_id"] = range( @@ -229,7 +229,7 @@ def insert_scenario(scenario): "carrier": "central_gas_CHP_heat", }, ), - "eGon2035", + scenario, ) chp_heat["link_id"] = range( @@ -269,7 +269,7 @@ def insert_scenario(scenario): ) .rename({"other_non_renewable": "others"}) .loc[chp_el_gen["carrier"]] - ) + ).values chp_el_gen["carrier"] = ( "central_" + chp_dh.loc[chp_generator_dh, "carrier"] + "_CHP" @@ -380,12 +380,10 @@ def insert_scenario(scenario): ) .rename({"other_non_renewable": "others"}) .loc[chp_el_ind_gen["carrier"]] - ) + ).values # Update carrier - chp_el_ind_gen["carrier"] = ( - "industrial_" + chp_el_ind_gen.loc[chp_el_ind_gen, "carrier"] + "_CHP" - ) + chp_el_ind_gen["carrier"] = "industrial_" + chp_el_ind_gen.carrier + "_CHP" chp_el_ind_gen.to_sql( targets["generator"]["table"], From 4bed64485779a531121fb1fed0a81d9f5fc0e7af Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:26:40 +0200 Subject: [PATCH 209/787] Use --scenarios in chp_to_etrago --- src/egon/data/datasets/chp_etrago.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/chp_etrago.py b/src/egon/data/datasets/chp_etrago.py index a86b8f01a..d200a192a 100644 --- a/src/egon/data/datasets/chp_etrago.py +++ b/src/egon/data/datasets/chp_etrago.py @@ -406,7 +406,7 @@ def insert(): """ - for scenario in ["status2019"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: if scenario != "eGon100RE": insert_scenario(scenario) From 85b706d438adef2d133828e1249666f025fae404 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:28:20 +0200 Subject: [PATCH 210/787] Use --scenarios parameter in heat_supply --- src/egon/data/datasets/heat_supply/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index 5011beb05..b2c97a36c 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -82,7 +82,7 @@ def district_heating(): """ ) - for scenario in ["status2019", "eGon2035"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: supply = cascade_heat_supply(scenario, plotting=False) supply["scenario"] = scenario @@ -151,7 +151,7 @@ def individual_heating(): """ targets = config.datasets()["heat_supply"]["targets"] - for scenario in ["status2019", "eGon2035"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: db.execute_sql( f""" DELETE FROM {targets['individual_heating_supply']['schema']}. From 11181db0bbc4498fd141a65e552f5ad7947c0e93 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 11:40:12 +0200 Subject: [PATCH 211/787] Add fuel and co2 costs for status2019 --- .../datasets/scenario_parameters/__init__.py | 2 +- .../scenario_parameters/parameters.py | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 1819863d3..f574ae47b 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -243,7 +243,7 @@ class ScenarioParameters(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioParameters", - version="0.0.13", + version="0.0.15", dependencies=dependencies, tasks=( create_table, diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 4c2300e82..8c435c3e3 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -129,6 +129,25 @@ def global_settings(scenario): parameters = { "weather_year": 2019, "population_year": 2019, + "fuel_costs": { # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) + "oil": 12.9*3.6, # [EUR/MWh] + "gas": 5.6*3.6, # [EUR/MWh] + "coal": 3.0*3.6, # [EUR/MWh] + "lignite": 1.1*3.6, # [EUR/MWh] + "nuclear": 0.47*3.6, # [EUR/MWh] + "biomass": read_costs(read_csv(2020), "biomass", "fuel"), + }, + "co2_costs": 24.7, # [EUR/t_CO2], source: + #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ + "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 + "waste": 0.165, # [t_CO2/MW_th] + "lignite": 0.393, # [t_CO2/MW_th] + "gas": 0.201, # [t_CO2/MW_th] + "nuclear": 0.0, # [t_CO2/MW_th] + "oil": 0.288, # [t_CO2/MW_th] + "coal": 0.335, # [t_CO2/MW_th] + "other_non_renewable": 0.268, # [t_CO2/MW_th] + }, "interest_rate": 0.05, # [p.u.] } @@ -613,6 +632,35 @@ def electricity(scenario): * parameters["capital_cost"]["battery storage"] ) + parameters["marginal_cost"] = { + "oil": global_settings(scenario)["fuel_costs"]["oil"] + + read_costs(costs, "oil", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["oil"], + "other_non_renewable": global_settings(scenario)["fuel_costs"][ + "gas" + ] + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"][ + "other_non_renewable" + ], + "lignite": global_settings(scenario)["fuel_costs"]["lignite"] + + read_costs(costs, "lignite", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["lignite"], + "coal": global_settings(scenario)["fuel_costs"]["coal"] + + read_costs(costs, "coal", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["coal"], + "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] + + read_costs(costs, "nuclear", "VOM"), + "biomass": global_settings(scenario)["fuel_costs"]["biomass"] + + read_costs(costs, "biomass CHP", "VOM"), + "wind_offshore": read_costs(costs, "offwind", "VOM"), + "wind_onshore": read_costs(costs, "onwind", "VOM"), + "solar": read_costs(costs, "solar", "VOM"), + } + else: print(f"Scenario name {scenario} is not valid.") From 097a97bfc1b7debc1ab4948ca524b71787ebb77e Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 5 May 2023 15:03:15 +0200 Subject: [PATCH 212/787] resample to hourly resolution --- src/egon/data/datasets/electrical_neighbours.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 7e09d8ec5..bb56cc205 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1282,7 +1282,7 @@ def tyndp_demand(): session.add(entry_ts) session.commit() -def entsoe_historic_generation_capacities(entsoe_token=None, year_start="20190101", year_end="20200101"): +def entsoe_historic_generation_capacities(entsoe_token="29e40f71-3ab5-4435-97dd-060039b962af", year_start="20190101", year_end="20200101"): client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1323,7 +1323,7 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 df.fillna(0, inplace=True) return df -def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="20200101"): +def entsoe_historic_demand(entsoe_token="29e40f71-3ab5-4435-97dd-060039b962af", year_start="20190101", year_end="20200101"): client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1333,20 +1333,20 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 countries= ["LU", "AT", "FR", "NL", "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] - # todo: define wanted countries not_retrieved = [] dfs = [] + for country in countries: if country == 'GB': kwargs = dict(start=start_gb, end=end_gb) else: kwargs = dict(start=start, end=end) try: - dfs.append(client.query_load(country, **kwargs)) + dfs.append(client.query_load(country, **kwargs).resample("H")["Actual Load"].mean()) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass @@ -1354,6 +1354,7 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 logger.warning( f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) + df = pd.concat(dfs, axis=1) df.columns = countries df.fillna(0, inplace=True) From 62b5244c54f59604bd90a22de7bc1aebd43c8cd5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 5 May 2023 15:05:49 +0200 Subject: [PATCH 213/787] Work-around to skip long tasks for individual heating supply --- .../heat_supply/individual_heating.py | 226 ++++++++++-------- 1 file changed, 123 insertions(+), 103 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 608a73a7e..666123564 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -208,7 +208,7 @@ write_table_to_postgres, ) from egon.data.datasets.emobility.motorized_individual_travel.helpers import ( - reduce_mem_usage + reduce_mem_usage, ) from egon.data.datasets.heat_demand import EgonPetaHeat from egon.data.datasets.heat_demand_timeseries.daily import ( @@ -264,34 +264,41 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ) tasks = set() - for i in range(parallel_tasks): - tasks.add( - PythonOperator( - task_id=( - f"individual_heating." - f"determine-hp-capacity-pypsa-eur-sec-" - f"mvgd-bulk{i}" - ), - python_callable=split_mvgds_into_bulks, - op_kwargs={ - "n": i, - "max_n": parallel_tasks, - "func": determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec, # noqa: E501 - }, + + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + for i in range(parallel_tasks): + tasks.add( + PythonOperator( + task_id=( + f"individual_heating." + f"determine-hp-capacity-pypsa-eur-sec-" + f"mvgd-bulk{i}" + ), + python_callable=split_mvgds_into_bulks, + op_kwargs={ + "n": i, + "max_n": parallel_tasks, + "func": determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec, # noqa: E501 + }, + ) ) - ) return tasks - super().__init__( - name="HeatPumpsPypsaEurSec", - version="0.0.2", - dependencies=dependencies, - tasks=( + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + tasks = ( delete_pypsa_eur_sec_csv_file, delete_mvgd_ts_100RE, delete_heat_peak_loads_100RE, {*dyn_parallel_tasks_pypsa_eur_sec()}, - ), + ) + else: + tasks = empty_task + + super().__init__( + name="HeatPumpsPypsaEurSec", + version="0.0.2", + dependencies=dependencies, + tasks=tasks, ) @@ -316,34 +323,40 @@ def dyn_parallel_tasks_2035(): "parallel_tasks", 1 ) tasks = set() - for i in range(parallel_tasks): - tasks.add( - PythonOperator( - task_id=( - "individual_heating." - f"determine-hp-capacity-2035-" - f"mvgd-bulk{i}" - ), - python_callable=split_mvgds_into_bulks, - op_kwargs={ - "n": i, - "max_n": parallel_tasks, - "func": determine_hp_cap_peak_load_mvgd_ts_2035, - }, + if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + for i in range(parallel_tasks): + tasks.add( + PythonOperator( + task_id=( + "individual_heating." + f"determine-hp-capacity-2035-" + f"mvgd-bulk{i}" + ), + python_callable=split_mvgds_into_bulks, + op_kwargs={ + "n": i, + "max_n": parallel_tasks, + "func": determine_hp_cap_peak_load_mvgd_ts_2035, + }, + ) ) - ) - return tasks + return tasks - super().__init__( - name="HeatPumps2035", - version="0.0.2", - dependencies=dependencies, - tasks=( + if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + tasks = ( delete_heat_peak_loads_2035, delete_hp_capacity_2035, delete_mvgd_ts_2035, {*dyn_parallel_tasks_2035()}, - ), + ) + else: + tasks = empty_task_2 + + super().__init__( + name="HeatPumps2035", + version="0.0.2", + dependencies=dependencies, + tasks=tasks, ) @@ -370,6 +383,14 @@ class BuildingHeatPeakLoads(Base): peak_load_in_w = Column(REAL) +def empty_task(): + print("Doing nothing") + + +def empty_task_2(): + print("Doing nothing again") + + def adapt_numpy_float64(numpy_float64): return AsIs(numpy_float64) @@ -385,7 +406,6 @@ def cascade_per_technology( distribution_level, max_size_individual_chp=0.05, ): - """Add plants for individual heat. Currently only on mv grid district level. @@ -415,7 +435,6 @@ def cascade_per_technology( # Distribute heat pumps linear to remaining demand. if tech.index == "heat_pump": - if distribution_level == "federal_state": # Select target values per federal state target = db.select_dataframe( @@ -467,7 +486,6 @@ def cascade_per_technology( ) elif tech.index == "gas_boiler": - append_df = pd.DataFrame( data={ "capacity": heat_per_mv.remaining_demand.div( @@ -816,8 +834,10 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): left=df_peta_demand, right=df_profiles_ids, on="zensus_population_id" ) - df_profile_merge.demand = df_profile_merge.demand.div(df_profile_merge.buildings) - df_profile_merge.drop('buildings', axis='columns', inplace=True) + df_profile_merge.demand = df_profile_merge.demand.div( + df_profile_merge.buildings + ) + df_profile_merge.drop("buildings", axis="columns", inplace=True) # Merge daily demand to daily profile ids by zensus_population_id and day df_profile_merge = pd.merge( @@ -826,8 +846,9 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): on=["zensus_population_id", "day_of_year"], ) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.daily_demand_share) - df_profile_merge.drop('daily_demand_share', axis='columns', inplace=True) + df_profile_merge.daily_demand_share + ) + df_profile_merge.drop("daily_demand_share", axis="columns", inplace=True) df_profile_merge = reduce_mem_usage(df_profile_merge) # Merge daily profiles by profile id @@ -840,10 +861,13 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): df_profile_merge = reduce_mem_usage(df_profile_merge) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.idp.astype(float)) - df_profile_merge.drop('idp', axis='columns', inplace=True) + df_profile_merge.idp.astype(float) + ) + df_profile_merge.drop("idp", axis="columns", inplace=True) - df_profile_merge.rename({'demand': 'demand_ts'}, axis='columns', inplace=True) + df_profile_merge.rename( + {"demand": "demand_ts"}, axis="columns", inplace=True + ) df_profile_merge = reduce_mem_usage(df_profile_merge) @@ -851,7 +875,6 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): def plot_heat_supply(resulting_capacities): - from matplotlib import pyplot as plt mv_grids = db.select_geodataframe( @@ -1425,7 +1448,6 @@ def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): ) if hp_cap_grid > 0.0: - # get buildings with decentral heating systems building_ids = get_buildings_with_decentral_heat_demand_in_mv_grid( mv_grid_id, scenario="eGon100RE" @@ -1459,59 +1481,61 @@ def determine_hp_cap_buildings_eGon100RE(): """ - # ========== Register np datatypes with SQLA ========== - register_adapter(np.float64, adapt_numpy_float64) - register_adapter(np.int64, adapt_numpy_int64) - # ===================================================== + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + # ========== Register np datatypes with SQLA ========== + register_adapter(np.float64, adapt_numpy_float64) + register_adapter(np.int64, adapt_numpy_int64) + # ===================================================== - with db.session_scope() as session: - query = ( - session.query( - MapZensusGridDistricts.bus_id, + with db.session_scope() as session: + query = ( + session.query( + MapZensusGridDistricts.bus_id, + ) + .filter( + MapZensusGridDistricts.zensus_population_id + == EgonPetaHeat.zensus_population_id + ) + .distinct(MapZensusGridDistricts.bus_id) ) - .filter( - MapZensusGridDistricts.zensus_population_id - == EgonPetaHeat.zensus_population_id + mvgd_ids = pd.read_sql( + query.statement, query.session.bind, index_col=None ) - .distinct(MapZensusGridDistricts.bus_id) - ) - mvgd_ids = pd.read_sql( - query.statement, query.session.bind, index_col=None + mvgd_ids = mvgd_ids.sort_values("bus_id") + mvgd_ids = mvgd_ids["bus_id"].values + + df_hp_cap_per_building_100RE_db = pd.DataFrame( + columns=["building_id", "hp_capacity"] ) - mvgd_ids = mvgd_ids.sort_values("bus_id") - mvgd_ids = mvgd_ids["bus_id"].values - df_hp_cap_per_building_100RE_db = pd.DataFrame( - columns=["building_id", "hp_capacity"] - ) + for mvgd_id in mvgd_ids: + logger.info(f"MVGD={mvgd_id} | Start") - for mvgd_id in mvgd_ids: + hp_cap_per_building_100RE = ( + determine_hp_cap_buildings_eGon100RE_per_mvgd(mvgd_id) + ) - logger.info(f"MVGD={mvgd_id} | Start") + if not hp_cap_per_building_100RE.empty: + df_hp_cap_per_building_100RE_db = pd.concat( + [ + df_hp_cap_per_building_100RE_db, + hp_cap_per_building_100RE.reset_index(), + ], + axis=0, + ) - hp_cap_per_building_100RE = ( - determine_hp_cap_buildings_eGon100RE_per_mvgd(mvgd_id) + logger.info( + f"MVGD={min(mvgd_ids)} : {max(mvgd_ids)} | Write data to db." ) + df_hp_cap_per_building_100RE_db["scenario"] = "eGon100RE" - if not hp_cap_per_building_100RE.empty: - df_hp_cap_per_building_100RE_db = pd.concat( - [ - df_hp_cap_per_building_100RE_db, - hp_cap_per_building_100RE.reset_index(), - ], - axis=0, - ) - - logger.info(f"MVGD={min(mvgd_ids)} : {max(mvgd_ids)} | Write data to db.") - df_hp_cap_per_building_100RE_db["scenario"] = "eGon100RE" - - EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) + EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) - write_table_to_postgres( - df_hp_cap_per_building_100RE_db, - EgonHpCapacityBuildings, - drop=False, - ) + write_table_to_postgres( + df_hp_cap_per_building_100RE_db, + EgonHpCapacityBuildings, + drop=False, + ) def aggregate_residential_and_cts_profiles(mvgd, scenario): @@ -1638,9 +1662,7 @@ def export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec): os.mkdir(folder) if not file.is_file(): logger.info(f"Create {file}") - df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( - file, mode="w", header=True - ) + df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv(file, mode="w", header=True) else: df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( file, mode="a", header=False @@ -1713,7 +1735,6 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -1847,7 +1868,6 @@ def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): df_hp_min_cap_mv_grid_pypsa_eur_sec = pd.Series(dtype="float64") for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### From ae062f1f59ac91ed5eecc4ae54d0f6ec8748a1fc Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 11 May 2023 18:31:03 +0200 Subject: [PATCH 214/787] update datasets.yml --- src/egon/data/datasets.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 07582e7f7..ef57cfa70 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -374,6 +374,10 @@ power_plants: nep_conv: "supply.egon_nep_2021_conventional_powerplants" buses_data: "osmtgmod_results.bus_data" power_plants: 'supply.egon_power_plants' + biomass: 'supply.egon_power_plants_biomass' + hydro: 'supply.egon_power_plants_hydro' + pv: 'supply.egon_power_plants_pv' + wind: 'supply.egon_power_plants_wind' nep_2035: "NEP2035_V2021_scnC2035.xlsx" target: table: 'egon_power_plants' From 6469367eb85cf7a28ab998402f7feab7dd13bb3e Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 11 May 2023 18:32:06 +0200 Subject: [PATCH 215/787] import hydro gen into power_plants table --- .../data/datasets/power_plants/__init__.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 4c1dd3310..d4c45aea6 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -930,3 +930,47 @@ def allocate_other_power_plants(): ) session.add(entry) session.commit() + +def power_plants_status_quo(scn_name = "status2019"): + scn_name = "status2019" + con = db.engine() + cfg = egon.data.config.datasets()["power_plants"] + + db.execute_sql( + f""" + DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} + WHERE carrier IN ('wind_onshore', 'solar', 'biomass', 'hydro', + 'run_of_river', 'reservoir') + AND scenario = '{scn_name}' + """ + ) + + # Write hydro power plants in supply.egon_power_plants + map_hydro = { + "Laufwasseranlage": "run_of_river", + "Speicherwasseranlage": "reservoir", + } + + hydro = pd.read_sql( + f"""SELECT * FROM {cfg['sources']['hydro']} + WHERE plant_type IN ('Laufwasseranlage', 'Speicherwasseranlage')""", + con, + ) + + # Insert into target table + session = sessionmaker(bind=db.engine())() + for i, row in hydro.iterrows(): + entry = EgonPowerPlants( + sources="Mastr", + source_id={"MastrNummer": row.gens_id}, + carrier=map_hydro[row.plant_type], + el_capacity=row.capacity, + voltage_level=row.voltage_level, + bus_id=row.bus_id, + scenario=scn_name, + geom=row.geom, + ) + session.add(entry) + session.commit() + + return \ No newline at end of file From 5e8aca7510840fd0bccb45cccafa6a586a963224 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 12 May 2023 13:48:03 +0200 Subject: [PATCH 216/787] include wind_onshore, solar, biomass --- .../data/datasets/power_plants/__init__.py | 83 ++++++++++++++++++- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index d4c45aea6..8037f7947 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -934,12 +934,13 @@ def allocate_other_power_plants(): def power_plants_status_quo(scn_name = "status2019"): scn_name = "status2019" con = db.engine() + session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] db.execute_sql( f""" DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} - WHERE carrier IN ('wind_onshore', 'solar', 'biomass', 'hydro', + WHERE carrier IN ('wind_onshore', 'solar', 'biomass', 'run_of_river', 'reservoir') AND scenario = '{scn_name}' """ @@ -957,11 +958,9 @@ def power_plants_status_quo(scn_name = "status2019"): con, ) - # Insert into target table - session = sessionmaker(bind=db.engine())() for i, row in hydro.iterrows(): entry = EgonPowerPlants( - sources="Mastr", + sources={"el_capacity": "MaStR"}, source_id={"MastrNummer": row.gens_id}, carrier=map_hydro[row.plant_type], el_capacity=row.capacity, @@ -973,4 +972,80 @@ def power_plants_status_quo(scn_name = "status2019"): session.add(entry) session.commit() + print(f""" + {len(hydro)} hydro generators with a total installed capacity of + {hydro.capacity.sum()}MW were inserted in db + """) + # Write biomass power plants in supply.egon_power_plants + biomass = pd.read_sql( + f"""SELECT * FROM {cfg['sources']['biomass']}""", + con, + ) + for i, row in biomass.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier="biomass", + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=row.geom, + ) + session.add(entry) + session.commit() + + print(f""" + {len(biomass)} biomass generators with a total installed capacity of + {biomass.capacity.sum()}MW were inserted in db + """) + + # Write solar power plants in supply.egon_power_plants + solar = pd.read_sql( + f"""SELECT * FROM {cfg['sources']['pv']}""", + con, + ) + for i, row in solar.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier="solar", + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=row.geom, + ) + session.add(entry) + session.commit() + + print(f""" + {len(solar)} solar generators with a total installed capacity of + {solar.capacity.sum()}MW were inserted in db + """) + + # Write wind_onshore power plants in supply.egon_power_plants + wind_onshore = pd.read_sql( + f"""SELECT * FROM {cfg['sources']['wind']}""", + con, + ) + for i, row in wind_onshore.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier="wind_onshore", + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=row.geom, + ) + session.add(entry) + session.commit() + + print(f""" + {len(wind_onshore)} wind_onshore generators with a total installed capacity of + {wind_onshore.capacity.sum()}MW were inserted in db + """) + return \ No newline at end of file From d52a23ef7a98d532ab3ade8bb5510c45a88376f9 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 12 May 2023 14:04:22 +0200 Subject: [PATCH 217/787] include power_plants_status_quo in class power_plants --- src/egon/data/datasets/power_plants/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 8037f7947..4c26ae123 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -60,11 +60,12 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.17", + version="0.0.18", dependencies=dependencies, tasks=( create_tables, import_mastr, + power_plants_status_quo, insert_hydro_biomass, allocate_conventional_non_chp_power_plants, allocate_other_power_plants, @@ -932,7 +933,6 @@ def allocate_other_power_plants(): session.commit() def power_plants_status_quo(scn_name = "status2019"): - scn_name = "status2019" con = db.engine() session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] From 8efc22f2af819da2ae38c2f8c5ada0f9ea41d69d Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 15 May 2023 11:29:53 +0200 Subject: [PATCH 218/787] resample to hourly resolution --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 7e09d8ec5..822ab891b 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1346,7 +1346,7 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 else: kwargs = dict(start=start, end=end) try: - dfs.append(client.query_load(country, **kwargs)) + dfs.append(client.query_load(country, **kwargs).resample("H")["Actual Load"].mean()) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass From 09811b79556fdc5eb749f3f1d30f4999ee44f9d5 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 15 May 2023 12:11:53 +0200 Subject: [PATCH 219/787] fix different time zones --- src/egon/data/datasets/electrical_neighbours.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 822ab891b..51da794e9 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1328,8 +1328,9 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 start = pd.Timestamp(year_start, tz="Europe/Brussels") end = pd.Timestamp(year_end, tz="Europe/Brussels") - start_gb = pd.Timestamp(year_start, tz="Europe/London") - end_gb = pd.Timestamp(year_end, tz="Europe/London") + start_gb = start.tz_convert("Europe/London") + end_gb = end.tz_convert("Europe/London") + countries= ["LU", "AT", "FR", "NL", "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] @@ -1346,7 +1347,10 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 else: kwargs = dict(start=start, end=end) try: - dfs.append(client.query_load(country, **kwargs).resample("H")["Actual Load"].mean()) + country_data = client.query_load(country, **kwargs).resample("H")["Actual Load"].mean() + if country == 'GB': + country_data.index = country_data.index.tz_convert("Europe/Brussels") + dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass @@ -1356,5 +1360,6 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 ) df = pd.concat(dfs, axis=1) df.columns = countries - df.fillna(0, inplace=True) + df.index = pd.date_range(year_start, periods=8760 , freq="H") + return df From 50df5d8f963dbca5fc36b3ce73e6f885a961df01 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 12:13:46 +0200 Subject: [PATCH 220/787] Use scenario parameter in electrical_neighbours --- .../data/datasets/electrical_neighbours.py | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b1fa1ccb3..9c835cbf1 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -16,16 +16,6 @@ from egon.data.datasets.scenario_parameters import get_sector_parameters -class ElectricalNeighbours(Dataset): - def __init__(self, dependencies): - super().__init__( - name="ElectricalNeighbours", - version="0.0.7", - dependencies=dependencies, - tasks=(grid, {tyndp_generation, tyndp_demand}), - ) - - def get_cross_border_buses(scenario, sources): """Returns buses from osmTGmod which are outside of Germany. @@ -488,7 +478,6 @@ def central_transformer(scenario, sources, targets, central_buses, new_lines): # Add one transformer per central foreign bus with v_nom != 380 for i, row in central_buses[central_buses.v_nom != 380].iterrows(): - s_nom_0 = new_lines[new_lines.bus0 == row.bus_id].s_nom.sum() s_nom_1 = new_lines[new_lines.bus1 == row.bus_id].s_nom.sum() if s_nom_0 == 0.0: @@ -673,8 +662,7 @@ def grid(): sources = config.datasets()["electrical_neighbours"]["sources"] targets = config.datasets()["electrical_neighbours"]["targets"] - for scenario in ["eGon2035"]: - + for scenario in config.settings()["egon-data"]["--scenarios"]: central_buses = buses(scenario, sources, targets) foreign_lines = cross_border_lines( @@ -1078,9 +1066,12 @@ def insert_storage(capacities): ) # Add columns for additional parameters to df - store["dispatch"], store["store"], store["standing_loss"], store[ - "max_hours" - ] = (None, None, None, None) + ( + store["dispatch"], + store["store"], + store["standing_loss"], + store["max_hours"], + ) = (None, None, None, None) # Insert carrier specific parameters @@ -1276,3 +1267,19 @@ def tyndp_demand(): session.add(entry) session.add(entry_ts) session.commit() + + +tasks = grid + +if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + tasks = (grid, {tyndp_generation, tyndp_demand}) + + +class ElectricalNeighbours(Dataset): + def __init__(self, dependencies): + super().__init__( + name="ElectricalNeighbours", + version="0.0.8", + dependencies=dependencies, + tasks=tasks, + ) From 4db694b1d26ca2c28083c4a5f80eb6f407bb3e12 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 15:40:27 +0200 Subject: [PATCH 221/787] Use CLI parameter for scenario names in DistrictHeatingAreas dataseto --- .../district_heating_areas/__init__.py | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 4e3759c28..3394575e5 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -12,7 +12,7 @@ end it saves them in the database. """ import os -from egon.data import db +from egon.data import config, db from egon.data.datasets.scenario_parameters import ( get_sector_parameters, EgonScenario, @@ -39,19 +39,22 @@ from egon.data.datasets import Dataset + # class for airflow task management (and version control) class DistrictHeatingAreas(Dataset): def __init__(self, dependencies): super().__init__( name="district-heating-areas", # version=self.target_files + "_0.0", - version="0.0.1", # maybe rethink the naming + version="0.0.2", # maybe rethink the naming dependencies=dependencies, tasks=(create_tables, demarcation), ) Base = declarative_base() + + # definition of classes for saving data in the database class MapZensusDistrictHeatingAreas(Base): __tablename__ = "egon_map_zensus_district_heating_areas" @@ -220,7 +223,9 @@ def load_census_data(minimum_connection_rate=0.3): # district_heat.head # district_heat['connection_rate'].describe() - district_heat = district_heat[district_heat["connection_rate"] >= minimum_connection_rate] + district_heat = district_heat[ + district_heat["connection_rate"] >= minimum_connection_rate + ] # district_heat.columns return district_heat, heating_type @@ -394,7 +399,6 @@ def area_grouping( maximum_total_demand and "residential_and_service_demand" in join.columns ): - huge_areas_index = ( join.groupby("area_id").residential_and_service_demand.sum() > maximum_total_demand @@ -499,7 +503,6 @@ def district_heating_areas(scenario_name, plotting=False): """ - # Load district heating shares from the scenario table if scenario_name == "eGon2015": district_heating_share = 0.08 @@ -508,12 +511,12 @@ def district_heating_areas(scenario_name, plotting=False): district_heating_share = heat_parameters["DE_district_heating_share"] - minimum_connection_rate=0.3 + minimum_connection_rate = 0.3 - # Adjust minimum connection rate for status2019, + # Adjust minimum connection rate for status2019, # otherwise the existing district heating grids would have too much demand - if scenario_name=="status2019": - minimum_connection_rate=0.6 + if scenario_name == "status2019": + minimum_connection_rate = 0.6 # heat_demand is scenario specific heat_demand_cells = load_heat_demands(scenario_name) @@ -523,7 +526,9 @@ def district_heating_areas(scenario_name, plotting=False): # by the area grouping function), load only the first returned result: [0] min_hd_census = 10000 / 3.6 # in MWh - census_plus_heat_demand = load_census_data(minimum_connection_rate=minimum_connection_rate)[0].copy() + census_plus_heat_demand = load_census_data( + minimum_connection_rate=minimum_connection_rate + )[0].copy() census_plus_heat_demand[ "residential_and_service_demand" ] = heat_demand_cells.loc[ @@ -1139,15 +1144,11 @@ def demarcation(plotting=True): heat_density_per_scenario = {} # scenario specific district heating areas - heat_density_per_scenario["status2019"] = district_heating_areas( - "status2019", plotting - ) - heat_density_per_scenario["eGon2035"] = district_heating_areas( - "eGon2035", plotting - ) - heat_density_per_scenario["eGon100RE"] = district_heating_areas( - "eGon100RE", plotting - ) + + for scenario in config.settings()["egon-data"]["--scenarios"]: + heat_density_per_scenario[scenario] = district_heating_areas( + scenario, plotting + ) if plotting: plot_heat_density_sorted(heat_density_per_scenario) From c27b365ca7718b8fe0a73a951b93c83413937579 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 15:42:06 +0200 Subject: [PATCH 222/787] Use CLI parameter for scenarios --- src/egon/data/datasets/electricity_demand_etrago.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_etrago.py b/src/egon/data/datasets/electricity_demand_etrago.py index 65b50a2a0..d143acf4a 100644 --- a/src/egon/data/datasets/electricity_demand_etrago.py +++ b/src/egon/data/datasets/electricity_demand_etrago.py @@ -173,8 +173,7 @@ def export_to_db(): sources = egon.data.config.datasets()["etrago_electricity"]["sources"] targets = egon.data.config.datasets()["etrago_electricity"]["targets"] - for scenario in ["eGon2035", "eGon100RE"]: - + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: # Delete existing data from database db.execute_sql( f""" @@ -271,7 +270,7 @@ class ElectricalLoadEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="Electrical_load_etrago", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=(export_to_db,), ) From 83b6eded6b2a6b78c4a55c5e8f06af027098d213 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 16:11:28 +0200 Subject: [PATCH 223/787] Use CLI parameter for scenario names in hts_etrago --- src/egon/data/datasets/heat_etrago/hts_etrago.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_etrago/hts_etrago.py b/src/egon/data/datasets/heat_etrago/hts_etrago.py index add44421c..2fbae7351 100644 --- a/src/egon/data/datasets/heat_etrago/hts_etrago.py +++ b/src/egon/data/datasets/heat_etrago/hts_etrago.py @@ -216,14 +216,14 @@ def demand(): None. """ - for scenario in ["status2019", "eGon2035", "eGon100RE"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: hts_to_etrago(scenario) class HtsEtragoTable(Dataset): def __init__(self, dependencies): super().__init__( name="HtsEtragoTable", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=(demand), ) From 3cb43332f198634a75cb4e2e5f5e3efac0da6393 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 16:19:49 +0200 Subject: [PATCH 224/787] Use CLI parameter for scenarios in OCGT dataseto --- src/egon/data/datasets/power_etrago/__init__.py | 2 +- src/egon/data/datasets/power_etrago/match_ocgt.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/power_etrago/__init__.py b/src/egon/data/datasets/power_etrago/__init__.py index 862271fa6..5d25a7b1c 100755 --- a/src/egon/data/datasets/power_etrago/__init__.py +++ b/src/egon/data/datasets/power_etrago/__init__.py @@ -10,7 +10,7 @@ class OpenCycleGasTurbineEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="OpenCycleGasTurbineEtrago", - version="0.0.1", + version="0.0.2", dependencies=dependencies, tasks=(insert_open_cycle_gas_turbines,), ) diff --git a/src/egon/data/datasets/power_etrago/match_ocgt.py b/src/egon/data/datasets/power_etrago/match_ocgt.py index f5cf29c53..c0e17a246 100755 --- a/src/egon/data/datasets/power_etrago/match_ocgt.py +++ b/src/egon/data/datasets/power_etrago/match_ocgt.py @@ -7,12 +7,17 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import config, db from egon.data.datasets.etrago_setup import link_geom_from_buses from egon.data.datasets.scenario_parameters import get_sector_parameters -def insert_open_cycle_gas_turbines(scn_name="eGon2035"): +def insert_open_cycle_gas_turbines(): + for scenario in config.settings()["egon-data"]["--scenarios"]: + insert_open_cycle_gas_turbines_per_scenario(scenario) + + +def insert_open_cycle_gas_turbines_per_scenario(scn_name): """Insert gas turbine links in egon_etrago_link table. Parameters From 0128b08b31557320023c558496a7fa9256d7e81b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 17:27:16 +0200 Subject: [PATCH 225/787] Create gas grid for selected scenarios --- src/egon/data/datasets/gas_grid.py | 86 ++++++++++++++++-------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 663d3581c..069b71afb 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -36,41 +36,6 @@ from egon.data.datasets.scenario_parameters import get_sector_parameters -class GasNodesAndPipes(Dataset): - """ - Insert the CH4 buses and links into the database. - - Insert the CH4 buses and links, which for the case of gas represent - pipelines, into the database for the scenarios status2019, eGon2035 and eGon100RE - with the functions :py:func:`insert_gas_data` and :py:func:`insert_gas_data_eGon100RE`. - - *Dependencies* - * :py:class:`DataBundle ` - * :py:class:`ElectricalNeighbours ` - * :py:class:`Osmtgmod ` - * :py:class:`ScenarioParameters ` - * :py:class:`EtragoSetup ` (more specifically the :func:`create_tables ` task) - - *Resulting tables* - * :py:class:`grid.egon_etrago_bus ` is extended - * :py:class:`grid.egon_etrago_link ` is extended - - """ - - #: - name: str = "GasNodesAndPipes" - #: - version: str = "0.0.9" - - def __init__(self, dependencies): - super().__init__( - name=self.name, - version=self.version, - dependencies=dependencies, - tasks=(insert_gas_data, insert_gas_data_eGon2035, insert_gas_data_eGon100RE), - ) - - def download_SciGRID_gas_data(): """ Download SciGRID_gas IGGIELGN data from Zenodo @@ -547,7 +512,6 @@ def insert_gas_pipeline_list( boundary = settings()["egon-data"]["--dataset-boundary"] if boundary != "Everything": - gas_pipelines_list = gas_pipelines_list[ gas_pipelines_list["NUTS1_0"].str.contains(map_states[boundary]) | gas_pipelines_list["NUTS1_1"].str.contains(map_states[boundary]) @@ -565,7 +529,6 @@ def insert_gas_pipeline_list( length_km = [] for index, row in gas_pipelines_list.iterrows(): - param = ast.literal_eval(row["param"]) diameter.append(param["diameter_mm"]) length_km.append(param["length_km"]) @@ -882,7 +845,6 @@ def insert_gas_data(): remove_isolated_gas_buses() - def insert_gas_data_eGon2035(): """ Overall function for importing methane data for eGon100RE @@ -953,7 +915,8 @@ def insert_gas_data_eGon2035(): con=db.engine(), index=False, dtype={"geom": Geometry(), "topo": Geometry()}, - ) + ) + def insert_gas_data_eGon100RE(): """ @@ -1031,5 +994,46 @@ def insert_gas_data_eGon100RE(): index=False, dtype={"geom": Geometry(), "topo": Geometry()}, ) - - + + +class GasNodesAndPipes(Dataset): + """ + Insert the CH4 buses and links into the database. + + Insert the CH4 buses and links, which for the case of gas represent + pipelines, into the database for the scenarios status2019, eGon2035 and eGon100RE + with the functions :py:func:`insert_gas_data` and :py:func:`insert_gas_data_eGon100RE`. + + *Dependencies* + * :py:class:`DataBundle ` + * :py:class:`ElectricalNeighbours ` + * :py:class:`Osmtgmod ` + * :py:class:`ScenarioParameters ` + * :py:class:`EtragoSetup ` (more specifically the :func:`create_tables ` task) + + *Resulting tables* + * :py:class:`grid.egon_etrago_bus ` is extended + * :py:class:`grid.egon_etrago_link ` is extended + + """ + + #: + name: str = "GasNodesAndPipes" + #: + version: str = "0.0.9" + + tasks = (insert_gas_data,) + + if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (insert_gas_data_eGon2035,) + + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (insert_gas_data_eGon100RE,) + + def __init__(self, dependencies): + super().__init__( + name=self.name, + version=self.version, + dependencies=dependencies, + tasks=self.tasks, + ) From d1c607a1ba64ed109d1ef9ca0d8654ef51185730 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 17:29:19 +0200 Subject: [PATCH 226/787] Remove unused dataset imports from status quo pipeline --- .../data/airflow/dags/pipeline_status_quo.py | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 982d5eba1..b13a3dbf6 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -5,7 +5,6 @@ from egon.data.config import set_numexpr_threads from egon.data.datasets import database -from egon.data.datasets.calculate_dlr import Calculate_dlr from egon.data.datasets.ch4_prod import CH4Production from egon.data.datasets.ch4_storages import CH4Storages from egon.data.datasets.chp import Chp @@ -13,7 +12,6 @@ from egon.data.datasets.data_bundle import DataBundle from egon.data.datasets.demandregio import DemandRegio from egon.data.datasets.district_heating_areas import DistrictHeatingAreas -from egon.data.datasets.DSM_cts_ind import DsmPotential from egon.data.datasets.electrical_neighbours import ElectricalNeighbours from egon.data.datasets.electricity_demand import ( CtsElectricityDemand, @@ -54,18 +52,6 @@ HeatPumps2050, HeatPumpsPypsaEurSec, ) -from egon.data.datasets.hydrogen_etrago import ( - HydrogenBusEtrago, - HydrogenGridEtrago, - HydrogenMethaneLinkEtrago, - HydrogenPowerLinkEtrago, - HydrogenStoreEtrago, -) -from egon.data.datasets.industrial_gas_demand import ( - IndustrialGasDemand, - IndustrialGasDemandeGon100RE, - IndustrialGasDemandeGon2035, -) from egon.data.datasets.industrial_sites import MergeIndustrialSites from egon.data.datasets.industry import IndustrialDemandCurves from egon.data.datasets.loadarea import LoadArea, OsmLanduse @@ -78,8 +64,6 @@ from egon.data.datasets.power_plants import PowerPlants from egon.data.datasets.pypsaeursec import PypsaEurSec from egon.data.datasets.renewable_feedin import RenewableFeedin -from egon.data.datasets.saltcavern import SaltcavernData -from egon.data.datasets.sanity_checks import SanityChecks from egon.data.datasets.scenario_parameters import ScenarioParameters from egon.data.datasets.society_prognosis import SocietyPrognosis from egon.data.datasets.storages import Storages @@ -199,11 +183,6 @@ dependencies=[scenario_parameters, vg250, zensus_vg250] ) - # Download industrial gas demand - industrial_gas_demand = IndustrialGasDemand( - dependencies=[scenario_parameters] - ) - # Extract landuse areas from the `osm` dataset osm_landuse = OsmLanduse(dependencies=[osm, vg250]) @@ -396,11 +375,6 @@ dependencies=[create_gas_polygons_status2019] ) - # Assign industrial gas demand eGon2035 TODO: adjust for SQ - IndustrialGasDemandeGon2035( - dependencies=[create_gas_polygons_status2019, industrial_gas_demand] - ) - # CHP locations chp = Chp( dependencies=[ @@ -545,15 +519,3 @@ ] ) - # ########## Keep this dataset at the end - # Sanity Checks - sanity_checks = SanityChecks( - dependencies=[ - storage_etrago, - hts_etrago_table, - fill_etrago_generators, - household_electricity_demand_annual, - cts_demand_buildings, - emobility_mit, - ] - ) From 2d1eaf4c0a765baa9305d8b5546eb53ddb8fa814 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 17:29:58 +0200 Subject: [PATCH 227/787] Fix CHP datasets tasks if status2019 is the only sceanrio --- src/egon/data/datasets/chp/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 8ca4921eb..a833772ea 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -636,6 +636,7 @@ def insert_chp_egon100re(): scenario="eGon100RE", ) +tasks = (create_tables, ) insert_per_scenario = set() @@ -648,6 +649,8 @@ def insert_chp_egon100re(): if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.add(insert_chp_egon100re) +tasks = tasks + (insert_per_scenario, assign_heat_bus) + extension = set() if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: @@ -677,6 +680,8 @@ def insert_chp_egon100re(): extension_BE, } +if len(extension)>0: + tasks = tasks + (extension,) class Chp(Dataset): def __init__(self, dependencies): @@ -684,10 +689,5 @@ def __init__(self, dependencies): name="Chp", version="0.0.7", dependencies=dependencies, - tasks=( - create_tables, - insert_per_scenario, - assign_heat_bus, - extension, - ), + tasks=tasks ) From d5662036fb68e739bde9706d94230b508ebfe949 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 15 May 2023 17:34:08 +0200 Subject: [PATCH 228/787] Remove heavy duty transport for status2019 --- src/egon/data/airflow/dags/pipeline_status_quo.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index b13a3dbf6..446d3a129 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -25,9 +25,6 @@ from egon.data.datasets.electricity_demand_timeseries.cts_buildings import ( CtsDemandBuildings, ) -from egon.data.datasets.emobility.heavy_duty_transport import ( - HeavyDutyTransport, -) from egon.data.datasets.emobility.motorized_individual_travel import ( MotorizedIndividualTravel, ) @@ -489,11 +486,6 @@ dependencies=[mv_grid_districts, hh_demand_buildings_setup] ) - # eMobility: heavy duty transport TODO: adjust for SQ - heavy_duty_transport = HeavyDutyTransport( - dependencies=[vg250, setup_etrago, create_gas_polygons_status2019] - ) - cts_demand_buildings = CtsDemandBuildings( dependencies=[ osm_buildings_streets, From f08341645b670747a34af7fdb1a6adc261e12407 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 16 May 2023 11:49:30 +0200 Subject: [PATCH 229/787] create central buses for sq scn --- src/egon/data/datasets/electrical_neighbours.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 51da794e9..bec2d0b53 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -237,9 +237,8 @@ def buses(scenario, sources, targets): "geometry", axis="columns" ) central_buses.scn_name = scenario - # Insert all central buses for eGon2035 - if scenario == "eGon2035": + if scenario in ["eGon2035", "status2019"]: central_buses.to_postgis( targets["buses"]["table"], schema=targets["buses"]["schema"], @@ -678,7 +677,7 @@ def grid(): sources = config.datasets()["electrical_neighbours"]["sources"] targets = config.datasets()["electrical_neighbours"]["targets"] - for scenario in ["eGon2035"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: central_buses = buses(scenario, sources, targets) From 3f99d3c42cc5c9104c3e6a7d816614bbc84f58cf Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 16 May 2023 11:52:01 +0200 Subject: [PATCH 230/787] Add scnearios from CLI parameters to dataset versioning --- src/egon/data/datasets/__init__.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index c45e0d470..788b5f1f6 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -13,7 +13,7 @@ from sqlalchemy import Column, ForeignKey, Integer, String, Table, orm, tuple_ from sqlalchemy.ext.declarative import declarative_base -from egon.data import db, logger +from egon.data import config, db, logger Base = declarative_base() SCHEMA = "metadata" @@ -66,6 +66,7 @@ class Model(Base): name = Column(String, unique=True, nullable=False) version = Column(String, nullable=False) epoch = Column(Integer, default=0) + scenarios = Column(String, nullable=False) dependencies = orm.relationship( "Model", secondary=DependencyGraph, @@ -138,7 +139,7 @@ def __init__(self, graph: TaskGraph): self.graph = set(tasks.graph for tasks in results) elif isinstance(graph, tuple): results = [Tasks(subtasks) for subtasks in graph] - for (left, right) in zip(results[:-1], results[1:]): + for left, right in zip(results[:-1], results[1:]): for last in left.last: for first in right.first: last.set_downstream(first) @@ -178,14 +179,19 @@ class Dataset: tasks: Union[Tasks, TaskGraph] = () def check_version(self, after_execution=()): + scenario_names = config.settings()["egon-data"]["--scenarios"] + def skip_task(task, *xs, **ks): with db.session_scope() as session: datasets = session.query(Model).filter_by(name=self.name).all() - if self.version in [ - ds.version for ds in datasets - ] and not re.search(r"\.dev$", self.version): + if ( + self.version in [ds.version for ds in datasets] + and scenario_names in [ds.scenarios for ds in datasets] + and not re.search(r"\.dev$", self.version) + ): logger.info( f"Dataset '{self.name}' version '{self.version}'" + f" scenarios {scenario_names}" f" already executed. Skipping." ) else: @@ -199,13 +205,17 @@ def skip_task(task, *xs, **ks): return skip_task def update(self, session): - dataset = Model(name=self.name, version=self.version) + dataset = Model( + name=self.name, + version=self.version, + scenarios=config.settings()["egon-data"]["--scenarios"], + ) dependencies = ( session.query(Model) .filter( - tuple_(Model.name, Model.version).in_( + tuple_(Model.name, Model.version, Model.scenarios).in_( [ - (dataset.name, dataset.version) + (dataset.name, dataset.version, dataset.scenarios) for dependency in self.dependencies if isinstance(dependency, Dataset) or hasattr(dependency, "dataset") From 69fec2742a69a1dec2d6edbf95803fc5affff2d2 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 16 May 2023 12:10:17 +0200 Subject: [PATCH 231/787] create function insert_generators_sq --- .../data/datasets/electrical_neighbours.py | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index bec2d0b53..4c49a5d5b 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1362,3 +1362,211 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 df.index = pd.date_range(year_start, periods=8760 , freq="H") return df + +def map_carriers_entsoe(): + """Map carriers from entsoe-data to carriers used in eGon + Returns + ------- + dict + Carrier from entsoe to eGon + """ + return { + 'Biomass': "biomass", + 'Fossil Brown coal/Lignite': "lignite", + 'Fossil Coal-derived gas': "coal", + 'Fossil Gas': "CH4_NG", + 'Fossil Hard coal': "coal", + 'Fossil Oil': "oil", + 'Fossil Oil shale': "oil", + 'Fossil Peat': "biomass", + 'Geothermal': "geo_thermal", + 'Hydro Pumped Storage': "Hydro Pumped Storage", + 'Hydro Run-of-river and poundage': "run_of_river", + 'Hydro Water Reservoir': "reservoir", + 'Marine': "marine", + 'Nuclear': "nuclear", + 'Other': "others", + 'Other renewable': "others", + 'Solar': "solar", + 'Waste': "others", + 'Wind Offshore': "wind_offshore", + 'Wind Onshore': "wind_onshore", + } + +def insert_generators_sq(gen_sq, scn_name = "status2019"): + """ + Insert generators for foreign countries based on ENTSO-E data + + Parameters + ---------- + gen_sq : pandas dataframe + df with all the foreign generators produced by the function + entsoe_historic_generation_capacities + scn_name : str + The default is "status2019". + + Returns + ------- + None. + + """ + ################# TEMPORAL #################### + gen_sq = pd.read_csv("data_bundle_egon_data/gen_entsoe.csv", index_col="Index") + ################# TEMPORAL #################### + + targets = config.datasets()["electrical_neighbours"]["targets"] + # Delete existing data + db.execute_sql( + f""" + DELETE FROM + {targets['generators']['schema']}.{targets['generators']['table']} + WHERE bus IN ( + SELECT bus_id FROM + {targets['buses']['schema']}.{targets['buses']['table']} + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + AND carrier != 'CH4' + """ + ) + + db.execute_sql( + f""" + DELETE FROM + {targets['generators_timeseries']['schema']}. + {targets['generators_timeseries']['table']} + WHERE generator_id NOT IN ( + SELECT generator_id FROM + {targets['generators']['schema']}.{targets['generators']['table']} + ) + AND scn_name = '{scn_name}' + """ + ) + + map_entsoe= pd.Series({"LU": "LU00", + "AT": "AT00", + "FR": "FR00", + "NL": "NL00", + "DK_1": "DK00", + "DK_2": "DKE1", + "PL": "PL00", + "CH": "CH00", + "NO": "NO00", + "BE": "BE00", + "SE": "SE00", + "GB": "UK00"}) + + for_bus = get_foreign_bus_id() + + entsoe_to_bus = map_entsoe.map(for_bus) + + map_entsoe = map_carriers_entsoe() + gen_sq = gen_sq.groupby(axis=1, by=map_entsoe).sum() + gen_sq = gen_sq.iloc[:, gen_sq.columns.isin( + [ + "others", + "wind_offshore", + "wind_onshore", + "solar", + "reservoir", + "run_of_river", + "lignite", + "coal", + "oil", + "nuclear", + ] + ) + ] + + list_gen_sq = pd.DataFrame(dtype=int, columns=["carrier", "country", "capacity"]) + for carrier in gen_sq.columns: + gen_carry = gen_sq[carrier] + for country, cap in gen_carry.iteritems(): + gen = pd.DataFrame({"carrier": carrier, "country": country, "capacity": cap}, index=[1]) + #print(gen) + list_gen_sq = pd.concat([list_gen_sq, gen], ignore_index=True) + + list_gen_sq = list_gen_sq[list_gen_sq.capacity > 0] + list_gen_sq["scenario"] = scn_name + + # Add marginal costs + list_gen_sq = add_marginal_costs(list_gen_sq) + + # Find foreign bus to assign the generator + list_gen_sq["bus"] = list_gen_sq.country.map(entsoe_to_bus) + + # insert generators data + session = sessionmaker(bind=db.engine())() + for i, row in list_gen_sq.iterrows(): + entry = etrago.EgonPfHvGenerator( + scn_name=row.scenario, + generator_id=int(db.next_etrago_id("generator")), + bus=row.bus, + carrier=row.carrier, + p_nom=row.capacity, + marginal_cost=row.marginal_cost, + ) + + session.add(entry) + session.commit() + + # assign generators time-series data + renew_carriers_sq = ["wind_onshore", "wind_offshore", "solar"] + + sql = f"""SELECT * FROM + {targets['generators_timeseries']['schema']}. + {targets['generators_timeseries']['table']} + WHERE scn_name = 'eGon100RE' + """ + series_egon100 = pd.read_sql_query(sql, db.engine()) + + sql = f""" SELECT * FROM + {targets['generators']['schema']}.{targets['generators']['table']} + WHERE bus IN ( + SELECT bus_id FROM + {targets['buses']['schema']}.{targets['buses']['table']} + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + """ + gen_sq = pd.read_sql_query(sql, db.engine()) + gen_sq = gen_sq[gen_sq.carrier.isin(renew_carriers_sq)] + + sql = f""" SELECT * FROM + {targets['generators']['schema']}.{targets['generators']['table']} + WHERE bus IN ( + SELECT bus_id FROM + {targets['buses']['schema']}.{targets['buses']['table']} + WHERE country != 'DE' + AND scn_name = 'eGon100RE') + AND scn_name = 'eGon100RE' + """ + gen_100 = pd.read_sql_query(sql, db.engine()) + gen_100 = gen_100[gen_100["carrier"].isin(renew_carriers_sq)] + + # egon_sq_to_100 map the timeseries used in the scenario eGon100RE + # to the same bus and carrier for the status quo scenario + egon_sq_to_100 = {} + for i, gen in gen_sq.iterrows(): + gen_id_100 = gen_100[ + (gen_100["bus"] == gen["bus"]) + & (gen_100["carrier"] == gen["carrier"]) + ]["generator_id"].values[0] + + egon_sq_to_100[gen["generator_id"]] = gen_id_100 + + # insert generators_timeseries data + session = sessionmaker(bind=db.engine())() + + for gen_id in gen_sq.generator_id: + serie = series_egon100[ + series_egon100.generator_id == egon_sq_to_100[gen_id] + ]["p_max_pu"].values[0] + entry = etrago.EgonPfHvGeneratorTimeseries( + scn_name=scn_name, generator_id=gen_id, temp_id=1, p_max_pu=serie + ) + + session.add(entry) + session.commit() + + return From 6db49866703a1f31faec77816736bc3f919a773d Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 16 May 2023 13:42:34 +0200 Subject: [PATCH 232/787] update class ElectricalNeighbours --- src/egon/data/datasets/electrical_neighbours.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 4c49a5d5b..20fa1d280 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -27,8 +27,8 @@ def __init__(self, dependencies): name="ElectricalNeighbours", version="0.0.7", dependencies=dependencies, - tasks=(grid, {tyndp_generation, tyndp_demand}), - ) + tasks=(grid, {tyndp_generation, tyndp_demand}, insert_generators_sq) + ) def get_cross_border_buses(scenario, sources): @@ -1393,7 +1393,7 @@ def map_carriers_entsoe(): 'Wind Onshore': "wind_onshore", } -def insert_generators_sq(gen_sq, scn_name = "status2019"): +def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1413,7 +1413,7 @@ def insert_generators_sq(gen_sq, scn_name = "status2019"): ################# TEMPORAL #################### gen_sq = pd.read_csv("data_bundle_egon_data/gen_entsoe.csv", index_col="Index") ################# TEMPORAL #################### - + targets = config.datasets()["electrical_neighbours"]["targets"] # Delete existing data db.execute_sql( From d30e35957bd38bac0d827263c8c87c2aff7d4312 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 16 May 2023 14:13:11 +0200 Subject: [PATCH 233/787] adjust MotorizedIndividualTravel class so status2019 is also considered --- .../emobility/motorized_individual_travel/__init__.py | 6 +++++- .../motorized_individual_travel/model_timeseries.py | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index fdf0b5fbe..641a6b93f 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -109,6 +109,7 @@ from egon.data.datasets.emobility.motorized_individual_travel.model_timeseries import ( # noqa: E501 delete_model_data_from_db, generate_model_data_bunch, + generate_model_data_status2019_remaining, generate_model_data_eGon100RE_remaining, generate_model_data_eGon2035_remaining, read_simbev_metadata_file, @@ -445,6 +446,8 @@ def generate_model_data_tasks(scenario_name): ) ) + if scenario_name == "status2019": + tasks.add(generate_model_data_status2019_remaining) if scenario_name == "eGon2035": tasks.add(generate_model_data_eGon2035_remaining) elif scenario_name == "eGon100RE": @@ -453,7 +456,7 @@ def generate_model_data_tasks(scenario_name): super().__init__( name="MotorizedIndividualTravel", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( create_tables, @@ -471,6 +474,7 @@ def generate_model_data_tasks(scenario_name): allocate_evs_to_grid_districts, delete_model_data_from_db, { + *generate_model_data_tasks(scenario_name="status2019"), *generate_model_data_tasks(scenario_name="eGon2035"), *generate_model_data_tasks(scenario_name="eGon100RE"), }, diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index ea68bfc67..fc2159ce5 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -1058,6 +1058,14 @@ def generate_model_data_bunch(scenario_name: str, bunch: range) -> None: bat_cap=meta_tech_data.battery_capacity, ) +def generate_model_data_status2019_remaining(): + """Generates timeseries for status2019 scenario for grid districts which + has not been processed in the parallel tasks before. + """ + generate_model_data_bunch( + scenario_name="status2019", + bunch=range(MVGD_MIN_COUNT, len(load_grid_district_ids())), + ) def generate_model_data_eGon2035_remaining(): """Generates timeseries for eGon2035 scenario for grid districts which From 48eb3657a81cf8bfe7f4e87a0ba53b8a6ec7fe94 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 17 May 2023 09:13:32 +0200 Subject: [PATCH 234/787] Fix update function of dataset versioning --- src/egon/data/datasets/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 788b5f1f6..8a20ee006 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -213,9 +213,9 @@ def update(self, session): dependencies = ( session.query(Model) .filter( - tuple_(Model.name, Model.version, Model.scenarios).in_( + tuple_(Model.name, Model.version).in_( [ - (dataset.name, dataset.version, dataset.scenarios) + (dataset.name, dataset.version) for dependency in self.dependencies if isinstance(dependency, Dataset) or hasattr(dependency, "dataset") From 93a325ea72bae0c1d20acd7588acb7742e8c9a1a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 17 May 2023 09:17:00 +0200 Subject: [PATCH 235/787] Fix checking if extension is empty --- src/egon/data/datasets/chp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index a833772ea..a1f509375 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -680,7 +680,7 @@ def insert_chp_egon100re(): extension_BE, } -if len(extension)>0: +if extension != set(): tasks = tasks + (extension,) class Chp(Dataset): From 9e8dfe650dcfa57609cb027c8808e92abdea2601 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 17 May 2023 15:49:14 +0200 Subject: [PATCH 236/787] Always create data for scenario eGon2021 --- src/egon/data/datasets/demandregio/__init__.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 1ebc4bbc0..a403a5f2f 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -181,7 +181,6 @@ def insert_cts_ind_wz_definitions(): engine = db.engine() for sector in source["wz_definitions"]: - file_path = ( Path(".") / "data_bundle_egon_data" @@ -448,7 +447,6 @@ def disagg_households_power( df *= 119000000 / df.sum().sum() elif scenario == "eGon100RE": - # chose demand per household size from survey without DHW power_per_HH = demand_per_hh_size["without DHW"] / 1e3 @@ -595,13 +593,16 @@ def insert_household_demand(): ] engine = db.engine() + scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] + + scenarios.append("eGon2021") + for t in targets: db.execute_sql( f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: - + for scn in scenarios: year = scenario_parameters.global_settings(scn)["population_year"] # Insert demands of private households @@ -629,8 +630,11 @@ def insert_cts_ind_demands(): insert_cts_ind_wz_definitions() - for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: + scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] + + scenarios.append("eGon2021") + for scn in scenarios: year = scenario_parameters.global_settings(scn)["population_year"] if year > 2035: @@ -785,7 +789,5 @@ def timeseries_per_wz(): years = get_sector_parameters("global").weather_year.unique() for year in years: - for sector in ["CTS", "industry"]: - insert_timeseries_per_wz(sector, int(year)) From 0a9e00e185c48ba416053420cdeccb2520eaccc1 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 17 May 2023 15:52:32 +0200 Subject: [PATCH 237/787] Revert "Work-around to skip long tasks for individual heating supply" This reverts commit 62b5244c54f59604bd90a22de7bc1aebd43c8cd5. --- .../heat_supply/individual_heating.py | 226 ++++++++---------- 1 file changed, 103 insertions(+), 123 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 1ae560ec6..08c038a6a 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -208,7 +208,7 @@ write_table_to_postgres, ) from egon.data.datasets.emobility.motorized_individual_travel.helpers import ( - reduce_mem_usage, + reduce_mem_usage ) from egon.data.datasets.heat_demand import EgonPetaHeat from egon.data.datasets.heat_demand_timeseries.daily import ( @@ -264,41 +264,34 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ) tasks = set() - - if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: - for i in range(parallel_tasks): - tasks.add( - PythonOperator( - task_id=( - f"individual_heating." - f"determine-hp-capacity-pypsa-eur-sec-" - f"mvgd-bulk{i}" - ), - python_callable=split_mvgds_into_bulks, - op_kwargs={ - "n": i, - "max_n": parallel_tasks, - "func": determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec, # noqa: E501 - }, - ) + for i in range(parallel_tasks): + tasks.add( + PythonOperator( + task_id=( + f"individual_heating." + f"determine-hp-capacity-pypsa-eur-sec-" + f"mvgd-bulk{i}" + ), + python_callable=split_mvgds_into_bulks, + op_kwargs={ + "n": i, + "max_n": parallel_tasks, + "func": determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec, # noqa: E501 + }, ) + ) return tasks - if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: - tasks = ( - delete_pypsa_eur_sec_csv_file, - delete_mvgd_ts_100RE, - delete_heat_peak_loads_100RE, - {*dyn_parallel_tasks_pypsa_eur_sec()}, - ) - else: - tasks = empty_task - super().__init__( name="HeatPumpsPypsaEurSec", version="0.0.2", dependencies=dependencies, - tasks=tasks, + tasks=( + delete_pypsa_eur_sec_csv_file, + delete_mvgd_ts_100RE, + delete_heat_peak_loads_100RE, + {*dyn_parallel_tasks_pypsa_eur_sec()}, + ), ) @@ -323,40 +316,34 @@ def dyn_parallel_tasks_2035(): "parallel_tasks", 1 ) tasks = set() - if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - for i in range(parallel_tasks): - tasks.add( - PythonOperator( - task_id=( - "individual_heating." - f"determine-hp-capacity-2035-" - f"mvgd-bulk{i}" - ), - python_callable=split_mvgds_into_bulks, - op_kwargs={ - "n": i, - "max_n": parallel_tasks, - "func": determine_hp_cap_peak_load_mvgd_ts_2035, - }, - ) + for i in range(parallel_tasks): + tasks.add( + PythonOperator( + task_id=( + "individual_heating." + f"determine-hp-capacity-2035-" + f"mvgd-bulk{i}" + ), + python_callable=split_mvgds_into_bulks, + op_kwargs={ + "n": i, + "max_n": parallel_tasks, + "func": determine_hp_cap_peak_load_mvgd_ts_2035, + }, ) - return tasks - - if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - tasks = ( - delete_heat_peak_loads_2035, - delete_hp_capacity_2035, - delete_mvgd_ts_2035, - {*dyn_parallel_tasks_2035()}, - ) - else: - tasks = empty_task_2 + ) + return tasks super().__init__( name="HeatPumps2035", version="0.0.2", dependencies=dependencies, - tasks=tasks, + tasks=( + delete_heat_peak_loads_2035, + delete_hp_capacity_2035, + delete_mvgd_ts_2035, + {*dyn_parallel_tasks_2035()}, + ), ) @@ -383,14 +370,6 @@ class BuildingHeatPeakLoads(Base): peak_load_in_w = Column(REAL) -def empty_task(): - print("Doing nothing") - - -def empty_task_2(): - print("Doing nothing again") - - def adapt_numpy_float64(numpy_float64): return AsIs(numpy_float64) @@ -406,6 +385,7 @@ def cascade_per_technology( distribution_level, max_size_individual_chp=0.05, ): + """Add plants for individual heat. Currently only on mv grid district level. @@ -435,6 +415,7 @@ def cascade_per_technology( # Distribute heat pumps linear to remaining demand. if tech.index == "heat_pump": + if distribution_level == "federal_state": # Select target values per federal state target = db.select_dataframe( @@ -486,6 +467,7 @@ def cascade_per_technology( ) elif tech.index == "gas_boiler": + append_df = pd.DataFrame( data={ "capacity": heat_per_mv.remaining_demand.div( @@ -841,10 +823,8 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): left=df_peta_demand, right=df_profiles_ids, on="zensus_population_id" ) - df_profile_merge.demand = df_profile_merge.demand.div( - df_profile_merge.buildings - ) - df_profile_merge.drop("buildings", axis="columns", inplace=True) + df_profile_merge.demand = df_profile_merge.demand.div(df_profile_merge.buildings) + df_profile_merge.drop('buildings', axis='columns', inplace=True) # Merge daily demand to daily profile ids by zensus_population_id and day df_profile_merge = pd.merge( @@ -853,9 +833,8 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): on=["zensus_population_id", "day_of_year"], ) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.daily_demand_share - ) - df_profile_merge.drop("daily_demand_share", axis="columns", inplace=True) + df_profile_merge.daily_demand_share) + df_profile_merge.drop('daily_demand_share', axis='columns', inplace=True) df_profile_merge = reduce_mem_usage(df_profile_merge) # Merge daily profiles by profile id @@ -868,13 +847,10 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): df_profile_merge = reduce_mem_usage(df_profile_merge) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.idp.astype(float) - ) - df_profile_merge.drop("idp", axis="columns", inplace=True) + df_profile_merge.idp.astype(float)) + df_profile_merge.drop('idp', axis='columns', inplace=True) - df_profile_merge.rename( - {"demand": "demand_ts"}, axis="columns", inplace=True - ) + df_profile_merge.rename({'demand': 'demand_ts'}, axis='columns', inplace=True) df_profile_merge = reduce_mem_usage(df_profile_merge) @@ -882,6 +858,7 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): def plot_heat_supply(resulting_capacities): + from matplotlib import pyplot as plt mv_grids = db.select_geodataframe( @@ -1455,6 +1432,7 @@ def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): ) if hp_cap_grid > 0.0: + # get buildings with decentral heating systems building_ids = get_buildings_with_decentral_heat_demand_in_mv_grid( mv_grid_id, scenario="eGon100RE" @@ -1488,61 +1466,59 @@ def determine_hp_cap_buildings_eGon100RE(): """ - if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: - # ========== Register np datatypes with SQLA ========== - register_adapter(np.float64, adapt_numpy_float64) - register_adapter(np.int64, adapt_numpy_int64) - # ===================================================== + # ========== Register np datatypes with SQLA ========== + register_adapter(np.float64, adapt_numpy_float64) + register_adapter(np.int64, adapt_numpy_int64) + # ===================================================== - with db.session_scope() as session: - query = ( - session.query( - MapZensusGridDistricts.bus_id, - ) - .filter( - MapZensusGridDistricts.zensus_population_id - == EgonPetaHeat.zensus_population_id - ) - .distinct(MapZensusGridDistricts.bus_id) + with db.session_scope() as session: + query = ( + session.query( + MapZensusGridDistricts.bus_id, ) - mvgd_ids = pd.read_sql( - query.statement, query.session.bind, index_col=None + .filter( + MapZensusGridDistricts.zensus_population_id + == EgonPetaHeat.zensus_population_id ) - mvgd_ids = mvgd_ids.sort_values("bus_id") - mvgd_ids = mvgd_ids["bus_id"].values - - df_hp_cap_per_building_100RE_db = pd.DataFrame( - columns=["building_id", "hp_capacity"] + .distinct(MapZensusGridDistricts.bus_id) + ) + mvgd_ids = pd.read_sql( + query.statement, query.session.bind, index_col=None ) + mvgd_ids = mvgd_ids.sort_values("bus_id") + mvgd_ids = mvgd_ids["bus_id"].values - for mvgd_id in mvgd_ids: - logger.info(f"MVGD={mvgd_id} | Start") + df_hp_cap_per_building_100RE_db = pd.DataFrame( + columns=["building_id", "hp_capacity"] + ) - hp_cap_per_building_100RE = ( - determine_hp_cap_buildings_eGon100RE_per_mvgd(mvgd_id) - ) + for mvgd_id in mvgd_ids: - if not hp_cap_per_building_100RE.empty: - df_hp_cap_per_building_100RE_db = pd.concat( - [ - df_hp_cap_per_building_100RE_db, - hp_cap_per_building_100RE.reset_index(), - ], - axis=0, - ) + logger.info(f"MVGD={mvgd_id} | Start") - logger.info( - f"MVGD={min(mvgd_ids)} : {max(mvgd_ids)} | Write data to db." + hp_cap_per_building_100RE = ( + determine_hp_cap_buildings_eGon100RE_per_mvgd(mvgd_id) ) - df_hp_cap_per_building_100RE_db["scenario"] = "eGon100RE" - EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) + if not hp_cap_per_building_100RE.empty: + df_hp_cap_per_building_100RE_db = pd.concat( + [ + df_hp_cap_per_building_100RE_db, + hp_cap_per_building_100RE.reset_index(), + ], + axis=0, + ) - write_table_to_postgres( - df_hp_cap_per_building_100RE_db, - EgonHpCapacityBuildings, - drop=False, - ) + logger.info(f"MVGD={min(mvgd_ids)} : {max(mvgd_ids)} | Write data to db.") + df_hp_cap_per_building_100RE_db["scenario"] = "eGon100RE" + + EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) + + write_table_to_postgres( + df_hp_cap_per_building_100RE_db, + EgonHpCapacityBuildings, + drop=False, + ) def aggregate_residential_and_cts_profiles(mvgd, scenario): @@ -1669,7 +1645,9 @@ def export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec): os.mkdir(folder) if not file.is_file(): logger.info(f"Create {file}") - df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv(file, mode="w", header=True) + df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( + file, mode="w", header=True + ) else: df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( file, mode="a", header=False @@ -1742,6 +1720,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: + logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -1875,6 +1854,7 @@ def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): df_hp_min_cap_mv_grid_pypsa_eur_sec = pd.Series(dtype="float64") for mvgd in mvgd_ids: + logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### From e0a52bfc9ea7f589b4b9fc0bdb555b67f8fe2ed7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 17 May 2023 15:56:13 +0200 Subject: [PATCH 238/787] Remove heat pump tasks for future scenarios --- src/egon/data/airflow/dags/pipeline_status_quo.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 446d3a129..a0ea5e245 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -44,11 +44,6 @@ from egon.data.datasets.heat_etrago import HeatEtrago from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable from egon.data.datasets.heat_supply import HeatSupply -from egon.data.datasets.heat_supply.individual_heating import ( - HeatPumps2035, - HeatPumps2050, - HeatPumpsPypsaEurSec, -) from egon.data.datasets.industrial_sites import MergeIndustrialSites from egon.data.datasets.industry import IndustrialDemandCurves from egon.data.datasets.loadarea import LoadArea, OsmLanduse @@ -309,15 +304,6 @@ ] ) - # Minimum heat pump capacity for pypsa-eur-sec - heat_pumps_pypsa_eur_sec = HeatPumpsPypsaEurSec( - dependencies=[ - cts_demand_buildings, - DistrictHeatingAreas, - heat_time_series, - ] - ) - # run pypsa-eur-sec run_pypsaeursec = PypsaEurSec( dependencies=[ @@ -328,7 +314,6 @@ data_bundle, electrical_load_etrago, heat_time_series, - heat_pumps_pypsa_eur_sec, ] ) From f39442b9ce3c0d641319adc8a041da9b7a1c2b8c Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 17 May 2023 17:04:01 +0200 Subject: [PATCH 239/787] add dumb charging strategy for status2019 scenario --- .../motorized_individual_travel/model_timeseries.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index fc2159ce5..c6418453e 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -745,6 +745,12 @@ def write_load( hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501 ), ) + elif scenario_name=='status2019': + write_load( + scenario_name=scenario_name, + connection_bus_id=etrago_bus.bus_id, + load_ts=hourly_load_time_series_df.load_time_series.to_list(), + ) else: # Get lowflex scenario name lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][ From d7793f3b801dc178eaf18a2afb4fb57dc501e03f Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 19 May 2023 10:42:10 +0200 Subject: [PATCH 240/787] fix coordinates --- src/egon/data/datasets/fix_ehv_subnetworks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 396deb8cf..0efb0bde5 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -214,8 +214,8 @@ def fix_subnetworks(scn_name): # Missing line from Umspannwerk Plottling to Gänsdorf UW add_line( - 12.853318030996972, # Umspannwerk Plottling - 48.76508569478315, + 12.85381530378627, # Umspannwerk Plottling + 48.764209444817745, 12.769768646403532, # Gänsdorf UW 48.80533685376445, 380, @@ -228,7 +228,7 @@ def fix_subnetworks(scn_name): 11.4295305, # Ottstedt 50.9115176, 11.4299277, # Ottstedt - 50.9114496, + 50.911449600000005, 380, scn_name, 3, From 0ad1c2b40f832b7e94612ddaf1a206e319e90b9e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 19 May 2023 14:12:39 +0200 Subject: [PATCH 241/787] Adjust creation of electricity demand profiles per building for status2019 --- .../hh_buildings.py | 4 +- .../hh_profiles.py | 105 +++++++++++++----- 2 files changed, 79 insertions(+), 30 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 9d5cbd4a9..7f38accd8 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -446,7 +446,6 @@ def generate_mapping_table( """ def create_pool(buildings, profiles): - if profiles > buildings: surplus = profiles - buildings surplus = rng.integers(0, buildings, surplus) @@ -642,6 +641,7 @@ def get_building_peak_loads(): session.query( HouseholdElectricityProfilesOfBuildings, HouseholdElectricityProfilesInCensusCells.nuts3, + HouseholdElectricityProfilesInCensusCells.factor_2019, HouseholdElectricityProfilesInCensusCells.factor_2035, HouseholdElectricityProfilesInCensusCells.factor_2050, ) @@ -689,10 +689,12 @@ def ve(s): df_building_peak_load_nuts3 = pd.DataFrame( [ + df_building_peak_load_nuts3 * df["factor_2019"].unique(), df_building_peak_load_nuts3 * df["factor_2035"].unique(), df_building_peak_load_nuts3 * df["factor_2050"].unique(), ], index=[ + "status2019", "eGon2035", "eGon100RE", ], diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index fc12de792..9deade3b6 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -164,6 +164,7 @@ class HouseholdElectricityProfilesInCensusCells(Base): cell_profile_ids = Column(ARRAY(String, dimensions=1)) nuts3 = Column(String) nuts1 = Column(String) + factor_2019 = Column(Float) factor_2035 = Column(Float) factor_2050 = Column(Float) @@ -195,28 +196,50 @@ class EgonEtragoElectricityHouseholds(Base): class HouseholdDemands(Dataset): def __init__(self, dependencies): - mv_hh_electricity_load_2035 = PythonOperator( - task_id="MV-hh-electricity-load-2035", - python_callable=mv_grid_district_HH_electricity_load, - op_args=["eGon2035", 2035], - op_kwargs={"drop_table": True}, - ) + tasks = (houseprofiles_in_census_cells,) + + if ( + "status2019" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + mv_hh_electricity_load_2035 = PythonOperator( + task_id="MV-hh-electricity-load-2019", + python_callable=mv_grid_district_HH_electricity_load, + op_args=["status2019", 2019], + op_kwargs={"drop_table": True}, + ) - mv_hh_electricity_load_2050 = PythonOperator( - task_id="MV-hh-electricity-load-2050", - python_callable=mv_grid_district_HH_electricity_load, - op_args=["eGon100RE", 2050], - ) + tasks = tasks + (mv_hh_electricity_load_2035,) + + if ( + "eGon2035" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + mv_hh_electricity_load_2035 = PythonOperator( + task_id="MV-hh-electricity-load-2035", + python_callable=mv_grid_district_HH_electricity_load, + op_args=["eGon2035", 2035], + ) + + tasks = tasks + (mv_hh_electricity_load_2035,) + + if ( + "eGon100RE" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + mv_hh_electricity_load_2050 = PythonOperator( + task_id="MV-hh-electricity-load-2050", + python_callable=mv_grid_district_HH_electricity_load, + op_args=["eGon100RE", 2050], + ) + + tasks = tasks + (mv_hh_electricity_load_2050,) super().__init__( name="Household Demands", - version="0.0.10", + version="0.0.11", dependencies=dependencies, - tasks=( - houseprofiles_in_census_cells, - mv_hh_electricity_load_2035, - mv_hh_electricity_load_2050, - ), + tasks=tasks, ) @@ -843,7 +866,6 @@ def impute_missing_hh_in_populated_cells(df_census_households_grid): # iterate over unique population values for population in df_wo_hh["population"].sort_values().unique(): - # create fallback if no cell with specific population available if population in df_w_hh["population"].unique(): fallback_value = population @@ -1271,7 +1293,6 @@ def assign_hh_demand_profiles_to_cells(df_zensus_cells, df_iee_profiles): # only use non zero entries df_zensus_cells = df_zensus_cells.loc[df_zensus_cells["hh_10types"] != 0] for grid_id, df_cell in df_zensus_cells.groupby(by="grid_id"): - # random sampling of household profiles for each cell # with or without replacement (see :func:`get_cell_demand_profile_ids`) # within cell but after number of households are rounded to the nearest @@ -1342,16 +1363,42 @@ def adjust_to_demand_regio_nuts3_annual( # ############## # demand regio in MWh # profiles in Wh - df_hh_profiles_in_census_cells.loc[nuts3_cell_ids, "factor_2035"] = ( - df_demand_regio.loc[(2035, nuts3_id), "demand_mwha"] - * 1e3 - / (nuts3_profiles_sum_annual / 1e3) - ) - df_hh_profiles_in_census_cells.loc[nuts3_cell_ids, "factor_2050"] = ( - df_demand_regio.loc[(2050, nuts3_id), "demand_mwha"] - * 1e3 - / (nuts3_profiles_sum_annual / 1e3) - ) + + if ( + "status2019" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + df_hh_profiles_in_census_cells.loc[ + nuts3_cell_ids, "factor_2019" + ] = ( + df_demand_regio.loc[(2019, nuts3_id), "demand_mwha"] + * 1e3 + / (nuts3_profiles_sum_annual / 1e3) + ) + + if ( + "eGon2035" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + df_hh_profiles_in_census_cells.loc[ + nuts3_cell_ids, "factor_2035" + ] = ( + df_demand_regio.loc[(2035, nuts3_id), "demand_mwha"] + * 1e3 + / (nuts3_profiles_sum_annual / 1e3) + ) + + if ( + "eGon100RE" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + df_hh_profiles_in_census_cells.loc[ + nuts3_cell_ids, "factor_2050" + ] = ( + df_demand_regio.loc[(2050, nuts3_id), "demand_mwha"] + * 1e3 + / (nuts3_profiles_sum_annual / 1e3) + ) return df_hh_profiles_in_census_cells From 8e31a06a6f68cca31c1314e59eeef0a8c70278b0 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 19 May 2023 14:30:20 +0200 Subject: [PATCH 242/787] Adjust CTS electricity demand profile creation to include status2019 --- .../cts_buildings.py | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index 3ac66c1ad..89851f945 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -175,7 +175,7 @@ import pandas as pd import saio -from egon.data import db +from egon.data import config, db from egon.data import logger as log from egon.data.datasets import Dataset from egon.data.datasets.electricity_demand import ( @@ -257,7 +257,7 @@ class CtsDemandBuildings(Dataset): def __init__(self, dependencies): super().__init__( name="CtsDemandBuildings", - version="0.0.3", + version="0.0.4", dependencies=dependencies, tasks=( cts_buildings, @@ -300,7 +300,7 @@ def amenities_without_buildings(): ) .filter( EgonDemandRegioZensusElectricity.sector == "service", - EgonDemandRegioZensusElectricity.scenario == "eGon2035", + EgonDemandRegioZensusElectricity.scenario == "status2019", ) ) @@ -461,7 +461,7 @@ def buildings_with_amenities(): ) .filter( EgonDemandRegioZensusElectricity.sector == "service", - EgonDemandRegioZensusElectricity.scenario == "eGon2035", + EgonDemandRegioZensusElectricity.scenario == "status2019", ) ) df_amenities_in_buildings = pd.read_sql( @@ -477,7 +477,6 @@ def buildings_with_amenities(): # retrieve building centroid bus_id with db.session_scope() as session: - cells_query = session.query( egon_map_zensus_buildings_filtered_all.id, MapZensusGridDistricts.bus_id.label("building_bus_id"), @@ -602,7 +601,6 @@ def buildings_without_amenities(): # buildings_filtered in cts-demand-cells without amenities with db.session_scope() as session: - # Synthetic Buildings q_synth_buildings = session.query( osm_buildings_synthetic.cell_id.cast(Integer).label( @@ -647,7 +645,7 @@ def buildings_without_amenities(): ) .filter( EgonDemandRegioZensusElectricity.sector == "service", - EgonDemandRegioZensusElectricity.scenario == "eGon2035", + EgonDemandRegioZensusElectricity.scenario == "status2019", ) .filter( EgonDemandRegioZensusElectricity.zensus_population_id.notin_( @@ -747,7 +745,7 @@ def cells_with_cts_demand_only(df_buildings_without_amenities): ) .filter( EgonDemandRegioZensusElectricity.sector == "service", - EgonDemandRegioZensusElectricity.scenario == "eGon2035", + EgonDemandRegioZensusElectricity.scenario == "status2019", ) .filter( EgonDemandRegioZensusElectricity.zensus_population_id.notin_( @@ -1194,10 +1192,11 @@ def cts_buildings(): Note: ----- Cells with CTS demand, amenities and buildings do not change within - the scenarios, only the demand itself. Therefore scenario eGon2035 + the scenarios, only the demand itself. Therefore scenario status2019 can be used universally to determine the cts buildings but not for the demand share. """ + # ========== Register np datatypes with SQLA ========== def adapt_numpy_float64(numpy_float64): return AsIs(numpy_float64) @@ -1234,7 +1233,6 @@ def adapt_numpy_int64(numpy_int64): # Append lost cells due to duplicated ids, to cover all demand cells if not df_lost_cells.empty: - # Number of synth amenities per cell df_lost_cells["amenities"] = median_n_amenities # create row for every amenity @@ -1398,21 +1396,21 @@ def cts_electricity(): cells_query.statement, cells_query.session.bind, index_col=None ) log.info("CTS buildings from DB imported!") - df_demand_share_2035 = calc_building_demand_profile_share( - df_cts_buildings, scenario="eGon2035", sector="electricity" - ) - log.info("Profile share for egon2035 calculated!") - df_demand_share_100RE = calc_building_demand_profile_share( - df_cts_buildings, scenario="eGon100RE", sector="electricity" - ) - log.info("Profile share for egon100RE calculated!") + df_demand_share = pd.DataFrame() + + for scenario in config.settings()["egon-data"]["--scenarios"]: + df_demand_share_per_scenario = calc_building_demand_profile_share( + df_cts_buildings, scenario=scenario, sector="electricity" + ) + log.info(f"Profile share for {scenario} calculated!") + + df_demand_share = pd.concat( + [df_demand_share, df_demand_share_per_scenario], + axis=0, + ignore_index=True, + ) - df_demand_share = pd.concat( - [df_demand_share_2035, df_demand_share_100RE], - axis=0, - ignore_index=True, - ) df_demand_share.rename(columns={"id": "building_id"}, inplace=True) write_table_to_postgres( @@ -1437,19 +1435,19 @@ def cts_heat(): ) log.info("CTS buildings from DB imported!") - df_demand_share_2035 = calc_building_demand_profile_share( - df_cts_buildings, scenario="eGon2035", sector="heat" - ) - log.info("Profile share for egon2035 calculated!") - df_demand_share_100RE = calc_building_demand_profile_share( - df_cts_buildings, scenario="eGon100RE", sector="heat" - ) - log.info("Profile share for egon100RE calculated!") - df_demand_share = pd.concat( - [df_demand_share_2035, df_demand_share_100RE], - axis=0, - ignore_index=True, - ) + df_demand_share = pd.DataFrame() + + for scenario in config.settings()["egon-data"]["--scenarios"]: + df_demand_share_per_scenario = calc_building_demand_profile_share( + df_cts_buildings, scenario=scenario, sector="heat" + ) + log.info(f"Profile share for {scenario} calculated!") + + df_demand_share = pd.concat( + [df_demand_share, df_demand_share_per_scenario], + axis=0, + ignore_index=True, + ) df_demand_share.rename(columns={"id": "building_id"}, inplace=True) @@ -1477,8 +1475,7 @@ def get_cts_electricity_peak_load(): ).delete() log.info("Cts electricity peak load removed from DB!") - for scenario in ["eGon2035", "eGon100RE"]: - + for scenario in config.settings()["egon-data"]["--scenarios"]: with db.session_scope() as session: cells_query = session.query( EgonCtsElectricityDemandBuildingShare @@ -1549,8 +1546,7 @@ def get_cts_heat_peak_load(): ).delete() log.info("Cts heat peak load removed from DB!") - for scenario in ["eGon2035", "eGon100RE"]: - + for scenario in config.settings()["egon-data"]["--scenarios"]: with db.session_scope() as session: cells_query = session.query( EgonCtsElectricityDemandBuildingShare From f4a7502d8b44dbbe9448a047eb6f6267bad518b6 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 19 May 2023 16:40:16 +0200 Subject: [PATCH 243/787] insert_loads_sq --- .../data/datasets/electrical_neighbours.py | 121 +++++++++++++++--- 1 file changed, 102 insertions(+), 19 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 20fa1d280..129281a0c 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -3,7 +3,7 @@ import zipfile -import entsoe +#import entsoe import requests import logging @@ -1393,6 +1393,24 @@ def map_carriers_entsoe(): 'Wind Onshore': "wind_onshore", } +def entsoe_to_bus_etrago(): + map_entsoe= pd.Series({"LU": "LU00", + "AT": "AT00", + "FR": "FR00", + "NL": "NL00", + "DK_1": "DK00", + "DK_2": "DKE1", + "PL": "PL00", + "CH": "CH00", + "NO": "NO00", + "BE": "BE00", + "SE": "SE00", + "GB": "UK00"}) + + for_bus = get_foreign_bus_id() + + return map_entsoe.map(for_bus) + def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1443,25 +1461,10 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ ) - map_entsoe= pd.Series({"LU": "LU00", - "AT": "AT00", - "FR": "FR00", - "NL": "NL00", - "DK_1": "DK00", - "DK_2": "DKE1", - "PL": "PL00", - "CH": "CH00", - "NO": "NO00", - "BE": "BE00", - "SE": "SE00", - "GB": "UK00"}) - - for_bus = get_foreign_bus_id() - - entsoe_to_bus = map_entsoe.map(for_bus) + entsoe_to_bus = entsoe_to_bus_etrago() - map_entsoe = map_carriers_entsoe() - gen_sq = gen_sq.groupby(axis=1, by=map_entsoe).sum() + carrier_entsoe = map_carriers_entsoe() + gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() gen_sq = gen_sq.iloc[:, gen_sq.columns.isin( [ "others", @@ -1570,3 +1573,83 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): session.commit() return + +def insert_loads_sq(load_sq=None, scn_name = "status2019"): + """ + Copy load timeseries data from entso-e. + + Returns + ------- + None. + + """ + sources = config.datasets()["electrical_neighbours"]["sources"] + targets = config.datasets()["electrical_neighbours"]["targets"] + + ################# TEMPORAL #################### + load_sq = pd.read_csv("data_bundle_egon_data/load_entsoe.csv", index_col="Index") + ################# TEMPORAL #################### + + # Delete existing data + db.execute_sql( + f""" + DELETE FROM {targets['load_timeseries']['schema']}. + {targets['load_timeseries']['table']} + WHERE + scn_name = '{scn_name}' + AND load_id IN ( + SELECT load_id FROM {targets['loads']['schema']}. + {targets['loads']['table']} + WHERE + scn_name = '{scn_name}' + AND carrier = 'AC' + AND bus NOT IN ( + SELECT bus_i + FROM {sources['osmtgmod_bus']['schema']}. + {sources['osmtgmod_bus']['table']})) + """ + ) + + db.execute_sql( + f""" + DELETE FROM {targets['loads']['schema']}. + {targets['loads']['table']} + WHERE + scn_name = '{scn_name}' + AND carrier = 'AC' + AND bus NOT IN ( + SELECT bus_i + FROM {sources['osmtgmod_bus']['schema']}. + {sources['osmtgmod_bus']['table']}) + """ + ) + + # Connect to database + engine = db.engine() + session = sessionmaker(bind=engine)() + + # get the corresponding bus per foreign country + entsoe_to_bus = entsoe_to_bus_etrago() + + # Calculate and insert demand timeseries per etrago bus_id + for country in load_sq.columns: + + load_id = db.next_etrago_id("load") + + entry = etrago.EgonPfHvLoad( + scn_name=scn_name, + load_id=int(load_id), + carrier="AC", + bus=int(entsoe_to_bus[country]), + ) + + entry_ts = etrago.EgonPfHvLoadTimeseries( + scn_name=scn_name, + load_id=int(load_id), + temp_id=1, + p_set=list(load_sq[country]), + ) + + session.add(entry) + session.add(entry_ts) + session.commit() \ No newline at end of file From cd84c670350663236e13cb4432a6359d8b656bc1 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 19 May 2023 16:42:12 +0200 Subject: [PATCH 244/787] add insert_loads_sq to ElectricalNeighbours --- src/egon/data/datasets/electrical_neighbours.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 129281a0c..0d2b09293 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -27,7 +27,8 @@ def __init__(self, dependencies): name="ElectricalNeighbours", version="0.0.7", dependencies=dependencies, - tasks=(grid, {tyndp_generation, tyndp_demand}, insert_generators_sq) + tasks=(grid, {tyndp_generation, tyndp_demand}, + insert_generators_sq, insert_loads_sq) ) From 66a2b90f8c17e6e6548bff185168e4256cc40824 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 22 May 2023 10:20:54 +0200 Subject: [PATCH 245/787] using the eGon2035 simbev run for the 2019 as a first quick and dirty solution --- src/egon/data/datasets.yml | 3 +++ .../emobility/motorized_individual_travel/__init__.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 07582e7f7..d2d96b380 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1116,6 +1116,9 @@ emobility_mit: columns: "D, J:N" skiprows: 8 trips: + status2019: + file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" + file_metadata: "metadata_simbev_run.json" eGon2035: file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" file_metadata: "metadata_simbev_run.json" diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 641a6b93f..e0cc4955a 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -242,7 +242,7 @@ def extract_trip_file(): """Extract trip file from data bundle""" trip_dir = DATA_BUNDLE_DIR / Path("mit_trip_data") - for scenario_name in ["eGon2035", "eGon100RE"]: + for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: print(f"SCENARIO: {scenario_name}") trip_file = trip_dir / Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -270,7 +270,7 @@ def import_csv(f): df["simbev_ev_id"] = "_".join(f.name.split("_")[0:3]) return df - for scenario_name in ["eGon2035", "eGon100RE"]: + for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: print(f"SCENARIO: {scenario_name}") trip_dir_name = Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -377,7 +377,7 @@ def write_metadata_to_db(): "grid_timeseries_by_usecase": bool, } - for scenario_name in ["eGon2035", "eGon100RE"]: + for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: meta_run_config = read_simbev_metadata_file( scenario_name, "config" ).loc["basic"] From 517541a020ce1fe579f3c47119d4d37a31daa521 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 22 May 2023 11:55:03 +0200 Subject: [PATCH 246/787] add scenario cli parameters for speed up --- .../motorized_individual_travel/__init__.py | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index e0cc4955a..4640967aa 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -242,7 +242,7 @@ def extract_trip_file(): """Extract trip file from data bundle""" trip_dir = DATA_BUNDLE_DIR / Path("mit_trip_data") - for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: + for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: print(f"SCENARIO: {scenario_name}") trip_file = trip_dir / Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -270,7 +270,7 @@ def import_csv(f): df["simbev_ev_id"] = "_".join(f.name.split("_")[0:3]) return df - for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: + for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: print(f"SCENARIO: {scenario_name}") trip_dir_name = Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -377,7 +377,7 @@ def write_metadata_to_db(): "grid_timeseries_by_usecase": bool, } - for scenario_name in ["status2019", "eGon2035", "eGon100RE"]: + for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: meta_run_config = read_simbev_metadata_file( scenario_name, "config" ).loc["basic"] @@ -448,17 +448,13 @@ def generate_model_data_tasks(scenario_name): if scenario_name == "status2019": tasks.add(generate_model_data_status2019_remaining) - if scenario_name == "eGon2035": + elif scenario_name == "eGon2035": tasks.add(generate_model_data_eGon2035_remaining) elif scenario_name == "eGon100RE": tasks.add(generate_model_data_eGon100RE_remaining) return tasks - super().__init__( - name="MotorizedIndividualTravel", - version="0.0.7", - dependencies=dependencies, - tasks=( + tasks = ( create_tables, { ( @@ -472,11 +468,18 @@ def generate_model_data_tasks(scenario_name): ), }, allocate_evs_to_grid_districts, - delete_model_data_from_db, - { - *generate_model_data_tasks(scenario_name="status2019"), - *generate_model_data_tasks(scenario_name="eGon2035"), - *generate_model_data_tasks(scenario_name="eGon100RE"), - }, - ), + delete_model_data_from_db, ) + + *generate_model_data_tasks = set() + + for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + *generate_model_data_tasks.add(*generate_model_data_tasks(scenario_name=scenario_name)) + + tasks = tasks + ({*generate_model_data_tasks},) + + super().__init__( + name="MotorizedIndividualTravel", + version="0.0.7", + dependencies=dependencies, + tasks=tasks ) From 7c8b442ade22582f7a64b31cae8942128acb977c Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Mon, 22 May 2023 12:04:28 +0200 Subject: [PATCH 247/787] dealing with the unknown * --- .../emobility/motorized_individual_travel/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 4640967aa..3f1adf606 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -470,10 +470,10 @@ def generate_model_data_tasks(scenario_name): allocate_evs_to_grid_districts, delete_model_data_from_db, ) - *generate_model_data_tasks = set() + generate_model_data_tasks = set() for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: - *generate_model_data_tasks.add(*generate_model_data_tasks(scenario_name=scenario_name)) + generate_model_data_tasks.add(generate_model_data_tasks(scenario_name=scenario_name)) tasks = tasks + ({*generate_model_data_tasks},) From f8e6469f022d925bf68bc227ca062a263b12162c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 22 May 2023 15:02:31 +0200 Subject: [PATCH 248/787] Import config from egon.data --- .../emobility/motorized_individual_travel/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 3f1adf606..4130d24e6 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -82,7 +82,7 @@ import numpy as np import pandas as pd -from egon.data import db, subprocess +from egon.data import config, db, subprocess from egon.data.datasets import Dataset from egon.data.datasets.emobility.motorized_individual_travel.db_classes import ( # noqa: E501 EgonEvCountMunicipality, @@ -242,7 +242,7 @@ def extract_trip_file(): """Extract trip file from data bundle""" trip_dir = DATA_BUNDLE_DIR / Path("mit_trip_data") - for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + for scenario_name in config.settings()["egon-data"]["--scenarios"]: print(f"SCENARIO: {scenario_name}") trip_file = trip_dir / Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -270,7 +270,7 @@ def import_csv(f): df["simbev_ev_id"] = "_".join(f.name.split("_")[0:3]) return df - for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + for scenario_name in config.settings()["egon-data"]["--scenarios"]: print(f"SCENARIO: {scenario_name}") trip_dir_name = Path( DATASET_CFG["original_data"]["sources"]["trips"][scenario_name][ @@ -377,7 +377,7 @@ def write_metadata_to_db(): "grid_timeseries_by_usecase": bool, } - for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + for scenario_name in config.settings()["egon-data"]["--scenarios"]: meta_run_config = read_simbev_metadata_file( scenario_name, "config" ).loc["basic"] From 53abf3a077161e9ea5f765a9e62f663415e741ca Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 22 May 2023 15:03:08 +0200 Subject: [PATCH 249/787] Update list of tasks per scenario --- .../emobility/motorized_individual_travel/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 4130d24e6..b78675fd6 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -454,7 +454,7 @@ def generate_model_data_tasks(scenario_name): tasks.add(generate_model_data_eGon100RE_remaining) return tasks - tasks = ( + tasks = ( create_tables, { ( @@ -470,12 +470,12 @@ def generate_model_data_tasks(scenario_name): allocate_evs_to_grid_districts, delete_model_data_from_db, ) - generate_model_data_tasks = set() + tasks_per_scenario = set() - for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: - generate_model_data_tasks.add(generate_model_data_tasks(scenario_name=scenario_name)) + for scenario_name in config.settings()["egon-data"]["--scenarios"]: + tasks_per_scenario.update(generate_model_data_tasks(scenario_name=scenario_name)) - tasks = tasks + ({*generate_model_data_tasks},) + tasks = tasks + (tasks_per_scenario,) super().__init__( name="MotorizedIndividualTravel", From dc6bd06b2f22493efe4cbaafa5dc4c7c73d463da Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 22 May 2023 16:11:02 +0200 Subject: [PATCH 250/787] adapt select_nep_pumped_hydro --- .../data/datasets/storages/pumped_hydro.py | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index fa076cc74..86559c2de 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -21,7 +21,7 @@ import egon.data.config -def select_nep_pumped_hydro(): +def select_nep_pumped_hydro(scn): """Select pumped hydro plants from NEP power plants list @@ -34,17 +34,32 @@ def select_nep_pumped_hydro(): carrier = "pumped_hydro" - # Select plants with geolocation from list of conventional power plants - nep_ph = db.select_dataframe( - f""" - SELECT bnetza_id, name, carrier, postcode, capacity, city, - federal_state, c2035_capacity - FROM {cfg['sources']['nep_conv']} - WHERE carrier = '{carrier}' - AND c2035_capacity > 0 - AND postcode != 'None'; - """ - ) + if scn == "eGon2035": + # Select plants with geolocation from list of conventional power plants + nep_ph = db.select_dataframe( + f""" + SELECT bnetza_id, name, carrier, postcode, capacity, city, + federal_state, c2035_capacity + FROM {cfg['sources']['nep_conv']} + WHERE carrier = '{carrier}' + AND c2035_capacity > 0 + AND postcode != 'None'; + """ + ) + elif scn == "status2019": + # Select plants with geolocation from list of conventional power plants + nep_ph = db.select_dataframe( + f""" + SELECT bnetza_id, name, carrier, postcode, capacity, city, + federal_state, capacity, commissioned + FROM {cfg['sources']['nep_conv']} + WHERE carrier = '{carrier}' + AND capacity > 0 + AND postcode != 'None'; + """ + ) + else: + raise SystemExit(f"{scn} not recognised") # Removing plants out of Germany nep_ph["postcode"] = nep_ph["postcode"].astype(str) From d7e1207b271892c9beaa178c0168afcf37d0614a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 23 May 2023 09:29:48 +0200 Subject: [PATCH 251/787] Use scenario names from CLI paramaters --- src/egon/data/datasets/electricity_demand/__init__.py | 2 +- src/egon/data/datasets/industry/__init__.py | 2 +- src/egon/data/datasets/industry/temporal.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index 067ca90f6..7233ab94f 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -200,7 +200,7 @@ def distribute_cts_demands(): ) # Insert data per scenario - for scn in sources["demandregio"]["scenarios"]: + for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: # Select heat_demand per zensus cell peta = db.select_dataframe( diff --git a/src/egon/data/datasets/industry/__init__.py b/src/egon/data/datasets/industry/__init__.py index bb4f0fb22..36f7533ef 100644 --- a/src/egon/data/datasets/industry/__init__.py +++ b/src/egon/data/datasets/industry/__init__.py @@ -199,7 +199,7 @@ def industrial_demand_distr(): f"""DELETE FROM {target_osm['schema']}.{target_osm['table']}""" ) - for scn in sources["demandregio"]["scenarios"]: + for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: # Select spatial information from local database # Select administrative districts (Landkreise) including its boundaries diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index 1a2a96450..769064bab 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -256,7 +256,7 @@ def insert_osm_ind_load(): "targets" ] - for scenario in ["eGon2021", "eGon2035", "eGon100RE"]: + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: # Delete existing data from database db.execute_sql( @@ -425,7 +425,7 @@ def insert_sites_ind_load(): "targets" ] - for scenario in ["eGon2021", "eGon2035", "eGon100RE"]: + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: # Delete existing data from database db.execute_sql( From b019db4320ae566240e696a08bc75f9b78e8193b Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 May 2023 11:08:55 +0200 Subject: [PATCH 252/787] Correct table from delete command --- src/egon/data/datasets.yml | 1 + src/egon/data/datasets/storages/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 07582e7f7..3fa60a179 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -375,6 +375,7 @@ power_plants: buses_data: "osmtgmod_results.bus_data" power_plants: 'supply.egon_power_plants' nep_2035: "NEP2035_V2021_scnC2035.xlsx" + storages: 'supply.egon_storages' target: table: 'egon_power_plants' schema: 'supply' diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index f503d4e85..c6add7687 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -231,9 +231,9 @@ def allocate_pumped_hydro_eGon2035(export=True): # Delete existing units in the target table db.execute_sql( - f""" DELETE FROM {cfg ['target']['schema']}.{cfg ['target']['table']} + f""" DELETE FROM {cfg ['sources']['storages']} WHERE carrier IN ('pumped_hydro') - AND scenario='eGon2035';""" + AND scenario='{scn}';""" ) # If export = True export pumped_hydro plants to data base From b047b24390e182f499c77131709a6fb679a7e4c9 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 May 2023 11:10:50 +0200 Subject: [PATCH 253/787] update allocate_pumped_hydro_eGon2035 --- src/egon/data/datasets/storages/__init__.py | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index c6add7687..fca8ff4f5 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -77,9 +77,9 @@ def create_tables(): EgonStorages.__table__.create(bind=engine, checkfirst=True) -def allocate_pumped_hydro_eGon2035(export=True): - """Allocates pumped_hydro plants for eGon2035 scenario and either exports - results to data base or returns as a dataframe +def allocate_pumped_hydro(scn, export=True): + """Allocates pumped_hydro plants for eGon2035 and scenario2019 scenarios + and either exports results to data base or returns as a dataframe Parameters ---------- @@ -91,14 +91,14 @@ def allocate_pumped_hydro_eGon2035(export=True): Returns ------- power_plants : pandas.DataFrame - List of pumped hydro plants in 'eGon2035' scenario + List of pumped hydro plants in 'eGon2035' and 'scenario2019' scenarios """ carrier = "pumped_hydro" cfg = config.datasets()["power_plants"] - nep = select_nep_pumped_hydro() + nep = select_nep_pumped_hydro(scn= scn) mastr = select_mastr_pumped_hydro() # Assign voltage level to MaStR @@ -124,7 +124,12 @@ def allocate_pumped_hydro_eGon2035(export=True): # Match pumped_hydro units from NEP list # using PLZ and capacity matched, mastr, nep = match_storage_units( - nep, mastr, matched, buffer_capacity=0.1, consider_carrier=False + nep, + mastr, + matched, + buffer_capacity=0.1, + consider_carrier=False, + scn=scn ) # Match plants from NEP list using plz, @@ -136,6 +141,7 @@ def allocate_pumped_hydro_eGon2035(export=True): consider_location="plz", consider_carrier=False, consider_capacity=False, + scn=scn, ) # Match plants from NEP list using city, @@ -147,6 +153,7 @@ def allocate_pumped_hydro_eGon2035(export=True): consider_location="city", consider_carrier=False, consider_capacity=False, + scn=scn, ) # Match remaining plants from NEP using the federal state @@ -157,6 +164,7 @@ def allocate_pumped_hydro_eGon2035(export=True): buffer_capacity=0.1, consider_location="federal_state", consider_carrier=False, + scn=scn, ) # Match remaining plants from NEP using the federal state @@ -167,12 +175,13 @@ def allocate_pumped_hydro_eGon2035(export=True): buffer_capacity=0.7, consider_location="federal_state", consider_carrier=False, + scn=scn, ) print(f"{matched.el_capacity.sum()} MW of {carrier} matched") - print(f"{nep.c2035_capacity.sum()} MW of {carrier} not matched") + print(f"{nep.elec_capacity.sum()} MW of {carrier} not matched") - if nep.c2035_capacity.sum() > 0: + if nep.elec_capacity.sum() > 0: # Get location using geolocator and city information located, unmatched = get_location(nep) From 69fc34c99450d6304ba8c10c593f6b006ef2e10d Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 May 2023 11:12:02 +0200 Subject: [PATCH 254/787] update class storages --- src/egon/data/datasets/storages/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index fca8ff4f5..62096f10d 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -46,11 +46,11 @@ class Storages(Dataset): def __init__(self, dependencies): super().__init__( name="Storages", - version="0.0.4", + version="0.0.5", dependencies=dependencies, tasks=( create_tables, - allocate_pumped_hydro_eGon2035, + allocate_pumped_hydro_2035_sq, allocate_pumped_hydro_eGon100RE, allocate_pv_home_batteries_to_grids, allocate_home_batteries_to_buildings, @@ -432,3 +432,9 @@ def allocate_pv_home_batteries_to_grids(): home_batteries_per_scenario("eGon2035") home_batteries_per_scenario("eGon100RE") + +def allocate_pumped_hydro_2035_sq(): + + allocate_pumped_hydro(scn="eGon2035") + allocate_pumped_hydro(scn="status2019") + From 5f203d3e6f065990dc8bff99f855f53ad546c963 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 May 2023 11:13:42 +0200 Subject: [PATCH 255/787] update select_nep_pumped_hydro to accept scenario2019 --- .../data/datasets/storages/pumped_hydro.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 86559c2de..91b95729d 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -46,21 +46,24 @@ def select_nep_pumped_hydro(scn): AND postcode != 'None'; """ ) + nep_ph.rename(columns={"c2035_capacity": "elec_capacity"}, inplace=True) elif scn == "status2019": # Select plants with geolocation from list of conventional power plants nep_ph = db.select_dataframe( f""" SELECT bnetza_id, name, carrier, postcode, capacity, city, - federal_state, capacity, commissioned + federal_state FROM {cfg['sources']['nep_conv']} WHERE carrier = '{carrier}' AND capacity > 0 - AND postcode != 'None'; + AND postcode != 'None' + AND commissioned < '2020'; """ ) + nep_ph["elec_capacity"] = nep_ph["capacity"] else: raise SystemExit(f"{scn} not recognised") - + # Removing plants out of Germany nep_ph["postcode"] = nep_ph["postcode"].astype(str) nep_ph = nep_ph[~nep_ph["postcode"].str.contains("A")] @@ -155,6 +158,7 @@ def match_storage_units( consider_location="plz", consider_carrier=True, consider_capacity=True, + scn="eGon2035", ): """Match storage_units (in this case only pumped hydro) from MaStR to list of power plants from NEP @@ -169,6 +173,8 @@ def match_storage_units( Already matched storage_units buffer_capacity : float, optional Maximum difference in capacity in p.u. The default is 0.1. + scn : string, optional + Scenario name Returns ------- @@ -252,8 +258,8 @@ def match_storage_units( "source": "MaStR scaled with NEP 2021 list", "MaStRNummer": selected.EinheitMastrNummer.head(1), "carrier": carrier, - "el_capacity": row.c2035_capacity, - "scenario": "eGon2035", + "el_capacity": row.elec_capacity, + "scenario": scn, "geometry": selected.geometry.head(1), "voltage_level": selected.voltage_level.head(1), } @@ -311,13 +317,13 @@ def get_location(unmatched): # Copy units with lon and lat to a new dataframe located = unmatched[ - ["bnetza_id", "name", "carrier", "city", "c2035_capacity", "geometry"] + ["bnetza_id", "name", "carrier", "city", "elec_capacity", "geometry"] ].copy() located.dropna(subset=["geometry"], inplace=True) # Rename columns for compatibility reasons located = located.rename( - columns={"c2035_capacity": "el_capacity", "bnetza_id": "MaStRNummer"} + columns={"elec_capacity": "el_capacity", "bnetza_id": "MaStRNummer"} ) located["scenario"] = "eGon2035" located["source"] = "NEP power plants geolocated using city" From 03c2043890c512e566e11a7e43171a68736b02f6 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 23 May 2023 12:22:00 +0200 Subject: [PATCH 256/787] corrected scenario-specific task creation --- src/egon/data/datasets/electrical_neighbours.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 4beea2752..5ba72eb25 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1652,12 +1652,12 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): insert_per_scenario = set() if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update([{tyndp_generation, tyndp_demand}]) + insert_per_scenario.update([tyndp_generation, tyndp_demand]) if "status2019" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update([{insert_generators_sq, insert_loads_sq}]) + insert_per_scenario.update([insert_generators_sq, insert_loads_sq]) -tasks = tasks + insert_per_scenario +tasks = tasks + (insert_per_scenario, ) class ElectricalNeighbours(Dataset): def __init__(self, dependencies): From 1ba1bf8740ce52cd91540e3615264737b14a7c57 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 May 2023 17:39:13 +0200 Subject: [PATCH 257/787] include solar_rooftop --- src/egon/data/datasets/power_plants/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 4c26ae123..f2b612ab9 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -941,7 +941,7 @@ def power_plants_status_quo(scn_name = "status2019"): f""" DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} WHERE carrier IN ('wind_onshore', 'solar', 'biomass', - 'run_of_river', 'reservoir') + 'run_of_river', 'reservoir', 'solar_rooftop') AND scenario = '{scn_name}' """ ) @@ -1002,14 +1002,21 @@ def power_plants_status_quo(scn_name = "status2019"): # Write solar power plants in supply.egon_power_plants solar = pd.read_sql( - f"""SELECT * FROM {cfg['sources']['pv']}""", + f"""SELECT * FROM {cfg['sources']['pv']} + WHERE site_type IN ('Freifläche', + 'Bauliche Anlagen (Hausdach, Gebäude und Fassade)') """, con, ) + map_solar = { + "Freifläche": "solar", + "Bauliche Anlagen (Hausdach, Gebäude und Fassade)": "solar_rooftop", + } + solar["site_type"] = solar["site_type"].map(map_solar) for i, row in solar.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, source_id={"MastrNummer": row.gens_id}, - carrier="solar", + carrier=row.site_type, el_capacity=row.capacity, scenario=scn_name, bus_id=row.bus_id, From 8d69abec49aef20f41b9e494692bcad65b0e1772 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 23 May 2023 14:19:09 +0200 Subject: [PATCH 258/787] debugging --- setup.py | 2 +- src/egon/data/datasets/electrical_neighbours.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index a70d87d64..d287b9d84 100755 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ def read(*names, **kwargs): "atlite==0.2.5", "cdsapi", "click", - "entsoe-py >=0.3.1", + #"entsoe-py >=0.3.1", "geopandas>=0.10.0,<0.11.0", "geopy", "geovoronoi==0.3.0", diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 5ba72eb25..f9ea3917f 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -732,7 +732,7 @@ def map_carriers_tyndp(): } -def get_foreign_bus_id(): +def get_foreign_bus_id(scenario): """Calculte the etrago bus id from Nodes of TYNDP based on the geometry Returns @@ -745,9 +745,9 @@ def get_foreign_bus_id(): sources = config.datasets()["electrical_neighbours"]["sources"] bus_id = db.select_geodataframe( - """SELECT bus_id, ST_Buffer(geom, 1) as geom, country + f"""SELECT bus_id, ST_Buffer(geom, 1) as geom, country FROM grid.egon_etrago_bus - WHERE scn_name = 'eGon2035' + WHERE scn_name = '{scenario}' AND carrier = 'AC' AND v_nom = 380. AND country != 'DE' @@ -932,7 +932,7 @@ def insert_generators(capacities): ) gen.loc[:, "bus"] = ( - get_foreign_bus_id().loc[gen.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario='eGon2035').loc[gen.loc[:, "Node/Line"]].values ) # Add scenario column @@ -1068,7 +1068,7 @@ def insert_storage(capacities): ) store.loc[:, "bus"] = ( - get_foreign_bus_id().loc[store.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario='eGon2035').loc[store.loc[:, "Node/Line"]].values ) # Add columns for additional parameters to df @@ -1212,7 +1212,7 @@ def tyndp_demand(): buses[buses.nodes.isin(map_buses.keys())].index, "nodes" ] = buses[buses.nodes.isin(map_buses.keys())].nodes.map(map_buses) buses.loc[:, "bus"] = ( - get_foreign_bus_id().loc[buses.loc[:, "nodes"]].values + get_foreign_bus_id(scenario='eGon2035').loc[buses.loc[:, "nodes"]].values ) buses.set_index("nodes", inplace=True) buses = buses[~buses.index.duplicated(keep="first")] @@ -1400,7 +1400,7 @@ def entsoe_to_bus_etrago(): "SE": "SE00", "GB": "UK00"}) - for_bus = get_foreign_bus_id() + for_bus = get_foreign_bus_id(scenario='status2019') return map_entsoe.map(for_bus) From 4ea0de39bdddb50fe4003c510a9b1c4f9ac8867d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 24 May 2023 11:10:58 +0200 Subject: [PATCH 259/787] Add scenario capacities to pipeline --- .../data/airflow/dags/pipeline_status_quo.py | 13 +++++++ src/egon/data/datasets/scenario_capacities.py | 37 +++++++++++-------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index a0ea5e245..8113d6cd9 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -56,6 +56,7 @@ from egon.data.datasets.power_plants import PowerPlants from egon.data.datasets.pypsaeursec import PypsaEurSec from egon.data.datasets.renewable_feedin import RenewableFeedin +from egon.data.datasets.scenario_capacities import ScenarioCapacities from egon.data.datasets.scenario_parameters import ScenarioParameters from egon.data.datasets.society_prognosis import SocietyPrognosis from egon.data.datasets.storages import Storages @@ -322,6 +323,17 @@ dependencies=[run_pypsaeursec, tyndp_data] ) + # Import NEP (Netzentwicklungsplan) data + scenario_capacities = ScenarioCapacities( + dependencies=[ + data_bundle, + run_pypsaeursec, + setup, + vg250, + zensus_population, + ] + ) + # Import gas grid gas_grid_insert_data = GasNodesAndPipes( dependencies=[ @@ -404,6 +416,7 @@ data_bundle, district_heating_areas, zensus_mv_grid_districts, + scenario_capacities, ] ) # Pumped hydro units diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 7f8790410..bce5b5f14 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -57,21 +57,6 @@ class NEP2021ConvPowerPlants(Base): b2040_capacity = Column(Float) -class ScenarioCapacities(Dataset): - def __init__(self, dependencies): - super().__init__( - name="ScenarioCapacities", - version="0.0.13", - dependencies=dependencies, - tasks=( - create_table, - insert_capacities_status2019, - insert_data_nep, - eGon100_capacities, - ), - ) - - def create_table(): """Create input tables for scenario setup @@ -800,3 +785,25 @@ def eGon100_capacities(): if_exists="append", index=False, ) + + +tasks = (create_table,) + +if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (insert_capacities_status2019,) + +if "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (insert_data_nep,) + +if "eGon100RE" in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (eGon100_capacities,) + + +class ScenarioCapacities(Dataset): + def __init__(self, dependencies): + super().__init__( + name="ScenarioCapacities", + version="0.0.14", + dependencies=dependencies, + tasks=tasks, + ) From 8839f864b4dde629ef25b5c16aabfccbfa9d55df Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 24 May 2023 11:25:08 +0200 Subject: [PATCH 260/787] Filter by scenario namen in assign_use_case --- src/egon/data/datasets/chp/small_chp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/chp/small_chp.py b/src/egon/data/datasets/chp/small_chp.py index 60f36440f..21f9490ba 100755 --- a/src/egon/data/datasets/chp/small_chp.py +++ b/src/egon/data/datasets/chp/small_chp.py @@ -95,7 +95,7 @@ def existing_chp_smaller_10mw(sources, MaStR_konv, EgonChp): mastr_chp, config.datasets()["chp_location"] ).bus_id - mastr_chp = assign_use_case(mastr_chp, sources) + mastr_chp = assign_use_case(mastr_chp, sources, "eGon2035") insert_mastr_chp(mastr_chp, EgonChp) @@ -631,7 +631,7 @@ def extension_per_federal_state(federal_state, EgonChp): print("Decommissioning of CHP plants is not implemented.") -def assign_use_case(chp, sources): +def assign_use_case(chp, sources, scenario): """Identifies CHPs used in district heating areas. A CHP plant is assigned to a district heating area if @@ -699,7 +699,7 @@ def assign_use_case(chp, sources): SELECT area_id, ST_Buffer(geom_polygon, 1000) as geom FROM {sources['district_heating_areas']['schema']}. {sources['district_heating_areas']['table']} - WHERE scenario = 'eGon2035' + WHERE scenario = '{scenario}' """, epsg=4326, ) @@ -737,4 +737,4 @@ def assign_use_case(chp, sources): # Set district_heating = True for all district heating chp chp.loc[district_heating_chp.index, "district_heating"] = True - return chp + return chp \ No newline at end of file From 99dc93417be7cfbb37bde4cf2fd0b4f51a22e5d6 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 24 May 2023 11:25:27 +0200 Subject: [PATCH 261/787] Iterate over list of scenario names from CLI parameterso --- src/egon/data/datasets/heat_etrago/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/heat_etrago/__init__.py b/src/egon/data/datasets/heat_etrago/__init__.py index a3161f45c..9b062b5eb 100644 --- a/src/egon/data/datasets/heat_etrago/__init__.py +++ b/src/egon/data/datasets/heat_etrago/__init__.py @@ -262,8 +262,10 @@ def insert_store(scenario, carrier): def store(): - insert_store("eGon2035", "central_heat") - insert_store("eGon2035", "rural_heat") + for scenario in config.settings()["egon-data"]["--scenarios"]: + if scenario != "status2019": + insert_store(scenario, "central_heat") + insert_store(scenario, "rural_heat") def insert_central_direct_heat(scenario): @@ -587,7 +589,7 @@ def buses(): None. """ - for scenario in ["status2019", "eGon2035", "eGon100RE"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: insert_buses("central_heat", scenario) insert_buses("rural_heat", scenario) @@ -604,7 +606,7 @@ def supply(): """ - for scenario in ["status2019", "eGon2035", "eGon100RE"]: + for scenario in config.settings()["egon-data"]["--scenarios"]: # There is no direct heat in status2019 scenario if scenario != "status2019": insert_central_direct_heat(scenario) @@ -620,4 +622,4 @@ def __init__(self, dependencies): version="0.0.11", dependencies=dependencies, tasks=(buses, supply, store), - ) + ) \ No newline at end of file From b672f2d9a65a38f64dc5992f0038d9a9da51bc0f Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 24 May 2023 14:01:47 +0200 Subject: [PATCH 262/787] heat pumps for status2019 scenario --- .../data/airflow/dags/pipeline_status_quo.py | 13 +- .../heat_supply/individual_heating.py | 214 +++++++++++++++++- 2 files changed, 223 insertions(+), 4 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index a0ea5e245..1f4f37cad 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -44,6 +44,7 @@ from egon.data.datasets.heat_etrago import HeatEtrago from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable from egon.data.datasets.heat_supply import HeatSupply +from egon.data.datasets.heat_supply.individual_heating import HeatPumps2019 from egon.data.datasets.industrial_sites import MergeIndustrialSites from egon.data.datasets.industry import IndustrialDemandCurves from egon.data.datasets.loadarea import LoadArea, OsmLanduse @@ -135,7 +136,7 @@ dependencies=[scenario_parameters, setup, vg250] ) - # Future national heat demands for foreign countries based on Hotmaps + # Future national demands for foreign countries based on Hotmaps # download only, processing in PyPSA-Eur-Sec fork hd_abroad = HeatDemandEurope(dependencies=[setup]) @@ -496,3 +497,13 @@ ] ) + # Heat pump disaggregation for status2019 + heat_pumps_2019 = HeatPumps2019( + dependencies=[ + cts_demand_buildings, + DistrictHeatingAreas, + heat_supply, + heat_time_series, + tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], + ] + ) \ No newline at end of file diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 08c038a6a..7ef54c14e 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -294,6 +294,57 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ), ) +class HeatPumps2019(Dataset): + def __init__(self, dependencies): + def dyn_parallel_tasks_2019(): + """Dynamically generate tasks + + The goal is to speed up tasks by parallelising bulks of mvgds. + + The number of parallel tasks is defined via parameter + `parallel_tasks` in the dataset config `datasets.yml`. + + Returns + ------- + set of airflow.PythonOperators + The tasks. Each element is of + :func:`egon.data.datasets.heat_supply.individual_heating. + determine_hp_cap_peak_load_mvgd_ts_2019` + """ + parallel_tasks = config.datasets()["demand_timeseries_mvgd"].get( + "parallel_tasks", 1 + ) + tasks = set() + for i in range(parallel_tasks): + tasks.add( + PythonOperator( + task_id=( + "individual_heating." + f"determine-hp-capacity-2019-" + f"mvgd-bulk{i}" + ), + python_callable=split_mvgds_into_bulks, + op_kwargs={ + "n": i, + "max_n": parallel_tasks, + "func": determine_hp_cap_peak_load_mvgd_ts_2019, + }, + ) + ) + return tasks + + super().__init__( + name="HeatPumps2035", + version="0.0.2", + dependencies=dependencies, + tasks=( + delete_heat_peak_loads_2019, + delete_hp_capacity_2019, + delete_mvgd_ts_2019, + {*dyn_parallel_tasks_2019()}, + ), + ) + class HeatPumps2035(Dataset): def __init__(self, dependencies): @@ -1364,7 +1415,7 @@ def determine_min_hp_cap_buildings_pypsa_eur_sec( return 0.0 -def determine_hp_cap_buildings_eGon2035_per_mvgd( +def determine_hp_cap_buildings_pvbased_per_mvgd(scenario, mv_grid_id, peak_heat_demand, building_ids ): """ @@ -1386,7 +1437,7 @@ def determine_hp_cap_buildings_eGon2035_per_mvgd( """ hp_cap_grid = get_total_heat_pump_capacity_of_mv_grid( - "eGon2035", mv_grid_id + scenario, mv_grid_id ) if len(building_ids) > 0 and hp_cap_grid > 0.0: @@ -1411,6 +1462,8 @@ def determine_hp_cap_buildings_eGon2035_per_mvgd( else: return pd.Series(dtype="float64").rename("hp_capacity") + + def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): @@ -1751,7 +1804,8 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): ) hp_cap_per_building_2035 = ( - determine_hp_cap_buildings_eGon2035_per_mvgd( + determine_hp_cap_buildings_pvbased_per_mvgd( + scenario='eGon2035', mvgd, peak_load_2035, buildings_decentral_heating, @@ -1831,6 +1885,140 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): ) +def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): + """ + Main function to determine HP capacity per building in status2019 scenario. + Further, creates heat demand time series for all buildings with heat pumps + in MV grid, as well as for all buildings with gas boilers, used in eTraGo. + + Parameters + ----------- + mvgd_ids : list(int) + List of MV grid IDs to determine data for. + + """ + + # ========== Register np datatypes with SQLA ========== + register_adapter(np.float64, adapt_numpy_float64) + register_adapter(np.int64, adapt_numpy_int64) + # ===================================================== + + df_peak_loads_db = pd.DataFrame() + df_hp_cap_per_building_2019_db = pd.DataFrame() + df_heat_mvgd_ts_db = pd.DataFrame() + + for mvgd in mvgd_ids: + + logger.info(f"MVGD={mvgd} | Start") + + # ############# aggregate residential and CTS demand profiles ##### + + df_heat_ts = aggregate_residential_and_cts_profiles( + mvgd, scenario="status2019" + ) + + # ##################### determine peak loads ################### + logger.info(f"MVGD={mvgd} | Determine peak loads.") + + peak_load_2019 = df_heat_ts.max().rename("status2019") + + # ######## determine HP capacity per building ######### + logger.info(f"MVGD={mvgd} | Determine HP capacities.") + + buildings_decentral_heating = ( + get_buildings_with_decentral_heat_demand_in_mv_grid( + mvgd, scenario="status2019" + ) + ) + + # Reduce list of decentral heating if no Peak load available + # TODO maybe remove after succesfull DE run + # Might be fixed in #990 + buildings_decentral_heating = catch_missing_buidings( + buildings_decentral_heating, peak_load_2019 + ) + + hp_cap_per_building_2019 = ( + determine_hp_cap_buildings_pvbased_per_mvgd( + scenario="status2019", + mvgd, + peak_load_2019, + buildings_decentral_heating, + ) + ) + buildings_gas_2019 = pd.Index(buildings_decentral_heating).drop( + hp_cap_per_building_2019.index + ) + + # ################ aggregated heat profiles ################### + logger.info(f"MVGD={mvgd} | Aggregate heat profiles.") + + df_mvgd_ts_2019_hp = df_heat_ts.loc[ + :, + hp_cap_per_building_2019.index, + ].sum(axis=1) + + # heat demand time series for buildings with gas boiler + df_mvgd_ts_2019_gas = df_heat_ts.loc[:, buildings_gas_2019].sum(axis=1) + + df_heat_mvgd_ts = pd.DataFrame( + data={ + "carrier": ["heat_pump", "CH4"], + "bus_id": mvgd, + "scenario": ["status2019", "status2019"], + "dist_aggregated_mw": [ + df_mvgd_ts_2019_hp.to_list(), + df_mvgd_ts_2019_gas.to_list(), + ], + } + ) + + # ################ collect results ################## + logger.info(f"MVGD={mvgd} | Collect results.") + + df_peak_loads_db = pd.concat( + [df_peak_loads_db, peak_load_2019.reset_index()], + axis=0, + ignore_index=True, + ) + + df_heat_mvgd_ts_db = pd.concat( + [df_heat_mvgd_ts_db, df_heat_mvgd_ts], axis=0, ignore_index=True + ) + + df_hp_cap_per_building_2019_db = pd.concat( + [ + df_hp_cap_per_building_2019_db, + hp_cap_per_building_2019.reset_index(), + ], + axis=0, + ) + + # ################ export to db ####################### + logger.info(f"MVGD={min(mvgd_ids)} : {max(mvgd_ids)} | Write data to db.") + + export_to_db(df_peak_loads_db, df_heat_mvgd_ts_db, drop=False) + + df_hp_cap_per_building_2019_db["scenario"] = "status2019" + + # TODO debug duplicated building_ids + duplicates = df_hp_cap_per_building_2019_db.loc[ + df_hp_cap_per_building_2019_db.duplicated("building_id", keep=False) + ] + + logger.info( + f"Dropped duplicated buildings: " + f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" + ) + + df_hp_cap_per_building_2019_db.drop_duplicates("building_id", inplace=True) + + write_table_to_postgres( + df_hp_cap_per_building_2019_db, + EgonHpCapacityBuildings, + drop=False, + ) + def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): """ Main function to determine minimum required HP capacity in MV for @@ -2018,12 +2206,24 @@ def delete_hp_capacity_100RE(): delete_hp_capacity(scenario="eGon100RE") +def delete_hp_capacity_2019(): + """Remove all hp capacities for the selected status2019""" + EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) + delete_hp_capacity(scenario="status2019") + def delete_hp_capacity_2035(): """Remove all hp capacities for the selected eGon2035""" EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) delete_hp_capacity(scenario="eGon2035") +def delete_mvgd_ts_2019(): + """Remove all mvgd ts for the selected status2019""" + EgonEtragoTimeseriesIndividualHeating.__table__.create( + bind=engine, checkfirst=True + ) + delete_mvgd_ts(scenario="status2019") + def delete_mvgd_ts_2035(): """Remove all mvgd ts for the selected eGon2035""" EgonEtragoTimeseriesIndividualHeating.__table__.create( @@ -2039,6 +2239,14 @@ def delete_mvgd_ts_100RE(): ) delete_mvgd_ts(scenario="eGon100RE") +def delete_heat_peak_loads_2019(): + """Remove all heat peak loads for status2019.""" + BuildingHeatPeakLoads.__table__.create(bind=engine, checkfirst=True) + with db.session_scope() as session: + # Buses + session.query(BuildingHeatPeakLoads).filter( + BuildingHeatPeakLoads.scenario == "status2019" + ).delete(synchronize_session=False) def delete_heat_peak_loads_2035(): """Remove all heat peak loads for eGon2035.""" From 3599313ad696e5199b22cc7aa4f3a7ec9c1f0ad6 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 24 May 2023 14:07:55 +0200 Subject: [PATCH 263/787] fix small accidental typo --- src/egon/data/airflow/dags/pipeline_status_quo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 1f4f37cad..2e0624210 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -136,7 +136,7 @@ dependencies=[scenario_parameters, setup, vg250] ) - # Future national demands for foreign countries based on Hotmaps + # Future national heat demands for foreign countries based on Hotmaps # download only, processing in PyPSA-Eur-Sec fork hd_abroad = HeatDemandEurope(dependencies=[setup]) @@ -506,4 +506,4 @@ heat_time_series, tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], ] - ) \ No newline at end of file + ) From dc6dd70a349cf1d8988ab4d95f70754578866307 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 24 May 2023 14:09:25 +0200 Subject: [PATCH 264/787] fix naming issue --- src/egon/data/datasets/heat_supply/individual_heating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 7ef54c14e..74d2782d1 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -334,7 +334,7 @@ def dyn_parallel_tasks_2019(): return tasks super().__init__( - name="HeatPumps2035", + name="HeatPumps2019", version="0.0.2", dependencies=dependencies, tasks=( From 22a29880c70d24ce4c8343621fbc555cfef4cb8c Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 24 May 2023 14:21:14 +0200 Subject: [PATCH 265/787] add dependency towards heat_pumps_2019 --- src/egon/data/airflow/dags/pipeline_status_quo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 2e0624210..0195cbf5b 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -440,6 +440,7 @@ heat_etrago, heat_time_series, mv_grid_districts, + heat_pumps_2019, ] ) From a35cb82c371c2b1a54470b7326974ba3eb6a11a2 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 24 May 2023 14:41:35 +0200 Subject: [PATCH 266/787] kick out gas boilers for status2019 --- .../data/datasets/heat_supply/individual_heating.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 74d2782d1..c62bbc188 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -1958,18 +1958,12 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): hp_cap_per_building_2019.index, ].sum(axis=1) - # heat demand time series for buildings with gas boiler - df_mvgd_ts_2019_gas = df_heat_ts.loc[:, buildings_gas_2019].sum(axis=1) - df_heat_mvgd_ts = pd.DataFrame( data={ - "carrier": ["heat_pump", "CH4"], + "carrier": "heat_pump", "bus_id": mvgd, - "scenario": ["status2019", "status2019"], - "dist_aggregated_mw": [ - df_mvgd_ts_2019_hp.to_list(), - df_mvgd_ts_2019_gas.to_list(), - ], + "scenario": "status2019", + "dist_aggregated_mw": [df_mvgd_ts_2019_hp.to_list()], } ) From 7d6cbef9d27772cf7c7df6bb607477f404a3e511 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 24 May 2023 15:29:48 +0200 Subject: [PATCH 267/787] include function fill_missing_bus_and_geom --- .../data/datasets/power_plants/__init__.py | 72 ++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f2b612ab9..f3cca99ce 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -946,18 +946,63 @@ def power_plants_status_quo(scn_name = "status2019"): """ ) + # import municipalities to assign missing geom and bus_id + geom_municipalities = gpd.GeoDataFrame.from_postgis( + """ + SELECT gen, ST_UNION(geometry) as geom + FROM boundaries.vg250_gem + GROUP BY gen + """, + con, + geom_col = "geom" + ).set_index("gen") + geom_municipalities["geom"] = geom_municipalities["geom"].centroid + + mv_grid_districts = gpd.GeoDataFrame.from_postgis( + f""" + SELECT * FROM {cfg['sources']['egon_mv_grid_district']} + """, + con, + ) + mv_grid_districts.geom = mv_grid_districts.geom.to_crs(4326) + + def fill_missing_bus_and_geom(gens, carrier): + # drop generators without data to get geometry. + drop_id = gens[(gens.geom.is_empty) & ~(gens.city.isin(geom_municipalities.index))].index + new_geom = gens["capacity"][(gens.geom.is_empty) & (gens.city.isin(geom_municipalities.index))] + print(f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] + .sum()}MW) were drop""") + + print(f"""{len(new_geom)} {carrier} generator(s) ({new_geom + .sum()}MW) received a geom based on city + """) + gens.drop(index=drop_id, inplace=True) + + # assign missing geometries based on city and buses based on geom + + gens["geom"] = gens.apply(lambda x: geom_municipalities.at[x["city"],"geom"] if x["geom"].is_empty else x["geom"], axis=1) + gens["bus_id"] = gens.sjoin(mv_grid_districts[["bus_id", "geom"]], how="left").bus_id_right.values + + gens = gens.dropna(subset=["bus_id"]) + # convert geom to WKB + gens["geom"] = gens["geom"].to_wkt() + + return gens + # Write hydro power plants in supply.egon_power_plants map_hydro = { "Laufwasseranlage": "run_of_river", "Speicherwasseranlage": "reservoir", } - hydro = pd.read_sql( + hydro = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['hydro']} WHERE plant_type IN ('Laufwasseranlage', 'Speicherwasseranlage')""", - con, + con, geom_col="geom" ) + hydro = fill_missing_bus_and_geom(hydro, carrier = "hydro") + for i, row in hydro.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, @@ -976,11 +1021,15 @@ def power_plants_status_quo(scn_name = "status2019"): {len(hydro)} hydro generators with a total installed capacity of {hydro.capacity.sum()}MW were inserted in db """) + # Write biomass power plants in supply.egon_power_plants - biomass = pd.read_sql( + biomass = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['biomass']}""", - con, + con, geom_col="geom" ) + + biomass = fill_missing_bus_and_geom(biomass, carrier = "biomass") + for i, row in biomass.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, @@ -1001,17 +1050,21 @@ def power_plants_status_quo(scn_name = "status2019"): """) # Write solar power plants in supply.egon_power_plants - solar = pd.read_sql( + solar = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['pv']} WHERE site_type IN ('Freifläche', 'Bauliche Anlagen (Hausdach, Gebäude und Fassade)') """, - con, + con, geom_col="geom" ) map_solar = { "Freifläche": "solar", "Bauliche Anlagen (Hausdach, Gebäude und Fassade)": "solar_rooftop", } solar["site_type"] = solar["site_type"].map(map_solar) + + solar = fill_missing_bus_and_geom(solar, carrier = "solar") + + solar = pd.DataFrame(solar, index = solar.index) for i, row in solar.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, @@ -1032,10 +1085,13 @@ def power_plants_status_quo(scn_name = "status2019"): """) # Write wind_onshore power plants in supply.egon_power_plants - wind_onshore = pd.read_sql( + wind_onshore = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['wind']}""", - con, + con, geom_col="geom" ) + + wind_onshore = fill_missing_bus_and_geom(wind_onshore, carrier = "wind_onshore") + for i, row in wind_onshore.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, From 18fafc6f21a0ec1c1c66cf656d1719622f83ee67 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 24 May 2023 15:30:37 +0200 Subject: [PATCH 268/787] using black --- .../data/datasets/power_plants/__init__.py | 93 +++++++++++-------- 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f3cca99ce..88fc22d1f 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -347,7 +347,6 @@ def insert_hydro_plants(scenario): } for carrier in map_carrier.keys(): - # import target values target = select_target(carrier, scenario) @@ -500,9 +499,7 @@ def assign_voltage_level(mastr_loc, cfg, mastr_working_dir): def assign_voltage_level_by_capacity(mastr_loc): - for i, row in mastr_loc[mastr_loc.voltage_level.isnull()].iterrows(): - if row.Nettonennleistung > 120: level = 1 elif row.Nettonennleistung > 20: @@ -610,7 +607,6 @@ def insert_hydro_biomass(): def allocate_conventional_non_chp_power_plants(): - carrier = ["oil", "gas"] cfg = egon.data.config.datasets()["power_plants"] @@ -625,14 +621,12 @@ def allocate_conventional_non_chp_power_plants(): ) for carrier in carrier: - nep = select_nep_power_plants(carrier) if nep.empty: print(f"DataFrame from NEP for carrier {carrier} is empty!") else: - mastr = select_no_chp_combustion_mastr(carrier) # Assign voltage level to MaStR @@ -771,7 +765,6 @@ def allocate_conventional_non_chp_power_plants(): def allocate_other_power_plants(): - # Get configuration cfg = egon.data.config.datasets()["power_plants"] boundary = egon.data.config.settings()["egon-data"]["--dataset-boundary"] @@ -932,7 +925,8 @@ def allocate_other_power_plants(): session.add(entry) session.commit() -def power_plants_status_quo(scn_name = "status2019"): + +def power_plants_status_quo(scn_name="status2019"): con = db.engine() session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] @@ -954,7 +948,7 @@ def power_plants_status_quo(scn_name = "status2019"): GROUP BY gen """, con, - geom_col = "geom" + geom_col="geom", ).set_index("gen") geom_municipalities["geom"] = geom_municipalities["geom"].centroid @@ -968,20 +962,35 @@ def power_plants_status_quo(scn_name = "status2019"): def fill_missing_bus_and_geom(gens, carrier): # drop generators without data to get geometry. - drop_id = gens[(gens.geom.is_empty) & ~(gens.city.isin(geom_municipalities.index))].index - new_geom = gens["capacity"][(gens.geom.is_empty) & (gens.city.isin(geom_municipalities.index))] - print(f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] - .sum()}MW) were drop""") + drop_id = gens[ + (gens.geom.is_empty) & ~(gens.city.isin(geom_municipalities.index)) + ].index + new_geom = gens["capacity"][ + (gens.geom.is_empty) & (gens.city.isin(geom_municipalities.index)) + ] + print( + f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] + .sum()}MW) were drop""" + ) - print(f"""{len(new_geom)} {carrier} generator(s) ({new_geom + print( + f"""{len(new_geom)} {carrier} generator(s) ({new_geom .sum()}MW) received a geom based on city - """) + """ + ) gens.drop(index=drop_id, inplace=True) # assign missing geometries based on city and buses based on geom - gens["geom"] = gens.apply(lambda x: geom_municipalities.at[x["city"],"geom"] if x["geom"].is_empty else x["geom"], axis=1) - gens["bus_id"] = gens.sjoin(mv_grid_districts[["bus_id", "geom"]], how="left").bus_id_right.values + gens["geom"] = gens.apply( + lambda x: geom_municipalities.at[x["city"], "geom"] + if x["geom"].is_empty + else x["geom"], + axis=1, + ) + gens["bus_id"] = gens.sjoin( + mv_grid_districts[["bus_id", "geom"]], how="left" + ).bus_id_right.values gens = gens.dropna(subset=["bus_id"]) # convert geom to WKB @@ -998,10 +1007,11 @@ def fill_missing_bus_and_geom(gens, carrier): hydro = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['hydro']} WHERE plant_type IN ('Laufwasseranlage', 'Speicherwasseranlage')""", - con, geom_col="geom" + con, + geom_col="geom", ) - hydro = fill_missing_bus_and_geom(hydro, carrier = "hydro") + hydro = fill_missing_bus_and_geom(hydro, carrier="hydro") for i, row in hydro.iterrows(): entry = EgonPowerPlants( @@ -1017,18 +1027,19 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print(f""" + print( + f""" {len(hydro)} hydro generators with a total installed capacity of {hydro.capacity.sum()}MW were inserted in db - """) + """ + ) # Write biomass power plants in supply.egon_power_plants biomass = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['biomass']}""", - con, geom_col="geom" + f"""SELECT * FROM {cfg['sources']['biomass']}""", con, geom_col="geom" ) - biomass = fill_missing_bus_and_geom(biomass, carrier = "biomass") + biomass = fill_missing_bus_and_geom(biomass, carrier="biomass") for i, row in biomass.iterrows(): entry = EgonPowerPlants( @@ -1044,17 +1055,20 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print(f""" + print( + f""" {len(biomass)} biomass generators with a total installed capacity of {biomass.capacity.sum()}MW were inserted in db - """) + """ + ) # Write solar power plants in supply.egon_power_plants solar = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['pv']} WHERE site_type IN ('Freifläche', 'Bauliche Anlagen (Hausdach, Gebäude und Fassade)') """, - con, geom_col="geom" + con, + geom_col="geom", ) map_solar = { "Freifläche": "solar", @@ -1062,9 +1076,9 @@ def fill_missing_bus_and_geom(gens, carrier): } solar["site_type"] = solar["site_type"].map(map_solar) - solar = fill_missing_bus_and_geom(solar, carrier = "solar") + solar = fill_missing_bus_and_geom(solar, carrier="solar") - solar = pd.DataFrame(solar, index = solar.index) + solar = pd.DataFrame(solar, index=solar.index) for i, row in solar.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, @@ -1079,18 +1093,21 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print(f""" + print( + f""" {len(solar)} solar generators with a total installed capacity of {solar.capacity.sum()}MW were inserted in db - """) + """ + ) # Write wind_onshore power plants in supply.egon_power_plants wind_onshore = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['wind']}""", - con, geom_col="geom" + f"""SELECT * FROM {cfg['sources']['wind']}""", con, geom_col="geom" ) - wind_onshore = fill_missing_bus_and_geom(wind_onshore, carrier = "wind_onshore") + wind_onshore = fill_missing_bus_and_geom( + wind_onshore, carrier="wind_onshore" + ) for i, row in wind_onshore.iterrows(): entry = EgonPowerPlants( @@ -1106,9 +1123,11 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print(f""" + print( + f""" {len(wind_onshore)} wind_onshore generators with a total installed capacity of {wind_onshore.capacity.sum()}MW were inserted in db - """) + """ + ) - return \ No newline at end of file + return From 6a69e74381587b596c602a6c9f5e1334bc3062ee Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 25 May 2023 10:36:15 +0200 Subject: [PATCH 269/787] hotfix --- src/egon/data/datasets/heat_supply/individual_heating.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index c62bbc188..f69a33251 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -1805,7 +1805,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): hp_cap_per_building_2035 = ( determine_hp_cap_buildings_pvbased_per_mvgd( - scenario='eGon2035', + 'eGon2035', mvgd, peak_load_2035, buildings_decentral_heating, @@ -1940,7 +1940,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): hp_cap_per_building_2019 = ( determine_hp_cap_buildings_pvbased_per_mvgd( - scenario="status2019", + "status2019", mvgd, peak_load_2019, buildings_decentral_heating, From 1870508dd1c43fa3ae8385bff8054a2413d0213e Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 25 May 2023 10:39:56 +0200 Subject: [PATCH 270/787] hotfix-number-2 --- .../data/airflow/dags/pipeline_status_quo.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index c8b8a00ab..37b63134d 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -420,6 +420,8 @@ scenario_capacities, ] ) + + # Pumped hydro units pumped_hydro = Storages( dependencies=[ @@ -446,6 +448,17 @@ # CHP to eTraGo chp_etrago = ChpEtrago(dependencies=[chp, heat_etrago]) + # Heat pump disaggregation for status2019 + heat_pumps_2019 = HeatPumps2019( + dependencies=[ + cts_demand_buildings, + DistrictHeatingAreas, + heat_supply, + heat_time_series, + tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], + ] + ) + # HTS to eTraGo table hts_etrago_table = HtsEtragoTable( dependencies=[ @@ -510,14 +523,3 @@ demand_curves_industry, ] ) - - # Heat pump disaggregation for status2019 - heat_pumps_2019 = HeatPumps2019( - dependencies=[ - cts_demand_buildings, - DistrictHeatingAreas, - heat_supply, - heat_time_series, - tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], - ] - ) From 60b142ffc58986f9525b14c0fd6209cd67582c7a Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 11:19:14 +0200 Subject: [PATCH 271/787] include home batteries scenario capacities --- src/egon/data/datasets/scenario_capacities.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 7f8790410..f6f8c1650 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -154,6 +154,27 @@ def insert_capacities_status2019(): ) """ ) + + # Include small storages for scenario2019 + small_storages = 600 #MW for Germany + + db.execute_sql( + f""" + INSERT INTO + {targets['scenario_capacities']['schema']}. + {targets['scenario_capacities']['table']} + (component, carrier, capacity, nuts, scenario_name) + VALUES ( + 'storage_units', + 'battery', + {small_storages}, + 'DE', + 'status2019' + ) + """ + ) + + def insert_capacities_per_federal_state_nep(): From 74f76f9f888e415ed88110307360709afd8ea98c Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 11:36:57 +0200 Subject: [PATCH 272/787] include status2019 in allocate_pv_home_batteries_to_grids --- src/egon/data/datasets/storages/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 62096f10d..321218bb8 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -403,7 +403,7 @@ def home_batteries_per_scenario(scenario): battery["carrier"] = "home_battery" battery["scenario"] = scenario - if scenario == "eGon2035": + if ((scenario == "eGon2035") | (scenario == "status2019")): source = "NEP" else: @@ -429,10 +429,10 @@ def home_batteries_per_scenario(scenario): def allocate_pv_home_batteries_to_grids(): - - home_batteries_per_scenario("eGon2035") - home_batteries_per_scenario("eGon100RE") + for scn in config.settings()["egon-data"]["--scenarios"]: + home_batteries_per_scenario(scn) + def allocate_pumped_hydro_2035_sq(): allocate_pumped_hydro(scn="eGon2035") From 9cac8e1a8ce1d12cc86072a66b50b6a40a1caa2b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 13:59:03 +0200 Subject: [PATCH 273/787] Add scenarios to default cli parameters --- src/egon/data/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/config.py b/src/egon/data/config.py index b019733e3..5dad8693f 100644 --- a/src/egon/data/config.py +++ b/src/egon/data/config.py @@ -73,6 +73,7 @@ def settings() -> dict[str, dict[str, str]]: "--jobs": 1, "--random-seed": 42, "--processes-per-task": 1, + "--scenarios": ["status2019", "eGon2035"], } } with open(files[0]) as f: From a4ae1b514d413ac7b4e0c3ffc3501f0a4713c4cb Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 13:59:23 +0200 Subject: [PATCH 274/787] Remove logging module, since it is already installed by default --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index d287b9d84..502d26e58 100755 --- a/setup.py +++ b/setup.py @@ -92,7 +92,6 @@ def read(*names, **kwargs): "geovoronoi==0.3.0", "importlib-resources", "loguru", - "logging", "markupsafe<2.1.0", # MarkupSafe>=2.1.0 breaks WTForms<3 "matplotlib", "netcdf4", From 4368391bf3e117d4798f2c39bf66cd3e2919c4e6 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 15:03:11 +0200 Subject: [PATCH 275/787] Create power_plant tasks depending on the scenario names --- .../data/datasets/power_plants/__init__.py | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 88fc22d1f..7246d879a 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -56,34 +56,6 @@ class EgonPowerPlants(Base): geom = Column(Geometry("POINT", 4326), index=True) -class PowerPlants(Dataset): - def __init__(self, dependencies): - super().__init__( - name="PowerPlants", - version="0.0.18", - dependencies=dependencies, - tasks=( - create_tables, - import_mastr, - power_plants_status_quo, - insert_hydro_biomass, - allocate_conventional_non_chp_power_plants, - allocate_other_power_plants, - { - wind_onshore.insert, - pv_ground_mounted.insert, - ( - pv_rooftop_per_mv_grid, - geocode_mastr_data, - pv_rooftop_to_buildings, - ), - }, - wind_offshore.insert, - assign_weather_data.weatherId_and_busId, - ), - ) - - def create_tables(): """Create tables for power plant data Returns @@ -1131,3 +1103,44 @@ def fill_missing_bus_and_geom(gens, carrier): ) return + + +tasks = ( + create_tables, + import_mastr, +) + +if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks = tasks + (power_plants_status_quo,) + +if ( + "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] + or "eGon100RE" in egon.data.config.settings()["egon-data"]["--scenarios"] +): + tasks = tasks + ( + insert_hydro_biomass, + allocate_conventional_non_chp_power_plants, + allocate_other_power_plants, + { + wind_onshore.insert, + pv_ground_mounted.insert, + ( + pv_rooftop_per_mv_grid, + geocode_mastr_data, + pv_rooftop_to_buildings, + ), + }, + wind_offshore.insert, + ) + +tasks = tasks + (assign_weather_data.weatherId_and_busId,) + + +class PowerPlants(Dataset): + def __init__(self, dependencies): + super().__init__( + name="PowerPlants", + version="0.0.18", + dependencies=dependencies, + tasks=tasks, + ) From 5965265d3977f46586f7f54f63b148cd2f1fa7fd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 15:03:53 +0200 Subject: [PATCH 276/787] Avoid circular import --- .../power_plants/assign_weather_data.py | 71 +++++++++++++++++-- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index e650699a9..5ffd870d0 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -3,7 +3,71 @@ from egon.data import db import egon.data.config -import egon.data.datasets.power_plants.__init__ as init_pp + + +def assign_bus_id(power_plants, cfg): + """Assigns bus_ids to power plants according to location and voltage level + + Parameters + ---------- + power_plants : pandas.DataFrame + Power plants including voltage level + + Returns + ------- + power_plants : pandas.DataFrame + Power plants including voltage level and bus_id + + """ + + mv_grid_districts = db.select_geodataframe( + f""" + SELECT * FROM {cfg['sources']['egon_mv_grid_district']} + """, + epsg=4326, + ) + + ehv_grid_districts = db.select_geodataframe( + f""" + SELECT * FROM {cfg['sources']['ehv_voronoi']} + """, + epsg=4326, + ) + + # Assign power plants in hv and below to hvmv bus + power_plants_hv = power_plants[power_plants.voltage_level >= 3].index + if len(power_plants_hv) > 0: + power_plants.loc[power_plants_hv, "bus_id"] = gpd.sjoin( + power_plants[power_plants.index.isin(power_plants_hv)], + mv_grid_districts, + ).bus_id + + # Assign power plants in ehv to ehv bus + power_plants_ehv = power_plants[power_plants.voltage_level < 3].index + + if len(power_plants_ehv) > 0: + ehv_join = gpd.sjoin( + power_plants[power_plants.index.isin(power_plants_ehv)], + ehv_grid_districts, + ) + + if "bus_id_right" in ehv_join.columns: + power_plants.loc[power_plants_ehv, "bus_id"] = gpd.sjoin( + power_plants[power_plants.index.isin(power_plants_ehv)], + ehv_grid_districts, + ).bus_id_right + + else: + power_plants.loc[power_plants_ehv, "bus_id"] = gpd.sjoin( + power_plants[power_plants.index.isin(power_plants_ehv)], + ehv_grid_districts, + ).bus_id + + # Assert that all power plants have a bus_id + assert power_plants.bus_id.notnull().all(), f"""Some power plants are + not attached to a bus: {power_plants[power_plants.bus_id.isnull()]}""" + + return power_plants def weatherId_and_busId(): @@ -20,9 +84,7 @@ def find_bus_id(power_plants, cfg): power_plants_no_busId = power_plants_no_busId.drop(columns="bus_id") if len(power_plants_no_busId) > 0: - power_plants_no_busId = init_pp.assign_bus_id( - power_plants_no_busId, cfg - ) + power_plants_no_busId = assign_bus_id(power_plants_no_busId, cfg) power_plants = power_plants.append(power_plants_no_busId) @@ -105,7 +167,6 @@ def find_weather_id(): def write_power_plants_table(power_plants, cfg, con): - # delete weather dependent power_plants from supply.egon_power_plants db.execute_sql( f""" From 0468eacd239034e6334888c23f3312c09079ca69 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 15:04:12 +0200 Subject: [PATCH 277/787] Set dependencies to dataset instead of tasks --- src/egon/data/airflow/dags/pipeline.py | 2 +- src/egon/data/airflow/dags/pipeline_status_quo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index a024ed1f9..1260ac9c1 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -581,7 +581,7 @@ heat_supply, heat_time_series, heat_pumps_pypsa_eur_sec, - tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], + power_plants, ] ) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 37b63134d..c8a5dd52d 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -455,7 +455,7 @@ DistrictHeatingAreas, heat_supply, heat_time_series, - tasks["power_plants.pv_rooftop_buildings.pv-rooftop-to-buildings"], + power_plants, ] ) From 282d734530a8778999ecae4103e498096f8c332e Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:01:23 +0200 Subject: [PATCH 278/787] add cbat_pbat_ratio to parameters --- src/egon/data/datasets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 5809d7da2..9bcff075b 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1232,6 +1232,7 @@ home_batteries: - "eGon100RE" # Mean ratio between the storage capacity and the power of the pv rooftop system cbat_ppv_ratio: 1 + cbat_pbat_ratio: 6 rtol: 0.05 max_it: 100 sources: From 5fcb895cdb205f2e6882ed930a923fb9d8e33295 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:03:58 +0200 Subject: [PATCH 279/787] run insert_data_nep when running status2019 --- src/egon/data/datasets/scenario_capacities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 22951f372..24b8d02ea 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -811,7 +811,7 @@ def eGon100_capacities(): tasks = (create_table,) if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (insert_capacities_status2019,) + tasks = tasks + (insert_capacities_status2019, insert_data_nep) if "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"]: tasks = tasks + (insert_data_nep,) From 155bd2523c6b2466b7b5968e41bc4b7ea41561b1 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:05:47 +0200 Subject: [PATCH 280/787] not using the function get_cbat_pbat_ratio --- src/egon/data/datasets/storages/home_batteries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 40d19c1ea..b04c4ea7e 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -73,11 +73,11 @@ def allocate_home_batteries_to_buildings(): """ # get constants constants = config.datasets()["home_batteries"]["constants"] - scenarios = constants["scenarios"] + scenarios = config.settings()["egon-data"]["--scenarios"] cbat_ppv_ratio = constants["cbat_ppv_ratio"] rtol = constants["rtol"] max_it = constants["max_it"] - cbat_pbat_ratio = get_cbat_pbat_ratio() + cbat_pbat_ratio = constants["cbat_pbat_ratio"] sources = config.datasets()["home_batteries"]["sources"] From 0b1f82e9be8bcbf69c801e8ae72011a963de5f0c Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:07:15 +0200 Subject: [PATCH 281/787] run extendable_batteries_per_scenario for status2019 --- src/egon/data/datasets/storages_etrago/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/storages_etrago/__init__.py b/src/egon/data/datasets/storages_etrago/__init__.py index 3382c62ff..86c8b8f82 100644 --- a/src/egon/data/datasets/storages_etrago/__init__.py +++ b/src/egon/data/datasets/storages_etrago/__init__.py @@ -32,7 +32,7 @@ def insert_PHES(): engine = db.engine() - scenario = ["eGon2035", "eGon100RE"] + scenario = config.settings()["egon-data"]["--scenarios"] for scn in scenario: # Delete outdated data on pumped hydro units (PHES) inside Germany from database db.execute_sql( @@ -177,6 +177,5 @@ def extendable_batteries_per_scenario(scenario): def extendable_batteries(): - - extendable_batteries_per_scenario("eGon2035") - extendable_batteries_per_scenario("eGon100RE") + for scn in config.settings()["egon-data"]["--scenarios"]: + extendable_batteries_per_scenario(scn) \ No newline at end of file From e4411f4258a117581b88b5aa06b87f76d2b09838 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:08:18 +0200 Subject: [PATCH 282/787] calculate storages for scenario2019 --- src/egon/data/datasets/storages/__init__.py | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 321218bb8..b6e34bd14 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -46,14 +46,13 @@ class Storages(Dataset): def __init__(self, dependencies): super().__init__( name="Storages", - version="0.0.5", + version="0.0.6", dependencies=dependencies, tasks=( create_tables, - allocate_pumped_hydro_2035_sq, - allocate_pumped_hydro_eGon100RE, + allocate_pumped_hydro_scn, allocate_pv_home_batteries_to_grids, - allocate_home_batteries_to_buildings, + #allocate_home_batteries_to_buildings, ), ) @@ -310,7 +309,7 @@ def allocate_pumped_hydro_eGon100RE(): # Get allocation of pumped_hydro plants in eGon2035 scenario as the # reference for the distribution in eGon100RE scenario - allocation = allocate_pumped_hydro_eGon2035(export=False) + allocation =allocate_pumped_hydro(scn="status2019", export=False) scaling_factor = capacity_phes / allocation.el_capacity.sum() @@ -433,8 +432,18 @@ def allocate_pv_home_batteries_to_grids(): for scn in config.settings()["egon-data"]["--scenarios"]: home_batteries_per_scenario(scn) -def allocate_pumped_hydro_2035_sq(): +def allocate_pumped_hydro_scn(): + + if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + allocate_pumped_hydro(scn="eGon2035") + + if "status2019" in config.settings()["egon-data"]["--scenarios"]: + allocate_pumped_hydro(scn="status2019") + + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + allocate_pumped_hydro_eGon100RE() + + + - allocate_pumped_hydro(scn="eGon2035") - allocate_pumped_hydro(scn="status2019") From 7750414b03763af13e9f3dd874bb61de9b065f39 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:29:37 +0200 Subject: [PATCH 283/787] add some logging messages --- src/egon/data/datasets/power_plants/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 88fc22d1f..866874eb3 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -7,6 +7,7 @@ from sqlalchemy.orm import sessionmaker import geopandas as gpd import numpy as np +import logging import pandas as pd from egon.data import db @@ -968,12 +969,12 @@ def fill_missing_bus_and_geom(gens, carrier): new_geom = gens["capacity"][ (gens.geom.is_empty) & (gens.city.isin(geom_municipalities.index)) ] - print( + logging.info( f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] .sum()}MW) were drop""" ) - print( + logging.info( f"""{len(new_geom)} {carrier} generator(s) ({new_geom .sum()}MW) received a geom based on city """ @@ -1027,7 +1028,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print( + logging.info( f""" {len(hydro)} hydro generators with a total installed capacity of {hydro.capacity.sum()}MW were inserted in db @@ -1055,7 +1056,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print( + logging.info( f""" {len(biomass)} biomass generators with a total installed capacity of {biomass.capacity.sum()}MW were inserted in db @@ -1093,7 +1094,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print( + logging.info( f""" {len(solar)} solar generators with a total installed capacity of {solar.capacity.sum()}MW were inserted in db @@ -1123,7 +1124,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - print( + logging.info( f""" {len(wind_onshore)} wind_onshore generators with a total installed capacity of {wind_onshore.capacity.sum()}MW were inserted in db From c700ee5aa4603d7749a09fe0489acfdf2b65feea Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 26 May 2023 16:56:58 +0200 Subject: [PATCH 284/787] import cbat_pbat_ratio from scenario parameters --- src/egon/data/datasets/storages/home_batteries.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index b04c4ea7e..c02eb9bd9 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -40,7 +40,7 @@ import pandas as pd from egon.data import config, db - +from egon.data.datasets.scenario_parameters import get_sector_parameters Base = declarative_base() @@ -77,7 +77,6 @@ def allocate_home_batteries_to_buildings(): cbat_ppv_ratio = constants["cbat_ppv_ratio"] rtol = constants["rtol"] max_it = constants["max_it"] - cbat_pbat_ratio = constants["cbat_pbat_ratio"] sources = config.datasets()["home_batteries"]["sources"] @@ -92,7 +91,10 @@ def allocate_home_batteries_to_buildings(): WHERE carrier = 'home_battery' AND scenario = '{scenario}'; """ - + cbat_pbat_ratio = get_sector_parameters( + "electricity", scenario + )["efficiency"]["battery"]["max_hours"] + home_batteries_df = db.select_dataframe(sql) home_batteries_df = home_batteries_df.assign( From a7bd5aabbf6d75da3c08995e87cfca9dbe2a4cfa Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 17:08:31 +0200 Subject: [PATCH 285/787] Add pv rooftop to builings for status 2019 --- src/egon/data/datasets/power_plants/__init__.py | 6 +++++- .../data/datasets/power_plants/pv_rooftop_buildings.py | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 7246d879a..95f3c3066 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1111,7 +1111,11 @@ def fill_missing_bus_and_geom(gens, carrier): ) if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (power_plants_status_quo,) + tasks = tasks + ( + power_plants_status_quo, + geocode_mastr_data, + pv_rooftop_to_buildings, + ) if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 908fe3610..8a523d483 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -158,7 +158,7 @@ # Scenario Data CARRIER = "solar_rooftop" -SCENARIOS = ["eGon2035", "eGon100RE"] +SCENARIOS = config.settings()["egon-data"]["--scenarios"] SCENARIO_TIMESTAMP = { "eGon2035": pd.Timestamp("2035-01-01", tz="UTC"), "eGon100RE": pd.Timestamp("2050-01-01", tz="UTC"), @@ -1183,7 +1183,6 @@ def allocate_pv( t0 = perf_counter() for count, ags in enumerate(ags_list): - buildings = q_buildings_gdf.loc[q_buildings_gdf.ags == ags] gens = q_mastr_gdf.loc[q_mastr_gdf.ags == ags] @@ -2748,7 +2747,9 @@ def add_weather_cell_id(buildings_gdf: gpd.GeoDataFrame) -> gpd.GeoDataFrame: return buildings_gdf -def add_bus_ids_sq(buildings_gdf: gpd.GeoDataFrame,) -> gpd.GeoDataFrame: +def add_bus_ids_sq( + buildings_gdf: gpd.GeoDataFrame, +) -> gpd.GeoDataFrame: """Add bus ids for status_quo units Parameters From 472ce45a9345ec0f21022e174e1e84b9939f157c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 26 May 2023 17:10:35 +0200 Subject: [PATCH 286/787] Remove unsued entry --- src/egon/data/datasets.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 9bcff075b..5809d7da2 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1232,7 +1232,6 @@ home_batteries: - "eGon100RE" # Mean ratio between the storage capacity and the power of the pv rooftop system cbat_ppv_ratio: 1 - cbat_pbat_ratio: 6 rtol: 0.05 max_it: 100 sources: From 3a879a22b41060506b0498b6b5b4a821abccfc9a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 30 May 2023 11:19:43 +0200 Subject: [PATCH 287/787] Fix pv rooftop distribution to buildings for status2019 --- src/egon/data/datasets.yml | 6 ++--- .../power_plants/pv_rooftop_buildings.py | 24 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 5809d7da2..90b16267a 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -527,10 +527,10 @@ solar_rooftop: federal_states: schema: 'boundaries' table: 'vg250_lan' + power_plants: + schema: 'supply' + table: 'egon_power_plants' targets: - generators: - schema: 'grid' - table: 'egon_etrago_generator' generator_timeseries: schema: 'grid' table: 'egon_etrago_generator_timeseries' diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 8a523d483..874eda6d6 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -160,6 +160,7 @@ CARRIER = "solar_rooftop" SCENARIOS = config.settings()["egon-data"]["--scenarios"] SCENARIO_TIMESTAMP = { + "status2019": pd.Timestamp("2020-01-01", tz="UTC"), "eGon2035": pd.Timestamp("2035-01-01", tz="UTC"), "eGon100RE": pd.Timestamp("2050-01-01", tz="UTC"), } @@ -1634,19 +1635,19 @@ def cap_per_bus_id( pandas.DataFrame DataFrame with total rooftop capacity per mv grid. """ - targets = config.datasets()["solar_rooftop"]["targets"] + sources = config.datasets()["solar_rooftop"]["sources"] sql = f""" - SELECT bus as bus_id, control, p_nom as capacity - FROM {targets['generators']['schema']}.{targets['generators']['table']} + SELECT bus_id, SUM(el_capacity) as capacity + FROM {sources['power_plants']['schema']}.{sources['power_plants']['table']} WHERE carrier = 'solar_rooftop' - AND scn_name = '{scenario}' + AND scenario = '{scenario}' + GROUP BY bus_id """ - # TODO: woher kommen die Slack rows??? df = db.select_dataframe(sql, index_col="bus_id") - return df.loc[df.control != "Slack"] + return df # overlay_gdf = overlay_gdf.assign(capacity=np.nan) # @@ -2527,6 +2528,7 @@ def add_start_up_date( geopandas.GeoDataFrame GeoDataFrame containing OSM buildings data with start-up date added. """ + rng = default_rng(seed=seed) date_range = pd.date_range(start=start, end=end, freq="1D") @@ -2780,6 +2782,8 @@ def pv_rooftop_to_buildings(): mastr_gdf = load_mastr_data() + mastr_gdf = mastr_gdf[mastr_gdf.Inbetriebnahmedatum < "2020-01-01"] + buildings_gdf = load_building_data() desagg_mastr_gdf, desagg_buildings_gdf = allocate_to_buildings( @@ -2797,6 +2801,14 @@ def pv_rooftop_to_buildings(): cap_per_bus_id_df = pd.DataFrame() for scenario in SCENARIOS: + if scenario == "status2019": + desagg_mastr_gdf = desagg_mastr_gdf[ + desagg_mastr_gdf.Inbetriebnahmedatum < "2020-01-01" + ] + scenario_buildings_gdf = scenario_buildings_gdf[ + scenario_buildings_gdf.Inbetriebnahmedatum < "2020-01-01" + ] + logger.debug(f"Desaggregating scenario {scenario}.") ( scenario_buildings_gdf, From f664503d2a674c6b2f419d9fe1bfec64f8682486 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 30 May 2023 11:45:36 +0200 Subject: [PATCH 288/787] little style change --- .../datasets/power_plants/pv_rooftop_buildings.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 874eda6d6..f0451660e 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2781,8 +2781,11 @@ def pv_rooftop_to_buildings(): """Main script, executed as task""" mastr_gdf = load_mastr_data() - - mastr_gdf = mastr_gdf[mastr_gdf.Inbetriebnahmedatum < "2020-01-01"] + + ts = pd.Timestamp( + egon.data.config.datasets()["mastr_new"]["status2019_date_max"] + + mastr_gdf = mastr_gdf.loc[pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts] buildings_gdf = load_building_data() @@ -2802,11 +2805,11 @@ def pv_rooftop_to_buildings(): for scenario in SCENARIOS: if scenario == "status2019": - desagg_mastr_gdf = desagg_mastr_gdf[ - desagg_mastr_gdf.Inbetriebnahmedatum < "2020-01-01" + desagg_mastr_gdf = desagg_mastr_gdf.loc[ + pd.to_datetime(desagg_mastr_gdf.Inbetriebnahmedatum) <= ts ] - scenario_buildings_gdf = scenario_buildings_gdf[ - scenario_buildings_gdf.Inbetriebnahmedatum < "2020-01-01" + scenario_buildings_gdf = scenario_buildings_gdf.loc[ + pd.to_datetime(scenario_buildings_gdf.Inbetriebnahmedatum) <= ts ] logger.debug(f"Desaggregating scenario {scenario}.") From 159315e84c35e7b0c71b9f2a9b7241e0e9934f43 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 30 May 2023 11:56:00 +0200 Subject: [PATCH 289/787] Adjust brackets and run black --- .../datasets/power_plants/pv_rooftop_buildings.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index f0451660e..f9da3035f 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2781,11 +2781,12 @@ def pv_rooftop_to_buildings(): """Main script, executed as task""" mastr_gdf = load_mastr_data() - - ts = pd.Timestamp( - egon.data.config.datasets()["mastr_new"]["status2019_date_max"] - - mastr_gdf = mastr_gdf.loc[pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts] + + ts = pd.Timestamp(config.datasets()["mastr_new"]["status2019_date_max"]) + + mastr_gdf = mastr_gdf.loc[ + pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts + ] buildings_gdf = load_building_data() @@ -2809,7 +2810,8 @@ def pv_rooftop_to_buildings(): pd.to_datetime(desagg_mastr_gdf.Inbetriebnahmedatum) <= ts ] scenario_buildings_gdf = scenario_buildings_gdf.loc[ - pd.to_datetime(scenario_buildings_gdf.Inbetriebnahmedatum) <= ts + pd.to_datetime(scenario_buildings_gdf.Inbetriebnahmedatum) + <= ts ] logger.debug(f"Desaggregating scenario {scenario}.") From 475505424b04133c4d10be2f4842dacfe16e7737 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 30 May 2023 14:45:35 +0200 Subject: [PATCH 290/787] Import gas generators per scenario --- src/egon/data/datasets/ch4_prod.py | 121 +++++++++++++++++------------ 1 file changed, 72 insertions(+), 49 deletions(-) diff --git a/src/egon/data/datasets/ch4_prod.py b/src/egon/data/datasets/ch4_prod.py index cc7f31b6f..f4f317a71 100755 --- a/src/egon/data/datasets/ch4_prod.py +++ b/src/egon/data/datasets/ch4_prod.py @@ -45,7 +45,7 @@ class CH4Production(Dataset): name: str = "CH4Production" #: - version: str = "0.0.7" + version: str = "0.0.8" def __init__(self, dependencies): super().__init__( @@ -280,7 +280,7 @@ def load_biogas_generators(scn_name): return biogas_generators_list -def import_gas_generators(scn_name="eGon2035"): +def import_gas_generators(): """ Insert list of gas production units into the database @@ -324,53 +324,76 @@ def import_gas_generators(scn_name="eGon2035"): source = config.datasets()["gas_prod"]["source"] target = config.datasets()["gas_prod"]["target"] - # Clean table - db.execute_sql( - f""" - DELETE FROM {target['stores']['schema']}.{target['stores']['table']} - WHERE "carrier" = 'CH4' AND - scn_name = '{scn_name}' AND bus not IN ( - SELECT bus_id FROM {source['buses']['schema']}.{source['buses']['table']} - WHERE scn_name = '{scn_name}' AND country != 'DE' - ); - """ - ) - - CH4_generators_list = pd.concat( - [load_NG_generators(scn_name), load_biogas_generators(scn_name)] - ) - - # Add missing columns - c = {"scn_name": scn_name, "carrier": "CH4"} - CH4_generators_list = CH4_generators_list.assign(**c) - - # Match to associated CH4 bus - CH4_generators_list = db.assign_gas_bus_id( - CH4_generators_list, scn_name, "CH4" - ) - - # Remove useless columns - CH4_generators_list = CH4_generators_list.drop(columns=["geom", "bus_id"]) - - # Aggregate ch4 productions with same properties at the same bus - CH4_generators_list = ( - CH4_generators_list.groupby( - ["bus", "carrier", "scn_name", "marginal_cost"] + for scn_name in config.settings()["egon-data"]["--scenarios"]: + # Clean table + db.execute_sql( + f""" + DELETE FROM {target['stores']['schema']}.{target['stores']['table']} + WHERE "carrier" = 'CH4' AND + scn_name = '{scn_name}' AND bus not IN ( + SELECT bus_id FROM {source['buses']['schema']}.{source['buses']['table']} + WHERE scn_name = '{scn_name}' AND country != 'DE' + ); + """ ) - .agg({"p_nom": "sum"}) - .reset_index(drop=False) - ) - new_id = db.next_etrago_id("generator") - CH4_generators_list["generator_id"] = range( - new_id, new_id + len(CH4_generators_list) - ) + if scn_name == "eGon2035": + CH4_generators_list = pd.concat( + [ + load_NG_generators(scn_name), + load_biogas_generators(scn_name), + ] + ) + + # Add missing columns + c = {"scn_name": scn_name, "carrier": "CH4"} + CH4_generators_list = CH4_generators_list.assign(**c) + + # Match to associated CH4 bus + CH4_generators_list = db.assign_gas_bus_id( + CH4_generators_list, scn_name, "CH4" + ) + + # Remove useless columns + CH4_generators_list = CH4_generators_list.drop( + columns=["geom", "bus_id"] + ) + + # Aggregate ch4 productions with same properties at the same bus + CH4_generators_list = ( + CH4_generators_list.groupby( + ["bus", "carrier", "scn_name", "marginal_cost"] + ) + .agg({"p_nom": "sum"}) + .reset_index(drop=False) + ) + + elif scn_name == "status2019": + # Add one large CH4 generator at each CH4 bus + CH4_generators_list = db.select_dataframe( + """ + SELECT bus_id as bus, scn_name, carrier + FROM grid.egon_gas_voronoi + WHERE scn_name = 'status2019' + AND carrier = 'CH4' + """ + ) + + CH4_generators_list["marginal_cost"] = get_sector_parameters( + "gas", scn_name + )["marginal_cost"]["CH4"] + CH4_generators_list["p_nom"] = 100000 + + new_id = db.next_etrago_id("generator") + CH4_generators_list["generator_id"] = range( + new_id, new_id + len(CH4_generators_list) + ) - # Insert data to db - CH4_generators_list.to_sql( - target["stores"]["table"], - engine, - schema=target["stores"]["schema"], - index=False, - if_exists="append", - ) + # Insert data to db + CH4_generators_list.to_sql( + target["stores"]["table"], + engine, + schema=target["stores"]["schema"], + index=False, + if_exists="append", + ) From 835445054ace5d77309ba6fb4312207ffefa1c91 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 31 May 2023 11:03:33 +0200 Subject: [PATCH 291/787] switching to explicit cli scenario calling --- src/egon/data/datasets/fix_ehv_subnetworks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 0efb0bde5..82175a609 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -4,7 +4,7 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import db, config from egon.data.config import settings from egon.data.datasets import Dataset from egon.data.datasets.etrago_setup import link_geom_from_buses @@ -235,6 +235,6 @@ def fix_subnetworks(scn_name): ) def run(): - fix_subnetworks("eGon2035") - fix_subnetworks("eGon100RE") - fix_subnetworks("status2019") + for scenario in config.settings()["egon-data"]["--scenarios"]: + fix_subnetworks(scenario) + From ff21b0cd77d29225923e1fceb00dc78e63bc501f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 31 May 2023 11:15:57 +0200 Subject: [PATCH 292/787] Fix calling chp.assign_use_case --- src/egon/data/datasets/chp/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index a1f509375..1d3b02783 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -288,7 +288,7 @@ def insert_biomass_chp(scenario): mastr_loc, cfg, WORKING_DIR_MASTR_OLD ) mastr_loc = assign_bus_id(mastr_loc, cfg) - mastr_loc = assign_use_case(mastr_loc, cfg["sources"]) + mastr_loc = assign_use_case(mastr_loc, cfg["sources"], scenario) # Insert entries with location session = sessionmaker(bind=db.engine())() @@ -419,7 +419,7 @@ def insert_chp_statusquo(): mastr["gas_bus_id"] = gas_bus_id - mastr = assign_use_case(mastr, cfg["sources"]) + mastr = assign_use_case(mastr, cfg["sources"], "status2019") # Insert entries with location session = sessionmaker(bind=db.engine())() @@ -636,7 +636,8 @@ def insert_chp_egon100re(): scenario="eGon100RE", ) -tasks = (create_tables, ) + +tasks = (create_tables,) insert_per_scenario = set() From 5fdc0d1b0af077ea0c281c0920a02744bd759f27 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 5 Jun 2023 11:24:14 +0200 Subject: [PATCH 293/787] make optional one of the fixes --- src/egon/data/datasets/fix_ehv_subnetworks.py | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 82175a609..90b938fab 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -211,17 +211,22 @@ def fix_subnetworks(scn_name): scn_name, 6, ) - - # Missing line from Umspannwerk Plottling to Gänsdorf UW - add_line( - 12.85381530378627, # Umspannwerk Plottling - 48.764209444817745, - 12.769768646403532, # Gänsdorf UW - 48.80533685376445, - 380, - scn_name, - 3, - ) + if (select_bus_id(12.85381530378627, + 48.764209444817745, + 380, + scn_name, + "AC") != None): + + # Missing line from Umspannwerk Plottling to Gänsdorf UW + add_line( + 12.85381530378627, # Umspannwerk Plottling + 48.764209444817745, + 12.769768646403532, # Gänsdorf UW + 48.80533685376445, + 380, + scn_name, + 3, + ) # Missing line inside Ottstedt add_line( From 0cf00edd483191639b1e3f3e270819e8dcff903c Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 5 Jun 2023 11:21:29 +0200 Subject: [PATCH 294/787] create wind_off status2019 --- .../data/datasets/power_plants/__init__.py | 43 ++++++- .../datasets/power_plants/wind_offshore.py | 110 ++++++++++++------ 2 files changed, 119 insertions(+), 34 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 0366fda32..f766246f8 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -33,6 +33,9 @@ geocode_mastr_data, pv_rooftop_to_buildings, ) +from egon.data.datasets.power_plants.wind_offshore import (map_to_city, + map_id_bus, + map_w_id) import egon.data.config import egon.data.datasets.power_plants.assign_weather_data as assign_weather_data # noqa: E501 import egon.data.datasets.power_plants.pv_ground_mounted as pv_ground_mounted @@ -1077,7 +1080,7 @@ def fill_missing_bus_and_geom(gens, carrier): wind_onshore = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['wind']}""", con, geom_col="geom" ) - + wind_onshore = fill_missing_bus_and_geom( wind_onshore, carrier="wind_onshore" ) @@ -1103,6 +1106,44 @@ def fill_missing_bus_and_geom(gens, carrier): """ ) + # Write wind_offshore power plants in supply.egon_power_plants + raw_wind = pd.read_csv("/home/carlos/powerd-data-exc/bnetza_mastr/dump_2022-11-17/bnetza_mastr_wind_cleaned.csv", + index_col = "EinheitMastrNummer", usecols=["EinheitMastrNummer", "LokationMastrNummer"]) + + wind_offshore = gpd.GeoDataFrame.from_postgis( + f"""SELECT * FROM {cfg['sources']['wind']} + WHERE site_type = 'Windkraft auf See'""", + con, geom_col="geom" + ) + + # Import table with all the buses of the grid + sql = f""" + SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) + as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} + """ + + buses = gpd.GeoDataFrame.from_postgis( + sql, con, crs="EPSG:4326", geom_col="point", index_col= "bus_id" + ) + + wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map(raw_wind["LokationMastrNummer"]) + wind_offshore["city"] = wind_offshore.LokationMastrNummer.map(map_to_city()) + wind_offshore["osm_id"] = wind_offshore.city.map(map_id_bus()) + + for wt in wind_offshore.index: + sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] + sub_sta.at[wt, "bus_id"] = sub_sta["voltage"].idxmax() + + wind_offshore["weather_cell_id"] = wind_offshore["city"].map(map_w_id()) + wind_offshore["weather_cell_id"] = wind_offshore["weather_cell_id"].apply(int) + + + + + wind_offshore.to_file("/home/carlos/git/powerd-data/off_shore/wind_off.geojson", driver='GeoJSON') + + + return diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index ba78778c8..f3f4de19e 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -8,39 +8,39 @@ from egon.data import db import egon.data.config - -def insert(): - """ - Include the offshore wind parks in egon-data. - locations and installed capacities based on: NEP2035_V2021_scnC2035 - - Parameters - ---------- - *No parameters required - """ - # Read file with all required input/output tables' names - cfg = egon.data.config.datasets()["power_plants"] - - # load NEP2035_V2021_scnC2035 file - offshore_path = ( - Path(".") - / "data_bundle_egon_data" - / "nep2035_version2021" - / cfg["sources"]["nep_2035"] - ) - - offshore = pd.read_excel( - offshore_path, - sheet_name="WInd_Offshore_NEP", - usecols=[ - "Netzverknuepfungspunkt", - "Spannungsebene in kV", - "C 2035", - "B 2040 ", - ], - ) - offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) - +def map_to_city(): + # map from connection point to city + to_city = { + 'SEL900790170542': 'Dörpen/West', + 'SEL903815302577': 'Dörpen/West', + 'SEL906065107428': 'Büttel', + 'SEL919433257267': 'Büttel', + 'SEL919746983181': 'Lubmin', + 'SEL919786394244': 'Emden/Ost', + 'SEL922199100944': 'Büttel', + 'SEL925169438559': 'Dörpen/West', + 'SEL928599601562': 'Büttel', + 'SEL929196129428': 'Cloppenburg', + 'SEL932958083050': 'Emden/Ost', + 'SEL933375144706': 'inhausen', + 'SEL941255164959': 'Emden/Borßum', + 'SEL943058624104': 'Bentwisch', + 'SEL943629000788': 'Emden/Ost', + 'SEL947312274135': 'Dörpen/West', + 'SEL947778987563': 'Dörpen/West', + 'SEL953673961584': 'Cloppenburg', + 'SEL960138676303': 'Büttel', + 'SEL964485571465': 'Cloppenburg', + 'SEL964827249373': 'Emden/Ost', + 'SEL969972182469': 'Büttel', + 'SEL988334563685': 'Dörpen/West', + 'SEL990492206410': 'Bentwisch', + 'SEL997728577467': 'Lubmin', + 'SEL998582120202': 'Emden/Ost', + } + return to_city + +def map_id_bus(): # Import manually generated list of wind offshore farms with their # connection points (OSM_id) id_bus = { @@ -66,7 +66,12 @@ def insert(): "Lubmin": "460134233", "Suchraum Gemeinde Papendorf": "32063539", "Suchraum Gemeinden Brünzow/Kemnitz": "460134233", + "inhausen": "29420322", + "Cloppenburg": "50643382" } + return id_bus + +def map_w_id(): w_id = { "Büttel": "16331", "Heide/West": "16516", @@ -90,7 +95,46 @@ def insert(): "Lubmin": "16548", "Suchraum Gemeinde Papendorf": "16352", "Suchraum Gemeinden Brünzow/Kemnitz": "16548", + "inhausen": "15769", + "Cloppenburg": "16334" } + return w_id + + +def insert(): + """ + Include the offshore wind parks in egon-data. + locations and installed capacities based on: NEP2035_V2021_scnC2035 + + Parameters + ---------- + *No parameters required + """ + # Read file with all required input/output tables' names + cfg = egon.data.config.datasets()["power_plants"] + + # load NEP2035_V2021_scnC2035 file + offshore_path = ( + Path(".") + / "data_bundle_egon_data" + / "nep2035_version2021" + / cfg["sources"]["nep_2035"] + ) + + offshore = pd.read_excel( + offshore_path, + sheet_name="WInd_Offshore_NEP", + usecols=[ + "Netzverknuepfungspunkt", + "Spannungsebene in kV", + "C 2035", + "B 2040 ", + ], + ) + offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) + + id_bus = map_id_bus() + w_id = map_w_id() # Match wind offshore table with the corresponding OSM_id offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) From fa5153cf9dbae9faaa124338f722d81412afa83d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 5 Jun 2023 14:47:19 +0200 Subject: [PATCH 295/787] Change format of JSONB column --- src/egon/data/datasets/power_plants/__init__.py | 2 +- src/egon/data/datasets/power_plants/assign_weather_data.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 0366fda32..626fd9421 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1145,7 +1145,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.18", + version="0.0.19", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 5ffd870d0..7793dabcb 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -1,3 +1,5 @@ +import json + import geopandas as gpd import pandas as pd @@ -205,6 +207,9 @@ def write_power_plants_table(power_plants, cfg, con): start=ini_id, stop=ini_id + len(power_plants), name="id" ) + for i in power_plants.index: + power_plants.sources[i] = json.dumps(power_plants.sources[i]) + # Insert into database power_plants.reset_index().to_postgis( name=f"{cfg['sources']['power_plants']['table']}", From 45570d0b8abb500adb807729436e371679fc328c Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 5 Jun 2023 16:22:50 +0200 Subject: [PATCH 296/787] include bus_id for wind_offshore --- .../data/datasets/power_plants/__init__.py | 81 +++++++++++++++---- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f766246f8..4a61adc00 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -906,12 +906,17 @@ def power_plants_status_quo(scn_name="status2019"): con = db.engine() session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] + TESTMODE = ( + egon.data.config.settings()["egon-data"]["--dataset-boundary"] + != "Everything" + ) db.execute_sql( f""" DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} WHERE carrier IN ('wind_onshore', 'solar', 'biomass', - 'run_of_river', 'reservoir', 'solar_rooftop') + 'run_of_river', 'reservoir', 'solar_rooftop', + 'wind_offshore') AND scenario = '{scn_name}' """ ) @@ -1006,7 +1011,7 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f""" {len(hydro)} hydro generators with a total installed capacity of - {hydro.capacity.sum()}MW were inserted in db + {hydro.capacity.sum()}MW were inserted into the db """ ) @@ -1034,7 +1039,7 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f""" {len(biomass)} biomass generators with a total installed capacity of - {biomass.capacity.sum()}MW were inserted in db + {biomass.capacity.sum()}MW were inserted into the db """ ) @@ -1072,7 +1077,7 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f""" {len(solar)} solar generators with a total installed capacity of - {solar.capacity.sum()}MW were inserted in db + {solar.capacity.sum()}MW were inserted into the db """ ) @@ -1102,13 +1107,14 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f""" {len(wind_onshore)} wind_onshore generators with a total installed capacity of - {wind_onshore.capacity.sum()}MW were inserted in db + {wind_onshore.capacity.sum()}MW were inserted into the db """ ) # Write wind_offshore power plants in supply.egon_power_plants raw_wind = pd.read_csv("/home/carlos/powerd-data-exc/bnetza_mastr/dump_2022-11-17/bnetza_mastr_wind_cleaned.csv", - index_col = "EinheitMastrNummer", usecols=["EinheitMastrNummer", "LokationMastrNummer"]) + index_col = "EinheitMastrNummer", + usecols=["EinheitMastrNummer", "LokationMastrNummer"]) wind_offshore = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['wind']} @@ -1116,7 +1122,7 @@ def fill_missing_bus_and_geom(gens, carrier): con, geom_col="geom" ) - # Import table with all the buses of the grid + # Import table with all the buses of the grid sql = f""" SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} @@ -1125,26 +1131,69 @@ def fill_missing_bus_and_geom(gens, carrier): buses = gpd.GeoDataFrame.from_postgis( sql, con, crs="EPSG:4326", geom_col="point", index_col= "bus_id" ) + #for testing purposes + # # Import table with all the buses of the grid + # import psycopg2 + # conn = psycopg2.connect(dbname="powerd-data", + # user="egon", + # password="data", + # host="127.0.0.1", + # port= "8083" + # ) + + + # sql = f""" + # SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) + # as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} + # """ + + # buses = gpd.GeoDataFrame.from_postgis( + # sql, conn, crs="EPSG:4326", geom_col="point", index_col= "bus_id" + # ) wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map(raw_wind["LokationMastrNummer"]) wind_offshore["city"] = wind_offshore.LokationMastrNummer.map(map_to_city()) wind_offshore["osm_id"] = wind_offshore.city.map(map_id_bus()) for wt in wind_offshore.index: - sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] - sub_sta.at[wt, "bus_id"] = sub_sta["voltage"].idxmax() + if TESTMODE: + try: + sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] + wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() + except: + wind_offshore.loc[wt, "bus_id"] = None + else: + sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] + wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() + + wind_offshore.dropna(subset=["bus_id"], inplace=True) - wind_offshore["weather_cell_id"] = wind_offshore["city"].map(map_w_id()) - wind_offshore["weather_cell_id"] = wind_offshore["weather_cell_id"].apply(int) - + wind_offshore["geom"] = wind_offshore["geom"].to_wkt() + for i, row in wind_offshore.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier="wind_offshore", + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + weather_cell_id=-1, + geom=row.geom, + ) + session.add(entry) + session.commit() + logging.info( + f""" + {len(wind_offshore)} wind_offshore generators with a total installed capacity of + {wind_offshore.capacity.sum()}MW were inserted into the db + """ + ) - - wind_offshore.to_file("/home/carlos/git/powerd-data/off_shore/wind_off.geojson", driver='GeoJSON') + return - - return tasks = ( From 38864a6fc12147974c91460f4c409bef2cfd85e1 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 5 Jun 2023 16:23:32 +0200 Subject: [PATCH 297/787] using black --- .../data/datasets/power_plants/__init__.py | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 4a61adc00..18294a943 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -33,9 +33,11 @@ geocode_mastr_data, pv_rooftop_to_buildings, ) -from egon.data.datasets.power_plants.wind_offshore import (map_to_city, - map_id_bus, - map_w_id) +from egon.data.datasets.power_plants.wind_offshore import ( + map_to_city, + map_id_bus, + map_w_id, +) import egon.data.config import egon.data.datasets.power_plants.assign_weather_data as assign_weather_data # noqa: E501 import egon.data.datasets.power_plants.pv_ground_mounted as pv_ground_mounted @@ -1085,7 +1087,7 @@ def fill_missing_bus_and_geom(gens, carrier): wind_onshore = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['wind']}""", con, geom_col="geom" ) - + wind_onshore = fill_missing_bus_and_geom( wind_onshore, carrier="wind_onshore" ) @@ -1112,26 +1114,29 @@ def fill_missing_bus_and_geom(gens, carrier): ) # Write wind_offshore power plants in supply.egon_power_plants - raw_wind = pd.read_csv("/home/carlos/powerd-data-exc/bnetza_mastr/dump_2022-11-17/bnetza_mastr_wind_cleaned.csv", - index_col = "EinheitMastrNummer", - usecols=["EinheitMastrNummer", "LokationMastrNummer"]) - + raw_wind = pd.read_csv( + "/home/carlos/powerd-data-exc/bnetza_mastr/dump_2022-11-17/bnetza_mastr_wind_cleaned.csv", + index_col="EinheitMastrNummer", + usecols=["EinheitMastrNummer", "LokationMastrNummer"], + ) + wind_offshore = gpd.GeoDataFrame.from_postgis( f"""SELECT * FROM {cfg['sources']['wind']} WHERE site_type = 'Windkraft auf See'""", - con, geom_col="geom" + con, + geom_col="geom", ) - - # Import table with all the buses of the grid + + # Import table with all the buses of the grid sql = f""" SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} """ buses = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="point", index_col= "bus_id" + sql, con, crs="EPSG:4326", geom_col="point", index_col="bus_id" ) - #for testing purposes + # for testing purposes # # Import table with all the buses of the grid # import psycopg2 # conn = psycopg2.connect(dbname="powerd-data", @@ -1140,8 +1145,7 @@ def fill_missing_bus_and_geom(gens, carrier): # host="127.0.0.1", # port= "8083" # ) - - + # sql = f""" # SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) # as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} @@ -1150,24 +1154,30 @@ def fill_missing_bus_and_geom(gens, carrier): # buses = gpd.GeoDataFrame.from_postgis( # sql, conn, crs="EPSG:4326", geom_col="point", index_col= "bus_id" # ) - - wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map(raw_wind["LokationMastrNummer"]) - wind_offshore["city"] = wind_offshore.LokationMastrNummer.map(map_to_city()) + + wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map( + raw_wind["LokationMastrNummer"] + ) + wind_offshore["city"] = wind_offshore.LokationMastrNummer.map( + map_to_city() + ) wind_offshore["osm_id"] = wind_offshore.city.map(map_id_bus()) - + for wt in wind_offshore.index: if TESTMODE: try: - sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] + sub_sta = buses[ + buses["osm_id"] == wind_offshore.at[wt, "osm_id"] + ] wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() except: wind_offshore.loc[wt, "bus_id"] = None else: sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() - + wind_offshore.dropna(subset=["bus_id"], inplace=True) - + wind_offshore["geom"] = wind_offshore["geom"].to_wkt() for i, row in wind_offshore.iterrows(): entry = EgonPowerPlants( @@ -1194,8 +1204,6 @@ def fill_missing_bus_and_geom(gens, carrier): return - - tasks = ( create_tables, import_mastr, From d6c9172b0ffc942f351052e9fcd6d492389bc010 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 6 Jun 2023 10:07:04 +0200 Subject: [PATCH 298/787] write off_shore only when df not empty --- .../data/datasets/power_plants/__init__.py | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 18294a943..99bbb6318 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1177,22 +1177,23 @@ def fill_missing_bus_and_geom(gens, carrier): wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() wind_offshore.dropna(subset=["bus_id"], inplace=True) - - wind_offshore["geom"] = wind_offshore["geom"].to_wkt() - for i, row in wind_offshore.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier="wind_offshore", - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - weather_cell_id=-1, - geom=row.geom, - ) - session.add(entry) - session.commit() + + if len(wind_offshore) > 0: + wind_offshore["geom"] = wind_offshore["geom"].to_wkt() + for i, row in wind_offshore.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier="wind_offshore", + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=1, + weather_cell_id=-1, + geom=row.geom, + ) + session.add(entry) + session.commit() logging.info( f""" From d795ef5aab95c43640e628365894af52b73057b6 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 6 Jun 2023 10:08:05 +0200 Subject: [PATCH 299/787] delete comments and using black --- .../data/datasets/power_plants/__init__.py | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 99bbb6318..b000a4ebb 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1136,24 +1136,6 @@ def fill_missing_bus_and_geom(gens, carrier): buses = gpd.GeoDataFrame.from_postgis( sql, con, crs="EPSG:4326", geom_col="point", index_col="bus_id" ) - # for testing purposes - # # Import table with all the buses of the grid - # import psycopg2 - # conn = psycopg2.connect(dbname="powerd-data", - # user="egon", - # password="data", - # host="127.0.0.1", - # port= "8083" - # ) - - # sql = f""" - # SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) - # as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} - # """ - - # buses = gpd.GeoDataFrame.from_postgis( - # sql, conn, crs="EPSG:4326", geom_col="point", index_col= "bus_id" - # ) wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map( raw_wind["LokationMastrNummer"] @@ -1177,7 +1159,7 @@ def fill_missing_bus_and_geom(gens, carrier): wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() wind_offshore.dropna(subset=["bus_id"], inplace=True) - + if len(wind_offshore) > 0: wind_offshore["geom"] = wind_offshore["geom"].to_wkt() for i, row in wind_offshore.iterrows(): From 19844a4fb265da4aaff9a8088de45da0df0d5e52 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 6 Jun 2023 11:52:31 +0200 Subject: [PATCH 300/787] added cli parameter --- .../motorized_individual_travel/ev_allocation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index 029f1bdfe..258cea95a 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -11,7 +11,7 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import db, config from egon.data.datasets.emobility.motorized_individual_travel.db_classes import ( EgonEvCountMunicipality, EgonEvCountMvGridDistrict, @@ -422,8 +422,8 @@ def allocate_evs_numbers(): # Import kba_data = read_kba_data() rs7_data = read_rs7_data() - - for scenario_name in ["eGon2035", "eGon100RE", "status2019"]: + + for scenario_name in config.settings()["egon-data"]["--scenarios"]: # Load scenario params scenario_parameters = get_sector_parameters( "mobility", scenario=scenario_name @@ -540,7 +540,7 @@ def get_random_evs(row): .ev_id.to_list() ) - for scenario_name in ["eGon2035", "eGon100RE", "status2019"]: + for scenario_name in config.settings()["egon-data"]["--scenarios"]: print(f"SCENARIO: {scenario_name}") # Load EVs per grid district From c789e6f60606831f38cf8765444c2daf3cc5647f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 5 Jun 2023 14:47:19 +0200 Subject: [PATCH 301/787] Change format of JSONB column --- src/egon/data/datasets/power_plants/assign_weather_data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 7793dabcb..4be800e0c 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -207,8 +207,10 @@ def write_power_plants_table(power_plants, cfg, con): start=ini_id, stop=ini_id + len(power_plants), name="id" ) + # Set json format for i in power_plants.index: power_plants.sources[i] = json.dumps(power_plants.sources[i]) + power_plants.source_id[i] = json.dumps(power_plants.source_id[i]) # Insert into database power_plants.reset_index().to_postgis( From 51c00ddda638e9eb2e22802dfb7627a5ad51264b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 6 Jun 2023 12:01:08 +0200 Subject: [PATCH 302/787] Fix heat demand timeseries for ststua2019o --- src/egon/data/datasets/heat_etrago/hts_etrago.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/heat_etrago/hts_etrago.py b/src/egon/data/datasets/heat_etrago/hts_etrago.py index 2fbae7351..d19357cc0 100644 --- a/src/egon/data/datasets/heat_etrago/hts_etrago.py +++ b/src/egon/data/datasets/heat_etrago/hts_etrago.py @@ -8,14 +8,15 @@ def hts_to_etrago(scenario): - sources = config.datasets()["etrago_heat"]["sources"] targets = config.datasets()["etrago_heat"]["targets"] carriers = ["central_heat", "rural_heat", "rural_gas_boiler"] + if scenario == "status2019": + carriers = ["central_heat", "rural_heat"] + for carrier in carriers: if carrier == "central_heat": - # Map heat buses to district heating id and area_id # interlinking bus_id and area_id bus_area = db.select_dataframe( @@ -88,7 +89,6 @@ def hts_to_etrago(scenario): bus_ts.loc[:, "bus_id"] = bus_ts.loc[:, "heat_bus_id"] else: - efficiency_gas_boiler = get_sector_parameters("heat", scenario)[ "efficiency" ]["rural_gas_boiler"] @@ -208,8 +208,9 @@ def hts_to_etrago(scenario): index=False, ) -def demand(): - """ Insert demand timeseries for heat into eTraGo tables + +def demand(): + """Insert demand timeseries for heat into eTraGo tables Returns ------- @@ -219,6 +220,7 @@ def demand(): for scenario in config.settings()["egon-data"]["--scenarios"]: hts_to_etrago(scenario) + class HtsEtragoTable(Dataset): def __init__(self, dependencies): super().__init__( From 3b1ac2abe22f4a19d412fc37630bbc9503bfd111 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 6 Jun 2023 13:01:54 +0200 Subject: [PATCH 303/787] find weather cell id for off_shore status2019 --- .../power_plants/assign_weather_data.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 5ffd870d0..088a21a36 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -1,5 +1,8 @@ +import json + import geopandas as gpd import pandas as pd +from shapely.geometry import Polygon from egon.data import db import egon.data.config @@ -120,6 +123,8 @@ def find_weather_id(): power_plants = power_plants[ (power_plants["carrier"] == "solar") | (power_plants["carrier"] == "wind_onshore") + | ((power_plants["carrier"] == "wind_offshore") & + (power_plants["weather_cell_id"] == -1)) ] power_plants.set_index("id", inplace=True) @@ -153,6 +158,12 @@ def find_weather_id(): sql, con, crs="EPSG:4326", geom_col="geometry" ) + baltic_sea = Polygon([(11, 56), (11, 53), (15, 53), (15, 56)]) + north_sea = Polygon([(5, 56), (5, 53), (9, 53), (9, 56)]) + + boundaries.loc["baltic_sea", "geometry"] = baltic_sea + boundaries.loc["north_sea", "geometry"] = north_sea + # Clip weater data cells using the German boundaries weather_cells = gpd.clip(weather_cells, boundaries) @@ -173,6 +184,7 @@ def write_power_plants_table(power_plants, cfg, con): DELETE FROM {cfg['sources']['power_plants']['schema']}. {cfg['sources']['power_plants']['table']} WHERE carrier IN ('wind_onshore', 'solar') + OR ((carrier = 'wind_offshore') AND (weather_cell_id = '-1')) """ ) @@ -205,6 +217,11 @@ def write_power_plants_table(power_plants, cfg, con): start=ini_id, stop=ini_id + len(power_plants), name="id" ) + # Set json format + for i in power_plants.index: + power_plants.sources[i] = json.dumps(power_plants.sources[i]) + power_plants.source_id[i] = json.dumps(power_plants.source_id[i]) + # Insert into database power_plants.reset_index().to_postgis( name=f"{cfg['sources']['power_plants']['table']}", From 2abf92ccb39b42af6f82eaf3fdd3fbf9d12fc003 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 6 Jun 2023 13:02:26 +0200 Subject: [PATCH 304/787] usign black --- src/egon/data/datasets/power_plants/assign_weather_data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 088a21a36..61e839a03 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -123,8 +123,10 @@ def find_weather_id(): power_plants = power_plants[ (power_plants["carrier"] == "solar") | (power_plants["carrier"] == "wind_onshore") - | ((power_plants["carrier"] == "wind_offshore") & - (power_plants["weather_cell_id"] == -1)) + | ( + (power_plants["carrier"] == "wind_offshore") + & (power_plants["weather_cell_id"] == -1) + ) ] power_plants.set_index("id", inplace=True) From ae504fd3c51b1952a9649263fec5eeab979a2017 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 6 Jun 2023 14:01:24 +0200 Subject: [PATCH 305/787] quick e-mobility fix for status2019 --- src/egon/data/datasets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 90b16267a..919f47986 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1133,6 +1133,7 @@ emobility_mit: scenario: # used scenario variation (available scenarios see parameters.py) variation: + status2019: "status2019" eGon2035: "NEP C 2035" eGon100RE: "Reference 2050" # name of low-flex scenario From 0f72c0d46d5213044d97bffea6c52179d77ed01a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 6 Jun 2023 16:18:27 +0200 Subject: [PATCH 306/787] Set data type for building_ids to int and run blacko --- .../heat_supply/individual_heating.py | 79 +++++++++---------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index f69a33251..6cbbc3547 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -208,7 +208,7 @@ write_table_to_postgres, ) from egon.data.datasets.emobility.motorized_individual_travel.helpers import ( - reduce_mem_usage + reduce_mem_usage, ) from egon.data.datasets.heat_demand import EgonPetaHeat from egon.data.datasets.heat_demand_timeseries.daily import ( @@ -294,6 +294,7 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ), ) + class HeatPumps2019(Dataset): def __init__(self, dependencies): def dyn_parallel_tasks_2019(): @@ -436,7 +437,6 @@ def cascade_per_technology( distribution_level, max_size_individual_chp=0.05, ): - """Add plants for individual heat. Currently only on mv grid district level. @@ -466,7 +466,6 @@ def cascade_per_technology( # Distribute heat pumps linear to remaining demand. if tech.index == "heat_pump": - if distribution_level == "federal_state": # Select target values per federal state target = db.select_dataframe( @@ -518,7 +517,6 @@ def cascade_per_technology( ) elif tech.index == "gas_boiler": - append_df = pd.DataFrame( data={ "capacity": heat_per_mv.remaining_demand.div( @@ -874,8 +872,10 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): left=df_peta_demand, right=df_profiles_ids, on="zensus_population_id" ) - df_profile_merge.demand = df_profile_merge.demand.div(df_profile_merge.buildings) - df_profile_merge.drop('buildings', axis='columns', inplace=True) + df_profile_merge.demand = df_profile_merge.demand.div( + df_profile_merge.buildings + ) + df_profile_merge.drop("buildings", axis="columns", inplace=True) # Merge daily demand to daily profile ids by zensus_population_id and day df_profile_merge = pd.merge( @@ -884,8 +884,9 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): on=["zensus_population_id", "day_of_year"], ) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.daily_demand_share) - df_profile_merge.drop('daily_demand_share', axis='columns', inplace=True) + df_profile_merge.daily_demand_share + ) + df_profile_merge.drop("daily_demand_share", axis="columns", inplace=True) df_profile_merge = reduce_mem_usage(df_profile_merge) # Merge daily profiles by profile id @@ -898,10 +899,13 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): df_profile_merge = reduce_mem_usage(df_profile_merge) df_profile_merge.demand = df_profile_merge.demand.mul( - df_profile_merge.idp.astype(float)) - df_profile_merge.drop('idp', axis='columns', inplace=True) + df_profile_merge.idp.astype(float) + ) + df_profile_merge.drop("idp", axis="columns", inplace=True) - df_profile_merge.rename({'demand': 'demand_ts'}, axis='columns', inplace=True) + df_profile_merge.rename( + {"demand": "demand_ts"}, axis="columns", inplace=True + ) df_profile_merge = reduce_mem_usage(df_profile_merge) @@ -909,7 +913,6 @@ def calc_residential_heat_profiles_per_mvgd(mvgd, scenario): def plot_heat_supply(resulting_capacities): - from matplotlib import pyplot as plt mv_grids = db.select_geodataframe( @@ -1415,8 +1418,8 @@ def determine_min_hp_cap_buildings_pypsa_eur_sec( return 0.0 -def determine_hp_cap_buildings_pvbased_per_mvgd(scenario, - mv_grid_id, peak_heat_demand, building_ids +def determine_hp_cap_buildings_pvbased_per_mvgd( + scenario, mv_grid_id, peak_heat_demand, building_ids ): """ Determines which buildings in the MV grid will have a HP (buildings with PV @@ -1436,9 +1439,7 @@ def determine_hp_cap_buildings_pvbased_per_mvgd(scenario, """ - hp_cap_grid = get_total_heat_pump_capacity_of_mv_grid( - scenario, mv_grid_id - ) + hp_cap_grid = get_total_heat_pump_capacity_of_mv_grid(scenario, mv_grid_id) if len(building_ids) > 0 and hp_cap_grid > 0.0: peak_heat_demand = peak_heat_demand.loc[building_ids] @@ -1462,8 +1463,6 @@ def determine_hp_cap_buildings_pvbased_per_mvgd(scenario, else: return pd.Series(dtype="float64").rename("hp_capacity") - - def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): @@ -1485,7 +1484,6 @@ def determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id): ) if hp_cap_grid > 0.0: - # get buildings with decentral heating systems building_ids = get_buildings_with_decentral_heat_demand_in_mv_grid( mv_grid_id, scenario="eGon100RE" @@ -1546,7 +1544,6 @@ def determine_hp_cap_buildings_eGon100RE(): ) for mvgd_id in mvgd_ids: - logger.info(f"MVGD={mvgd_id} | Start") hp_cap_per_building_100RE = ( @@ -1698,9 +1695,7 @@ def export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec): os.mkdir(folder) if not file.is_file(): logger.info(f"Create {file}") - df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( - file, mode="w", header=True - ) + df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv(file, mode="w", header=True) else: df_hp_min_cap_mv_grid_pypsa_eur_sec.to_csv( file, mode="a", header=False @@ -1773,7 +1768,6 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -1803,13 +1797,11 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): buildings_decentral_heating, peak_load_2035 ) - hp_cap_per_building_2035 = ( - determine_hp_cap_buildings_pvbased_per_mvgd( - 'eGon2035', - mvgd, - peak_load_2035, - buildings_decentral_heating, - ) + hp_cap_per_building_2035 = determine_hp_cap_buildings_pvbased_per_mvgd( + "eGon2035", + mvgd, + peak_load_2035, + buildings_decentral_heating, ) buildings_gas_2035 = pd.Index(buildings_decentral_heating).drop( hp_cap_per_building_2035.index @@ -1878,6 +1870,10 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_hp_cap_per_building_2035_db.drop_duplicates("building_id", inplace=True) + df_hp_cap_per_building_2019_db.building_id = ( + df_hp_cap_per_building_2019_db.building_id.astype(int) + ) + write_table_to_postgres( df_hp_cap_per_building_2035_db, EgonHpCapacityBuildings, @@ -1908,7 +1904,6 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -1938,13 +1933,11 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): buildings_decentral_heating, peak_load_2019 ) - hp_cap_per_building_2019 = ( - determine_hp_cap_buildings_pvbased_per_mvgd( - "status2019", - mvgd, - peak_load_2019, - buildings_decentral_heating, - ) + hp_cap_per_building_2019 = determine_hp_cap_buildings_pvbased_per_mvgd( + "status2019", + mvgd, + peak_load_2019, + buildings_decentral_heating, ) buildings_gas_2019 = pd.Index(buildings_decentral_heating).drop( hp_cap_per_building_2019.index @@ -2013,6 +2006,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): drop=False, ) + def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): """ Main function to determine minimum required HP capacity in MV for @@ -2036,7 +2030,6 @@ def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): df_hp_min_cap_mv_grid_pypsa_eur_sec = pd.Series(dtype="float64") for mvgd in mvgd_ids: - logger.info(f"MVGD={mvgd} | Start") # ############# aggregate residential and CTS demand profiles ##### @@ -2205,6 +2198,7 @@ def delete_hp_capacity_2019(): EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) delete_hp_capacity(scenario="status2019") + def delete_hp_capacity_2035(): """Remove all hp capacities for the selected eGon2035""" EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) @@ -2218,6 +2212,7 @@ def delete_mvgd_ts_2019(): ) delete_mvgd_ts(scenario="status2019") + def delete_mvgd_ts_2035(): """Remove all mvgd ts for the selected eGon2035""" EgonEtragoTimeseriesIndividualHeating.__table__.create( @@ -2233,6 +2228,7 @@ def delete_mvgd_ts_100RE(): ) delete_mvgd_ts(scenario="eGon100RE") + def delete_heat_peak_loads_2019(): """Remove all heat peak loads for status2019.""" BuildingHeatPeakLoads.__table__.create(bind=engine, checkfirst=True) @@ -2242,6 +2238,7 @@ def delete_heat_peak_loads_2019(): BuildingHeatPeakLoads.scenario == "status2019" ).delete(synchronize_session=False) + def delete_heat_peak_loads_2035(): """Remove all heat peak loads for eGon2035.""" BuildingHeatPeakLoads.__table__.create(bind=engine, checkfirst=True) From d94d3e5baf689f43153bd355c2c80d0d810e4986 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 8 Jun 2023 10:59:56 +0200 Subject: [PATCH 307/787] adjust fuction lines_to_etrago --- src/egon/data/datasets/pypsaeursec/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/pypsaeursec/__init__.py b/src/egon/data/datasets/pypsaeursec/__init__.py index 0a43de772..03b3def48 100755 --- a/src/egon/data/datasets/pypsaeursec/__init__.py +++ b/src/egon/data/datasets/pypsaeursec/__init__.py @@ -16,7 +16,7 @@ import pypsa import yaml -from egon.data import __path__, db, logger +from egon.data import __path__, db, logger, config from egon.data.datasets import Dataset from egon.data.datasets.scenario_parameters import get_sector_parameters import egon.data.config @@ -669,9 +669,9 @@ def lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE"): index=True, index_label="line_id", ) - - lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE") - lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon2035") + + for scn in config.settings()["egon-data"]["--scenarios"]: + lines_to_etrago(neighbor_lines=neighbor_lines, scn=scn) def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): """Prepare and write neighboring crossborder links to eTraGo table From 0f3428a0cee2d9915af14d52fb63328641c4ba43 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 8 Jun 2023 11:05:11 +0200 Subject: [PATCH 308/787] adapt function links_to_etrago --- src/egon/data/datasets/pypsaeursec/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/pypsaeursec/__init__.py b/src/egon/data/datasets/pypsaeursec/__init__.py index 03b3def48..5827fa690 100755 --- a/src/egon/data/datasets/pypsaeursec/__init__.py +++ b/src/egon/data/datasets/pypsaeursec/__init__.py @@ -24,7 +24,6 @@ def run_pypsa_eur_sec(): - cwd = Path(".") filepath = cwd / "run-pypsa-eur-sec" filepath.mkdir(parents=True, exist_ok=True) @@ -132,7 +131,6 @@ def run_pypsa_eur_sec(): def read_network(): - # Set execute_pypsa_eur_sec to False until optional task is implemented execute_pypsa_eur_sec = False cwd = Path(".") @@ -266,7 +264,6 @@ def clean_database(): def neighbor_reduction(): - network = read_network() network.links.drop("pipe_retrofit", axis="columns", inplace=True) @@ -669,7 +666,7 @@ def lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE"): index=True, index_label="line_id", ) - + for scn in config.settings()["egon-data"]["--scenarios"]: lines_to_etrago(neighbor_lines=neighbor_lines, scn=scn) @@ -820,7 +817,11 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): extendable=False, ) - links_to_etrago(neighbor_links[neighbor_links.carrier == "DC"], "eGon2035") + for scn in config.settings()["egon-data"]["--scenarios"]: + if scn != "eGon100RE": + links_to_etrago( + neighbor_links[neighbor_links.carrier == "DC"], scn + ) # prepare neighboring generators for etrago tables neighbor_gens["scn_name"] = "eGon100RE" From cea625554c3a29ccad0103b11d40bf8dc69be07d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 16 Jun 2023 10:47:56 +0200 Subject: [PATCH 309/787] Only print duplicated ids if there are any --- .../heat_supply/individual_heating.py | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 6cbbc3547..0392e6f59 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -1863,15 +1863,16 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): df_hp_cap_per_building_2035_db.duplicated("building_id", keep=False) ] - logger.info( - f"Dropped duplicated buildings: " - f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" - ) + if not duplicates.empty: + logger.info( + f"Dropped duplicated buildings: " + f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" + ) df_hp_cap_per_building_2035_db.drop_duplicates("building_id", inplace=True) - df_hp_cap_per_building_2019_db.building_id = ( - df_hp_cap_per_building_2019_db.building_id.astype(int) + df_hp_cap_per_building_2035_db.building_id = ( + df_hp_cap_per_building_2035_db.building_id.astype(int) ) write_table_to_postgres( @@ -1988,18 +1989,24 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): df_hp_cap_per_building_2019_db["scenario"] = "status2019" + # TODO debug duplicated building_ids duplicates = df_hp_cap_per_building_2019_db.loc[ df_hp_cap_per_building_2019_db.duplicated("building_id", keep=False) ] - logger.info( - f"Dropped duplicated buildings: " - f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" - ) + if not duplicates.empty: + logger.info( + f"Dropped duplicated buildings: " + f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" + ) df_hp_cap_per_building_2019_db.drop_duplicates("building_id", inplace=True) + df_hp_cap_per_building_2019_db.building_id = ( + df_hp_cap_per_building_2019_db.building_id.astype(int) + ) + write_table_to_postgres( df_hp_cap_per_building_2019_db, EgonHpCapacityBuildings, From 11c93dcbb741cf437d8a90daa10584bf6e923fb9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 16 Jun 2023 13:36:25 +0200 Subject: [PATCH 310/787] Drop chp plants without bus_id --- src/egon/data/datasets/chp/__init__.py | 8 +++----- src/egon/data/datasets/power_plants/__init__.py | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 1d3b02783..9b865561b 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -415,7 +415,7 @@ def insert_chp_statusquo(): gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus - mastr = assign_bus_id(mastr, cfg) + mastr = assign_bus_id(mastr, cfg, drop_missing=True) mastr["gas_bus_id"] = gas_bus_id @@ -684,11 +684,9 @@ def insert_chp_egon100re(): if extension != set(): tasks = tasks + (extension,) + class Chp(Dataset): def __init__(self, dependencies): super().__init__( - name="Chp", - version="0.0.7", - dependencies=dependencies, - tasks=tasks + name="Chp", version="0.0.7", dependencies=dependencies, tasks=tasks ) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 626fd9421..b7ad848d8 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -493,7 +493,7 @@ def assign_voltage_level_by_capacity(mastr_loc): return mastr_loc.voltage_level -def assign_bus_id(power_plants, cfg): +def assign_bus_id(power_plants, cfg, drop_missing=False): """Assigns bus_ids to power plants according to location and voltage level Parameters @@ -551,6 +551,9 @@ def assign_bus_id(power_plants, cfg): ehv_grid_districts, ).bus_id + if drop_missing: + power_plants = power_plants[~power_plants.bus_id.isnull()] + # Assert that all power plants have a bus_id assert power_plants.bus_id.notnull().all(), f"""Some power plants are not attached to a bus: {power_plants[power_plants.bus_id.isnull()]}""" From 5e80c952fd468c6bcffda892582b2410bee13949 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Sun, 18 Jun 2023 15:47:00 +0200 Subject: [PATCH 311/787] use new NEP source --- src/egon/data/datasets.yml | 1 + .../data/datasets/power_plants/__init__.py | 104 ++++++++++-------- .../datasets/power_plants/wind_offshore.py | 96 +++++++++++----- 3 files changed, 130 insertions(+), 71 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 90b16267a..62b68ccd4 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -379,6 +379,7 @@ power_plants: pv: 'supply.egon_power_plants_pv' wind: 'supply.egon_power_plants_wind' nep_2035: "NEP2035_V2021_scnC2035.xlsx" + nep_2019: "NEP_scn_status2019.xlsx" storages: 'supply.egon_storages' target: table: 'egon_power_plants' diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index b000a4ebb..b4b2bff4a 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1,6 +1,7 @@ """The central module containing all code dealing with power plant data. """ from geoalchemy2 import Geometry +from pathlib import Path from sqlalchemy import BigInteger, Column, Float, Integer, Sequence, String from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.ext.declarative import declarative_base @@ -37,6 +38,7 @@ map_to_city, map_id_bus, map_w_id, + map_ONEP_areas, ) import egon.data.config import egon.data.datasets.power_plants.assign_weather_data as assign_weather_data # noqa: E501 @@ -908,10 +910,6 @@ def power_plants_status_quo(scn_name="status2019"): con = db.engine() session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] - TESTMODE = ( - egon.data.config.settings()["egon-data"]["--dataset-boundary"] - != "Everything" - ) db.execute_sql( f""" @@ -1114,60 +1112,78 @@ def fill_missing_bus_and_geom(gens, carrier): ) # Write wind_offshore power plants in supply.egon_power_plants - raw_wind = pd.read_csv( - "/home/carlos/powerd-data-exc/bnetza_mastr/dump_2022-11-17/bnetza_mastr_wind_cleaned.csv", - index_col="EinheitMastrNummer", - usecols=["EinheitMastrNummer", "LokationMastrNummer"], + offshore_path = ( + Path(".") + / "data_bundle_egon_data" + / "nep2035_version2021" + / cfg["sources"]["nep_2019"] ) - - wind_offshore = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['wind']} - WHERE site_type = 'Windkraft auf See'""", - con, - geom_col="geom", + offshore = pd.read_excel( + offshore_path, + sheet_name="wind_offshore", + usecols=[ + "Name ONEP/NEP", + "NVP", + "Spannung [kV]", + "Inbetriebnahme", + "Kapazität Gesamtsystem [MW]", + ], + ) + offshore.dropna(subset=["Name ONEP/NEP"], inplace=True) + offshore.rename( + columns={ + "NVP": "Netzverknuepfungspunkt", + "Spannung [kV]": "Spannungsebene in kV", + }, + inplace=True, ) + offshore = offshore[offshore["Inbetriebnahme"] <= 2019] - # Import table with all the buses of the grid + id_bus = map_id_bus(scenario=scn_name) + + # Match wind offshore table with the corresponding OSM_id + offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) + + # Import table with all the busses of the grid sql = f""" SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) - as osm_id, cast(base_kv AS int) as voltage FROM {cfg["sources"]["buses_data"]} + as osm_id, CAST(base_kv AS int) FROM {cfg["sources"]["buses_data"]} """ - buses = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="point", index_col="bus_id" + busses = gpd.GeoDataFrame.from_postgis( + sql, con, crs="EPSG:4326", geom_col="point" ) - wind_offshore["LokationMastrNummer"] = wind_offshore.gens_id.map( - raw_wind["LokationMastrNummer"] - ) - wind_offshore["city"] = wind_offshore.LokationMastrNummer.map( - map_to_city() - ) - wind_offshore["osm_id"] = wind_offshore.city.map(map_id_bus()) + # Drop NANs in column osm_id + busses.dropna(subset=["osm_id"], inplace=True) - for wt in wind_offshore.index: - if TESTMODE: - try: - sub_sta = buses[ - buses["osm_id"] == wind_offshore.at[wt, "osm_id"] - ] - wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() - except: - wind_offshore.loc[wt, "bus_id"] = None + # Create columns for bus_id and geometry in the offshore df + offshore["bus_id"] = np.nan + + # Match bus_id + for index, wind_park in offshore.iterrows(): + if not busses[ + (busses["osm_id"] == wind_park["osm_id"]) + & (busses["base_kv"] == wind_park["Spannungsebene in kV"]) + ].empty: + bus_ind = busses[busses["osm_id"] == wind_park["osm_id"]].index[0] + offshore.at[index, "bus_id"] = busses.at[bus_ind, "bus_id"] else: - sub_sta = buses[buses["osm_id"] == wind_offshore.at[wt, "osm_id"]] - wind_offshore.loc[wt, "bus_id"] = sub_sta["voltage"].idxmax() + print(f'Wind offshore farm not found: {wind_park["osm_id"]}') + + offshore.dropna(subset=["bus_id"], inplace=True) - wind_offshore.dropna(subset=["bus_id"], inplace=True) + offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) + offshore = gpd.GeoDataFrame(offshore, geometry="geom") - if len(wind_offshore) > 0: - wind_offshore["geom"] = wind_offshore["geom"].to_wkt() - for i, row in wind_offshore.iterrows(): + if len(offshore) > 0: + offshore["geom"] = offshore["geom"].to_wkt() + for i, row in offshore.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, + source_id={"MastrNummer": row["Name ONEP/NEP"]}, carrier="wind_offshore", - el_capacity=row.capacity, + el_capacity=row["Kapazität Gesamtsystem [MW]"], scenario=scn_name, bus_id=row.bus_id, voltage_level=1, @@ -1179,8 +1195,8 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f""" - {len(wind_offshore)} wind_offshore generators with a total installed capacity of - {wind_offshore.capacity.sum()}MW were inserted into the db + {len(offshore)} wind_offshore generators with a total installed capacity of + {offshore['Kapazität Gesamtsystem [MW]'].sum()}MW were inserted into the db """ ) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index f3f4de19e..1754a0c2b 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -40,35 +40,52 @@ def map_to_city(): } return to_city -def map_id_bus(): +def map_id_bus(scenario="eGon2035"): # Import manually generated list of wind offshore farms with their # connection points (OSM_id) - id_bus = { - "Büttel": "136034396", - "Heide/West": "603661085", - "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "114319248", - "Suchraum Zensenbusch": "76185022", - "Rommerskirchen": "24839976", - "Oberzier": "26593929", - "Garrel/Ost": "23837631", - "Diele": "177829920", - "Dörpen/West": "142487746", - "Emden/Borßum": "34835258", - "Emden/Ost": "34835258", - "Hagermarsch": "79316833", - "Hanekenfähr": "61918154", - "Inhausen": "29420322", - "Unterweser": "32076853", - "Wehrendorf": "33411203", - "Wilhelmshaven 2": "23744346", - "Rastede": "23837631", - "Bentwisch": "32063539", - "Lubmin": "460134233", - "Suchraum Gemeinde Papendorf": "32063539", - "Suchraum Gemeinden Brünzow/Kemnitz": "460134233", - "inhausen": "29420322", - "Cloppenburg": "50643382" - } + if scenario=="eGon2035": + id_bus = { + "Büttel": "136034396", + "Heide/West": "603661085", + "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "114319248", + "Suchraum Zensenbusch": "76185022", + "Rommerskirchen": "24839976", + "Oberzier": "26593929", + "Garrel/Ost": "23837631", + "Diele": "177829920", + "Dörpen/West": "142487746", + "Emden/Borßum": "34835258", + "Emden/Ost": "34835258", + "Hagermarsch": "79316833", + "Hanekenfähr": "61918154", + "Inhausen": "29420322", + "Unterweser": "32076853", + "Wehrendorf": "33411203", + "Wilhelmshaven 2": "23744346", + "Rastede": "23837631", + "Bentwisch": "32063539", + "Lubmin": "460134233", + "Suchraum Gemeinde Papendorf": "32063539", + "Suchraum Gemeinden Brünzow/Kemnitz": "460134233", + "inhausen": "29420322", + "Cloppenburg": "50643382" + } + elif scenario=="status2019": + id_bus = { + 'UW Inhausen':'29420322', + 'UW Bentwisch':'32063539', + 'UW Emden / Borssum':'34835258', + 'UW Emden Ost':'34835258', + 'UW Cloppenburg':'50643382', + 'UW Hagermarsch':'79316833', + 'UW Büttel':'136034396', + 'UW Dörpen West':'142487746', + 'UW Diele':'177829920', + 'UW Lubmin':'460134233', + } + else: + id_bus = {} + return id_bus def map_w_id(): @@ -100,6 +117,31 @@ def map_w_id(): } return w_id +def map_ONEP_areas(): + onep = { + "NOR-0-1": Point(6.5,53.6), + "NOR-0-2": Point(8.07,53.76), + "NOR-1": Point(6.21,54.06), + "NOR-2-1": Point(6.54,53.99), + "NOR-2-2": Point(6.54,53.99), + "NOR-2-3": Point(6.54,53.99), + "NOR-3-1": Point(6.95,54.02), + "NOR-4-1": Point(7.70,54.44), + "NOR-4-2": Point(7.70,54.44), + "NOR-5-1": Point(7.21,55.14), + "NOR-6-1": Point(5.92,54.30), + "NOR-6-2": Point(5.92,54.30), + "NOR-7": Point(6.22,54.32), + "NOR-8-1": Point(6.35,54.48), + "OST-1-1": Point(14.09,54.82), + "OST-1-2": Point(14.09,54.82), + "OST-1-3": Point(14.09,54.82), + "OST-2": Point(13.86,54.83), + "OST-3-1": Point(13.16,54.98), + "OST-3-2": Point(13.16,54.98), + } + return onep + def insert(): """ From 5953a91986ea254633e4b41805778670ce1c30cf Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 20 Jun 2023 11:22:28 +0200 Subject: [PATCH 312/787] downscaled MVGD_MIN_COUNT --- .../datasets/emobility/motorized_individual_travel/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/helpers.py b/src/egon/data/datasets/emobility/motorized_individual_travel/helpers.py index 7f9e86583..898a30ebf 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/helpers.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/helpers.py @@ -82,7 +82,7 @@ "drive_end_timesteps": "drive_end", "consumption_kWh": "consumption", } -MVGD_MIN_COUNT = 3700 if TESTMODE_OFF else 150 +MVGD_MIN_COUNT = 3600 if TESTMODE_OFF else 150 def read_kba_data(): From c1350b49b32afdbdf86d0879014409433da028b3 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 20 Jun 2023 11:26:30 +0200 Subject: [PATCH 313/787] loosen rtol --- .../emobility/motorized_individual_travel/ev_allocation.py | 2 +- .../datasets/emobility/motorized_individual_travel/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index 258cea95a..a3e1c8346 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -632,7 +632,7 @@ def get_random_evs(row): np.testing.assert_allclose( int(ev_actual), ev_target, - rtol=0.0001, + rtol=0.05, err_msg=f"Dataset on EV numbers allocated to MVGDs " f"seems to be flawed. " f"Scenario: [{scn}], " diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py b/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py index 722135798..a992cdcf9 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py @@ -30,6 +30,6 @@ def validate_electric_vehicles_numbers(dataset_name, ev_data, ev_target): assert_allclose( ev_data[[_ for _ in CONFIG_EV.keys()]].sum().sum(), ev_target, - rtol=0.0001, + rtol=0.05, err_msg=f"Dataset on EV numbers [{dataset_name}] seems to be flawed.", ) From 8ea5de0913f9319d23aafd11d8fbfdcb83a66a9c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 20 Jun 2023 11:31:04 +0200 Subject: [PATCH 314/787] Fix checking if task was already executed for the scenario names --- src/egon/data/datasets/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 8a20ee006..7453febfa 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -186,7 +186,11 @@ def skip_task(task, *xs, **ks): datasets = session.query(Model).filter_by(name=self.name).all() if ( self.version in [ds.version for ds in datasets] - and scenario_names in [ds.scenarios for ds in datasets] + and scenario_names + == [ + ds.scenarios.replace("{", "").replace("}", "") + for ds in datasets + ] and not re.search(r"\.dev$", self.version) ): logger.info( From f421f3b5e130c755e9af420877838717f505fc76 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 21 Jun 2023 11:38:27 +0200 Subject: [PATCH 315/787] Insert wind offshore parks with the same function for all scenarios --- .../data/datasets/power_plants/__init__.py | 94 +--- .../datasets/power_plants/wind_offshore.py | 484 ++++++++++-------- 2 files changed, 267 insertions(+), 311 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index b4b2bff4a..152e32916 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1111,95 +1111,6 @@ def fill_missing_bus_and_geom(gens, carrier): """ ) - # Write wind_offshore power plants in supply.egon_power_plants - offshore_path = ( - Path(".") - / "data_bundle_egon_data" - / "nep2035_version2021" - / cfg["sources"]["nep_2019"] - ) - offshore = pd.read_excel( - offshore_path, - sheet_name="wind_offshore", - usecols=[ - "Name ONEP/NEP", - "NVP", - "Spannung [kV]", - "Inbetriebnahme", - "Kapazität Gesamtsystem [MW]", - ], - ) - offshore.dropna(subset=["Name ONEP/NEP"], inplace=True) - offshore.rename( - columns={ - "NVP": "Netzverknuepfungspunkt", - "Spannung [kV]": "Spannungsebene in kV", - }, - inplace=True, - ) - offshore = offshore[offshore["Inbetriebnahme"] <= 2019] - - id_bus = map_id_bus(scenario=scn_name) - - # Match wind offshore table with the corresponding OSM_id - offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) - - # Import table with all the busses of the grid - sql = f""" - SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) - as osm_id, CAST(base_kv AS int) FROM {cfg["sources"]["buses_data"]} - """ - - busses = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="point" - ) - - # Drop NANs in column osm_id - busses.dropna(subset=["osm_id"], inplace=True) - - # Create columns for bus_id and geometry in the offshore df - offshore["bus_id"] = np.nan - - # Match bus_id - for index, wind_park in offshore.iterrows(): - if not busses[ - (busses["osm_id"] == wind_park["osm_id"]) - & (busses["base_kv"] == wind_park["Spannungsebene in kV"]) - ].empty: - bus_ind = busses[busses["osm_id"] == wind_park["osm_id"]].index[0] - offshore.at[index, "bus_id"] = busses.at[bus_ind, "bus_id"] - else: - print(f'Wind offshore farm not found: {wind_park["osm_id"]}') - - offshore.dropna(subset=["bus_id"], inplace=True) - - offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) - offshore = gpd.GeoDataFrame(offshore, geometry="geom") - - if len(offshore) > 0: - offshore["geom"] = offshore["geom"].to_wkt() - for i, row in offshore.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row["Name ONEP/NEP"]}, - carrier="wind_offshore", - el_capacity=row["Kapazität Gesamtsystem [MW]"], - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=1, - weather_cell_id=-1, - geom=row.geom, - ) - session.add(entry) - session.commit() - - logging.info( - f""" - {len(offshore)} wind_offshore generators with a total installed capacity of - {offshore['Kapazität Gesamtsystem [MW]'].sum()}MW were inserted into the db - """ - ) - return @@ -1232,17 +1143,16 @@ def fill_missing_bus_and_geom(gens, carrier): pv_rooftop_to_buildings, ), }, - wind_offshore.insert, ) -tasks = tasks + (assign_weather_data.weatherId_and_busId,) +tasks = tasks + (wind_offshore.insert, assign_weather_data.weatherId_and_busId,) class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.18", + version="0.0.19", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 1754a0c2b..17e7fd4b1 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -1,4 +1,5 @@ from pathlib import Path +import logging from shapely.geometry import Point import geopandas as gpd @@ -8,42 +9,44 @@ from egon.data import db import egon.data.config + def map_to_city(): # map from connection point to city to_city = { - 'SEL900790170542': 'Dörpen/West', - 'SEL903815302577': 'Dörpen/West', - 'SEL906065107428': 'Büttel', - 'SEL919433257267': 'Büttel', - 'SEL919746983181': 'Lubmin', - 'SEL919786394244': 'Emden/Ost', - 'SEL922199100944': 'Büttel', - 'SEL925169438559': 'Dörpen/West', - 'SEL928599601562': 'Büttel', - 'SEL929196129428': 'Cloppenburg', - 'SEL932958083050': 'Emden/Ost', - 'SEL933375144706': 'inhausen', - 'SEL941255164959': 'Emden/Borßum', - 'SEL943058624104': 'Bentwisch', - 'SEL943629000788': 'Emden/Ost', - 'SEL947312274135': 'Dörpen/West', - 'SEL947778987563': 'Dörpen/West', - 'SEL953673961584': 'Cloppenburg', - 'SEL960138676303': 'Büttel', - 'SEL964485571465': 'Cloppenburg', - 'SEL964827249373': 'Emden/Ost', - 'SEL969972182469': 'Büttel', - 'SEL988334563685': 'Dörpen/West', - 'SEL990492206410': 'Bentwisch', - 'SEL997728577467': 'Lubmin', - 'SEL998582120202': 'Emden/Ost', - } + "SEL900790170542": "Dörpen/West", + "SEL903815302577": "Dörpen/West", + "SEL906065107428": "Büttel", + "SEL919433257267": "Büttel", + "SEL919746983181": "Lubmin", + "SEL919786394244": "Emden/Ost", + "SEL922199100944": "Büttel", + "SEL925169438559": "Dörpen/West", + "SEL928599601562": "Büttel", + "SEL929196129428": "Cloppenburg", + "SEL932958083050": "Emden/Ost", + "SEL933375144706": "inhausen", + "SEL941255164959": "Emden/Borßum", + "SEL943058624104": "Bentwisch", + "SEL943629000788": "Emden/Ost", + "SEL947312274135": "Dörpen/West", + "SEL947778987563": "Dörpen/West", + "SEL953673961584": "Cloppenburg", + "SEL960138676303": "Büttel", + "SEL964485571465": "Cloppenburg", + "SEL964827249373": "Emden/Ost", + "SEL969972182469": "Büttel", + "SEL988334563685": "Dörpen/West", + "SEL990492206410": "Bentwisch", + "SEL997728577467": "Lubmin", + "SEL998582120202": "Emden/Ost", + } return to_city -def map_id_bus(scenario="eGon2035"): + +def map_id_bus(scenario): # Import manually generated list of wind offshore farms with their # connection points (OSM_id) - if scenario=="eGon2035": + if scenario == "eGon2035": id_bus = { "Büttel": "136034396", "Heide/West": "603661085", @@ -68,26 +71,27 @@ def map_id_bus(scenario="eGon2035"): "Suchraum Gemeinde Papendorf": "32063539", "Suchraum Gemeinden Brünzow/Kemnitz": "460134233", "inhausen": "29420322", - "Cloppenburg": "50643382" + "Cloppenburg": "50643382", } - elif scenario=="status2019": + elif scenario == "status2019": id_bus = { - 'UW Inhausen':'29420322', - 'UW Bentwisch':'32063539', - 'UW Emden / Borssum':'34835258', - 'UW Emden Ost':'34835258', - 'UW Cloppenburg':'50643382', - 'UW Hagermarsch':'79316833', - 'UW Büttel':'136034396', - 'UW Dörpen West':'142487746', - 'UW Diele':'177829920', - 'UW Lubmin':'460134233', + "UW Inhausen": "29420322", + "UW Bentwisch": "32063539", + "UW Emden / Borssum": "34835258", + "UW Emden Ost": "34835258", + "UW Cloppenburg": "50643382", + "UW Hagermarsch": "79316833", + "UW Büttel": "136034396", + "UW Dörpen West": "142487746", + "UW Diele": "177829920", + "UW Lubmin": "460134233", } else: id_bus = {} - + return id_bus + def map_w_id(): w_id = { "Büttel": "16331", @@ -113,40 +117,40 @@ def map_w_id(): "Suchraum Gemeinde Papendorf": "16352", "Suchraum Gemeinden Brünzow/Kemnitz": "16548", "inhausen": "15769", - "Cloppenburg": "16334" + "Cloppenburg": "16334", } return w_id + def map_ONEP_areas(): onep = { - "NOR-0-1": Point(6.5,53.6), - "NOR-0-2": Point(8.07,53.76), - "NOR-1": Point(6.21,54.06), - "NOR-2-1": Point(6.54,53.99), - "NOR-2-2": Point(6.54,53.99), - "NOR-2-3": Point(6.54,53.99), - "NOR-3-1": Point(6.95,54.02), - "NOR-4-1": Point(7.70,54.44), - "NOR-4-2": Point(7.70,54.44), - "NOR-5-1": Point(7.21,55.14), - "NOR-6-1": Point(5.92,54.30), - "NOR-6-2": Point(5.92,54.30), - "NOR-7": Point(6.22,54.32), - "NOR-8-1": Point(6.35,54.48), - "OST-1-1": Point(14.09,54.82), - "OST-1-2": Point(14.09,54.82), - "OST-1-3": Point(14.09,54.82), - "OST-2": Point(13.86,54.83), - "OST-3-1": Point(13.16,54.98), - "OST-3-2": Point(13.16,54.98), - } + "NOR-0-1": Point(6.5, 53.6), + "NOR-0-2": Point(8.07, 53.76), + "NOR-1": Point(6.21, 54.06), + "NOR-2-1": Point(6.54, 53.99), + "NOR-2-2": Point(6.54, 53.99), + "NOR-2-3": Point(6.54, 53.99), + "NOR-3-1": Point(6.95, 54.02), + "NOR-4-1": Point(7.70, 54.44), + "NOR-4-2": Point(7.70, 54.44), + "NOR-5-1": Point(7.21, 55.14), + "NOR-6-1": Point(5.92, 54.30), + "NOR-6-2": Point(5.92, 54.30), + "NOR-7": Point(6.22, 54.32), + "NOR-8-1": Point(6.35, 54.48), + "OST-1-1": Point(14.09, 54.82), + "OST-1-2": Point(14.09, 54.82), + "OST-1-3": Point(14.09, 54.82), + "OST-2": Point(13.86, 54.83), + "OST-3-1": Point(13.16, 54.98), + "OST-3-2": Point(13.16, 54.98), + } return onep def insert(): """ Include the offshore wind parks in egon-data. - locations and installed capacities based on: NEP2035_V2021_scnC2035 Parameters ---------- @@ -155,158 +159,200 @@ def insert(): # Read file with all required input/output tables' names cfg = egon.data.config.datasets()["power_plants"] - # load NEP2035_V2021_scnC2035 file - offshore_path = ( - Path(".") - / "data_bundle_egon_data" - / "nep2035_version2021" - / cfg["sources"]["nep_2035"] - ) - - offshore = pd.read_excel( - offshore_path, - sheet_name="WInd_Offshore_NEP", - usecols=[ - "Netzverknuepfungspunkt", - "Spannungsebene in kV", - "C 2035", - "B 2040 ", - ], - ) - offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) - - id_bus = map_id_bus() - w_id = map_w_id() - - # Match wind offshore table with the corresponding OSM_id - offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) - - # Connect to the data-base - con = db.engine() - - # Import table with all the busses of the grid - sql = f""" - SELECT bus_i as bus_id, geom as point, CAST(osm_substation_id AS text) - as osm_id FROM {cfg["sources"]["buses_data"]} - """ - - busses = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="point" - ) - - # Drop NANs in column osm_id - busses.dropna(subset=["osm_id"], inplace=True) - - # Create columns for bus_id and geometry in the offshore df - offshore["bus_id"] = np.nan - offshore["geom"] = Point(0, 0) - - # Match bus_id and geometry - for index, wind_park in offshore.iterrows(): - if len(busses[busses["osm_id"] == wind_park["osm_id"]].index) > 0: - bus_ind = busses[busses["osm_id"] == wind_park["osm_id"]].index[0] - offshore.at[index, "bus_id"] = busses.at[bus_ind, "bus_id"] - offshore.at[index, "geom"] = busses.at[bus_ind, "point"] + scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] + + for scenario in scenarios: + # load file + if scenario == "eGon2035": + offshore_path = ( + Path(".") + / "data_bundle_egon_data" + / "nep2035_version2021" + / cfg["sources"]["nep_2035"] + ) + + offshore = pd.read_excel( + offshore_path, + sheet_name="WInd_Offshore_NEP", + usecols=[ + "Netzverknuepfungspunkt", + "Spannungsebene in kV", + "C 2035", + ], + ) + offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) + + elif scenario == "eGon100RE": + offshore_path = ( + Path(".") + / "data_bundle_egon_data" + / "nep2035_version2021" + / cfg["sources"]["nep_2035"] + ) + + offshore = pd.read_excel( + offshore_path, + sheet_name="WInd_Offshore_NEP", + usecols=[ + "Netzverknuepfungspunkt", + "Spannungsebene in kV", + "B 2040 ", + ], + ) + offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) + + elif scenario == "status2019": + offshore_path = ( + Path(".") + / "data_bundle_egon_data" + / "nep2035_version2021" + / cfg["sources"]["nep_2019"] + ) + offshore = pd.read_excel( + offshore_path, + sheet_name="wind_offshore", + usecols=[ + "Name ONEP/NEP", + "NVP", + "Spannung [kV]", + "Inbetriebnahme", + "Kapazität Gesamtsystem [MW]", + ], + ) + offshore.dropna(subset=["Name ONEP/NEP"], inplace=True) + offshore.rename( + columns={ + "NVP": "Netzverknuepfungspunkt", + "Spannung [kV]": "Spannungsebene in kV", + "Kapazität Gesamtsystem [MW]": "el_capacity", + }, + inplace=True, + ) + offshore = offshore[offshore["Inbetriebnahme"] <= 2019] + + id_bus = map_id_bus(scenario) + w_id = map_w_id() + + # Match wind offshore table with the corresponding OSM_id + offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) + + busses = db.select_geodataframe( + f""" + SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) + as osm_id FROM {cfg["sources"]["buses_data"]} + """, + epsg=4326, + geom_col="point", + ) + + # Drop NANs in column osm_id + busses.dropna(subset=["osm_id"], inplace=True) + + # Create columns for bus_id and geometry in the offshore df + offshore["bus_id"] = 0 + offshore["geom"] = Point(0, 0) + + # Match bus_id + for index, wind_park in offshore.iterrows(): + if not busses[ + (busses["osm_id"] == wind_park["osm_id"]) + & (busses["base_kv"] == wind_park["Spannungsebene in kV"]) + ].empty: + bus_ind = busses[ + busses["osm_id"] == wind_park["osm_id"] + ].index[0] + offshore.at[index, "bus_id"] = busses.at[bus_ind, "bus_id"] + else: + print(f'Wind offshore farm not found: {wind_park["osm_id"]}') + + offshore.dropna(subset=["bus_id"], inplace=True) + + # Overwrite geom for status2019 parks + if scenario == "status2019": + offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) + offshore["weather_cell_id"] = -1 + offshore.drop( + ["Name ONEP/NEP", "Inbetriebnahme"], axis=1, inplace=True + ) else: - print(f'Wind offshore farm not found: {wind_park["osm_id"]}') - - offshore["weather_cell_id"] = offshore["Netzverknuepfungspunkt"].map(w_id) - offshore["weather_cell_id"] = offshore["weather_cell_id"].apply(int) - # Drop offshore wind farms without found connexion point - offshore.dropna(subset=["bus_id"], inplace=True) - - # Assign voltage levels to wind offshore parks - offshore["voltage_level"] = np.nan - offshore.loc[ - offshore[offshore["Spannungsebene in kV"] == 110].index, - "voltage_level", - ] = 3 - offshore.loc[ - offshore[offshore["Spannungsebene in kV"] > 110].index, "voltage_level" - ] = 1 - - # Delete unnecessary columns - offshore.drop( - [ - "Netzverknuepfungspunkt", - "Spannungsebene in kV", - "osm_id", - ], - axis=1, - inplace=True, - ) - - # Assign static values - offshore["carrier"] = "wind_offshore" - - # Create wind farms for the different scenarios - offshore_2035 = offshore.drop(columns=["B 2040 "]).copy() - offshore_2035["scenario"] = "eGon2035" - offshore_2035.rename(columns={"C 2035": "el_capacity"}, inplace=True) - - offshore_100RE = offshore.drop(columns=["C 2035"]).copy() - offshore_100RE["scenario"] = "eGon100RE" - offshore_100RE.rename(columns={"B 2040 ": "el_capacity"}, inplace=True) - - # Import capacity targets for wind_offshore per scenario - sql = f""" - SELECT * FROM {cfg["sources"]["capacities"]} - WHERE scenario_name = 'eGon100RE' AND - carrier = 'wind_offshore' - """ - capacities = pd.read_sql(sql, con) - cap_100RE = capacities.capacity.sum() - - # Scale capacities to match target - scale_factor = cap_100RE / offshore_100RE.el_capacity.sum() - offshore_100RE["el_capacity"] = ( - offshore_100RE["el_capacity"] * scale_factor - ) - - # Join power plants from the different scenarios - offshore = pd.concat([offshore_2035, offshore_100RE], axis=0) - - # convert column "bus_id" and "voltage_level" to integer - offshore["bus_id"] = offshore["bus_id"].apply(int) - offshore["voltage_level"] = offshore["voltage_level"].apply(int) - - # Delete, in case of existing, previous wind offshore parks - - db.execute_sql( - f""" - DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} - WHERE carrier IN ('wind_offshore') - """ - ) - - # Look for the maximum id in the table egon_power_plants - sql = ( - "SELECT MAX(id) FROM " - + cfg["target"]["schema"] - + "." - + cfg["target"]["table"] - ) - max_id = pd.read_sql(sql, con) - max_id = max_id["max"].iat[0] - if max_id is None: - ini_id = 1 - else: - ini_id = int(max_id + 1) - - offshore = gpd.GeoDataFrame(offshore, geometry="geom", crs=4326) - - # write_table in egon-data database: - # Reset index - offshore.index = pd.RangeIndex( - start=ini_id, stop=ini_id + len(offshore), name="id" - ) - - # Insert into database - offshore.reset_index().to_postgis( - cfg["target"]["table"], - schema=cfg["target"]["schema"], - con=db.engine(), - if_exists="append", - ) - - return "Off shore wind farms successfully created" + offshore["weather_cell_id"] = offshore[ + "Netzverknuepfungspunkt" + ].map(w_id) + offshore["weather_cell_id"] = offshore["weather_cell_id"].apply( + int + ) + + # Scale capacities for eGon100RE + if scenario == "eGon100RE": + # Import capacity targets for wind_offshore per scenario + cap_100RE = db.select_dataframe( + f""" + SELECT SUM(capacity) + FROM {cfg["sources"]["capacities"]} + WHERE scenario_name = 'eGon100RE' AND + carrier = 'wind_offshore' + """ + ) + + # Scale capacities to match target + scale_factor = cap_100RE / offshore.el_capacity.sum() + offshore["el_capacity"] *= scale_factor + + # Assign voltage levels to wind offshore parks + offshore["voltage_level"] = 0 + offshore.loc[ + offshore[offshore["Spannungsebene in kV"] == 110].index, + "voltage_level", + ] = 3 + offshore.loc[ + offshore[offshore["Spannungsebene in kV"] > 110].index, + "voltage_level", + ] = 1 + + # Delete unnecessary columns + offshore.drop( + [ + "Netzverknuepfungspunkt", + "Spannungsebene in kV", + "osm_id", + ], + axis=1, + inplace=True, + ) + + # Set static columns + offshore["carrier"] = "wind_offshore" + offshore["scenario"] = scenario + + offshore = gpd.GeoDataFrame(offshore, geometry="geom", crs=4326) + + # Look for the maximum id in the table egon_power_plants + next_id = ( + db.select_dataframe( + "SELECT MAX(id) FROM " + + cfg["target"]["schema"] + + "." + + cfg["target"]["table"] + ).iloc[0, 0] + + 1 + ) + + # Reset index + offshore.index = pd.RangeIndex( + start=next_id, stop=next_id + len(offshore), name="id" + ) + + # Insert into database + offshore.reset_index().to_postgis( + cfg["target"]["table"], + schema=cfg["target"]["schema"], + con=db.engine(), + if_exists="append", + ) + + logging.info( + f""" + {len(offshore)} wind_offshore generators with a total installed capacity of + {offshore['Kapazität Gesamtsystem [MW]'].sum()}MW were inserted into the db + """ + ) From 724ee9a5bd30ff11ebc9a9405a28ca472cee63f6 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 21 Jun 2023 11:39:27 +0200 Subject: [PATCH 316/787] Remove unsued import --- src/egon/data/datasets/power_plants/wind_offshore.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 17e7fd4b1..a89d8e1bf 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -3,7 +3,6 @@ from shapely.geometry import Point import geopandas as gpd -import numpy as np import pandas as pd from egon.data import db From bcc220ce9ddb3c9873380b784ad6dc18259c3756 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 21 Jun 2023 11:40:25 +0200 Subject: [PATCH 317/787] Remove unused import --- src/egon/data/datasets/power_plants/__init__.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 152e32916..3854690f4 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -34,12 +34,6 @@ geocode_mastr_data, pv_rooftop_to_buildings, ) -from egon.data.datasets.power_plants.wind_offshore import ( - map_to_city, - map_id_bus, - map_w_id, - map_ONEP_areas, -) import egon.data.config import egon.data.datasets.power_plants.assign_weather_data as assign_weather_data # noqa: E501 import egon.data.datasets.power_plants.pv_ground_mounted as pv_ground_mounted From 6e9d3c21e7cc06fbc04c69710fab740ca791df1b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 21 Jun 2023 11:40:43 +0200 Subject: [PATCH 318/787] Remove unused function --- .../datasets/power_plants/wind_offshore.py | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index a89d8e1bf..6b5462451 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -9,39 +9,6 @@ import egon.data.config -def map_to_city(): - # map from connection point to city - to_city = { - "SEL900790170542": "Dörpen/West", - "SEL903815302577": "Dörpen/West", - "SEL906065107428": "Büttel", - "SEL919433257267": "Büttel", - "SEL919746983181": "Lubmin", - "SEL919786394244": "Emden/Ost", - "SEL922199100944": "Büttel", - "SEL925169438559": "Dörpen/West", - "SEL928599601562": "Büttel", - "SEL929196129428": "Cloppenburg", - "SEL932958083050": "Emden/Ost", - "SEL933375144706": "inhausen", - "SEL941255164959": "Emden/Borßum", - "SEL943058624104": "Bentwisch", - "SEL943629000788": "Emden/Ost", - "SEL947312274135": "Dörpen/West", - "SEL947778987563": "Dörpen/West", - "SEL953673961584": "Cloppenburg", - "SEL960138676303": "Büttel", - "SEL964485571465": "Cloppenburg", - "SEL964827249373": "Emden/Ost", - "SEL969972182469": "Büttel", - "SEL988334563685": "Dörpen/West", - "SEL990492206410": "Bentwisch", - "SEL997728577467": "Lubmin", - "SEL998582120202": "Emden/Ost", - } - return to_city - - def map_id_bus(scenario): # Import manually generated list of wind offshore farms with their # connection points (OSM_id) From 4e3832620ad646e3b2cd2dcea5b7937738a17275 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 21 Jun 2023 14:15:41 +0200 Subject: [PATCH 319/787] include CZ as a neighbor --- src/egon/data/datasets/electrical_neighbours.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index f9ea3917f..7696bbe5f 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1281,7 +1281,7 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 end = pd.Timestamp(year_end, tz="Europe/Brussels") start_gb = pd.Timestamp(year_start, tz="Europe/London") end_gb = pd.Timestamp(year_end, tz="Europe/London") - countries= ["LU", "AT", "FR", "NL", + countries= ["LU", "AT", "FR", "NL", "CZ", "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] # todo: define wanted countries @@ -1321,7 +1321,7 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 start_gb = start.tz_convert("Europe/London") end_gb = end.tz_convert("Europe/London") - countries= ["LU", "AT", "FR", "NL", + countries= ["LU", "AT", "FR", "NL", "CZ", "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] @@ -1398,7 +1398,8 @@ def entsoe_to_bus_etrago(): "NO": "NO00", "BE": "BE00", "SE": "SE00", - "GB": "UK00"}) + "GB": "UK00", + "CZ": "CZ00"}) for_bus = get_foreign_bus_id(scenario='status2019') From e89b9bc8ef0cd72251ffb2e86308f759fa44d0ae Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 21 Jun 2023 14:22:47 +0200 Subject: [PATCH 320/787] increase version number --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 7696bbe5f..3c4a7172b 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1664,7 +1664,7 @@ class ElectricalNeighbours(Dataset): def __init__(self, dependencies): super().__init__( name="ElectricalNeighbours", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=tasks, ) From 85550d88563a17d031380759504df7cb1d2f72ea Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 22 Jun 2023 09:27:41 +0200 Subject: [PATCH 321/787] Map weather cell id to solar rooftop plants --- src/egon/data/datasets/power_plants/__init__.py | 2 +- src/egon/data/datasets/power_plants/assign_weather_data.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 03cc32c42..c952fa0f6 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1149,7 +1149,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.19", + version="0.0.20", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 61e839a03..fe2264e4f 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -123,6 +123,7 @@ def find_weather_id(): power_plants = power_plants[ (power_plants["carrier"] == "solar") | (power_plants["carrier"] == "wind_onshore") + | (power_plants["carrier"] == "solar_rooftop") | ( (power_plants["carrier"] == "wind_offshore") & (power_plants["weather_cell_id"] == -1) @@ -185,7 +186,7 @@ def write_power_plants_table(power_plants, cfg, con): f""" DELETE FROM {cfg['sources']['power_plants']['schema']}. {cfg['sources']['power_plants']['table']} - WHERE carrier IN ('wind_onshore', 'solar') + WHERE carrier IN ('wind_onshore', 'solar', 'solar_rooftop') OR ((carrier = 'wind_offshore') AND (weather_cell_id = '-1')) """ ) From 3d47a71ab64309e79f172f6aedfe15ed19f89a17 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 22 Jun 2023 10:31:41 +0200 Subject: [PATCH 322/787] Replace hard-coded scenario name --- src/egon/data/datasets/district_heating_areas/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 3394575e5..4ea7be780 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -46,7 +46,7 @@ def __init__(self, dependencies): super().__init__( name="district-heating-areas", # version=self.target_files + "_0.0", - version="0.0.2", # maybe rethink the naming + version="0.0.3", # maybe rethink the naming dependencies=dependencies, tasks=(create_tables, demarcation), ) @@ -560,7 +560,7 @@ def district_heating_areas(scenario_name, plotting=False): # ASSUMPTION HERE: 2035 HD defined the PSDs min_hd = 10000 / 3.6 PSDs = area_grouping( - select_high_heat_demands(load_heat_demands("eGon2035")), + select_high_heat_demands(load_heat_demands(scenario_name)), distance=200, minimum_total_demand=min_hd, ) From c4a7cd40e16924879de49add6144033633a23149 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 12:26:59 +0200 Subject: [PATCH 323/787] create dict assign_ONEP_areas --- .../datasets/power_plants/wind_offshore.py | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 6b5462451..b7c91c420 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -58,34 +58,34 @@ def map_id_bus(scenario): return id_bus -def map_w_id(): +def assign_ONEP_areas(): w_id = { - "Büttel": "16331", - "Heide/West": "16516", - "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "16326", - "Suchraum Zensenbusch": "16139", - "Rommerskirchen": "16139", - "Oberzier": "16139", - "Garrel/Ost": "16139", - "Diele": "16138", - "Dörpen/West": "15952", - "Emden/Borßum": "15762", - "Emden/Ost": "16140", - "Hagermarsch": "15951", - "Hanekenfähr": "16139", - "Inhausen": "15769", - "Unterweser": "16517", - "Wehrendorf": "16139", - "Wilhelmshaven 2": "16517", - "Rastede": "16139", - "Bentwisch": "16734", - "Lubmin": "16548", - "Suchraum Gemeinde Papendorf": "16352", - "Suchraum Gemeinden Brünzow/Kemnitz": "16548", - "inhausen": "15769", - "Cloppenburg": "16334", + "Büttel": "NOR-4-1", + "Heide/West": "NOR-10-2", + "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "NOR-9-2", + "Suchraum Zensenbusch": "NOR-7-1", + "Rommerskirchen": "NOR-7-1", + "Oberzier": "NOR-7-1", + "Garrel/Ost": "NOR-7-1", + "Diele": "NOR-6-1", + "Dörpen/West": "NOR-2-2", + "Emden/Borßum": "NOR-0-1", + "Emden/Ost": "NOR-3-3", + "Hagermarsch": "NOR-2-1", + "Hanekenfähr": "NOR-6-3", + "Inhausen": "NOR-0-2", + "Unterweser": "NOR-9-1", + "Wehrendorf": "NOR-7-1", + "Wilhelmshaven 2": "NOR-11-1", + "Rastede": "NOR-7-1", + "Bentwisch": "OST-3-1", + "Lubmin": "OST-1-1", + "Suchraum Gemeinde Papendorf": "OST-7-1", + "Suchraum Gemeinden Brünzow/Kemnitz": "OST-1-4", + "inhausen": "NOR-0-2", + "Cloppenburg": "NOR-4-1", } - return w_id + return assign_onep def map_ONEP_areas(): @@ -93,6 +93,7 @@ def map_ONEP_areas(): "NOR-0-1": Point(6.5, 53.6), "NOR-0-2": Point(8.07, 53.76), "NOR-1": Point(6.21, 54.06), + "NOR-1-1": Point(6.21, 54.06), "NOR-2-1": Point(6.54, 53.99), "NOR-2-2": Point(6.54, 53.99), "NOR-2-3": Point(6.54, 53.99), @@ -102,14 +103,22 @@ def map_ONEP_areas(): "NOR-5-1": Point(7.21, 55.14), "NOR-6-1": Point(5.92, 54.30), "NOR-6-2": Point(5.92, 54.30), + "NOR-6-3": Point(5.92, 54.30), "NOR-7": Point(6.22, 54.32), + "NOR-7-1": Point(6.22, 54.32), "NOR-8-1": Point(6.35, 54.48), + "NOR-9-1": Point(5.75, 54.5), + "NOR-9-2": Point(5.75, 54.5), + "NOR-10-2": Point(6, 54.75), + "NOR-11-1": Point(6.5, 54.75), "OST-1-1": Point(14.09, 54.82), "OST-1-2": Point(14.09, 54.82), "OST-1-3": Point(14.09, 54.82), + "OST-1-4": Point(14.09, 54.82), "OST-2": Point(13.86, 54.83), "OST-3-1": Point(13.16, 54.98), "OST-3-2": Point(13.16, 54.98), + "OST-7-1": Point(12.25, 54.5), } return onep From 1295ff6f3aaa2503c6abe0e9c3138abdc3cfc10f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 26 Jun 2023 14:10:51 +0200 Subject: [PATCH 324/787] Use CLI parameter for scenario names in electricity_demand_per_cell --- .../datasets/electricity_demand/__init__.py | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index 7233ab94f..d4b00bb82 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -28,7 +28,7 @@ class HouseholdElectricityDemand(Dataset): def __init__(self, dependencies): super().__init__( name="HouseholdElectricityDemand", - version="0.0.3", + version="0.0.4", dependencies=dependencies, tasks=(create_tables, get_annual_household_el_demand_cells), ) @@ -92,6 +92,7 @@ def get_annual_household_el_demand_cells(): session.query( HouseholdElectricityProfilesOfBuildings, HouseholdElectricityProfilesInCensusCells.nuts3, + HouseholdElectricityProfilesInCensusCells.factor_2019, HouseholdElectricityProfilesInCensusCells.factor_2035, HouseholdElectricityProfilesInCensusCells.factor_2050, ) @@ -113,6 +114,8 @@ def ve(s): raise (ValueError(s)) dataset = egon.data.config.settings()["egon-data"]["--dataset-boundary"] + scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] + iterate_over = ( "nuts3" if dataset == "Everything" @@ -122,21 +125,29 @@ def ve(s): ) df_annual_demand = pd.DataFrame( - columns=["eGon2035", "eGon100RE", "zensus_population_id"] + columns=scenarios + ["zensus_population_id"] ) for _, df in df_buildings_and_profiles.groupby(by=iterate_over): df_annual_demand_iter = pd.DataFrame( - columns=["eGon2035", "eGon100RE", "zensus_population_id"] - ) - df_annual_demand_iter["eGon2035"] = ( - df_profiles.loc[:, df["profile_id"]].sum(axis=0) - * df["factor_2035"].values - ) - df_annual_demand_iter["eGon100RE"] = ( - df_profiles.loc[:, df["profile_id"]].sum(axis=0) - * df["factor_2050"].values + columns=scenarios + ["zensus_population_id"] ) + + if "eGon2035" in scenarios: + df_annual_demand_iter["eGon2035"] = ( + df_profiles.loc[:, df["profile_id"]].sum(axis=0) + * df["factor_2035"].values + ) + if "eGon100RE" in scenarios: + df_annual_demand_iter["eGon100RE"] = ( + df_profiles.loc[:, df["profile_id"]].sum(axis=0) + * df["factor_2050"].values + ) + if "status2019" in scenarios: + df_annual_demand_iter["status2019"] = ( + df_profiles.loc[:, df["profile_id"]].sum(axis=0) + * df["factor_2019"].values + ) df_annual_demand_iter["zensus_population_id"] = df["cell_id"].values df_annual_demand = df_annual_demand.append(df_annual_demand_iter) From 7afc6af8770693268d9be5e5bf49b6e995937587 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 26 Jun 2023 14:11:20 +0200 Subject: [PATCH 325/787] Use scenario names from CLI parameters --- src/egon/data/datasets/heat_demand_timeseries/idp_pool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py index d3294ad15..e7f9f209f 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py +++ b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py @@ -362,7 +362,7 @@ def create(): return idp_df -def annual_demand_generator(): +def annual_demand_generator(scenario): """ Description: Create dataframe with annual demand and household count for each zensus cell @@ -374,7 +374,6 @@ def annual_demand_generator(): """ - scenario = "eGon2035" demand_zone = db.select_dataframe( f""" SELECT a.demand, a.zensus_population_id, a.scenario, c.climate_zone @@ -463,7 +462,9 @@ def select(): ) # Calculate annual heat demand per census cell - annual_demand = annual_demand_generator() + annual_demand = annual_demand_generator( + scenario = egon.data.config.settings()["egon-data"]["--scenarios"][0] + ) # Count number of SFH and MFH per climate zone houses_per_climate_zone = ( From e9f997cf2e35d43790557f55917f4ba50f9d40fa Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 26 Jun 2023 14:11:37 +0200 Subject: [PATCH 326/787] Use scenario names from CLI parameters --- src/egon/data/datasets/electricity_demand/temporal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index 73f5f62df..d657112cf 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -215,7 +215,7 @@ def insert_cts_load(): create_table() - for scenario in ["eGon2035", "eGon100RE"]: + for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: # Delete existing data from database db.execute_sql( From ccca5ce2dbac018f6b66c3398aa11de436d8b1b7 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 14:57:17 +0200 Subject: [PATCH 327/787] include geom for off_shore all scn --- .../datasets/power_plants/wind_offshore.py | 88 ++++++++++++------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index b7c91c420..dd9c8d252 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -59,7 +59,7 @@ def map_id_bus(scenario): def assign_ONEP_areas(): - w_id = { + assign_onep = { "Büttel": "NOR-4-1", "Heide/West": "NOR-10-2", "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "NOR-9-2", @@ -98,6 +98,7 @@ def map_ONEP_areas(): "NOR-2-2": Point(6.54, 53.99), "NOR-2-3": Point(6.54, 53.99), "NOR-3-1": Point(6.95, 54.02), + "NOR-3-3": Point(6.95, 54.02), "NOR-4-1": Point(7.70, 54.44), "NOR-4-2": Point(7.70, 54.44), "NOR-5-1": Point(7.21, 55.14), @@ -156,6 +157,7 @@ def insert(): ], ) offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) + offshore.rename(columns={"C 2035": "el_capacity"}, inplace= True) elif scenario == "eGon100RE": offshore_path = ( @@ -206,57 +208,83 @@ def insert(): offshore = offshore[offshore["Inbetriebnahme"] <= 2019] id_bus = map_id_bus(scenario) - w_id = map_w_id() # Match wind offshore table with the corresponding OSM_id offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) - - busses = db.select_geodataframe( - f""" - SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) - as osm_id FROM {cfg["sources"]["buses_data"]} - """, - epsg=4326, - geom_col="point", + + ###################################################################### + # for testing purposes + # # Import table with all the buses of the grid + import psycopg2 + conn = psycopg2.connect(dbname="powerd-data", + user="egon", + password="data", + host="127.0.0.1", + port= "8083" + ) + + sql = f""" + SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) + as osm_id FROM {cfg["sources"]["buses_data"]} + """ + + buses = gpd.GeoDataFrame.from_postgis( + sql, conn, crs="EPSG:4326", geom_col="point", ) + ###################################################################### + + + + + + # buses = db.select_geodataframe( + # f""" + # SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) + # as osm_id FROM {cfg["sources"]["buses_data"]} + # """, + # epsg=4326, + # geom_col="point", + # ) # Drop NANs in column osm_id - busses.dropna(subset=["osm_id"], inplace=True) + buses.dropna(subset=["osm_id"], inplace=True) # Create columns for bus_id and geometry in the offshore df offshore["bus_id"] = 0 offshore["geom"] = Point(0, 0) - + # Match bus_id for index, wind_park in offshore.iterrows(): - if not busses[ - (busses["osm_id"] == wind_park["osm_id"]) - & (busses["base_kv"] == wind_park["Spannungsebene in kV"]) + if not buses[ + (buses["osm_id"] == wind_park["osm_id"]) + & (buses["base_kv"] == wind_park["Spannungsebene in kV"]) ].empty: - bus_ind = busses[ - busses["osm_id"] == wind_park["osm_id"] + bus_ind = buses[ + buses["osm_id"] == wind_park["osm_id"] ].index[0] - offshore.at[index, "bus_id"] = busses.at[bus_ind, "bus_id"] + offshore.at[index, "bus_id"] = buses.at[bus_ind, "bus_id"] else: print(f'Wind offshore farm not found: {wind_park["osm_id"]}') offshore.dropna(subset=["bus_id"], inplace=True) - + # Overwrite geom for status2019 parks + if scenario in ["eGon2035", "eGon100RE"]: + offshore["Name ONEP/NEP"] = offshore["Netzverknuepfungspunkt"].map(assign_ONEP_areas()) + + offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) + offshore["weather_cell_id"] = pd.NA + + offshore.drop( + ["Name ONEP/NEP"], axis=1, inplace=True + ) + if scenario == "status2019": - offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) - offshore["weather_cell_id"] = -1 offshore.drop( - ["Name ONEP/NEP", "Inbetriebnahme"], axis=1, inplace=True - ) - else: - offshore["weather_cell_id"] = offshore[ - "Netzverknuepfungspunkt" - ].map(w_id) - offshore["weather_cell_id"] = offshore["weather_cell_id"].apply( - int + ["Inbetriebnahme"], axis=1, inplace=True ) + # Scale capacities for eGon100RE if scenario == "eGon100RE": # Import capacity targets for wind_offshore per scenario @@ -328,6 +356,6 @@ def insert(): logging.info( f""" {len(offshore)} wind_offshore generators with a total installed capacity of - {offshore['Kapazität Gesamtsystem [MW]'].sum()}MW were inserted into the db + {offshore['el_capacity'].sum()}MW were inserted into the db """ ) From 05050cf2629760c67cdeb58fe42935e2c1b8e4b6 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 14:58:41 +0200 Subject: [PATCH 328/787] include wind_offshore in assign_weather func --- src/egon/data/datasets/power_plants/assign_weather_data.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index fe2264e4f..4201fd8ed 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -124,10 +124,7 @@ def find_weather_id(): (power_plants["carrier"] == "solar") | (power_plants["carrier"] == "wind_onshore") | (power_plants["carrier"] == "solar_rooftop") - | ( - (power_plants["carrier"] == "wind_offshore") - & (power_plants["weather_cell_id"] == -1) - ) + | (power_plants["carrier"] == "wind_offshore") ] power_plants.set_index("id", inplace=True) From 879c78d1486537bbbcb1db9bd205619728e350fa Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 15:33:44 +0200 Subject: [PATCH 329/787] delete existing wind offshore gen --- src/egon/data/datasets/power_plants/wind_offshore.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index dd9c8d252..a0c6e2795 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -138,6 +138,15 @@ def insert(): scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] for scenario in scenarios: + # Delete previous generators + db.execute_sql( + f""" + DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} + WHERE carrier = 'wind_offshore' + AND scenario = '{scenario}' + """ + ) + # load file if scenario == "eGon2035": offshore_path = ( From 2c97bbd887492d439d9eb38358465cece1f42193 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 15:34:31 +0200 Subject: [PATCH 330/787] delete test code --- .../datasets/power_plants/wind_offshore.py | 42 ++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index a0c6e2795..6bec26ab9 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -221,45 +221,21 @@ def insert(): # Match wind offshore table with the corresponding OSM_id offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) - ###################################################################### - # for testing purposes - # # Import table with all the buses of the grid - import psycopg2 - conn = psycopg2.connect(dbname="powerd-data", - user="egon", - password="data", - host="127.0.0.1", - port= "8083" - ) - - sql = f""" - SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) - as osm_id FROM {cfg["sources"]["buses_data"]} - """ - - buses = gpd.GeoDataFrame.from_postgis( - sql, conn, crs="EPSG:4326", geom_col="point", + + buses = db.select_geodataframe( + f""" + SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) + as osm_id FROM {cfg["sources"]["buses_data"]} + """, + epsg=4326, + geom_col="point", ) - ###################################################################### - - - - - - # buses = db.select_geodataframe( - # f""" - # SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) - # as osm_id FROM {cfg["sources"]["buses_data"]} - # """, - # epsg=4326, - # geom_col="point", - # ) # Drop NANs in column osm_id buses.dropna(subset=["osm_id"], inplace=True) # Create columns for bus_id and geometry in the offshore df - offshore["bus_id"] = 0 + offshore["bus_id"] = pd.NA offshore["geom"] = Point(0, 0) # Match bus_id From 95d69a10c7ffcc2b1768d90698d1de1c0599643a Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 15:35:23 +0200 Subject: [PATCH 331/787] update version PowerPlants --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index c952fa0f6..f2bb42e5c 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1149,7 +1149,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.20", + version="0.0.21", dependencies=dependencies, tasks=tasks, ) From 8c6d25e972da966e249c91f480fd752898973a65 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 15:36:15 +0200 Subject: [PATCH 332/787] use Black --- .../datasets/power_plants/wind_offshore.py | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 6bec26ab9..d2052c7e1 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -146,7 +146,7 @@ def insert(): AND scenario = '{scenario}' """ ) - + # load file if scenario == "eGon2035": offshore_path = ( @@ -166,7 +166,7 @@ def insert(): ], ) offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) - offshore.rename(columns={"C 2035": "el_capacity"}, inplace= True) + offshore.rename(columns={"C 2035": "el_capacity"}, inplace=True) elif scenario == "eGon100RE": offshore_path = ( @@ -220,8 +220,7 @@ def insert(): # Match wind offshore table with the corresponding OSM_id offshore["osm_id"] = offshore["Netzverknuepfungspunkt"].map(id_bus) - - + buses = db.select_geodataframe( f""" SELECT bus_i as bus_id, base_kv, geom as point, CAST(osm_substation_id AS text) @@ -237,38 +236,35 @@ def insert(): # Create columns for bus_id and geometry in the offshore df offshore["bus_id"] = pd.NA offshore["geom"] = Point(0, 0) - + # Match bus_id for index, wind_park in offshore.iterrows(): if not buses[ (buses["osm_id"] == wind_park["osm_id"]) & (buses["base_kv"] == wind_park["Spannungsebene in kV"]) ].empty: - bus_ind = buses[ - buses["osm_id"] == wind_park["osm_id"] - ].index[0] + bus_ind = buses[buses["osm_id"] == wind_park["osm_id"]].index[ + 0 + ] offshore.at[index, "bus_id"] = buses.at[bus_ind, "bus_id"] else: print(f'Wind offshore farm not found: {wind_park["osm_id"]}') offshore.dropna(subset=["bus_id"], inplace=True) - + # Overwrite geom for status2019 parks if scenario in ["eGon2035", "eGon100RE"]: - offshore["Name ONEP/NEP"] = offshore["Netzverknuepfungspunkt"].map(assign_ONEP_areas()) + offshore["Name ONEP/NEP"] = offshore["Netzverknuepfungspunkt"].map( + assign_ONEP_areas() + ) offshore["geom"] = offshore["Name ONEP/NEP"].map(map_ONEP_areas()) offshore["weather_cell_id"] = pd.NA - - offshore.drop( - ["Name ONEP/NEP"], axis=1, inplace=True - ) - - if scenario == "status2019": - offshore.drop( - ["Inbetriebnahme"], axis=1, inplace=True - ) + offshore.drop(["Name ONEP/NEP"], axis=1, inplace=True) + + if scenario == "status2019": + offshore.drop(["Inbetriebnahme"], axis=1, inplace=True) # Scale capacities for eGon100RE if scenario == "eGon100RE": From 7fb4477e344eb01447d3a26f2a3b0ffabffb1941 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 26 Jun 2023 16:17:30 +0200 Subject: [PATCH 333/787] correct delete sql --- src/egon/data/datasets/power_plants/assign_weather_data.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 4201fd8ed..958804967 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -183,8 +183,7 @@ def write_power_plants_table(power_plants, cfg, con): f""" DELETE FROM {cfg['sources']['power_plants']['schema']}. {cfg['sources']['power_plants']['table']} - WHERE carrier IN ('wind_onshore', 'solar', 'solar_rooftop') - OR ((carrier = 'wind_offshore') AND (weather_cell_id = '-1')) + WHERE carrier IN ('wind_onshore', 'solar', 'solar_rooftop', 'wind_offshore') """ ) From e6f9a19798510004160edd82e8640d795b770a1e Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Wed, 28 Jun 2023 14:14:21 +0200 Subject: [PATCH 334/787] first try for mail notification on failure --- src/egon/data/airflow/airflow.cfg | 14 ++++++-------- src/egon/data/airflow/dags/pipeline_status_quo.py | 8 +++++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/egon/data/airflow/airflow.cfg b/src/egon/data/airflow/airflow.cfg index 80b7247f7..6f97f2032 100755 --- a/src/egon/data/airflow/airflow.cfg +++ b/src/egon/data/airflow/airflow.cfg @@ -465,15 +465,13 @@ email_backend = airflow.utils.email.send_email_smtp # If you want airflow to send emails on retries, failure, and you want to use # the airflow.utils.email.send_email_smtp function, you have to configure an # smtp server here -smtp_host = localhost -smtp_starttls = True +smtp_host = smtp.sendgrid.net +smtp_starttls = False smtp_ssl = False -# Example: smtp_user = airflow -# smtp_user = -# Example: smtp_password = airflow -# smtp_password = -smtp_port = 25 -smtp_mail_from = airflow@example.com +smtp_user = apikey +smtp_password = ***REMOVED*** +smtp_port = 587 +smtp_mail_from = powerddata@gmail.com [sentry] diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index c8a5dd52d..e3b1b7bf8 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -74,10 +74,14 @@ # Set number of threads used by numpy and pandas set_numexpr_threads() + + with airflow.DAG( "powerd-status-quo-processing-pipeline", description="The PoWerD Status Quo data processing DAG.", - default_args={"start_date": days_ago(1)}, + default_args={"start_date": days_ago(1), + "email_on_failure": True, + "email":"ulf.p.mueller@hs-flensburg.de"}, template_searchpath=[ os.path.abspath( os.path.join( @@ -523,3 +527,5 @@ demand_curves_industry, ] ) + + From 3fd239325b0f60284a2e8cd470a373b70fc546b4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 29 Jun 2023 11:12:41 +0200 Subject: [PATCH 335/787] Add download of data bundle for status2019 --- src/egon/data/datasets.yml | 3 +++ .../data/datasets/data_bundle/__init__.py | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 4495afb61..64fc468ee 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -540,9 +540,12 @@ data-bundle: sources: zenodo: deposit_id: 1095882 + deposit_id_powerd: 1214744 targets: file: 'data_bundle_egon_data.zip' + file_powerd: + 'data_bundle_powerd_data.zip' pypsa-technology-data: sources: diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index 015c09a12..178a3e17a 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -34,14 +34,32 @@ def download(): zip_ref.extractall(".") + powerd_data_bundle_path = Path(".") / "data_bundle_powerd_data" + # Delete folder if it already exists + if powerd_data_bundle_path.exists() and powerd_data_bundle_path.is_dir(): + shutil.rmtree(powerd_data_bundle_path) + + url = f"""https://sandbox.zenodo.org/record/{sources['deposit_id_powerd']}/files/data_bundle_powerd_data.zip""" + target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file_powerd"] + + # Retrieve files + urlretrieve(url, target_file) + + with zipfile.ZipFile(target_file, "r") as zip_ref: + zip_ref.extractall(".") + + class DataBundle(Dataset): def __init__(self, dependencies): deposit_id = egon.data.config.datasets()["data-bundle"]["sources"][ "zenodo" ]["deposit_id"] + deposit_id_powerd = egon.data.config.datasets()["data-bundle"]["sources"][ + "zenodo" + ]["deposit_id"] super().__init__( name="DataBundle", - version=str(deposit_id) + "-0.0.0", + version=str(deposit_id) + str(deposit_id_powerd) + "-0.0.1", dependencies=dependencies, tasks=(download), ) From d1c5617a844c0573839bb978422a6e2ae51638a8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 29 Jun 2023 11:13:15 +0200 Subject: [PATCH 336/787] Update path of file with wind offshore capacities for status2019 --- src/egon/data/datasets.yml | 2 +- src/egon/data/datasets/power_plants/wind_offshore.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 64fc468ee..ed1bf8a3d 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -379,7 +379,7 @@ power_plants: pv: 'supply.egon_power_plants_pv' wind: 'supply.egon_power_plants_wind' nep_2035: "NEP2035_V2021_scnC2035.xlsx" - nep_2019: "NEP_scn_status2019.xlsx" + wind_offshore_status2019: "windoffshore_status2019.xlsx" storages: 'supply.egon_storages' target: table: 'egon_power_plants' diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 6b5462451..5e7e281c3 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -170,9 +170,9 @@ def insert(): elif scenario == "status2019": offshore_path = ( Path(".") - / "data_bundle_egon_data" - / "nep2035_version2021" - / cfg["sources"]["nep_2019"] + / "data_bundle_powerd_data" + / "wind_offshore_status2019" + / cfg["sources"]["wind_offshore_status2019"] ) offshore = pd.read_excel( offshore_path, From 1b2db468dad835232f8a9317bf8868d820bc2212 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 29 Jun 2023 11:13:50 +0200 Subject: [PATCH 337/787] Update path of entsoe load and generation files for status2019 --- src/egon/data/datasets/electrical_neighbours.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 3c4a7172b..b062ac6d0 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1423,7 +1423,7 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ ################# TEMPORAL #################### - gen_sq = pd.read_csv("data_bundle_egon_data/gen_entsoe.csv", index_col="Index") + gen_sq = pd.read_csv("data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index") ################# TEMPORAL #################### targets = config.datasets()["electrical_neighbours"]["targets"] @@ -1581,7 +1581,7 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): targets = config.datasets()["electrical_neighbours"]["targets"] ################# TEMPORAL #################### - load_sq = pd.read_csv("data_bundle_egon_data/load_entsoe.csv", index_col="Index") + load_sq = pd.read_csv("data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index") ################# TEMPORAL #################### # Delete existing data From e76492032cebf247b78818355c59f8d1d018c6a8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 29 Jun 2023 13:36:15 +0200 Subject: [PATCH 338/787] Access sceanrio names from CLI parameters --- .../data/datasets/heat_demand_timeseries/service_sector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index b7f7aa132..5af9c8e7a 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -5,7 +5,7 @@ import pandas as pd -from egon.data import db +from egon.data import config, db try: @@ -215,7 +215,7 @@ def CTS_demand_scale(aggregation_level): Profiles scaled up to annual demand """ - scenarios = ["status2019", "eGon2035", "eGon100RE"] + scenarios = config.settings()["egon-data"]["--scenarios"] CTS_district = pd.DataFrame() CTS_grid = pd.DataFrame() From cbe90a9c37442b854417f547726b9ddc9462a896 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 29 Jun 2023 14:54:37 +0200 Subject: [PATCH 339/787] include argument find_closest --- src/egon/data/datasets/fix_ehv_subnetworks.py | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 90b938fab..0a9f15add 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -20,7 +20,7 @@ def __init__(self, dependencies): ) -def select_bus_id(x, y, v_nom, scn_name, carrier): +def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): bus_id = db.select_dataframe( f""" SELECT bus_id @@ -34,7 +34,23 @@ def select_bus_id(x, y, v_nom, scn_name, carrier): ) if bus_id.empty: - return None + if find_closest: + buses = db.select_dataframe( + f""" + SELECT bus_id, x, y + FROM grid.egon_etrago_bus + WHERE v_nom = {v_nom} + AND scn_name = '{scn_name}' + AND carrier = '{carrier}' + """, + index_col="bus_id", + ) + buses["distance"] = buses.apply( + lambda b: ((b.x - x) ** 2 + (b.y - y) ** 2) ** (1 / 2), axis=1 + ) + return buses["distance"].idxmin() + else: + return None else: return bus_id.bus_id[0] @@ -78,8 +94,8 @@ def drop_bus(x, y, v_nom, scn_name): def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): - bus0 = select_bus_id(x0, y0, v_nom, scn_name, carrier="AC") - bus1 = select_bus_id(x1, y1, v_nom, scn_name, carrier="AC") + bus0 = select_bus_id(x0, y0, v_nom, scn_name, carrier="AC", find_closest= True) + bus1 = select_bus_id(x1, y1, v_nom, scn_name, carrier="AC", find_closest= True) df = pd.DataFrame( index=[db.next_etrago_id("line")], @@ -134,8 +150,8 @@ def drop_line(x0, y0, x1, y1, v_nom, scn_name): def add_trafo(x, y, v_nom0, v_nom1, scn_name, n=1): - bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC") - bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC") + bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC", find_closest= True) + bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC", find_closest= True) df = pd.DataFrame( index=[db.next_etrago_id("line")], @@ -211,12 +227,12 @@ def fix_subnetworks(scn_name): scn_name, 6, ) - if (select_bus_id(12.85381530378627, - 48.764209444817745, - 380, - scn_name, - "AC") != None): - + if ( + select_bus_id( + 12.85381530378627, 48.764209444817745, 380, scn_name, "AC" + ) + != None + ): # Missing line from Umspannwerk Plottling to Gänsdorf UW add_line( 12.85381530378627, # Umspannwerk Plottling @@ -239,7 +255,7 @@ def fix_subnetworks(scn_name): 3, ) + def run(): for scenario in config.settings()["egon-data"]["--scenarios"]: fix_subnetworks(scenario) - From 6dfb3354c4b01d74ab29dd4df4b3e0ef823af0c0 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 29 Jun 2023 15:23:58 +0200 Subject: [PATCH 340/787] use select_bus_id in electrical_neighbours --- .../data/datasets/electrical_neighbours.py | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b062ac6d0..48449a807 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -16,6 +16,7 @@ import egon.data.datasets.scenario_parameters.parameters as scenario_parameters from egon.data import config, db from egon.data.datasets import Dataset +from egon.data.datasets.fix_ehv_subnetworks import select_bus_id from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.scenario_parameters import get_sector_parameters @@ -568,18 +569,12 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): ] # Add DC line from Lübeck to Sweden - converter_luebeck = db.select_dataframe( - f""" - SELECT bus_id FROM - {sources['electricity_buses']['schema']}. - {sources['electricity_buses']['table']} - WHERE x = 10.802358024202768 - AND y = 53.897547401787 - AND v_nom = 380 - AND scn_name = '{scenario}' - AND carrier = 'AC' - """ - ).squeeze() + converter_luebeck = select_bus_id( + 10.802358024202768, + 53.897547401787, + 380, scenario, + "AC", + find_closest= True) foreign_links = pd.DataFrame( index=[0], @@ -598,18 +593,13 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): # When not in test-mode, add DC line from Bentwisch to Denmark if config.settings()["egon-data"]["--dataset-boundary"] == "Everything": - converter_bentwisch = db.select_dataframe( - f""" - SELECT bus_id FROM - {sources['electricity_buses']['schema']}. - {sources['electricity_buses']['table']} - WHERE x = 12.213671694775988 - AND y = 54.09974494662279 - AND v_nom = 380 - AND scn_name = '{scenario}' - AND carrier = 'AC' - """ - ).squeeze() + converter_bentwisch = select_bus_id( + 12.213671694775988, + 54.09974494662279, + 380, + scenario, + "AC", + find_closest= True) foreign_links = foreign_links.append( pd.DataFrame( From a207ed311c8bf4fc5b6b610353f4a8f6465b4715 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 29 Jun 2023 15:40:41 +0200 Subject: [PATCH 341/787] using Black --- .../data/datasets/electrical_neighbours.py | 219 +++++++++++------- 1 file changed, 140 insertions(+), 79 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 48449a807..efea7fc74 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -3,7 +3,7 @@ import zipfile -#import entsoe +# import entsoe import requests import logging @@ -483,7 +483,6 @@ def central_transformer(scenario, sources, targets, central_buses, new_lines): # Add one transformer per central foreign bus with v_nom != 380 for i, row in central_buses[central_buses.v_nom != 380].iterrows(): - s_nom_0 = new_lines[new_lines.bus0 == row.bus_id].s_nom.sum() s_nom_1 = new_lines[new_lines.bus1 == row.bus_id].s_nom.sum() if s_nom_0 == 0.0: @@ -572,9 +571,11 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): converter_luebeck = select_bus_id( 10.802358024202768, 53.897547401787, - 380, scenario, + 380, + scenario, "AC", - find_closest= True) + find_closest=True, + ) foreign_links = pd.DataFrame( index=[0], @@ -599,7 +600,8 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): 380, scenario, "AC", - find_closest= True) + find_closest=True, + ) foreign_links = foreign_links.append( pd.DataFrame( @@ -658,7 +660,6 @@ def grid(): targets = config.datasets()["electrical_neighbours"]["targets"] for scenario in config.settings()["egon-data"]["--scenarios"]: - central_buses = buses(scenario, sources, targets) foreign_lines = cross_border_lines( @@ -922,7 +923,9 @@ def insert_generators(capacities): ) gen.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[gen.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[gen.loc[:, "Node/Line"]] + .values ) # Add scenario column @@ -1058,7 +1061,9 @@ def insert_storage(capacities): ) store.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[store.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[store.loc[:, "Node/Line"]] + .values ) # Add columns for additional parameters to df @@ -1202,7 +1207,9 @@ def tyndp_demand(): buses[buses.nodes.isin(map_buses.keys())].index, "nodes" ] = buses[buses.nodes.isin(map_buses.keys())].nodes.map(map_buses) buses.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[buses.loc[:, "nodes"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[buses.loc[:, "nodes"]] + .values ) buses.set_index("nodes", inplace=True) buses = buses[~buses.index.duplicated(keep="first")] @@ -1263,24 +1270,39 @@ def tyndp_demand(): session.add(entry) session.add(entry_ts) session.commit() - -def entsoe_historic_generation_capacities(entsoe_token=None, year_start="20190101", year_end="20200101"): + + +def entsoe_historic_generation_capacities( + entsoe_token=None, year_start="20190101", year_end="20200101" +): client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") end = pd.Timestamp(year_end, tz="Europe/Brussels") start_gb = pd.Timestamp(year_start, tz="Europe/London") end_gb = pd.Timestamp(year_end, tz="Europe/London") - countries= ["LU", "AT", "FR", "NL", "CZ", - "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] - - # todo: define wanted countries + countries = [ + "LU", + "AT", + "FR", + "NL", + "CZ", + "DK_1", + "DK_2", + "PL", + "CH", + "NO", + "BE", + "SE", + "GB", + ] + # todo: define wanted countries not_retrieved = [] dfs = [] for country in countries: - if country == 'GB': + if country == "GB": kwargs = dict(start=start_gb, end=end_gb) else: kwargs = dict(start=start, end=end) @@ -1288,7 +1310,7 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 dfs.append( client.query_installed_generation_capacity(country, **kwargs) ) - + except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass @@ -1298,39 +1320,58 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) df = pd.concat(dfs) - df['country']=countries - df.set_index('country', inplace=True) + df["country"] = countries + df.set_index("country", inplace=True) df.fillna(0, inplace=True) return df -def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="20200101"): + +def entsoe_historic_demand( + entsoe_token=None, year_start="20190101", year_end="20200101" +): client = entsoe.EntsoePandasClient(api_key=entsoe_token) - + start = pd.Timestamp(year_start, tz="Europe/Brussels") end = pd.Timestamp(year_end, tz="Europe/Brussels") start_gb = start.tz_convert("Europe/London") end_gb = end.tz_convert("Europe/London") - countries= ["LU", "AT", "FR", "NL", "CZ", - "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] - - + countries = [ + "LU", + "AT", + "FR", + "NL", + "CZ", + "DK_1", + "DK_2", + "PL", + "CH", + "NO", + "BE", + "SE", + "GB", + ] # todo: define wanted countries - not_retrieved = [] dfs = [] for country in countries: - if country == 'GB': + if country == "GB": kwargs = dict(start=start_gb, end=end_gb) else: kwargs = dict(start=start, end=end) try: - country_data = client.query_load(country, **kwargs).resample("H")["Actual Load"].mean() - if country == 'GB': - country_data.index = country_data.index.tz_convert("Europe/Brussels") + country_data = ( + client.query_load(country, **kwargs) + .resample("H")["Actual Load"] + .mean() + ) + if country == "GB": + country_data.index = country_data.index.tz_convert( + "Europe/Brussels" + ) dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) @@ -1342,10 +1383,11 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 df = pd.concat(dfs, axis=1) df.columns = countries - df.index = pd.date_range(year_start, periods=8760 , freq="H") + df.index = pd.date_range(year_start, periods=8760, freq="H") return df + def map_carriers_entsoe(): """Map carriers from entsoe-data to carriers used in eGon Returns @@ -1354,48 +1396,54 @@ def map_carriers_entsoe(): Carrier from entsoe to eGon """ return { - 'Biomass': "biomass", - 'Fossil Brown coal/Lignite': "lignite", - 'Fossil Coal-derived gas': "coal", - 'Fossil Gas': "CH4_NG", - 'Fossil Hard coal': "coal", - 'Fossil Oil': "oil", - 'Fossil Oil shale': "oil", - 'Fossil Peat': "biomass", - 'Geothermal': "geo_thermal", - 'Hydro Pumped Storage': "Hydro Pumped Storage", - 'Hydro Run-of-river and poundage': "run_of_river", - 'Hydro Water Reservoir': "reservoir", - 'Marine': "marine", - 'Nuclear': "nuclear", - 'Other': "others", - 'Other renewable': "others", - 'Solar': "solar", - 'Waste': "others", - 'Wind Offshore': "wind_offshore", - 'Wind Onshore': "wind_onshore", - } + "Biomass": "biomass", + "Fossil Brown coal/Lignite": "lignite", + "Fossil Coal-derived gas": "coal", + "Fossil Gas": "CH4_NG", + "Fossil Hard coal": "coal", + "Fossil Oil": "oil", + "Fossil Oil shale": "oil", + "Fossil Peat": "biomass", + "Geothermal": "geo_thermal", + "Hydro Pumped Storage": "Hydro Pumped Storage", + "Hydro Run-of-river and poundage": "run_of_river", + "Hydro Water Reservoir": "reservoir", + "Marine": "marine", + "Nuclear": "nuclear", + "Other": "others", + "Other renewable": "others", + "Solar": "solar", + "Waste": "others", + "Wind Offshore": "wind_offshore", + "Wind Onshore": "wind_onshore", + } + def entsoe_to_bus_etrago(): - map_entsoe= pd.Series({"LU": "LU00", - "AT": "AT00", - "FR": "FR00", - "NL": "NL00", - "DK_1": "DK00", - "DK_2": "DKE1", - "PL": "PL00", - "CH": "CH00", - "NO": "NO00", - "BE": "BE00", - "SE": "SE00", - "GB": "UK00", - "CZ": "CZ00"}) - - for_bus = get_foreign_bus_id(scenario='status2019') + map_entsoe = pd.Series( + { + "LU": "LU00", + "AT": "AT00", + "FR": "FR00", + "NL": "NL00", + "DK_1": "DK00", + "DK_2": "DKE1", + "PL": "PL00", + "CH": "CH00", + "NO": "NO00", + "BE": "BE00", + "SE": "SE00", + "GB": "UK00", + "CZ": "CZ00", + } + ) + + for_bus = get_foreign_bus_id(scenario="status2019") return map_entsoe.map(for_bus) -def insert_generators_sq(gen_sq=None, scn_name = "status2019"): + +def insert_generators_sq(gen_sq=None, scn_name="status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1413,7 +1461,9 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ ################# TEMPORAL #################### - gen_sq = pd.read_csv("data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index") + gen_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" + ) ################# TEMPORAL #################### targets = config.datasets()["electrical_neighbours"]["targets"] @@ -1449,7 +1499,9 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): carrier_entsoe = map_carriers_entsoe() gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() - gen_sq = gen_sq.iloc[:, gen_sq.columns.isin( + gen_sq = gen_sq.iloc[ + :, + gen_sq.columns.isin( [ "others", "wind_offshore", @@ -1462,15 +1514,20 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): "oil", "nuclear", ] - ) + ), ] - list_gen_sq = pd.DataFrame(dtype=int, columns=["carrier", "country", "capacity"]) + list_gen_sq = pd.DataFrame( + dtype=int, columns=["carrier", "country", "capacity"] + ) for carrier in gen_sq.columns: gen_carry = gen_sq[carrier] for country, cap in gen_carry.iteritems(): - gen = pd.DataFrame({"carrier": carrier, "country": country, "capacity": cap}, index=[1]) - #print(gen) + gen = pd.DataFrame( + {"carrier": carrier, "country": country, "capacity": cap}, + index=[1], + ) + # print(gen) list_gen_sq = pd.concat([list_gen_sq, gen], ignore_index=True) list_gen_sq = list_gen_sq[list_gen_sq.capacity > 0] @@ -1558,7 +1615,8 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): return -def insert_loads_sq(load_sq=None, scn_name = "status2019"): + +def insert_loads_sq(load_sq=None, scn_name="status2019"): """ Copy load timeseries data from entso-e. @@ -1571,7 +1629,9 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): targets = config.datasets()["electrical_neighbours"]["targets"] ################# TEMPORAL #################### - load_sq = pd.read_csv("data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index") + load_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" + ) ################# TEMPORAL #################### # Delete existing data @@ -1617,7 +1677,6 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): # Calculate and insert demand timeseries per etrago bus_id for country in load_sq.columns: - load_id = db.next_etrago_id("load") entry = etrago.EgonPfHvLoad( @@ -1638,7 +1697,8 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): session.add(entry_ts) session.commit() -tasks = (grid, ) + +tasks = (grid,) insert_per_scenario = set() @@ -1648,7 +1708,8 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): if "status2019" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update([insert_generators_sq, insert_loads_sq]) -tasks = tasks + (insert_per_scenario, ) +tasks = tasks + (insert_per_scenario,) + class ElectricalNeighbours(Dataset): def __init__(self, dependencies): From 4b9ca47068c723303a8798b7f03133f381274b06 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Fri, 30 Jun 2023 09:57:13 +0200 Subject: [PATCH 342/787] Drop foreign key constraint from egon_peta_heat to scenarios --- src/egon/data/datasets/heat_demand/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index 630f4915f..a346bf82e 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -24,7 +24,7 @@ from rasterio.mask import mask # packages for ORM class definition -from sqlalchemy import Column, Float, ForeignKey, Integer, Sequence, String +from sqlalchemy import Column, Float, Integer, Sequence, String from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd @@ -34,7 +34,6 @@ from egon.data import db, subprocess from egon.data.datasets import Dataset from egon.data.datasets.scenario_parameters import ( - EgonScenario, get_sector_parameters, ) import egon.data.config @@ -48,7 +47,7 @@ def __init__(self, dependencies): super().__init__( name="heat-demands", # version=self.target_files + "_0.0", - version="0.0.2", # maybe rethink the naming + version="0.0.3", # maybe rethink the naming dependencies=dependencies, tasks=(scenario_data_import), ) @@ -71,7 +70,7 @@ class EgonPetaHeat(Base): ) demand = Column(Float) sector = Column(String) - scenario = Column(String, ForeignKey(EgonScenario.name)) + scenario = Column(String) zensus_population_id = Column(Integer) From 97b0f087587a01bf55f9e9525f4dc97359c202ba Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 10:02:10 +0200 Subject: [PATCH 343/787] Remove upper version limits --- setup.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 502d26e58..89b49a895 100755 --- a/setup.py +++ b/setup.py @@ -82,25 +82,23 @@ def read(*names, **kwargs): python_requires=">=3.7", install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', - "apache-airflow>=1.10.14,<2.0", # See accompanying commit message + "apache-airflow>2.0", "atlite==0.2.5", "cdsapi", "click", #"entsoe-py >=0.3.1", - "geopandas>=0.10.0,<0.11.0", + "geopandas>=0.10.0", "geopy", - "geovoronoi==0.3.0", + "geovoronoi", "importlib-resources", "loguru", - "markupsafe<2.1.0", # MarkupSafe>=2.1.0 breaks WTForms<3 + "markupsafe", "matplotlib", "netcdf4", - "numpy<1.23", # incompatibilities with shapely 1.7. - # See: https://stackoverflow.com/a/73354885/12460232 - "oedialect==0.0.8", + "numpy", "omi", "openpyxl", - "pandas>1.2.0,<1.4", # pandas>=1.4 needs SQLAlchemy>=1.4 + "pandas>1.2.0", "psycopg2", "pyaml", "pypsa==0.17.1", @@ -112,8 +110,8 @@ def read(*names, **kwargs): "seaborn", "shapely", "snakemake<7", - "sqlalchemy<1.4", # Airflow<2.0 is not compatible with SQLAlchemy>=1.4 - "wtforms<3", # WTForms>=3.0 breaks Airflow<2.0 + "sqlalchemy", + "wtforms", "xarray", "xlrd", ], From aacd304fdd49cefe845f8896f4156b0e6e4aa769 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 10:02:59 +0200 Subject: [PATCH 344/787] Chance key names for new airflow versiono --- src/egon/data/airflow/airflow.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/airflow.cfg b/src/egon/data/airflow/airflow.cfg index 80b7247f7..47e6b4bd8 100755 --- a/src/egon/data/airflow/airflow.cfg +++ b/src/egon/data/airflow/airflow.cfg @@ -42,7 +42,7 @@ log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(me simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s # Log filename format -log_filename_template = {{{{ ti.dag_id }}}}/{{{{ ti.task_id }}}}/{{{{ ts }}}}/{{{{ try_number }}}}.log +log_filename_template = dag_id={{ ti.dag_id }}/run_id={{ ti.run_id }}/task_id={{ ti.task_id }}/attempt={{ try_number }}.log log_processor_filename_template = {{{{ filename }}}}.log # dag_processor_manager_log_location = ${{AIRFLOW_HOME}}/logs/dag_processor_manager/dag_processor_manager.log @@ -58,7 +58,7 @@ task_log_reader = task # # No argument should be required in the function specified. # If using IP address as hostname is preferred, use value ``airflow.utils.net:get_host_ip_address`` -hostname_callable = socket:getfqdn +hostname_callable = socket.getfqdn # Default timezone in case supplied date times are naive # can be utc (default), system, or any IANA timezone string (e.g. Europe/Amsterdam) From 1a7e2099c47a750209fb4473a66a23b4578460c1 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 10:04:44 +0200 Subject: [PATCH 345/787] Set conn_type when connecting to the database --- src/egon/data/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index 10922ce05..44da64f2d 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -398,6 +398,7 @@ def render(template, target, update=True, inserts={}, **more_inserts): connection.host = options["--database-host"] connection.port = options["--database-port"] connection.schema = options["--database-name"] + connection.conn_type = "pgsql" airflow.add(connection) airflow.commit() From 1482aafb49ea2e5f4497630e75fa8cda5f13f7f1 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 10:06:16 +0200 Subject: [PATCH 346/787] Remove duplicate dataset --- src/egon/data/airflow/dags/pipeline_status_quo.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index c8a5dd52d..6a5553c03 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -499,15 +499,6 @@ dependencies=[mv_grid_districts, hh_demand_buildings_setup] ) - cts_demand_buildings = CtsDemandBuildings( - dependencies=[ - osm_buildings_streets, - cts_electricity_demand_annual, - hh_demand_buildings_setup, - tasks["heat_demand_timeseries.export-etrago-cts-heat-profiles"], - ] - ) - # Create load areas load_areas = LoadArea( dependencies=[ From 09e082ea5c430282bbb317e228e4758d5b8e2a8b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 10:07:15 +0200 Subject: [PATCH 347/787] Update import of airflow package to new module names --- src/egon/data/datasets/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 8a20ee006..2ed8f2b88 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -8,7 +8,7 @@ from typing import Callable, Iterable, Set, Tuple, Union import re -from airflow.operators import BaseOperator as Operator +from airflow.models.baseoperator import BaseOperator as Operator from airflow.operators.python_operator import PythonOperator from sqlalchemy import Column, ForeignKey, Integer, String, Table, orm, tuple_ from sqlalchemy.ext.declarative import declarative_base From 824baa17a4754f6c80899636c4686c6709f17560 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 4 Jul 2023 14:03:27 +0200 Subject: [PATCH 348/787] added some necessary mail configs and an error to test --- src/egon/data/airflow/airflow.cfg | 4 +++- src/egon/data/datasets.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/airflow.cfg b/src/egon/data/airflow/airflow.cfg index 6f97f2032..f8062afba 100755 --- a/src/egon/data/airflow/airflow.cfg +++ b/src/egon/data/airflow/airflow.cfg @@ -458,7 +458,9 @@ update_fab_perms = True # session_lifetime_minutes = 43200 [email] -email_backend = airflow.utils.email.send_email_smtp +email_backend = airflow.providers.sendgrid.utils.emailer.send_email +email_conn_id = sendgrid_default +from_email = "powerddata@gmail.com" [smtp] diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index ed1bf8a3d..6acb4b646 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -21,7 +21,7 @@ openstreetmap: vg250: original_data: source: - url: "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip" + url: "https://datenX.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip" target: file: "vg250_01-01.geo84.shape.ebenen.zip" processed: From 202848a78e4ad213f6989d214cee36dff10233ef Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Tue, 4 Jul 2023 14:16:27 +0200 Subject: [PATCH 349/787] added sendgrid to setup and cleared the api-key --- setup.py | 4 +++- src/egon/data/airflow/airflow.cfg | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 89b49a895..86ebb52a8 100755 --- a/setup.py +++ b/setup.py @@ -82,7 +82,9 @@ def read(*names, **kwargs): python_requires=">=3.7", install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', - "apache-airflow>2.0", + "apache-airflow>2.0", + "apache-airflow-providers-sendgrid", + "sendgrid", "atlite==0.2.5", "cdsapi", "click", diff --git a/src/egon/data/airflow/airflow.cfg b/src/egon/data/airflow/airflow.cfg index 40a3428cf..b35f2d7b9 100755 --- a/src/egon/data/airflow/airflow.cfg +++ b/src/egon/data/airflow/airflow.cfg @@ -471,7 +471,7 @@ smtp_host = smtp.sendgrid.net smtp_starttls = False smtp_ssl = False smtp_user = apikey -smtp_password = ***REMOVED*** +smtp_password = smtp_port = 587 smtp_mail_from = powerddata@gmail.com From c7ee522a108d684c7b39c86698830181e000c63e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 15:41:18 +0200 Subject: [PATCH 350/787] Add timeseries for solar rooftop --- src/egon/data/datasets/fill_etrago_gen.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index c9d8ea68b..c2084779b 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -12,7 +12,7 @@ class Egon_etrago_gen(Dataset): def __init__(self, dependencies): super().__init__( name="etrago_generators", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=(fill_etrago_generators,), ) @@ -155,6 +155,7 @@ def fill_etrago_gen_time_table( etrago_pp_time = etrago_pp_time[ (etrago_pp_time["carrier"] == "solar") + | (etrago_pp_time["carrier"] == "solar_rooftop") | (etrago_pp_time["carrier"] == "wind_onshore") | (etrago_pp_time["carrier"] == "wind_offshore") ] @@ -248,6 +249,11 @@ def adjust_renew_feedin_table(renew_feedin, cfg): carrier_pv_mask = renew_feedin["carrier"] == "pv" renew_feedin.loc[carrier_pv_mask, "carrier"] = "solar" + # Copy solar timeseries for solar_rooftop + feedin_solar_rooftop = renew_feedin.loc[renew_feedin["carrier"]=="solar"] + feedin_solar_rooftop.loc[:, "carrier"] = "solar_rooftop" + renew_feedin = pd.concat([renew_feedin, feedin_solar_rooftop], ignore_index=True) + # convert renewable feedin lists to arrays renew_feedin["feedin"] = renew_feedin["feedin"].apply(np.array) From 93dadecdabc9de64e9b44e8f0d2924797ec8c39a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 16:40:50 +0200 Subject: [PATCH 351/787] Rename and move configuration parameters for new airflow version --- src/egon/data/airflow/airflow.cfg | 213 ++++++++++++++++-------------- 1 file changed, 114 insertions(+), 99 deletions(-) diff --git a/src/egon/data/airflow/airflow.cfg b/src/egon/data/airflow/airflow.cfg index 47e6b4bd8..c368dff19 100755 --- a/src/egon/data/airflow/airflow.cfg +++ b/src/egon/data/airflow/airflow.cfg @@ -7,48 +7,6 @@ dags_folder = {dags} # This path must be absolute # base_log_folder = ${{AIRFLOW_HOME}}/logs -# Airflow can store logs remotely in AWS S3, Google Cloud Storage or Elastic Search. -# Set this to True if you want to enable remote logging. -remote_logging = False - -# Users must supply an Airflow connection id that provides access to the storage -# location. -remote_log_conn_id = -remote_base_log_folder = -encrypt_s3_logs = False - -# Logging level -logging_level = INFO - -# Logging level for Flask-appbuilder UI -fab_logging_level = WARN - -# Logging class -# Specify the class that will specify the logging configuration -# This class has to be on the python classpath -# Example: logging_config_class = my.path.default_local_settings.LOGGING_CONFIG -logging_config_class = - -# Flag to enable/disable Colored logs in Console -# Colour the logs when the controlling terminal is a TTY. -colored_console_log = True - -# Log format for when Colored logs is enabled -colored_log_format = [%%(blue)s%%(asctime)s%%(reset)s] {{%%(blue)s%%(filename)s:%%(reset)s%%(lineno)d}} %%(log_color)s%%(levelname)s%%(reset)s - %%(log_color)s%%(message)s%%(reset)s -colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatter - -# Format of Log line -log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s -simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s - -# Log filename format -log_filename_template = dag_id={{ ti.dag_id }}/run_id={{ ti.run_id }}/task_id={{ ti.task_id }}/attempt={{ try_number }}.log -log_processor_filename_template = {{{{ filename }}}}.log -# dag_processor_manager_log_location = ${{AIRFLOW_HOME}}/logs/dag_processor_manager/dag_processor_manager.log - -# Name of handler to read task instance logs. -# Default to use task handler. -task_log_reader = task # Hostname by providing a path to a callable, which will resolve the hostname. # The format is "package:function". @@ -68,53 +26,8 @@ default_timezone = utc # SequentialExecutor, LocalExecutor, CeleryExecutor, DaskExecutor, KubernetesExecutor executor = LocalExecutor -# The SqlAlchemy connection string to the metadata database. -# SqlAlchemy supports many different database engine, more information -# their website -sql_alchemy_conn = postgresql+psycopg2://{--database-user}:{--database-password}@{--database-host}:{--database-port}/{--airflow-database-name} - -# The encoding for the databases -sql_engine_encoding = utf-8 - -# If SqlAlchemy should pool database connections. -sql_alchemy_pool_enabled = True - -# The SqlAlchemy pool size is the maximum number of database connections -# in the pool. 0 indicates no limit. -sql_alchemy_pool_size = 5 - -# The maximum overflow size of the pool. -# When the number of checked-out connections reaches the size set in pool_size, -# additional connections will be returned up to this limit. -# When those additional connections are returned to the pool, they are disconnected and discarded. -# It follows then that the total number of simultaneous connections the pool will allow -# is pool_size + max_overflow, -# and the total number of "sleeping" connections the pool will allow is pool_size. -# max_overflow can be set to -1 to indicate no overflow limit; -# no limit will be placed on the total number of concurrent connections. Defaults to 10. -sql_alchemy_max_overflow = 10 -# The SqlAlchemy pool recycle is the number of seconds a connection -# can be idle in the pool before it is invalidated. This config does -# not apply to sqlite. If the number of DB connections is ever exceeded, -# a lower config value will allow the system to recover faster. -sql_alchemy_pool_recycle = 1800 -# Check connection at the start of each connection pool checkout. -# Typically, this is a simple statement like "SELECT 1". -# More information here: -# https://docs.sqlalchemy.org/en/13/core/pooling.html#disconnect-handling-pessimistic -sql_alchemy_pool_pre_ping = True - -# The schema to use for the metadata database. -# SqlAlchemy supports databases with the concept of multiple schemas. -sql_alchemy_schema = - -# Import path for connect args in SqlAlchemy. Default to an empty dict. -# This is useful when you want to configure db engine args that SqlAlchemy won't parse -# in connection string. -# See https://docs.sqlalchemy.org/en/13/core/engines.html#sqlalchemy.create_engine.params.connect_args -# sql_alchemy_connect_args = # The amount of parallelism as a setting to the executor. This defines # the max number of task instances that should run simultaneously @@ -122,7 +35,7 @@ sql_alchemy_schema = parallelism = 32 # The number of task instances allowed to run concurrently by the scheduler -dag_concurrency = {--jobs} +max_active_tasks_per_dag = {--jobs} # Are DAGs paused by default at creation dags_are_paused_at_creation = False @@ -229,6 +142,100 @@ check_slas = True # Example: xcom_backend = path.to.CustomXCom xcom_backend = airflow.models.xcom.BaseXCom +# UI to hide sensitive variable fields when set to True +hide_sensitive_variable_fields = True + +[database] +# The SqlAlchemy connection string to the metadata database. +# SqlAlchemy supports many different database engine, more information +# their website +sql_alchemy_conn = postgresql+psycopg2://{--database-user}:{--database-password}@{--database-host}:{--database-port}/{--airflow-database-name} + +# The encoding for the databases +sql_engine_encoding = utf-8 + +# If SqlAlchemy should pool database connections. +sql_alchemy_pool_enabled = True + +# The SqlAlchemy pool size is the maximum number of database connections +# in the pool. 0 indicates no limit. +sql_alchemy_pool_size = 5 + +# The maximum overflow size of the pool. +# When the number of checked-out connections reaches the size set in pool_size, +# additional connections will be returned up to this limit. +# When those additional connections are returned to the pool, they are disconnected and discarded. +# It follows then that the total number of simultaneous connections the pool will allow +# is pool_size + max_overflow, +# and the total number of "sleeping" connections the pool will allow is pool_size. +# max_overflow can be set to -1 to indicate no overflow limit; +# no limit will be placed on the total number of concurrent connections. Defaults to 10. +sql_alchemy_max_overflow = 10 + +# The SqlAlchemy pool recycle is the number of seconds a connection +# can be idle in the pool before it is invalidated. This config does +# not apply to sqlite. If the number of DB connections is ever exceeded, +# a lower config value will allow the system to recover faster. +sql_alchemy_pool_recycle = 1800 + +# Check connection at the start of each connection pool checkout. +# Typically, this is a simple statement like "SELECT 1". +# More information here: +# https://docs.sqlalchemy.org/en/13/core/pooling.html#disconnect-handling-pessimistic +sql_alchemy_pool_pre_ping = True + +# The schema to use for the metadata database. +# SqlAlchemy supports databases with the concept of multiple schemas. +sql_alchemy_schema = + +# Import path for connect args in SqlAlchemy. Default to an empty dict. +# This is useful when you want to configure db engine args that SqlAlchemy won't parse +# in connection string. +# See https://docs.sqlalchemy.org/en/13/core/engines.html#sqlalchemy.create_engine.params.connect_args +# sql_alchemy_connect_args = + +[logging] +# Logging level +logging_level = INFO + +# Logging level for Flask-appbuilder UI +fab_logging_level = WARN + +# Logging class +# Specify the class that will specify the logging configuration +# This class has to be on the python classpath +# Example: logging_config_class = my.path.default_local_settings.LOGGING_CONFIG +logging_config_class = + +# Flag to enable/disable Colored logs in Console +# Colour the logs when the controlling terminal is a TTY. +colored_console_log = False + +# Log format for when Colored logs is enabled +#colored_log_format = [%%(blue)s%%(asctime)s%%(reset)s] {{%%(blue)s%%(filename)s:%%(reset)s%%(lineno)d}} %%(log_color)s%%(levelname)s%%(reset)s - %%(log_color)s%%(message)s%%(reset)s +#colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatter + + +# Format of Log line +log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s +simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s + +# Log filename format +log_filename_template = {{{{ ti.dag_id }}}}/{{{{ ti.task_id }}}}/{{{{ ts }}}}/{{{{ try_number }}}}.log + +log_processor_filename_template = {{{{ filename }}}}.log + + +# Airflow can store logs remotely in AWS S3, Google Cloud Storage or Elastic Search. +# Set this to True if you want to enable remote logging. +remote_logging = False + +# Users must supply an Airflow connection id that provides access to the storage +# location. +remote_log_conn_id = +remote_base_log_folder = +encrypt_s3_logs = False + [secrets] # Full class name of secrets backend to enable (will precede env vars and metastore in search path) # Example: backend = airflow.contrib.secrets.aws_systems_manager.SystemsManagerParameterStoreBackend @@ -260,7 +267,7 @@ fail_fast = False # How to authenticate users of the API. See # https://airflow.apache.org/docs/stable/security.html for possible values. # ("airflow.api.auth.backend.default" allows all requests for historic reasons) -auth_backend = airflow.api.auth.backend.deny_all +auth_backends = airflow.api.auth.backend.session [lineage] # what lineage backend to use @@ -276,12 +283,17 @@ password = [operators] # The default owner assigned to each new operator, unless # provided explicitly or passed via ``default_args`` -default_owner = airflow +default_owner = airflowstatsd_on = False default_cpus = 1 default_ram = 512 default_disk = 512 default_gpus = 0 + + +# Default queue that tasks get assigned to and that worker listen on. +default_queue = default + [hive] # Default mapreduce queue for HiveOperator tasks default_hive_mapred_queue = @@ -372,7 +384,7 @@ owner_mode = user # Default DAG view. Valid values are: # tree, graph, duration, gantt, landing_times -dag_default_view = tree +dag_default_view = graph # "Default DAG orientation. Valid values are:" # LR (Left->Right), TB (Top->Bottom), RL (Right->Left), BT (Bottom->Top) @@ -406,7 +418,7 @@ page_size = 100 rbac = False # Define the color of navigation bar -navbar_color = #007A87 +navbar_color = #fff # Default dagrun to show in UI default_dag_run_display_number = 25 @@ -539,8 +551,6 @@ flower_port = 5555 # Example: flower_basic_auth = user1:password1,user2:password2 flower_basic_auth = -# Default queue that tasks get assigned to and that worker listen on. -default_queue = default # How many processes CeleryExecutor uses to sync task state. # 0 means to use max(1, number of cores - 1) processes. @@ -654,7 +664,7 @@ catchup_by_default = True max_tis_per_query = 512 # Statsd (https://github.com/etsy/statsd) integration settings -statsd_on = False + statsd_host = localhost statsd_port = 8125 statsd_prefix = airflow @@ -677,6 +687,9 @@ use_job_schedule = True # Only has effect if schedule_interval is set to None in DAG allow_trigger_in_future = False +[metrics] +statsd_on = False + [ldap] # set this to ldaps://: uri = @@ -754,8 +767,7 @@ keytab = airflow.keytab api_rev = v3 [admin] -# UI to hide sensitive variable fields when set to True -hide_sensitive_variable_fields = True + [elasticsearch] # Elasticsearch host @@ -785,6 +797,10 @@ json_fields = asctime, filename, lineno, levelname, message use_ssl = False verify_certs = True +[kubernetes_executor] +# The Kubernetes namespace where airflow workers should be created. Defaults to ``default`` +namespace = default + [kubernetes] # The repository, tag and imagePullPolicy of the Kubernetes Image for the Worker to Run worker_container_repository = @@ -805,8 +821,7 @@ delete_worker_pods_on_failure = False # Number of Kubernetes Worker Pod creation calls per scheduler loop worker_pods_creation_batch_size = 1 -# The Kubernetes namespace where airflow workers should be created. Defaults to ``default`` -namespace = default + # Allows users to launch pods in multiple namespaces. # Will require creating a cluster-role for the scheduler From 620a96e1d3965af704e005b1fa410cdd24be51d4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 16:41:56 +0200 Subject: [PATCH 352/787] Avoid using PostgresOperator in airflow --- src/egon/data/datasets/substation/__init__.py | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/egon/data/datasets/substation/__init__.py b/src/egon/data/datasets/substation/__init__.py index 594ed40f9..122d3b687 100644 --- a/src/egon/data/datasets/substation/__init__.py +++ b/src/egon/data/datasets/substation/__init__.py @@ -1,11 +1,10 @@ """The central module containing code to create substation tables """ -from airflow.operators.postgres_operator import PostgresOperator from geoalchemy2.types import Geometry from sqlalchemy import Column, Float, Integer, Sequence, Text from sqlalchemy.ext.declarative import declarative_base -import importlib_resources as resources +import os from egon.data import db from egon.data.datasets import Dataset @@ -80,22 +79,8 @@ def __init__(self, dependencies): create_tables, create_sql_functions, { - PostgresOperator( - task_id="hvmv_substation", - sql=resources.read_text( - __name__, "hvmv_substation.sql" - ), - postgres_conn_id="egon_data", - autocommit=True, - ), - PostgresOperator( - task_id="ehv_substation", - sql=resources.read_text( - __name__, "ehv_substation.sql" - ), - postgres_conn_id="egon_data", - autocommit=True, - ), + extract_hvmv, + extract_ehv, }, transfer_busses, ), @@ -237,10 +222,7 @@ def create_sql_functions(): def transfer_busses(): - - targets = egon.data.config.datasets()["substation_extraction"][ - "targets" - ] + targets = egon.data.config.datasets()["substation_extraction"]["targets"] db.execute_sql( f""" @@ -254,4 +236,13 @@ def transfer_busses(): ref, operator, dbahn, status FROM {targets['hvmv_substation']['schema']}. {targets['hvmv_substation']['table']} ORDER BY osm_id) as foo; - """) + """ + ) + + +def extract_ehv(): + db.execute_sql_script(os.path.dirname(__file__) + "/ehv_substation.sql") + + +def extract_hvmv(): + db.execute_sql_script(os.path.dirname(__file__) + "/hvmv_substation.sql") From b793d23f575ec409f77caee18cc82ac36ae1dc75 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 16:42:28 +0200 Subject: [PATCH 353/787] Replace outdated geopandas function --- src/egon/data/datasets/zensus_vg250.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/zensus_vg250.py b/src/egon/data/datasets/zensus_vg250.py index f055f0b8d..5c6a950cf 100755 --- a/src/egon/data/datasets/zensus_vg250.py +++ b/src/egon/data/datasets/zensus_vg250.py @@ -15,6 +15,7 @@ ) from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd +import pandas as pd from egon.data import db from egon.data.datasets import Dataset @@ -213,7 +214,7 @@ def map_zensus_vg250(): join_missing = gpd.sjoin( missing_cells, boundaries_buffer, how="inner", op="intersects" ) - join = join.append(join_missing) + join = pd.concat([join, join_missing]) missing_cells = gdf[ (~gdf.id.isin(join.id_left)) & (gdf.population > 0) ] From 9ee28ac81cd6723f0f9f30f82420d7b0b7f977af Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 16:44:13 +0200 Subject: [PATCH 354/787] Make sure that the existing configuration file is used --- src/egon/data/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index 44da64f2d..d9e98ef77 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -277,16 +277,19 @@ def options(value, check=None): with open(config.paths(pid="*")[0]) as f: options = yaml.load(f, Loader=yaml.SafeLoader) else: # len(config.paths(pid="*")) == 0, so need to create one. + with open(config.paths()[0]) as f: options["file"] = yaml.load(f, Loader=yaml.SafeLoader) + options = dict( options.get("file", {}), **{ - flag: options["cli"][flag] + flag: options["file"][flag] for flag in options["cli"] if options["cli"][flag] != options["defaults"][flag] }, ) + with open(config.paths(pid="current")[0], "w") as f: f.write(yaml.safe_dump(options)) From 3903b4903f7f7d96cb336bb260a7c2a56f43c8a2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 4 Jul 2023 16:53:35 +0200 Subject: [PATCH 355/787] Replace Postgres Operator --- src/egon/data/datasets/loadarea/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/loadarea/__init__.py b/src/egon/data/datasets/loadarea/__init__.py index 0cda809d2..c8ebe7dc8 100644 --- a/src/egon/data/datasets/loadarea/__init__.py +++ b/src/egon/data/datasets/loadarea/__init__.py @@ -55,17 +55,7 @@ def __init__(self, dependencies): name="OsmLanduse", version="0.0.0", dependencies=dependencies, - tasks=( - create_landuse_table, - PostgresOperator( - task_id="osm_landuse_extraction", - sql=resources.read_text( - __name__, "osm_landuse_extraction.sql" - ), - postgres_conn_id="egon_data", - autocommit=True, - ), - ), + tasks=(create_landuse_table, extract_osm_landuse), ) @@ -90,6 +80,12 @@ def __init__(self, dependencies): ) +def extract_osm_landuse(): + db.execute_sql_script( + os.path.dirname(__file__) + "/osm_landuse_extraction.sql" + ) + + def create_landuse_table(): """Create tables for landuse data Returns From 0b2ada6e251c1fc21cd1413e2093fdf36008c901 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 11:14:27 +0200 Subject: [PATCH 356/787] Changes for new geopandas version --- .../district_heating_areas/__init__.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 3394575e5..e2f2b5ffb 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -346,9 +346,8 @@ def area_grouping( buffer_distance ) # print(cell_buffers.area) - # create a shapely Multipolygon which is split into a list - buffer_polygons = list(cell_buffers["geom_polygon"].unary_union) + buffer_polygons = list(cell_buffers["geom_polygon"].unary_union.geoms) # change the data type into geopandas geodataframe buffer_polygons_gdf = gpd.GeoDataFrame(geometry=buffer_polygons, crs=3035) @@ -423,10 +422,9 @@ def area_grouping( join_2["area_id"] = join_2.index_right + max_area_id + 1 - join = join.append( - join_2[ - ["residential_and_service_demand", "geom_polygon", "area_id"] - ] + join = pd.concat([join, + join_2[["residential_and_service_demand", "geom_polygon", "area_id"]]], + ignore_index=True ) return join @@ -598,11 +596,10 @@ def district_heating_areas(scenario_name, plotting=False): # group the resulting scenario specific district heating areas scenario_dh_area = area_grouping( - gpd.GeoDataFrame( - cells[["residential_and_service_demand", "geom_polygon"]].append( - new_areas[["residential_and_service_demand", "geom_polygon"]] - ), - geometry="geom_polygon", + pd.concat( + [cells[["residential_and_service_demand", "geom_polygon"]], + new_areas[["residential_and_service_demand", "geom_polygon"]] + ], ignore_index=True ), distance=500, maximum_total_demand=4e6, @@ -626,6 +623,7 @@ def district_heating_areas(scenario_name, plotting=False): schema="demand", con=db.engine(), if_exists="append", + index=False ) # Create polygons around the grouped cells and store them in the database From c8684ecaeb652309046cd55d711837b365c357ab Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 11:14:45 +0200 Subject: [PATCH 357/787] Changes for new atlite version --- src/egon/data/datasets/era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index 940ee141c..b766e9e3e 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -176,7 +176,7 @@ def insert_weather_cells(): cutout = import_cutout() df = gpd.GeoDataFrame( - {"geom": cutout.grid_cells()}, geometry="geom", crs=4326 + {"geom": cutout.grid.geometry}, geometry="geom", crs=4326 ) df.to_postgis( From 92506f9352f33843b165dec1d50d359211bf304d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 11:15:02 +0200 Subject: [PATCH 358/787] Changes for new atlite version --- src/egon/data/datasets/renewable_feedin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 59100bca5..105526d0c 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -211,7 +211,7 @@ def feedin_per_turbine(): # Select weather data for Germany cutout = import_cutout(boundary="Germany") - gdf = gpd.GeoDataFrame(geometry=cutout.grid_cells(), crs=4326) + gdf = gpd.GeoDataFrame(geometry=cutout.grid.geometry, crs=4326) # Calculate feedin-timeseries for E-141 # source: From 76cebcd1c0556a64cfb05aaeead75b6db44e3aa2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 11:15:22 +0200 Subject: [PATCH 359/787] Changes for new pandas version --- .../data/datasets/scenario_parameters/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index f574ae47b..3133fc287 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -184,15 +184,15 @@ def get_sector_parameters(sector, scenario=None): else: print(f"Scenario name {scenario} is not valid.") else: - values = pd.DataFrame( + values = pd.concat([ + pd.DataFrame( db.select_dataframe( f""" SELECT {sector}_parameters as val FROM scenario.egon_scenario_parameters WHERE name='eGon2035'""" ).val[0], - index=["eGon2035"], - ).append( + index=["eGon2035"]), pd.DataFrame( db.select_dataframe( f""" @@ -201,8 +201,8 @@ def get_sector_parameters(sector, scenario=None): WHERE name='eGon100RE'""" ).val[0], index=["eGon100RE"], - ) - ).append( + ), + pd.DataFrame( db.select_dataframe( f""" @@ -212,7 +212,8 @@ def get_sector_parameters(sector, scenario=None): ).val[0], index=["eGon2021"], ) - ) + ], ignore_index=True) + return values From 422f4e393fe3e3c99334be1cd218441def8e5154 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:33:23 +0200 Subject: [PATCH 360/787] Remove sendgrid from requirements since it is installed by apache-airflow-providers-sendgrid --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 86ebb52a8..2521c2f0e 100755 --- a/setup.py +++ b/setup.py @@ -84,7 +84,6 @@ def read(*names, **kwargs): # eg: 'aspectlib==1.1.1', 'six>=1.7', "apache-airflow>2.0", "apache-airflow-providers-sendgrid", - "sendgrid", "atlite==0.2.5", "cdsapi", "click", From 692ae3068389dbc737cfe2340ba5f900cd84269d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:35:21 +0200 Subject: [PATCH 361/787] Drop non-numeric columns before groupby --- src/egon/data/datasets/demandregio/__init__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index a403a5f2f..3756c7e90 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -732,7 +732,23 @@ def insert_timeseries_per_wz(sector, year): if sector == "CTS": profiles = ( - data.CTS_power_slp_generator("SH", year=year).resample("H").sum() + data.CTS_power_slp_generator("SH", year=year) + .drop( + [ + "Day", + "Hour", + "DayOfYear", + "WD", + "SA", + "SU", + "WIZ", + "SOZ", + "UEZ", + ], + axis="columns", + ) + .resample("H") + .sum() ) wz_slp = config.slp_branch_cts_power() elif sector == "industry": From 86caaa7781cc51f6c7a377b28c371aea7148a799 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:36:09 +0200 Subject: [PATCH 362/787] Replace df.append with pd.concat --- .../electricity_demand_timeseries/hh_profiles.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 9deade3b6..67aa44014 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -909,7 +909,7 @@ def impute_missing_hh_in_populated_cells(df_census_households_grid): * df_wo_hh_population_i.shape[0] ).values # append new cells - df_w_hh = df_w_hh.append(df_repeated, ignore_index=True) + df_w_hh = pd.concat([df_w_hh, df_repeated], ignore_index=True) return df_w_hh @@ -1167,12 +1167,13 @@ def refine_census_data_at_cell_level( df_group, dist_households_nuts1, hh_10types_cluster ) df_distribution_group["characteristics_code"] = hh_5type_cluster - df_distribution_nuts1 = df_distribution_nuts1.append( - df_distribution_group + df_distribution_nuts1 = pd.concat( + [df_distribution_nuts1, df_distribution_group], + ignore_index=True, ) - df_distribution_nuts0 = df_distribution_nuts0.append( - df_distribution_nuts1 + df_distribution_nuts0 = pd.concat( + [df_distribution_nuts0, df_distribution_nuts1], ignore_index=True ) df_census_households_grid_refined = df_census_households_grid.merge( From 4eb61ba5ae989a61ecf29cff60a4192bc6e67c26 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:36:59 +0200 Subject: [PATCH 363/787] Replace df.append with pd.concat --- src/egon/data/datasets/industry/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/industry/__init__.py b/src/egon/data/datasets/industry/__init__.py index 36f7533ef..4e5ceab49 100644 --- a/src/egon/data/datasets/industry/__init__.py +++ b/src/egon/data/datasets/industry/__init__.py @@ -10,6 +10,7 @@ from sqlalchemy import ARRAY, Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd +import pandas as pd from egon.data import db from egon.data.datasets import Dataset @@ -351,8 +352,8 @@ def industrial_demand_distr(): # Create df containing all demand per wz which will be allocated to # osm areas - demand_nuts3_osm_wz = demand_nuts3_a.append( - demand_nuts3_b_osm, ignore_index=True + demand_nuts3_osm_wz = pd.concat( + [demand_nuts3_a, demand_nuts3_b_osm], ignore_index=True ) demand_nuts3_osm_wz = ( demand_nuts3_osm_wz.groupby(["nuts3", "wz"]).sum().reset_index() From 9c42ebd0c1d2e825446e3a853a9c19e972035eac Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:37:27 +0200 Subject: [PATCH 364/787] Drop non-numeric columns before groupby --- src/egon/data/datasets/industry/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/industry/__init__.py b/src/egon/data/datasets/industry/__init__.py index 4e5ceab49..e6614aa2e 100644 --- a/src/egon/data/datasets/industry/__init__.py +++ b/src/egon/data/datasets/industry/__init__.py @@ -201,7 +201,6 @@ def industrial_demand_distr(): ) for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: - # Select spatial information from local database # Select administrative districts (Landkreise) including its boundaries boundaries = db.select_geodataframe( @@ -252,7 +251,7 @@ def industrial_demand_distr(): landuse = landuse.rename({"index_right": "nuts3"}, axis=1) landuse_nuts3 = landuse[["area_ha", "nuts3"]] - landuse_nuts3 = landuse.groupby(["nuts3"]).sum().reset_index() + landuse_nuts3 = landuse_nuts3.groupby(["nuts3"]).sum().reset_index() # Select data on industrial sites sites = db.select_dataframe( @@ -386,7 +385,12 @@ def industrial_demand_distr(): landuse = landuse.rename({"id": "osm_id"}, axis=1) # Remove duplicates and adjust index - landuse = landuse.groupby(["osm_id", "wz"]).sum().reset_index() + landuse = ( + landuse.drop("geom", axis="columns") + .groupby(["osm_id", "wz"]) + .sum() + .reset_index() + ) landuse.index.rename("id", inplace=True) landuse["scenario"] = scn From b0f8fe53a1f3de58e97a5c3413cf72392ad23334 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:38:12 +0200 Subject: [PATCH 365/787] Changes for new atlite version --- src/egon/data/datasets/renewable_feedin.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 105526d0c..d44178389 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -135,7 +135,6 @@ def federal_states_per_weather_cell(): while (buffer < 30000) & ( len(weather_cells[weather_cells["federal_state"].isnull()]) > 0 ): - cells = weather_cells[weather_cells["federal_state"].isnull()] cells.loc[:, "geom_point"] = cells.geom_point.buffer(buffer) @@ -252,7 +251,7 @@ def feedin_per_turbine(): ), } ts_e141 = cutout.wind( - turbine_e141, per_unit=True, shapes=cutout.grid_cells() + turbine_e141, per_unit=True, shapes=cutout.grid.geometry ) gdf["E-141"] = ts_e141.to_pandas().transpose().values.tolist() @@ -296,7 +295,7 @@ def feedin_per_turbine(): ), } ts_e126 = cutout.wind( - turbine_e126, per_unit=True, shapes=cutout.grid_cells() + turbine_e126, per_unit=True, shapes=cutout.grid.geometry ) gdf["E-126"] = ts_e126.to_pandas().transpose().values.tolist() From 356e199223895e6897b715f0a340ca84c05d62d0 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:38:44 +0200 Subject: [PATCH 366/787] Minor change for new pandas versiono --- src/egon/data/datasets/society_prognosis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/society_prognosis.py b/src/egon/data/datasets/society_prognosis.py index 1e17f66ab..48c70b6ab 100755 --- a/src/egon/data/datasets/society_prognosis.py +++ b/src/egon/data/datasets/society_prognosis.py @@ -89,7 +89,7 @@ def zensus_population(): zensus.groupby(zensus.nuts3) .population.apply(lambda grp: grp / grp.sum()) .fillna(0) - ) + ).values db.execute_sql( f"""DELETE FROM {cfg['target']['population_prognosis']['schema']}. From 69c08bfe4cdb3b8af6f962d358389aa9cd2e31dd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 14:39:18 +0200 Subject: [PATCH 367/787] Turn off automatic emails --- src/egon/data/airflow/dags/pipeline_status_quo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 192610bea..fd93b7399 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -80,8 +80,8 @@ "powerd-status-quo-processing-pipeline", description="The PoWerD Status Quo data processing DAG.", default_args={"start_date": days_ago(1), - "email_on_failure": True, - "email":"ulf.p.mueller@hs-flensburg.de"}, + "email_on_failure": False, + "email":"clara.buettner@hs-flensburg.de"}, template_searchpath=[ os.path.abspath( os.path.join( From 45c5276ffd6cfaadbfdcf08304c3f18dbe2b855b Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 6 Jul 2023 15:04:34 +0200 Subject: [PATCH 368/787] include conventional generators --- src/egon/data/datasets.yml | 2 + .../data/datasets/power_plants/__init__.py | 87 ++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index ed1bf8a3d..c126c5b72 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -364,6 +364,8 @@ power_plants: mastr_hydro: "bnetza_mastr_hydro_cleaned.csv" mastr_location: "location_elec_generation_raw.csv" mastr_combustion_without_chp: "supply.egon_mastr_conventional_without_chp" + mastr_combustion: "bnetza_mastr/dump_2022-11-17/bnetza_mastr_combustion_cleaned.csv" + mastr_nuclear: "bnetza_mastr/dump_2022-11-17/bnetza_mastr_nuclear_cleaned.csv" mastr_storage: "bnetza_mastr_storage_cleaned.csv" mastr_gsgk: "bnetza_mastr_gsgk_cleaned.csv" capacities: "supply.egon_scenario_capacities" diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f2bb42e5c..53ba073ef 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -2,6 +2,7 @@ """ from geoalchemy2 import Geometry from pathlib import Path +from shapely.geometry import Point from sqlalchemy import BigInteger, Column, Float, Integer, Sequence, String from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.ext.declarative import declarative_base @@ -913,7 +914,7 @@ def power_plants_status_quo(scn_name="status2019"): DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} WHERE carrier IN ('wind_onshore', 'solar', 'biomass', 'run_of_river', 'reservoir', 'solar_rooftop', - 'wind_offshore') + 'wind_offshore', 'nuclear', 'coal', 'lignite', 'oil') AND scenario = '{scn_name}' """ ) @@ -976,6 +977,85 @@ def fill_missing_bus_and_geom(gens, carrier): return gens + # Write conventional power plants in supply.egon_power_plants + conv = pd.read_csv( + cfg["sources"]["mastr_combustion"], + usecols=[ + "EinheitMastrNummer", + "Energietraeger", + "Nettonennleistung", + "ThermischeNutzleistung", + "Laengengrad", + "Breitengrad", + "Gemeinde", + "Inbetriebnahmedatum", + ], + ) + # drop chp generators + conv = conv[conv.ThermischeNutzleistung == 0] + # drop generators installed after 2019 + conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) + conv = conv[conv["Inbetriebnahmedatum"] < "2020-01-01"] + # filter just necessary carriers + conv = conv[ + conv.Energietraeger.isin( + ["Braunkohle", "Mineralölprodukte", "Steinkohle"] + ) + ] + # rename carriers + conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" + conv.loc[conv.Energietraeger == "Steinkohle", "Energietraeger"] = "coal" + conv.loc[ + conv.Energietraeger == "Mineralölprodukte", "Energietraeger" + ] = "oil" + # rename columns + conv.rename( + columns={ + "EinheitMastrNummer": "gens_id", + "Energietraeger": "carrier", + "Nettonennleistung": "capacity", + "Gemeinde": "city", + }, + inplace=True, + ) + conv["bus_id"] = np.nan + + conv["geom"] = gpd.points_from_xy( + conv.Laengengrad, conv.Breitengrad, crs=4326 + ) + conv.loc[ + (conv.Laengengrad.isna() | conv.Breitengrad.isna()), "geom" + ] = Point() + conv = gpd.GeoDataFrame(conv, geometry="geom") + + conv = fill_missing_bus_and_geom(conv, carrier="conventional") + conv["voltage_level"] = np.nan + + conv["voltage_level"] = assign_voltage_level_by_capacity( + conv.rename(columns={"capacity": "Nettonennleistung"}) + ) + + for i, row in conv.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier=row.carrier, + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=row.geom, + ) + session.add(entry) + session.commit() + + logging.info( + f""" + {len(conv)} conventional generators with a total installed capacity of + {conv.capacity.sum()}MW were inserted into the db + """ + ) + # Write hydro power plants in supply.egon_power_plants map_hydro = { "Laufwasseranlage": "run_of_river", @@ -1142,7 +1222,10 @@ def fill_missing_bus_and_geom(gens, carrier): }, ) -tasks = tasks + (wind_offshore.insert, assign_weather_data.weatherId_and_busId,) +tasks = tasks + ( + wind_offshore.insert, + assign_weather_data.weatherId_and_busId, +) class PowerPlants(Dataset): From 44913d655e9766b6dc421cf48725b6a13cb1e930 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:18:56 +0200 Subject: [PATCH 369/787] Replace append with concat --- src/egon/data/datasets/electricity_demand/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index d4b00bb82..2a8f173dc 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -149,7 +149,7 @@ def ve(s): * df["factor_2019"].values ) df_annual_demand_iter["zensus_population_id"] = df["cell_id"].values - df_annual_demand = df_annual_demand.append(df_annual_demand_iter) + df_annual_demand = pd.concat([df_annual_demand, df_annual_demand_iter]) df_annual_demand = ( df_annual_demand.groupby("zensus_population_id").sum().reset_index() @@ -212,7 +212,6 @@ def distribute_cts_demands(): # Insert data per scenario for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: - # Select heat_demand per zensus cell peta = db.select_dataframe( f"""SELECT zensus_population_id, demand as heat_demand, From 5f1488a2bd725c7f422d739af0a34253dfdd2ee2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:19:25 +0200 Subject: [PATCH 370/787] Set only values to existing dataframe --- src/egon/data/datasets/electricity_demand/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index 2a8f173dc..e0653663f 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -227,8 +227,10 @@ def distribute_cts_demands(): peta["nuts3"] = map_nuts3.nuts3 # Calculate share of nuts3 heat demand per zensus cell - peta["share"] = peta.heat_demand.groupby(peta.nuts3).apply( - lambda grp: grp / grp.sum() + peta["share"] = ( + peta.heat_demand.groupby(peta.nuts3) + .apply(lambda grp: grp / grp.sum()) + .values ) # Select forecasted electrical demands from demandregio table From 95c43e749becdcbe6338d9ce8754fc4c0d146c00 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:20:11 +0200 Subject: [PATCH 371/787] Rename parameter to new pandas version --- src/egon/data/datasets/electricity_demand/temporal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index d657112cf..75a846bec 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -72,7 +72,7 @@ def calc_load_curve(share_wz, annual_demand=1): start=f"01/01/{year}", end=f"01/01/{year+1}", freq="H", - closed="left", + inclusive="left", ) ) From edaeac181df720b51d2130c432c2bbc7737f00e8 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 6 Jul 2023 15:20:38 +0200 Subject: [PATCH 372/787] include nuclear generators --- .../data/datasets/power_plants/__init__.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 53ba073ef..f6ed0259e 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -977,6 +977,77 @@ def fill_missing_bus_and_geom(gens, carrier): return gens + # Write nuclear power plants in supply.egon_power_plants + nuclear = pd.read_csv( + cfg["sources"]["mastr_nuclear"], + usecols=[ + "EinheitMastrNummer", + "Energietraeger", + "Nettonennleistung", + "Laengengrad", + "Breitengrad", + "Gemeinde", + "Inbetriebnahmedatum", + ], + ) + # drop generators installed after 2019 + nuclear["Inbetriebnahmedatum"] = pd.to_datetime( + nuclear["Inbetriebnahmedatum"] + ) + nuclear = nuclear[nuclear["Inbetriebnahmedatum"] < "2020-01-01"] + + # rename carriers + nuclear.loc[ + nuclear.Energietraeger == "Kernenergie", "Energietraeger" + ] = "nuclear" + # rename columns + nuclear.rename( + columns={ + "EinheitMastrNummer": "gens_id", + "Energietraeger": "carrier", + "Nettonennleistung": "capacity", + "Gemeinde": "city", + }, + inplace=True, + ) + nuclear["bus_id"] = np.nan + + nuclear["geom"] = gpd.points_from_xy( + nuclear.Laengengrad, nuclear.Breitengrad, crs=4326 + ) + nuclear.loc[ + (nuclear.Laengengrad.isna() | nuclear.Breitengrad.isna()), "geom" + ] = Point() + nuclear = gpd.GeoDataFrame(nuclear, geometry="geom") + + nuclear = fill_missing_bus_and_geom(nuclear, carrier="nuclear") + nuclear["voltage_level"] = np.nan + + nuclear["voltage_level"] = assign_voltage_level_by_capacity( + nuclear.rename(columns={"capacity": "Nettonennleistung"}) + ) + + for i, row in nuclear.iterrows(): + entry = EgonPowerPlants( + sources={"el_capacity": "MaStR"}, + source_id={"MastrNummer": row.gens_id}, + carrier=row.carrier, + el_capacity=row.capacity, + scenario=scn_name, + bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=row.geom, + ) + session.add(entry) + session.commit() + + logging.info( + f""" + {len(nuclear)} nuclear generators with a total installed capacity of + {nuclear.capacity.sum()}MW were inserted into the db + """ + ) + # Write conventional power plants in supply.egon_power_plants conv = pd.read_csv( cfg["sources"]["mastr_combustion"], From 018f52986b85618e27c427085e495fa0d9381ab8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:20:52 +0200 Subject: [PATCH 373/787] Do not change index when using groupby --- src/egon/data/datasets/electricity_demand/temporal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index 75a846bec..abcc13169 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -170,7 +170,7 @@ def calc_load_curves_cts(scenario): ) # Calculate shares of cts branches per nuts3-region - nuts3_share_wz = demands_nuts.groupby("nuts3").apply( + nuts3_share_wz = demands_nuts.groupby("nuts3", as_index=False).apply( lambda grp: grp / grp.sum() ) From 7c58af68e9d2ed7a95f3b22348b03600667230e3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:21:13 +0200 Subject: [PATCH 374/787] Drop non-numeric columns before using groupby --- src/egon/data/datasets/electricity_demand/temporal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index abcc13169..f8a073554 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -190,7 +190,9 @@ def calc_load_curves_cts(scenario): # Calculate shares of cts branches per hvmv substation share_subst = ( - demands_zensus.drop("demand", axis=1).groupby("bus_id").mean() + demands_zensus.drop(["nuts3", "demand"], axis=1) + .groupby("bus_id") + .mean() ) # Calculate cts annual demand per hvmv substation From b3ccfb05d53d15cacd943f964410d5fab8588208 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:21:36 +0200 Subject: [PATCH 375/787] Black --- src/egon/data/datasets/electricity_demand/temporal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index f8a073554..f0943d58a 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -36,7 +36,7 @@ def create_table(): def calc_load_curve(share_wz, annual_demand=1): - """ Create aggregated demand curve for service sector + """Create aggregated demand curve for service sector Parameters ---------- @@ -86,7 +86,6 @@ def calc_load_curve(share_wz, annual_demand=1): # If shares per cts branch is a DataFrame (e.g. shares per substation) # demand curves are created for each row if type(share_wz) == pd.core.frame.DataFrame: - # Replace NaN values with 0 share_wz = share_wz.fillna(0.0) @@ -218,7 +217,6 @@ def insert_cts_load(): create_table() for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: - # Delete existing data from database db.execute_sql( f""" From b539b78168c43e7bc77511d151801e1ca9ec96de Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:22:04 +0200 Subject: [PATCH 376/787] Rename id to index --- .../data/datasets/electricity_demand_timeseries/hh_buildings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 7f38accd8..921d67d5c 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -364,7 +364,7 @@ def generate_synthetic_buildings(missing_buildings, edge_length): columns={ "building_count": "building_id", "cell_profile_ids": "profiles", - "index": "cell_id", + "id": "cell_id", } ) From 9539a260d4522f51e909e4845cd6ae569678ed48 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:22:22 +0200 Subject: [PATCH 377/787] Use groupby instead of level when summing over multiindex --- .../electricity_demand_timeseries/hh_buildings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 921d67d5c..e9ea3e770 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -683,9 +683,11 @@ def ve(s): names=("profile_id", "building_id"), ) df_building_peak_load_nuts3.columns = m_index - df_building_peak_load_nuts3 = df_building_peak_load_nuts3.sum( - level="building_id", axis=1 - ).max() + df_building_peak_load_nuts3 = ( + df_building_peak_load_nuts3.groupby("building_id", axis=1) + .sum() + .max() + ) df_building_peak_load_nuts3 = pd.DataFrame( [ From 5880645cab4e622c4deaa20acb6d9e8bd90de7e4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:23:10 +0200 Subject: [PATCH 378/787] Replace append with concat --- src/egon/data/datasets/industry/temporal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index 769064bab..d71c3b77f 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -112,7 +112,7 @@ def identify_bus(load_curves, demand_area): ).drop_duplicates(subset=["id"]) # Bring both dataframes together - peak_bus = peak_hv_c.append(peak_hv_p, ignore_index=True) + peak_bus = pd.concat([peak_hv_c, peak_hv_p], ignore_index=True) # Select ehv voronoi ehv_voronoi = db.select_geodataframe( @@ -133,7 +133,7 @@ def identify_bus(load_curves, demand_area): peak_ehv = gpd.sjoin(peak_ehv, ehv_voronoi, how="inner", op="intersects") # Bring both dataframes together - peak_bus = peak_bus.append(peak_ehv, ignore_index=True) + peak_bus = pd.concat([peak_bus, peak_ehv], ignore_index=True) # Combine dataframes to bring loadcurves and bus id together curves_da = pd.merge( From d9ffe9d9c935da5b2417b5432fab15020f17da7e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:23:28 +0200 Subject: [PATCH 379/787] Do not changes index when using groupby --- src/egon/data/datasets/industry/temporal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index d71c3b77f..76e1707f9 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -190,7 +190,7 @@ def calc_load_curves_ind_osm(scenario): ) # Calculate shares of industrial branches per osm area - osm_share_wz = demands_osm_area.groupby("osm_id").apply( + osm_share_wz = demands_osm_area.groupby(["osm_id"], as_index=False).apply( lambda grp: grp / grp.sum() ) From 1499ed4d2a8e1ef04eee05864bd9d7a36c717b78 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:23:46 +0200 Subject: [PATCH 380/787] Drop non-numeric columns before using griupby --- src/egon/data/datasets/industry/temporal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index 76e1707f9..43f2d6da5 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -219,7 +219,10 @@ def calc_load_curves_ind_osm(scenario): # Group all load curves per bus curves_bus = ( - curves_da.drop(["id"], axis=1).fillna(0).groupby("bus_id").sum() + curves_da.drop(["id", "geom"], axis=1) + .fillna(0) + .groupby("bus_id") + .sum() ) # Initalize pandas.DataFrame for export to database From cfc3963e64d5ed822ba7dd5c8e8592496fc7b85b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:24:01 +0200 Subject: [PATCH 381/787] Blacko --- src/egon/data/datasets/industry/temporal.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index 43f2d6da5..4018d9bbd 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -16,7 +16,6 @@ def identify_voltage_level(df): - """Identify the voltage_level of a grid component based on its peak load and defined thresholds. @@ -260,7 +259,6 @@ def insert_osm_ind_load(): ] for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: - # Delete existing data from database db.execute_sql( f""" @@ -429,7 +427,6 @@ def insert_sites_ind_load(): ] for scenario in egon.data.config.settings()["egon-data"]["--scenarios"]: - # Delete existing data from database db.execute_sql( f""" From fb8c9f7f37b876fc459ab1ce6462f0b724f3de62 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 6 Jul 2023 15:25:25 +0200 Subject: [PATCH 382/787] include nuclear in mastr_new to be downloaded --- src/egon/data/datasets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index c126c5b72..326b69f22 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -304,6 +304,7 @@ mastr_new: - "solar" - "biomass" - "combustion" + - "nuclear" file_basename: "bnetza_mastr" deposit_id: 1132987 egon2021_date_max: "2021-12-31 23:59:00" From 74b8f8ad887426fbb5fada75d6c24f51427fae55 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:31:52 +0200 Subject: [PATCH 383/787] Drop non-numeric columns before using groupby --- src/egon/data/datasets/industry/temporal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index 4018d9bbd..b1fb05900 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -383,10 +383,10 @@ def calc_load_curves_ind_sites(scenario): # Group all load curves per bus and wz curves_bus = ( - curves_da.fillna(0) + curves_da.drop(["id", "geom"], axis=1) + .fillna(0) .groupby(["bus_id", "wz"]) .sum() - .drop(["id"], axis=1) ) # Initalize pandas.DataFrame for pf table load timeseries From fce211bb642236926b2ed1d7e0d0fdaaf17a8f46 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:57:24 +0200 Subject: [PATCH 384/787] Replace append with concat --- src/egon/data/datasets/electricity_demand_etrago.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_etrago.py b/src/egon/data/datasets/electricity_demand_etrago.py index d143acf4a..a52f521ad 100644 --- a/src/egon/data/datasets/electricity_demand_etrago.py +++ b/src/egon/data/datasets/electricity_demand_etrago.py @@ -73,8 +73,9 @@ def demands_per_bus(scenario): # Create one df by appending all imported dataframes - demand_curves = cts_curves.append( - [ind_curves_osm, ind_curves_sites, hh_curves] + demand_curves = pd.concat( + [cts_curves, ind_curves_osm, ind_curves_sites, hh_curves], + ignore_index=True, ) # Split array to single columns in the dataframe From 7d7789411545fd4f1090248f3be1a8d4d5a63b3b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:58:03 +0200 Subject: [PATCH 385/787] Avoid problems with different datat types --- .../use_cases.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/use_cases.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/use_cases.py index e0081d90f..18a20e888 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/use_cases.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/use_cases.py @@ -151,7 +151,6 @@ def distribute_by_poi(region_poi: gpd.GeoDataFrame, num_points: int | float): def match_existing_points( region_points: gpd.GeoDataFrame, region_poi: gpd.GeoDataFrame ): - region_poi = region_poi.assign(exists=False) poi_buffer = region_poi.buffer(region_poi["radius"].astype(int)) region_points = region_points.assign(potential=0) @@ -165,7 +164,7 @@ def match_existing_points( # decent average as fallback region_points.at[i, "potential"] = 5 elif num_clusters == 1: - region_points.at[i, "potential"] = clusters["potential"] + region_points.at[i, "potential"] = clusters["potential"].values[0] region_poi.loc[cluster, "exists"] = True elif num_clusters > 1: From ab52f6ae56b1a335f3389475ddbf83f725fc89f5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:58:35 +0200 Subject: [PATCH 386/787] Replace append with concat --- .../datasets/heat_demand_timeseries/daily.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/daily.py b/src/egon/data/datasets/heat_demand_timeseries/daily.py index aeef26ef0..95da233e0 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/daily.py +++ b/src/egon/data/datasets/heat_demand_timeseries/daily.py @@ -192,16 +192,21 @@ def daily_demand_shares_per_climate_zone(): # Insert data into dataframe for index, row in daily_demand_shares.transpose().iterrows(): - - df = df.append( - pd.DataFrame( - data={ - "climate_zone": index, - "day_of_year": row.index.day_of_year, - "daily_demand_share": row.values, - "temperature_class": temperature_classes[index][row.index], - } - ) + df = pd.concat( + [ + df, + pd.DataFrame( + data={ + "climate_zone": index, + "day_of_year": row.index.day_of_year, + "daily_demand_share": row.values, + "temperature_class": temperature_classes[index][ + row.index + ], + } + ), + ], + ignore_index=True, ) # Insert dataframe to SQL table From 85056a69754b2d3bdcbe34064ae2971323a13c03 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:59:09 +0200 Subject: [PATCH 387/787] Replace append with concat --- .../heat_demand_timeseries/idp_pool.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py index e7f9f209f..54046a0b7 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py +++ b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py @@ -324,20 +324,23 @@ def create(): idp_df = pd.DataFrame(columns=["idp", "house", "temperature_class"]) for s in stock: for m in class_list: - if s == "SFH": i = class_list.index(m) if s == "MFH": i = class_list.index(m) + 9 current_pool = idp_list[i] - idp_df = idp_df.append( - pd.DataFrame( - data={ - "idp": current_pool.transpose().values.tolist(), - "house": s, - "temperature_class": m, - } - ) + idp_df = pd.concat( + [ + idp_df, + pd.DataFrame( + data={ + "idp": current_pool.transpose().values.tolist(), + "house": s, + "temperature_class": m, + } + ), + ], + ignore_index=True, ) idp_df = idp_df.reset_index(drop=True) From afa52d44d3959bed2fa1d39ba7e3d73838b72454 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:59:20 +0200 Subject: [PATCH 388/787] Black --- src/egon/data/datasets/heat_demand_timeseries/idp_pool.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py index 54046a0b7..9202fffe0 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py +++ b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py @@ -466,8 +466,8 @@ def select(): # Calculate annual heat demand per census cell annual_demand = annual_demand_generator( - scenario = egon.data.config.settings()["egon-data"]["--scenarios"][0] - ) + scenario=egon.data.config.settings()["egon-data"]["--scenarios"][0] + ) # Count number of SFH and MFH per climate zone houses_per_climate_zone = ( @@ -480,7 +480,6 @@ def select(): ) for station in houses_per_climate_zone.index: - result_SFH = pd.DataFrame(columns=range(1, 366)) result_MFH = pd.DataFrame(columns=range(1, 366)) From 36331e6687b8888ed4445ed03c31b2847987ab5b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 15:59:54 +0200 Subject: [PATCH 389/787] Replace append with concat --- .../datasets/heat_demand_timeseries/service_sector.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index 5af9c8e7a..305f73c7d 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -283,7 +283,9 @@ def CTS_demand_scale(aggregation_level): CTS_per_district.insert(0, "scenario", scenario) - CTS_district = CTS_district.append(CTS_per_district) + CTS_district = pd.concat( + [CTS_district, CTS_per_district], ignore_index=True + ) CTS_district = CTS_district.sort_index() mv_grid_ind = db.select_dataframe( @@ -332,7 +334,7 @@ def CTS_demand_scale(aggregation_level): CTS_per_grid.insert(0, "scenario", scenario) - CTS_grid = CTS_grid.append(CTS_per_grid) + CTS_grid = pd.concat([CTS_grid, CTS_per_grid]) CTS_grid = CTS_grid.sort_index() CTS_per_zensus = 0 @@ -358,7 +360,7 @@ def CTS_demand_scale(aggregation_level): CTS_per_zensus.reset_index(inplace=True) - CTS_zensus = CTS_zensus.append(CTS_per_grid) + CTS_zensus = pd.concat([CTS_zensus, CTS_per_grid]) CTS_zensus = CTS_zensus.set_index("bus_id") CTS_zensus = CTS_zensus.sort_index() From 1173711ad48e80030f67e5d20141fb138501bf41 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 16:00:04 +0200 Subject: [PATCH 390/787] Black --- src/egon/data/datasets/heat_demand_timeseries/service_sector.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index 305f73c7d..f16b37e6f 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -242,7 +242,6 @@ def CTS_demand_scale(aggregation_level): ) if aggregation_level == "district": - district_heating = db.select_dataframe( f""" SELECT area_id, zensus_population_id From 5845fd67098cb70d13244af731371c552d41b9ce Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 16:04:41 +0200 Subject: [PATCH 391/787] Exclude pydantic version that is not working with airflow==2.6.1 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 2521c2f0e..8748ea436 100755 --- a/setup.py +++ b/setup.py @@ -103,6 +103,7 @@ def read(*names, **kwargs): "psycopg2", "pyaml", "pypsa==0.17.1", + "pydantic!=2.0" "rasterio", "requests", "rioxarray", From 7703773a2d531ab0c1a273278621b08621168cec Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 16:13:41 +0200 Subject: [PATCH 392/787] Fix limit for requirements --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8748ea436..84e616770 100755 --- a/setup.py +++ b/setup.py @@ -103,7 +103,7 @@ def read(*names, **kwargs): "psycopg2", "pyaml", "pypsa==0.17.1", - "pydantic!=2.0" + "pydantic<2.0" "rasterio", "requests", "rioxarray", From c0acb40b969ed0b47a8c04b0152d7ffc10c2389a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 6 Jul 2023 16:16:34 +0200 Subject: [PATCH 393/787] fix requirements again --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 84e616770..e6ecc0f30 100755 --- a/setup.py +++ b/setup.py @@ -103,7 +103,7 @@ def read(*names, **kwargs): "psycopg2", "pyaml", "pypsa==0.17.1", - "pydantic<2.0" + "pydantic<2.0", "rasterio", "requests", "rioxarray", From c46a63d8667f5ef5513f3891df232a4dd1ae13f2 Mon Sep 17 00:00:00 2001 From: smhsadat <131297335+smhsadat@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:00:39 +0200 Subject: [PATCH 394/787] Add files via upload --- src/egon/data/NEP_Table_V4_JUL3.py | 116 +++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 src/egon/data/NEP_Table_V4_JUL3.py diff --git a/src/egon/data/NEP_Table_V4_JUL3.py b/src/egon/data/NEP_Table_V4_JUL3.py new file mode 100644 index 000000000..6186bdd4e --- /dev/null +++ b/src/egon/data/NEP_Table_V4_JUL3.py @@ -0,0 +1,116 @@ +import pandas as pd +import geopandas as gpd +import psycopg2 +from sqlalchemy import create_engine +from turtle import home +from shapely.geometry import Point +from geopy.distance import geodesic +import difflib + +# Create connection with pgAdmin4 - Offline +engine = create_engine( + f"postgresql+psycopg2://postgres:" + f"postgres@localhost:" + f"5432/etrago", + echo=False, +) + +# Read the Source file +substation_df = pd.read_sql( + """ + SELECT * FROM grid.egon_ehv_substation + UNION + SELECT * FROM grid.egon_hvmv_substation; + + """ + , engine) + + + +substation_df = gpd.read_postgis( + """ + SELECT * FROM grid.egon_ehv_substation + UNION + SELECT * FROM grid.egon_hvmv_substation; + + """ + , engine, geom_col="point") + + + +# Read the Destination file from CSV +lines_df = pd.read_csv("./egon_etrago_line_new.csv") + + +# # Read the Destination file from pgAdmin4 +# lines_df = pd.read_sql( +# """ +# SELECT * FROM grid.egon_etrago_line_new +# UNION +# SELECT * FROM grid.egon_etrago_line_new; + +# """ +# , engine) + +# lines_df = gpd.read_postgis( +# """ +# SELECT * FROM grid.egon_etrago_line_new +# UNION +# SELECT * FROM grid.egon_etrago_line_new; + +# """ +# , engine) + + +# Match Similarity of Source & Destination files +best_match_start=None +best_match_end=None + +for index, row in lines_df.iterrows(): + Startpunkt = str(row['Startpoint']) + Endpunkt = str(row['Endpoint']) + + for r in [1.0, 0.9, 0.8, 0.7, 0.6, 0.5]: + if best_match_start is None: + matching_rows_start = substation_df[substation_df['subst_name'].apply( + lambda x: any(difflib.SequenceMatcher(None, word, Startpunkt).ratio() >= r for word in x.split()))] + if not matching_rows_start.empty: + best_match_start = 1 + lines_df.at[index, 'bus0'] = matching_rows_start.iloc[0]['bus_id'] + point_1 = matching_rows_start.iloc[0]['point'] + formatted_point_1 = f"{point_1.x} {point_1.y}" + lines_df.at[index, 'Coordinate0'] = formatted_point_1 + + # Calculate the matching percentage + matching_percentage_start = difflib.SequenceMatcher(None, Startpunkt, matching_rows_start.iloc[0]['subst_name']).ratio() * 100 + lines_df.at[index, 'matching1%'] = round(matching_percentage_start,2) + + if best_match_end is None: + matching_rows_end = substation_df[substation_df['subst_name'].apply( + lambda x: any(difflib.SequenceMatcher(None, word, Endpunkt).ratio() >= r for word in x.split()))] + + if not matching_rows_end.empty: + best_match_end = 1 + lines_df.at[index, 'bus1'] = matching_rows_end.iloc[0]['bus_id'] + point_2 = matching_rows_end.iloc[0]['point'] + formatted_point_2 = f"{point_2.x} {point_2.y}" + lines_df.at[index, 'Coordinate1'] = formatted_point_2 + + # Calculate the matching percentage + matching_percentage_end = difflib.SequenceMatcher(None, Endpunkt, matching_rows_end.iloc[0]['subst_name']).ratio() * 100 + lines_df.at[index, 'matching2%'] = round(matching_percentage_end,2) + + if pd.notna(formatted_point_1) and pd.notna(formatted_point_2): + lon1, lat1 = map(float, formatted_point_1.split(' ')) + lon2, lat2 = map(float, formatted_point_2.split(' ')) + distance = geodesic((lat1, lon1), (lat2, lon2)).kilometers + lines_df.at[index, 'length'] = distance + + best_match_end = None + best_match_start = None + + +# Save the updated file +lines_df.to_csv('./egon_etrago_line_new.csv', index=False) + +print("Operation successful") \ No newline at end of file From 0d6e3d4ca0b216fb02d9a737948c17e1931d7b77 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 7 Jul 2023 13:33:33 +0200 Subject: [PATCH 395/787] find closest point using SQL queries --- src/egon/data/datasets/fix_ehv_subnetworks.py | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 0a9f15add..1e3a8c2ab 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -35,20 +35,17 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): if bus_id.empty: if find_closest: - buses = db.select_dataframe( - f""" - SELECT bus_id, x, y - FROM grid.egon_etrago_bus - WHERE v_nom = {v_nom} - AND scn_name = '{scn_name}' - AND carrier = '{carrier}' - """, - index_col="bus_id", - ) - buses["distance"] = buses.apply( - lambda b: ((b.x - x) ** 2 + (b.y - y) ** 2) ** (1 / 2), axis=1 - ) - return buses["distance"].idxmin() + bus_id = db.select_dataframe( + f""" + SELECT bus_id, st_distance(geom, 'SRID=4326;POINT({x} {y})'::geometry) + FROM grid.egon_etrago_bus + WHERE v_nom = {v_nom} + AND scn_name = '{scn_name}' + AND carrier = '{carrier}' + ORDER BY st_distance + Limit 1 + """) + return bus_id.bus_id[0] else: return None else: From 60a4ced92d6fcd9635af6dcc95be75e0d9c16ef9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 10 Jul 2023 08:58:42 +0200 Subject: [PATCH 396/787] Revert "Add files via upload" This reverts commit c46a63d8667f5ef5513f3891df232a4dd1ae13f2. --- src/egon/data/NEP_Table_V4_JUL3.py | 116 ----------------------------- 1 file changed, 116 deletions(-) delete mode 100644 src/egon/data/NEP_Table_V4_JUL3.py diff --git a/src/egon/data/NEP_Table_V4_JUL3.py b/src/egon/data/NEP_Table_V4_JUL3.py deleted file mode 100644 index 6186bdd4e..000000000 --- a/src/egon/data/NEP_Table_V4_JUL3.py +++ /dev/null @@ -1,116 +0,0 @@ -import pandas as pd -import geopandas as gpd -import psycopg2 -from sqlalchemy import create_engine -from turtle import home -from shapely.geometry import Point -from geopy.distance import geodesic -import difflib - -# Create connection with pgAdmin4 - Offline -engine = create_engine( - f"postgresql+psycopg2://postgres:" - f"postgres@localhost:" - f"5432/etrago", - echo=False, -) - -# Read the Source file -substation_df = pd.read_sql( - """ - SELECT * FROM grid.egon_ehv_substation - UNION - SELECT * FROM grid.egon_hvmv_substation; - - """ - , engine) - - - -substation_df = gpd.read_postgis( - """ - SELECT * FROM grid.egon_ehv_substation - UNION - SELECT * FROM grid.egon_hvmv_substation; - - """ - , engine, geom_col="point") - - - -# Read the Destination file from CSV -lines_df = pd.read_csv("./egon_etrago_line_new.csv") - - -# # Read the Destination file from pgAdmin4 -# lines_df = pd.read_sql( -# """ -# SELECT * FROM grid.egon_etrago_line_new -# UNION -# SELECT * FROM grid.egon_etrago_line_new; - -# """ -# , engine) - -# lines_df = gpd.read_postgis( -# """ -# SELECT * FROM grid.egon_etrago_line_new -# UNION -# SELECT * FROM grid.egon_etrago_line_new; - -# """ -# , engine) - - -# Match Similarity of Source & Destination files -best_match_start=None -best_match_end=None - -for index, row in lines_df.iterrows(): - Startpunkt = str(row['Startpoint']) - Endpunkt = str(row['Endpoint']) - - for r in [1.0, 0.9, 0.8, 0.7, 0.6, 0.5]: - if best_match_start is None: - matching_rows_start = substation_df[substation_df['subst_name'].apply( - lambda x: any(difflib.SequenceMatcher(None, word, Startpunkt).ratio() >= r for word in x.split()))] - if not matching_rows_start.empty: - best_match_start = 1 - lines_df.at[index, 'bus0'] = matching_rows_start.iloc[0]['bus_id'] - point_1 = matching_rows_start.iloc[0]['point'] - formatted_point_1 = f"{point_1.x} {point_1.y}" - lines_df.at[index, 'Coordinate0'] = formatted_point_1 - - # Calculate the matching percentage - matching_percentage_start = difflib.SequenceMatcher(None, Startpunkt, matching_rows_start.iloc[0]['subst_name']).ratio() * 100 - lines_df.at[index, 'matching1%'] = round(matching_percentage_start,2) - - if best_match_end is None: - matching_rows_end = substation_df[substation_df['subst_name'].apply( - lambda x: any(difflib.SequenceMatcher(None, word, Endpunkt).ratio() >= r for word in x.split()))] - - if not matching_rows_end.empty: - best_match_end = 1 - lines_df.at[index, 'bus1'] = matching_rows_end.iloc[0]['bus_id'] - point_2 = matching_rows_end.iloc[0]['point'] - formatted_point_2 = f"{point_2.x} {point_2.y}" - lines_df.at[index, 'Coordinate1'] = formatted_point_2 - - # Calculate the matching percentage - matching_percentage_end = difflib.SequenceMatcher(None, Endpunkt, matching_rows_end.iloc[0]['subst_name']).ratio() * 100 - lines_df.at[index, 'matching2%'] = round(matching_percentage_end,2) - - if pd.notna(formatted_point_1) and pd.notna(formatted_point_2): - lon1, lat1 = map(float, formatted_point_1.split(' ')) - lon2, lat2 = map(float, formatted_point_2.split(' ')) - distance = geodesic((lat1, lon1), (lat2, lon2)).kilometers - lines_df.at[index, 'length'] = distance - - best_match_end = None - best_match_start = None - - -# Save the updated file -lines_df.to_csv('./egon_etrago_line_new.csv', index=False) - -print("Operation successful") \ No newline at end of file From b968b45704409033b10dc5709605100f65ec1c5a Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 10 Jul 2023 09:56:22 +0200 Subject: [PATCH 397/787] use column name location instead of city --- .../data/datasets/power_plants/__init__.py | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f6ed0259e..5cdd3b7de 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -942,10 +942,12 @@ def power_plants_status_quo(scn_name="status2019"): def fill_missing_bus_and_geom(gens, carrier): # drop generators without data to get geometry. drop_id = gens[ - (gens.geom.is_empty) & ~(gens.city.isin(geom_municipalities.index)) + (gens.geom.is_empty) + & ~(gens.location.isin(geom_municipalities.index)) ].index new_geom = gens["capacity"][ - (gens.geom.is_empty) & (gens.city.isin(geom_municipalities.index)) + (gens.geom.is_empty) + & (gens.location.isin(geom_municipalities.index)) ] logging.info( f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] @@ -954,15 +956,15 @@ def fill_missing_bus_and_geom(gens, carrier): logging.info( f"""{len(new_geom)} {carrier} generator(s) ({new_geom - .sum()}MW) received a geom based on city + .sum()}MW) received a geom based on location """ ) gens.drop(index=drop_id, inplace=True) - # assign missing geometries based on city and buses based on geom + # assign missing geometries based on location and buses based on geom gens["geom"] = gens.apply( - lambda x: geom_municipalities.at[x["city"], "geom"] + lambda x: geom_municipalities.at[x["location"], "geom"] if x["geom"].is_empty else x["geom"], axis=1, @@ -1006,7 +1008,7 @@ def fill_missing_bus_and_geom(gens, carrier): "EinheitMastrNummer": "gens_id", "Energietraeger": "carrier", "Nettonennleistung": "capacity", - "Gemeinde": "city", + "Gemeinde": "location", }, inplace=True, ) @@ -1085,7 +1087,7 @@ def fill_missing_bus_and_geom(gens, carrier): "EinheitMastrNummer": "gens_id", "Energietraeger": "carrier", "Nettonennleistung": "capacity", - "Gemeinde": "city", + "Gemeinde": "location", }, inplace=True, ) @@ -1134,7 +1136,7 @@ def fill_missing_bus_and_geom(gens, carrier): } hydro = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['hydro']} + f"""SELECT *, city AS location FROM {cfg['sources']['hydro']} WHERE plant_type IN ('Laufwasseranlage', 'Speicherwasseranlage')""", con, geom_col="geom", @@ -1165,7 +1167,9 @@ def fill_missing_bus_and_geom(gens, carrier): # Write biomass power plants in supply.egon_power_plants biomass = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['biomass']}""", con, geom_col="geom" + f"""SELECT *, city AS location FROM {cfg['sources']['biomass']}""", + con, + geom_col="geom", ) biomass = fill_missing_bus_and_geom(biomass, carrier="biomass") @@ -1193,7 +1197,7 @@ def fill_missing_bus_and_geom(gens, carrier): # Write solar power plants in supply.egon_power_plants solar = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['pv']} + f"""SELECT *, city AS location FROM {cfg['sources']['pv']} WHERE site_type IN ('Freifläche', 'Bauliche Anlagen (Hausdach, Gebäude und Fassade)') """, con, @@ -1231,7 +1235,9 @@ def fill_missing_bus_and_geom(gens, carrier): # Write wind_onshore power plants in supply.egon_power_plants wind_onshore = gpd.GeoDataFrame.from_postgis( - f"""SELECT * FROM {cfg['sources']['wind']}""", con, geom_col="geom" + f"""SELECT *, city AS location FROM {cfg['sources']['wind']}""", + con, + geom_col="geom", ) wind_onshore = fill_missing_bus_and_geom( From 074bce3181d52ccdeecd07fad627e6a4a61b2522 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 10 Jul 2023 11:35:42 +0200 Subject: [PATCH 398/787] join nuclear and combustion --- .../data/datasets/power_plants/__init__.py | 116 +++++------------- 1 file changed, 31 insertions(+), 85 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 5cdd3b7de..c4339dbdc 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -979,108 +979,54 @@ def fill_missing_bus_and_geom(gens, carrier): return gens - # Write nuclear power plants in supply.egon_power_plants + # Write conventional power plants in supply.egon_power_plants + common_columns = [ + "EinheitMastrNummer", + "Energietraeger", + "Nettonennleistung", + "Laengengrad", + "Breitengrad", + "Gemeinde", + "Inbetriebnahmedatum", + ] + # import nuclear power plants nuclear = pd.read_csv( cfg["sources"]["mastr_nuclear"], - usecols=[ - "EinheitMastrNummer", - "Energietraeger", - "Nettonennleistung", - "Laengengrad", - "Breitengrad", - "Gemeinde", - "Inbetriebnahmedatum", - ], - ) - # drop generators installed after 2019 - nuclear["Inbetriebnahmedatum"] = pd.to_datetime( - nuclear["Inbetriebnahmedatum"] - ) - nuclear = nuclear[nuclear["Inbetriebnahmedatum"] < "2020-01-01"] - - # rename carriers - nuclear.loc[ - nuclear.Energietraeger == "Kernenergie", "Energietraeger" - ] = "nuclear" - # rename columns - nuclear.rename( - columns={ - "EinheitMastrNummer": "gens_id", - "Energietraeger": "carrier", - "Nettonennleistung": "capacity", - "Gemeinde": "location", - }, - inplace=True, + usecols=common_columns, ) - nuclear["bus_id"] = np.nan - - nuclear["geom"] = gpd.points_from_xy( - nuclear.Laengengrad, nuclear.Breitengrad, crs=4326 + # import combustion power plants + comb = pd.read_csv( + cfg["sources"]["mastr_combustion"], + usecols=common_columns + ["ThermischeNutzleistung"], ) - nuclear.loc[ - (nuclear.Laengengrad.isna() | nuclear.Breitengrad.isna()), "geom" - ] = Point() - nuclear = gpd.GeoDataFrame(nuclear, geometry="geom") - - nuclear = fill_missing_bus_and_geom(nuclear, carrier="nuclear") - nuclear["voltage_level"] = np.nan - nuclear["voltage_level"] = assign_voltage_level_by_capacity( - nuclear.rename(columns={"capacity": "Nettonennleistung"}) - ) + conv = pd.concat([comb, nuclear]) - for i, row in nuclear.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier=row.carrier, - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=row.geom, + conv = conv[ + conv.Energietraeger.isin( + ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie"] ) - session.add(entry) - session.commit() - - logging.info( - f""" - {len(nuclear)} nuclear generators with a total installed capacity of - {nuclear.capacity.sum()}MW were inserted into the db - """ - ) + ] - # Write conventional power plants in supply.egon_power_plants - conv = pd.read_csv( - cfg["sources"]["mastr_combustion"], - usecols=[ - "EinheitMastrNummer", - "Energietraeger", - "Nettonennleistung", - "ThermischeNutzleistung", - "Laengengrad", - "Breitengrad", - "Gemeinde", - "Inbetriebnahmedatum", - ], - ) - # drop chp generators - conv = conv[conv.ThermischeNutzleistung == 0] # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[conv["Inbetriebnahmedatum"] < "2020-01-01"] - # filter just necessary carriers - conv = conv[ - conv.Energietraeger.isin( - ["Braunkohle", "Mineralölprodukte", "Steinkohle"] - ) - ] + + # drop chp generators + conv["ThermischeNutzleistung"] = conv["ThermischeNutzleistung"].fillna(0) + conv = conv[conv.ThermischeNutzleistung == 0] + + # rename carriers conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" conv.loc[conv.Energietraeger == "Steinkohle", "Energietraeger"] = "coal" conv.loc[ conv.Energietraeger == "Mineralölprodukte", "Energietraeger" ] = "oil" + conv.loc[ + conv.Energietraeger == "Kernenergie", "Energietraeger" + ] = "nuclear" + # rename columns conv.rename( columns={ From 01b15f0faec16f352707b0674d0928a61196e235 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 10 Jul 2023 11:47:11 +0200 Subject: [PATCH 399/787] Exclude biomass generators with thermal capacity --- src/egon/data/datasets/power_plants/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index c4339dbdc..b8f8686d3 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1011,12 +1011,11 @@ def fill_missing_bus_and_geom(gens, carrier): # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[conv["Inbetriebnahmedatum"] < "2020-01-01"] - + # drop chp generators conv["ThermischeNutzleistung"] = conv["ThermischeNutzleistung"].fillna(0) conv = conv[conv.ThermischeNutzleistung == 0] - # rename carriers conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" conv.loc[conv.Energietraeger == "Steinkohle", "Energietraeger"] = "coal" @@ -1117,7 +1116,11 @@ def fill_missing_bus_and_geom(gens, carrier): con, geom_col="geom", ) - + + # drop chp generators + biomass["th_capacity"] = biomass["th_capacity"].fillna(0) + biomass = biomass[biomass.th_capacity == 0] + biomass = fill_missing_bus_and_geom(biomass, carrier="biomass") for i, row in biomass.iterrows(): From f18af17104cc87a18c31858c1d0c3bde8a35668d Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 10 Jul 2023 11:58:55 +0200 Subject: [PATCH 400/787] using config parameters instead of hard hard coded dates --- src/egon/data/datasets/power_plants/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index b8f8686d3..d750ba3e8 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -908,7 +908,6 @@ def power_plants_status_quo(scn_name="status2019"): con = db.engine() session = sessionmaker(bind=db.engine())() cfg = egon.data.config.datasets()["power_plants"] - db.execute_sql( f""" DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} @@ -1010,7 +1009,10 @@ def fill_missing_bus_and_geom(gens, carrier): # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) - conv = conv[conv["Inbetriebnahmedatum"] < "2020-01-01"] + conv = conv[ + conv["Inbetriebnahmedatum"] + < egon.data.config.datasets()["mastr_new"]["status2019_date_max"] + ] # drop chp generators conv["ThermischeNutzleistung"] = conv["ThermischeNutzleistung"].fillna(0) @@ -1116,11 +1118,11 @@ def fill_missing_bus_and_geom(gens, carrier): con, geom_col="geom", ) - + # drop chp generators biomass["th_capacity"] = biomass["th_capacity"].fillna(0) biomass = biomass[biomass.th_capacity == 0] - + biomass = fill_missing_bus_and_geom(biomass, carrier="biomass") for i, row in biomass.iterrows(): From 711eb374efcb28285a825f8b111dfa11169c8995 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 10 Jul 2023 14:52:29 +0200 Subject: [PATCH 401/787] update version power_plants dataset --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index d750ba3e8..db4731b35 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1260,7 +1260,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.21", + version="0.0.22", dependencies=dependencies, tasks=tasks, ) From 282896d5f5ae6086408dc5aa4f769203a1786416 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:31:26 +0200 Subject: [PATCH 402/787] Add zensus_population_id --- .../datasets/district_heating_areas/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index f00e01712..dff63c3af 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -597,13 +597,17 @@ def district_heating_areas(scenario_name, plotting=False): # group the resulting scenario specific district heating areas scenario_dh_area = area_grouping( pd.concat( - [cells[["residential_and_service_demand", "geom_polygon"]], - new_areas[["residential_and_service_demand", "geom_polygon"]] - ], ignore_index=True - ), + [ + cells[["residential_and_service_demand", "geom_polygon"]], + new_areas[["residential_and_service_demand", "geom_polygon"]], + ] + ).reset_index(), distance=500, maximum_total_demand=4e6, ) + scenario_dh_area.loc[:, "zensus_population_id"] = scenario_dh_area.loc[ + :, "zensus_population_id" + ].astype(int) # scenario_dh_area.plot(column = "area_id") scenario_dh_area.groupby("area_id").size().sort_values() @@ -618,12 +622,12 @@ def district_heating_areas(scenario_name, plotting=False): f"""DELETE FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario_name}'""" ) - scenario_dh_area[["scenario", "area_id"]].to_sql( + scenario_dh_area[["scenario", "area_id", "zensus_population_id"]].to_sql( "egon_map_zensus_district_heating_areas", schema="demand", con=db.engine(), if_exists="append", - index=False + index=False, ) # Create polygons around the grouped cells and store them in the database From 602a9478fa3281858d31181a10d74e0645627cdf Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:31:40 +0200 Subject: [PATCH 403/787] Black --- .../datasets/district_heating_areas/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index dff63c3af..6552228ad 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -422,9 +422,18 @@ def area_grouping( join_2["area_id"] = join_2.index_right + max_area_id + 1 - join = pd.concat([join, - join_2[["residential_and_service_demand", "geom_polygon", "area_id"]]], - ignore_index=True + join = pd.concat( + [ + join, + join_2[ + [ + "residential_and_service_demand", + "geom_polygon", + "area_id", + ] + ], + ], + ignore_index=True, ) return join From 4c739790ed17605ac9335599250cc2a7243e797f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:32:07 +0200 Subject: [PATCH 404/787] Replace append with concat --- .../datasets/electricity_demand_timeseries/cts_buildings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index 89851f945..21af89b8b 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -1241,8 +1241,8 @@ def adapt_numpy_int64(numpy_int64): ) df_lost_cells = df_lost_cells.explode("amenities") df_lost_cells.drop(columns="amenities", inplace=True) - df_amenities_without_buildings = df_amenities_without_buildings.append( - df_lost_cells, ignore_index=True + df_amenities_without_buildings = pd.concat( + [df_amenities_without_buildings, df_lost_cells], ignore_index=True ) log.info( f"{df_lost_cells.shape[0]} lost cells due to substation " From e83b9df9eacc361fa14d4618d70161ae008a59a6 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:32:58 +0200 Subject: [PATCH 405/787] Adjust groupby for new pandas version --- .../heat_demand_timeseries/__init__.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index f1415459d..86ba0e414 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -354,7 +354,7 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): ) diff = ( - slice_df.groupby("day").sum()[range(24)].sum().sum() + slice_df[range(24)].sum().sum() - annual_demand[ annual_demand.area_id == area ].demand_total.sum() @@ -368,7 +368,21 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): series for district heating grid {str(area)} is {diff}""" hh = np.concatenate( - slice_df.groupby("day").sum()[range(24)].values + slice_df.drop( + [ + "zensus_population_id", + "building_id", + "climate_zone", + "selected_idp", + "area_id", + "daily_demand_share", + "idp", + ], + axis="columns", + ) + .groupby("day") + .sum()[range(24)] + .values ).ravel() cts = CTS_demand_dist[ From 63c1ab6a77addbdc8eb2719aa24427ed07c274f5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:33:23 +0200 Subject: [PATCH 406/787] Access scenario names from CLI parameters --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 86ba0e414..89776c39c 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -795,12 +795,12 @@ def district_heating(method="python"): ) if method == "python": - create_district_heating_profile_python_like("status2019") - create_district_heating_profile_python_like("eGon2035") - create_district_heating_profile_python_like("eGon100RE") + for scenario in egon.data.config.settings()["egon-data"][ + "--scenarios" + ]: + create_district_heating_profile_python_like(scenario) else: - CTS_demand_dist, CTS_demand_grid, CTS_demand_zensus = CTS_demand_scale( aggregation_level="district" ) From 1c95020cbc628e6a49d3661c805ec28c744c170c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 09:33:44 +0200 Subject: [PATCH 407/787] Black --- .../data/datasets/heat_demand_timeseries/__init__.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 89776c39c..ed9f1811e 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -327,7 +327,6 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): ) if not selected_profiles.empty: - df = pd.merge( selected_profiles, daily_demand_shares, @@ -494,7 +493,6 @@ def create_individual_heat_per_mv_grid(scenario="eGon2035", mv_grid_id=1564): def calulate_peak_load(df, scenario): - # peat load in W_th data = ( df.groupby("building_id") @@ -519,7 +517,6 @@ def calulate_peak_load(df, scenario): def create_individual_heating_peak_loads(scenario="eGon2035"): - engine = db.engine() EgonIndividualHeatingPeakLoads.__table__.drop(bind=engine, checkfirst=True) @@ -578,7 +575,6 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): start_time = datetime.now() for grid in annual_demand.bus_id.unique(): - selected_profiles = db.select_dataframe( f""" SELECT a.zensus_population_id, building_id, c.climate_zone, @@ -629,7 +625,6 @@ def create_individual_heating_peak_loads(scenario="eGon2035"): def create_individual_heating_profile_python_like(scenario="eGon2035"): - start_time = datetime.now() idp_df = db.select_dataframe( @@ -694,7 +689,6 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): start_time = datetime.now() for grid in annual_demand.bus_id.unique(): - selected_profiles = db.select_dataframe( f""" SELECT a.zensus_population_id, building_id, c.climate_zone, @@ -787,7 +781,6 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): def district_heating(method="python"): - engine = db.engine() EgonTimeseriesDistrictHeating.__table__.drop(bind=engine, checkfirst=True) EgonTimeseriesDistrictHeating.__table__.create( @@ -876,7 +869,6 @@ def individual_heating_per_mv_grid_100(method="python"): def individual_heating_per_mv_grid(method="python"): - if method == "python": engine = db.engine() EgonEtragoTimeseriesIndividualHeating.__table__.drop( @@ -890,7 +882,6 @@ def individual_heating_per_mv_grid(method="python"): create_individual_heating_profile_python_like("eGon100RE") else: - engine = db.engine() EgonEtragoTimeseriesIndividualHeating.__table__.drop( bind=engine, checkfirst=True @@ -912,7 +903,6 @@ def individual_heating_per_mv_grid(method="python"): ) for index, row in ids.iterrows(): - for scenario in ["eGon2035", "eGon100RE"]: series = create_individual_heat_per_mv_grid( scenario, row.bus_id @@ -953,7 +943,6 @@ def individual_heating_per_mv_grid(method="python"): def store_national_profiles(): - scenario = "eGon100RE" df = db.select_dataframe( From 724f61f6298fed9ffc18070b309bc687ee34cdc8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:27:36 +0200 Subject: [PATCH 408/787] Replace append with concat --- src/egon/data/datasets/chp/small_chp.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/chp/small_chp.py b/src/egon/data/datasets/chp/small_chp.py index 21f9490ba..2a6f990d7 100755 --- a/src/egon/data/datasets/chp/small_chp.py +++ b/src/egon/data/datasets/chp/small_chp.py @@ -3,6 +3,7 @@ """ from sqlalchemy.orm import sessionmaker import geopandas as gpd +import pandas as pd import numpy as np from egon.data import config, db @@ -378,9 +379,11 @@ def extension_district_heating( if not areas_without_chp_only: # Append district heating areas with CHP # assumed dispatch of existing CHP is substracted from remaining demand - dh_areas = dh_areas.append( - db.select_geodataframe( - f""" + dh_areas = pd.concat( + [ + dh_areas, + db.select_geodataframe( + f""" SELECT b.residential_and_service_demand - sum(a.el_capacity)*{flh_chp} as demand, b.area_id, @@ -403,8 +406,9 @@ def extension_district_heating( b.residential_and_service_demand, b.area_id, geom_polygon) """, - epsg=3035, - ), + epsg=3035, + ), + ], ignore_index=True, ).set_crs(3035, allow_override=True) From 2d57c72aa1501d659b5d4871df15a8bccfd70e2e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:27:52 +0200 Subject: [PATCH 409/787] Black --- src/egon/data/datasets/chp/small_chp.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/chp/small_chp.py b/src/egon/data/datasets/chp/small_chp.py index 2a6f990d7..bade2152c 100755 --- a/src/egon/data/datasets/chp/small_chp.py +++ b/src/egon/data/datasets/chp/small_chp.py @@ -164,7 +164,6 @@ def extension_to_areas( # Add new CHP as long as the additional capacity is not reached while additional_capacity > existing_chp.el_capacity.min(): - if district_heating: selected_areas = areas.loc[ areas.demand > existing_chp.th_capacity.min() * flh, : @@ -175,7 +174,6 @@ def extension_to_areas( ] if len(selected_areas) > 0: - selected_areas = selected_areas.to_crs(4326) # Assign gas bus_id selected_areas["gas_bus_id"] = db.assign_gas_bus_id( @@ -577,7 +575,6 @@ def extension_per_federal_state(federal_state, EgonChp): ) if additional_capacity > 0: - share_dh = ( existing_capacity[ existing_capacity.district_heating @@ -734,11 +731,14 @@ def assign_use_case(chp, sources, scenario): # Chp which are close to a district heating area and not close to an # industrial location are assigned as district_heating_chp - district_heating_chp = district_heating_chp.append( - close_to_dh[~close_to_dh.index.isin(close_to_industry.index)] + district_heating_chp = pd.concat( + [ + district_heating_chp, + close_to_dh[~close_to_dh.index.isin(close_to_industry.index)], + ] ) # Set district_heating = True for all district heating chp chp.loc[district_heating_chp.index, "district_heating"] = True - return chp \ No newline at end of file + return chp From 1315b61843dde7a7c4550947fd683b7f9c63ba27 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:29:13 +0200 Subject: [PATCH 410/787] Replace append with concat --- .../data/datasets/electrical_neighbours.py | 159 ++++++++++-------- 1 file changed, 93 insertions(+), 66 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b062ac6d0..698d15bef 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -157,16 +157,22 @@ def buses(scenario, sources, targets): # if in test mode, add bus in center of Germany if config.settings()["egon-data"]["--dataset-boundary"] != "Everything": - central_buses = central_buses.append( - { - "scn_name": scenario, - "bus_id": next_bus_id, - "x": 10.4234469, - "y": 51.0834196, - "country": "DE", - "carrier": "AC", - "v_nom": 380.0, - }, + central_buses = pd.concat( + [ + central_buses, + pd.DataFrame( + index=[central_buses.index.max() + 1], + data={ + "scn_name": scenario, + "bus_id": next_bus_id, + "x": 10.4234469, + "y": 51.0834196, + "country": "DE", + "carrier": "AC", + "v_nom": 380.0, + }, + ), + ], ignore_index=True, ) next_bus_id += 1 @@ -179,38 +185,50 @@ def buses(scenario, sources, targets): for cntr in vnom_per_country.index: print(cntr) if 110.0 in vnom_per_country[cntr]: - central_buses = central_buses.append( - { - "scn_name": scenario, - "bus_id": next_bus_id, - "x": central_buses[ - central_buses.country == cntr - ].x.unique()[0], - "y": central_buses[ - central_buses.country == cntr - ].y.unique()[0], - "country": cntr, - "carrier": "AC", - "v_nom": 110.0, - }, + central_buses = pd.concat( + [ + central_buses, + pd.DataFrame( + index=[central_buses.index.max() + 1], + data={ + "scn_name": scenario, + "bus_id": next_bus_id, + "x": central_buses[ + central_buses.country == cntr + ].x.unique()[0], + "y": central_buses[ + central_buses.country == cntr + ].y.unique()[0], + "country": cntr, + "carrier": "AC", + "v_nom": 110.0, + }, + ), + ], ignore_index=True, ) next_bus_id += 1 if 220.0 in vnom_per_country[cntr]: - central_buses = central_buses.append( - { - "scn_name": scenario, - "bus_id": next_bus_id, - "x": central_buses[ - central_buses.country == cntr - ].x.unique()[0], - "y": central_buses[ - central_buses.country == cntr - ].y.unique()[0], - "country": cntr, - "carrier": "AC", - "v_nom": 220.0, - }, + central_buses = pd.concat( + [ + central_buses, + pd.DataFrame( + index=[central_buses.index.max() + 1], + data={ + "scn_name": scenario, + "bus_id": next_bus_id, + "x": central_buses[ + central_buses.country == cntr + ].x.unique()[0], + "y": central_buses[ + central_buses.country == cntr + ].y.unique()[0], + "country": cntr, + "carrier": "AC", + "v_nom": 220.0, + }, + ), + ], ignore_index=True, ) next_bus_id += 1 @@ -494,17 +512,23 @@ def central_transformer(scenario, sources, targets, central_buses, new_lines): s_nom, x = choose_transformer(s_nom) - trafo = trafo.append( - { - "trafo_id": trafo_id, - "bus0": row.bus_id, - "bus1": central_buses[ - (central_buses.v_nom == 380) - & (central_buses.country == row.country) - ].bus_id.values[0], - "s_nom": s_nom, - "x": x, - }, + trafo = pd.concat( + [ + trafo, + pd.DataFrame( + index=[trafo.index.max() + 1], + data={ + "trafo_id": trafo_id, + "bus0": row.bus_id, + "bus1": central_buses[ + (central_buses.v_nom == 380) + & (central_buses.country == row.country) + ].bus_id.values[0], + "s_nom": s_nom, + "x": x, + }, + ), + ], ignore_index=True, ) trafo_id += 1 @@ -611,23 +635,26 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): """ ).squeeze() - foreign_links = foreign_links.append( - pd.DataFrame( - index=[1], - data={ - "link_id": db.next_etrago_id("link") + 1, - "bus0": converter_bentwisch, - "bus1": central_buses[ - (central_buses.country == "DK") - & (central_buses.v_nom == 380) - & (central_buses.x > 10) - ] - .squeeze() - .bus_id, - "p_nom": 600, - "length": 170, - }, - ) + foreign_links = pd.concat( + [ + foreign_links, + pd.DataFrame( + index=[1], + data={ + "link_id": db.next_etrago_id("link") + 1, + "bus0": converter_bentwisch, + "bus1": central_buses[ + (central_buses.country == "DK") + & (central_buses.v_nom == 380) + & (central_buses.x > 10) + ] + .squeeze() + .bus_id, + "p_nom": 600, + "length": 170, + }, + ), + ] ) # Set parameters for all DC lines From daf02d32ca31f9487b9d274f164b7f2173a33f3d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:29:54 +0200 Subject: [PATCH 411/787] Set crs on geodataframe --- src/egon/data/datasets/electrical_neighbours.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 698d15bef..becd479ad 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -331,10 +331,11 @@ def cross_border_lines(scenario, sources, targets, central_buses): lines.loc[:, "foreign_bus"] = lines.loc[:, "foreign_bus"].astype(int) # Copy all parameters from border-crossing lines - new_lines = lines.copy() + new_lines = lines.copy().set_crs(4326) # Set bus0 as foreign_bus from osmtgmod new_lines.bus0 = new_lines.foreign_bus.copy() + new_lines.bus0 = new_lines.bus0.astype(int) # Add country tag and set index new_lines["country"] = ( @@ -369,8 +370,7 @@ def cross_border_lines(scenario, sources, targets, central_buses): ) # Set topo as geometry column - new_lines = new_lines.set_geometry("topo") - + new_lines = new_lines.set_geometry("topo").set_crs(4326) # Calcultae length of lines based on topology old_length = new_lines["length"].copy() new_lines["length"] = new_lines.to_crs(3035).length / 1000 From 0be19a7d9a30030e974d9d47bc81f76b26595b4c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:30:11 +0200 Subject: [PATCH 412/787] Black --- .../data/datasets/electrical_neighbours.py | 212 +++++++++++------- 1 file changed, 135 insertions(+), 77 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index becd479ad..add5350fe 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -3,7 +3,7 @@ import zipfile -#import entsoe +# import entsoe import requests import logging @@ -500,7 +500,6 @@ def central_transformer(scenario, sources, targets, central_buses, new_lines): # Add one transformer per central foreign bus with v_nom != 380 for i, row in central_buses[central_buses.v_nom != 380].iterrows(): - s_nom_0 = new_lines[new_lines.bus0 == row.bus_id].s_nom.sum() s_nom_1 = new_lines[new_lines.bus1 == row.bus_id].s_nom.sum() if s_nom_0 == 0.0: @@ -695,7 +694,6 @@ def grid(): targets = config.datasets()["electrical_neighbours"]["targets"] for scenario in config.settings()["egon-data"]["--scenarios"]: - central_buses = buses(scenario, sources, targets) foreign_lines = cross_border_lines( @@ -959,7 +957,9 @@ def insert_generators(capacities): ) gen.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[gen.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[gen.loc[:, "Node/Line"]] + .values ) # Add scenario column @@ -1095,7 +1095,9 @@ def insert_storage(capacities): ) store.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[store.loc[:, "Node/Line"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[store.loc[:, "Node/Line"]] + .values ) # Add columns for additional parameters to df @@ -1239,7 +1241,9 @@ def tyndp_demand(): buses[buses.nodes.isin(map_buses.keys())].index, "nodes" ] = buses[buses.nodes.isin(map_buses.keys())].nodes.map(map_buses) buses.loc[:, "bus"] = ( - get_foreign_bus_id(scenario='eGon2035').loc[buses.loc[:, "nodes"]].values + get_foreign_bus_id(scenario="eGon2035") + .loc[buses.loc[:, "nodes"]] + .values ) buses.set_index("nodes", inplace=True) buses = buses[~buses.index.duplicated(keep="first")] @@ -1300,24 +1304,39 @@ def tyndp_demand(): session.add(entry) session.add(entry_ts) session.commit() - -def entsoe_historic_generation_capacities(entsoe_token=None, year_start="20190101", year_end="20200101"): + + +def entsoe_historic_generation_capacities( + entsoe_token=None, year_start="20190101", year_end="20200101" +): client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") end = pd.Timestamp(year_end, tz="Europe/Brussels") start_gb = pd.Timestamp(year_start, tz="Europe/London") end_gb = pd.Timestamp(year_end, tz="Europe/London") - countries= ["LU", "AT", "FR", "NL", "CZ", - "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] - - # todo: define wanted countries + countries = [ + "LU", + "AT", + "FR", + "NL", + "CZ", + "DK_1", + "DK_2", + "PL", + "CH", + "NO", + "BE", + "SE", + "GB", + ] + # todo: define wanted countries not_retrieved = [] dfs = [] for country in countries: - if country == 'GB': + if country == "GB": kwargs = dict(start=start_gb, end=end_gb) else: kwargs = dict(start=start, end=end) @@ -1325,7 +1344,7 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 dfs.append( client.query_installed_generation_capacity(country, **kwargs) ) - + except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass @@ -1335,39 +1354,58 @@ def entsoe_historic_generation_capacities(entsoe_token=None, year_start="2019010 f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) df = pd.concat(dfs) - df['country']=countries - df.set_index('country', inplace=True) + df["country"] = countries + df.set_index("country", inplace=True) df.fillna(0, inplace=True) return df -def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="20200101"): + +def entsoe_historic_demand( + entsoe_token=None, year_start="20190101", year_end="20200101" +): client = entsoe.EntsoePandasClient(api_key=entsoe_token) - + start = pd.Timestamp(year_start, tz="Europe/Brussels") end = pd.Timestamp(year_end, tz="Europe/Brussels") start_gb = start.tz_convert("Europe/London") end_gb = end.tz_convert("Europe/London") - countries= ["LU", "AT", "FR", "NL", "CZ", - "DK_1", "DK_2", "PL", "CH", "NO", "BE", "SE", "GB"] - - + countries = [ + "LU", + "AT", + "FR", + "NL", + "CZ", + "DK_1", + "DK_2", + "PL", + "CH", + "NO", + "BE", + "SE", + "GB", + ] # todo: define wanted countries - not_retrieved = [] dfs = [] for country in countries: - if country == 'GB': + if country == "GB": kwargs = dict(start=start_gb, end=end_gb) else: kwargs = dict(start=start, end=end) try: - country_data = client.query_load(country, **kwargs).resample("H")["Actual Load"].mean() - if country == 'GB': - country_data.index = country_data.index.tz_convert("Europe/Brussels") + country_data = ( + client.query_load(country, **kwargs) + .resample("H")["Actual Load"] + .mean() + ) + if country == "GB": + country_data.index = country_data.index.tz_convert( + "Europe/Brussels" + ) dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) @@ -1379,10 +1417,11 @@ def entsoe_historic_demand(entsoe_token=None, year_start="20190101", year_end="2 df = pd.concat(dfs, axis=1) df.columns = countries - df.index = pd.date_range(year_start, periods=8760 , freq="H") + df.index = pd.date_range(year_start, periods=8760, freq="H") return df + def map_carriers_entsoe(): """Map carriers from entsoe-data to carriers used in eGon Returns @@ -1391,48 +1430,54 @@ def map_carriers_entsoe(): Carrier from entsoe to eGon """ return { - 'Biomass': "biomass", - 'Fossil Brown coal/Lignite': "lignite", - 'Fossil Coal-derived gas': "coal", - 'Fossil Gas': "CH4_NG", - 'Fossil Hard coal': "coal", - 'Fossil Oil': "oil", - 'Fossil Oil shale': "oil", - 'Fossil Peat': "biomass", - 'Geothermal': "geo_thermal", - 'Hydro Pumped Storage': "Hydro Pumped Storage", - 'Hydro Run-of-river and poundage': "run_of_river", - 'Hydro Water Reservoir': "reservoir", - 'Marine': "marine", - 'Nuclear': "nuclear", - 'Other': "others", - 'Other renewable': "others", - 'Solar': "solar", - 'Waste': "others", - 'Wind Offshore': "wind_offshore", - 'Wind Onshore': "wind_onshore", - } + "Biomass": "biomass", + "Fossil Brown coal/Lignite": "lignite", + "Fossil Coal-derived gas": "coal", + "Fossil Gas": "CH4_NG", + "Fossil Hard coal": "coal", + "Fossil Oil": "oil", + "Fossil Oil shale": "oil", + "Fossil Peat": "biomass", + "Geothermal": "geo_thermal", + "Hydro Pumped Storage": "Hydro Pumped Storage", + "Hydro Run-of-river and poundage": "run_of_river", + "Hydro Water Reservoir": "reservoir", + "Marine": "marine", + "Nuclear": "nuclear", + "Other": "others", + "Other renewable": "others", + "Solar": "solar", + "Waste": "others", + "Wind Offshore": "wind_offshore", + "Wind Onshore": "wind_onshore", + } + def entsoe_to_bus_etrago(): - map_entsoe= pd.Series({"LU": "LU00", - "AT": "AT00", - "FR": "FR00", - "NL": "NL00", - "DK_1": "DK00", - "DK_2": "DKE1", - "PL": "PL00", - "CH": "CH00", - "NO": "NO00", - "BE": "BE00", - "SE": "SE00", - "GB": "UK00", - "CZ": "CZ00"}) - - for_bus = get_foreign_bus_id(scenario='status2019') + map_entsoe = pd.Series( + { + "LU": "LU00", + "AT": "AT00", + "FR": "FR00", + "NL": "NL00", + "DK_1": "DK00", + "DK_2": "DKE1", + "PL": "PL00", + "CH": "CH00", + "NO": "NO00", + "BE": "BE00", + "SE": "SE00", + "GB": "UK00", + "CZ": "CZ00", + } + ) + + for_bus = get_foreign_bus_id(scenario="status2019") return map_entsoe.map(for_bus) -def insert_generators_sq(gen_sq=None, scn_name = "status2019"): + +def insert_generators_sq(gen_sq=None, scn_name="status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1450,7 +1495,9 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): """ ################# TEMPORAL #################### - gen_sq = pd.read_csv("data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index") + gen_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" + ) ################# TEMPORAL #################### targets = config.datasets()["electrical_neighbours"]["targets"] @@ -1486,7 +1533,9 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): carrier_entsoe = map_carriers_entsoe() gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() - gen_sq = gen_sq.iloc[:, gen_sq.columns.isin( + gen_sq = gen_sq.iloc[ + :, + gen_sq.columns.isin( [ "others", "wind_offshore", @@ -1499,15 +1548,20 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): "oil", "nuclear", ] - ) + ), ] - list_gen_sq = pd.DataFrame(dtype=int, columns=["carrier", "country", "capacity"]) + list_gen_sq = pd.DataFrame( + dtype=int, columns=["carrier", "country", "capacity"] + ) for carrier in gen_sq.columns: gen_carry = gen_sq[carrier] - for country, cap in gen_carry.iteritems(): - gen = pd.DataFrame({"carrier": carrier, "country": country, "capacity": cap}, index=[1]) - #print(gen) + for country, cap in gen_carry.items(): + gen = pd.DataFrame( + {"carrier": carrier, "country": country, "capacity": cap}, + index=[1], + ) + # print(gen) list_gen_sq = pd.concat([list_gen_sq, gen], ignore_index=True) list_gen_sq = list_gen_sq[list_gen_sq.capacity > 0] @@ -1595,7 +1649,8 @@ def insert_generators_sq(gen_sq=None, scn_name = "status2019"): return -def insert_loads_sq(load_sq=None, scn_name = "status2019"): + +def insert_loads_sq(load_sq=None, scn_name="status2019"): """ Copy load timeseries data from entso-e. @@ -1608,7 +1663,9 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): targets = config.datasets()["electrical_neighbours"]["targets"] ################# TEMPORAL #################### - load_sq = pd.read_csv("data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index") + load_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" + ) ################# TEMPORAL #################### # Delete existing data @@ -1654,7 +1711,6 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): # Calculate and insert demand timeseries per etrago bus_id for country in load_sq.columns: - load_id = db.next_etrago_id("load") entry = etrago.EgonPfHvLoad( @@ -1675,7 +1731,8 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): session.add(entry_ts) session.commit() -tasks = (grid, ) + +tasks = (grid,) insert_per_scenario = set() @@ -1685,7 +1742,8 @@ def insert_loads_sq(load_sq=None, scn_name = "status2019"): if "status2019" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update([insert_generators_sq, insert_loads_sq]) -tasks = tasks + (insert_per_scenario, ) +tasks = tasks + (insert_per_scenario,) + class ElectricalNeighbours(Dataset): def __init__(self, dependencies): From 1ae4286268bfe4855ce3cdc4d975d7ba671c3eb3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:30:43 +0200 Subject: [PATCH 413/787] Replace append with concat --- src/egon/data/datasets/fill_etrago_gen.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index c9d8ea68b..466adba9a 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -106,25 +106,30 @@ def add_marginal_costs(power_plants): for carrier in pp_scn.carrier.unique(): if carrier not in (marginal_costs.index): warning.append(carrier) - marginal_costs = marginal_costs.append( - pd.Series(name=carrier, data={"marginal_cost": 0}) + marginal_costs = pd.concat( + [ + marginal_costs, + pd.Series(name=carrier, data={"marginal_cost": 0}), + ] ) if warning: print( f"""There are not marginal_cost values for: \n{warning} in the scenario {scenario}. Missing values set to 0""" ) - pp = pp.append( - pp_scn.merge( - right=marginal_costs, left_on="carrier", right_index=True - ) + pp = pd.concat( + [ + pp, + pp_scn.merge( + right=marginal_costs, left_on="carrier", right_index=True + ), + ] ) return pp def fill_etrago_gen_table(etrago_pp2, etrago_gen_orig, cfg, con): - etrago_pp = etrago_pp2[ ["carrier", "el_capacity", "bus_id", "scenario", "marginal_cost"] ] From a8d0b764abd4a7e8dc74eff48906b3d3910aba3e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:30:55 +0200 Subject: [PATCH 414/787] Black --- src/egon/data/datasets/fill_etrago_gen.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index 466adba9a..8646e2326 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -65,7 +65,6 @@ def fill_etrago_generators(): def group_power_plants(power_plants, renew_feedin, etrago_gen_orig, cfg): - # group power plants by bus and carrier agg_func = { @@ -89,7 +88,6 @@ def group_power_plants(power_plants, renew_feedin, etrago_gen_orig, cfg): def add_marginal_costs(power_plants): - scenarios = power_plants.scenario.unique() pp = pd.DataFrame() @@ -248,7 +246,6 @@ def power_timeser(weather_data): def adjust_renew_feedin_table(renew_feedin, cfg): - # Define carrier 'pv' as 'solar' carrier_pv_mask = renew_feedin["carrier"] == "pv" renew_feedin.loc[carrier_pv_mask, "carrier"] = "solar" From 38d1505e455489445b1b5fd75556ece15d96b32d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:31:16 +0200 Subject: [PATCH 415/787] Replace append with concat --- src/egon/data/datasets/gas_grid.py | 48 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 069b71afb..4efc5382c 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -324,30 +324,42 @@ def insert_gas_buses_abroad(scn_name="status2019"): gdf_abroad_buses["bus_id"] = range(new_id, new_id + len(gdf_abroad_buses)) # Add central bus in Russia - gdf_abroad_buses = gdf_abroad_buses.append( - { - "scn_name": scn_name, - "bus_id": (new_id + len(gdf_abroad_buses) + 1), - "x": 41, - "y": 55, - "country": "RU", - "carrier": main_gas_carrier, - }, + gdf_abroad_buses = pd.concat( + [ + gdf_abroad_buses, + pd.DataFrame( + index=[gdf_abroad_buses.index.max() + 1], + data={ + "scn_name": scn_name, + "bus_id": (new_id + len(gdf_abroad_buses) + 1), + "x": 41, + "y": 55, + "country": "RU", + "carrier": main_gas_carrier, + }, + ), + ], ignore_index=True, ) # if in test mode, add bus in center of Germany boundary = settings()["egon-data"]["--dataset-boundary"] if boundary != "Everything": - gdf_abroad_buses = gdf_abroad_buses.append( - { - "scn_name": scn_name, - "bus_id": (new_id + len(gdf_abroad_buses) + 1), - "x": 10.4234469, - "y": 51.0834196, - "country": "DE", - "carrier": main_gas_carrier, - }, + gdf_abroad_buses = pd.concat( + [ + gdf_abroad_buses, + pd.DataFrame( + index=[gdf_abroad_buses.index.max() + 1], + data={ + "scn_name": scn_name, + "bus_id": (new_id + len(gdf_abroad_buses) + 1), + "x": 10.4234469, + "y": 51.0834196, + "country": "DE", + "carrier": main_gas_carrier, + }, + ), + ], ignore_index=True, ) From 62dbb9eef5cfa99eba4fef92816b91e3e247fd2f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:31:48 +0200 Subject: [PATCH 416/787] Replace append with concat --- src/egon/data/datasets/power_plants/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f2bb42e5c..d83f02cb2 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -822,7 +822,7 @@ def allocate_other_power_plants(): "and Technologie == 'ORCOrganicRankineCycleAnlage'" ) - mastr_sg = mastr_sludge.append(mastr_geothermal) + mastr_sg = pd.concat([mastr_sludge, mastr_geothermal]) # Insert geometry column mastr_sg = mastr_sg[~(mastr_sg["Laengengrad"].isnull())] @@ -856,7 +856,7 @@ def allocate_other_power_plants(): mastr_sg.loc[:, "Nettonennleistung"] *= 1e-3 # Merge different sources to one df - mastr_others = mastr_sg.append(mastr_combustion).reset_index() + mastr_others = pd.concat([mastr_sg, mastr_combustion]).reset_index() # Delete entries outside Schleswig-Holstein for test mode if boundary == "Schleswig-Holstein": From bdcc49b031d6cc809f677110deb66d922c1d45ef Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:32:01 +0200 Subject: [PATCH 417/787] Black --- src/egon/data/datasets/power_plants/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index d83f02cb2..3fa940386 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1142,7 +1142,10 @@ def fill_missing_bus_and_geom(gens, carrier): }, ) -tasks = tasks + (wind_offshore.insert, assign_weather_data.weatherId_and_busId,) +tasks = tasks + ( + wind_offshore.insert, + assign_weather_data.weatherId_and_busId, +) class PowerPlants(Dataset): From d6ad5a1706fd355525aefcdb784c02bbc52ea061 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:32:44 +0200 Subject: [PATCH 418/787] Change column names of to pypsa version --- .../data/datasets/pypsaeursec/__init__.py | 85 +++++++++++++++---- 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/pypsaeursec/__init__.py b/src/egon/data/datasets/pypsaeursec/__init__.py index 5827fa690..69760778f 100755 --- a/src/egon/data/datasets/pypsaeursec/__init__.py +++ b/src/egon/data/datasets/pypsaeursec/__init__.py @@ -502,7 +502,7 @@ def neighbor_reduction(): neighbor_gens.index += db.next_etrago_id("generator") for i in neighbor_gens_t.columns: - new_index = neighbor_gens[neighbor_gens["name"] == i].index + new_index = neighbor_gens[neighbor_gens["Generator"] == i].index neighbor_gens_t.rename(columns={i: new_index[0]}, inplace=True) # loads @@ -520,7 +520,7 @@ def neighbor_reduction(): neighbor_loads.index += db.next_etrago_id("load") for i in neighbor_loads_t.columns: - new_index = neighbor_loads[neighbor_loads["index"] == i].index + new_index = neighbor_loads[neighbor_loads["Load"] == i].index neighbor_loads_t.rename(columns={i: new_index[0]}, inplace=True) # stores @@ -537,7 +537,7 @@ def neighbor_reduction(): neighbor_stores.index += db.next_etrago_id("store") for i in neighbor_stores_t.columns: - new_index = neighbor_stores[neighbor_stores["name"] == i].index + new_index = neighbor_stores[neighbor_stores["Store"] == i].index neighbor_stores_t.rename(columns={i: new_index[0]}, inplace=True) # storage_units @@ -560,7 +560,9 @@ def neighbor_reduction(): neighbor_storage.index += db.next_etrago_id("storage") for i in neighbor_storage_t.columns: - new_index = neighbor_storage[neighbor_storage["name"] == i].index + new_index = neighbor_storage[ + neighbor_storage["StorageUnit"] == i + ].index neighbor_storage_t.rename(columns={i: new_index[0]}, inplace=True) # Connect to local database @@ -585,10 +587,19 @@ def neighbor_reduction(): c_neighbors = pd.concat([coordinates, c_neighbors], axis=1).set_index( "new_index", drop=False ) - non_AC_neighbors = non_AC_neighbors.append(c_neighbors) - neighbors = neighbors[neighbors.carrier == "AC"].append(non_AC_neighbors) + non_AC_neighbors = pd.concat([non_AC_neighbors, c_neighbors]) + neighbors = pd.concat( + [neighbors[neighbors.carrier == "AC"], non_AC_neighbors] + ) - for i in ["new_index", "control", "generator", "location", "sub_network"]: + for i in [ + "new_index", + "control", + "generator", + "location", + "sub_network", + "unit", + ]: neighbors = neighbors.drop(i, axis=1) # Add geometry column @@ -628,7 +639,7 @@ def lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE"): neighbor_lines["s_nom"] = neighbor_lines["s_nom_min"] for i in [ - "name", + "Line", "x_pu_eff", "r_pu_eff", "sub_network", @@ -706,7 +717,7 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): if extendable is True: neighbor_links = neighbor_links.drop( columns=[ - "name", + "Link", "geometry", "tags", "under_construction", @@ -721,6 +732,17 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): "lifetime", "p_nom_opt", "pipe_retrofit", + "committable", + "start_up_cost", + "shut_down_cost", + "min_up_time", + "min_down_time", + "up_time_before", + "down_time_before", + "ramp_limit_up", + "ramp_limit_down", + "ramp_limit_start_up", + "ramp_limit_shut_down", ], errors="ignore", ) @@ -728,7 +750,7 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): elif extendable is False: neighbor_links = neighbor_links.drop( columns=[ - "name", + "Link", "geometry", "tags", "under_construction", @@ -744,6 +766,17 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): "p_nom", "p_nom_extendable", "pipe_retrofit", + "committable", + "start_up_cost", + "shut_down_cost", + "min_up_time", + "min_down_time", + "up_time_before", + "down_time_before", + "ramp_limit_up", + "ramp_limit_start_up", + "ramp_limit_down", + "ramp_limit_shut_down", ], errors="ignore", ) @@ -844,7 +877,14 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): inplace=True, ) - for i in ["name", "weight", "lifetime", "p_set", "q_set", "p_nom_opt"]: + for i in [ + "Generator", + "weight", + "lifetime", + "p_set", + "q_set", + "p_nom_opt", + ]: neighbor_gens = neighbor_gens.drop(i, axis=1) neighbor_gens.to_sql( @@ -875,7 +915,7 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): ) neighbor_loads = neighbor_loads.drop( - columns=["index"], + columns=["Load"], errors="ignore", ) @@ -916,8 +956,16 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): "carrier", ] = "H2_overground" - for i in ["name", "p_set", "q_set", "e_nom_opt", "lifetime"]: - neighbor_stores = neighbor_stores.drop(i, axis=1) + for i in [ + "Store", + "p_set", + "q_set", + "e_nom_opt", + "lifetime", + "e_initial_per_period", + "e_cyclic_per_period", + ]: + neighbor_stores = neighbor_stores.drop(i, axis=1, errors="ignore") neighbor_stores.to_sql( "egon_etrago_store", @@ -938,8 +986,13 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True): {"PHS": "pumped_hydro", "hydro": "reservoir"}, inplace=True ) - for i in ["name", "p_nom_opt"]: - neighbor_storage = neighbor_storage.drop(i, axis=1) + for i in [ + "StorageUnit", + "p_nom_opt", + "state_of_charge_initial_per_period", + "cyclic_state_of_charge_per_period", + ]: + neighbor_storage = neighbor_storage.drop(i, axis=1, errors="ignore") neighbor_storage.to_sql( "egon_etrago_storage", From 1effc22935d6a594fe7f8fb1fef87036899a6149 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:33:39 +0200 Subject: [PATCH 419/787] Replace append with concat --- src/egon/data/datasets/scenario_capacities.py | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 24b8d02ea..be8f8b4d6 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -313,7 +313,7 @@ def insert_capacities_per_federal_state_nep(): # convert GW to MW data.capacity *= 1e3 - insert_data = insert_data.append(data) + insert_data = pd.concat([insert_data, data]) # Get aggregated capacities from nep's power plant list for certain carrier @@ -722,14 +722,17 @@ def eGon100_capacities(): df.index = df.index.str.replace(" ", "_") # Aggregate offshore wind - df = df.append( - pd.DataFrame( - index=["wind_offshore"], - data={ - "p_nom": (df.p_nom["offwind-ac"] + df.p_nom["offwind-dc"]), - "component": df.component["offwind-ac"], - }, - ) + df = pd.concat( + [ + df, + pd.DataFrame( + index=["wind_offshore"], + data={ + "p_nom": (df.p_nom["offwind-ac"] + df.p_nom["offwind-dc"]), + "component": df.component["offwind-ac"], + }, + ), + ] ) df = df.drop(["offwind-ac", "offwind-dc"]) @@ -746,19 +749,22 @@ def eGon100_capacities(): "rural_solar_thermal", ]: if f"residential_{merge_carrier}" in df.index: - df = df.append( - pd.DataFrame( - index=[merge_carrier], - data={ - "p_nom": ( - df.p_nom[f"residential_{merge_carrier}"] - + df.p_nom[f"services_{merge_carrier}"] - ), - "component": df.component[ - f"residential_{merge_carrier}" - ], - }, - ) + df = pd.concat( + [ + df, + pd.DataFrame( + index=[merge_carrier], + data={ + "p_nom": ( + df.p_nom[f"residential_{merge_carrier}"] + + df.p_nom[f"services_{merge_carrier}"] + ), + "component": df.component[ + f"residential_{merge_carrier}" + ], + }, + ), + ] ) df = df.drop( [f"residential_{merge_carrier}", f"services_{merge_carrier}"] From 963a9acd8695ce3c993f7fc129d223e1aa5d1690 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:33:54 +0200 Subject: [PATCH 420/787] Black --- src/egon/data/datasets/scenario_capacities.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index be8f8b4d6..e83e64c4f 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -139,10 +139,10 @@ def insert_capacities_status2019(): ) """ ) - + # Include small storages for scenario2019 - small_storages = 600 #MW for Germany - + small_storages = 600 # MW for Germany + db.execute_sql( f""" INSERT INTO @@ -158,8 +158,6 @@ def insert_capacities_status2019(): ) """ ) - - def insert_capacities_per_federal_state_nep(): From a451d4f79483b7e9295c47ac8c552140ae743e74 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:37:06 +0200 Subject: [PATCH 421/787] Replace append with concat --- src/egon/data/datasets/heat_supply/district_heating.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/district_heating.py b/src/egon/data/datasets/heat_supply/district_heating.py index abc466505..3b62c87f6 100644 --- a/src/egon/data/datasets/heat_supply/district_heating.py +++ b/src/egon/data/datasets/heat_supply/district_heating.py @@ -367,8 +367,8 @@ def cascade_heat_supply(scenario, plotting=True): scenario, areas, technologies, capacity_per_category, size_dh ) - resulting_capacities = resulting_capacities.append( - append_df, ignore_index=True + resulting_capacities = pd.concat( + [resulting_capacities, append_df], ignore_index=True ) # Plot results per district heating area From 67ff7072185ef810ad13a6b2b061ccf099d10583 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:37:35 +0200 Subject: [PATCH 422/787] Replace append with concat --- .../data/datasets/heat_supply/individual_heating.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 0392e6f59..e464c6d1b 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -629,8 +629,8 @@ def cascade_heat_supply_indiv(scenario, distribution_level, plotting=True): heat_per_mv, technologies, scenario, distribution_level ) # Collect resulting capacities - resulting_capacities = resulting_capacities.append( - append_df, ignore_index=True + resulting_capacities = pd.concat( + [resulting_capacities, append_df], ignore_index=True ) if plotting: @@ -1145,8 +1145,8 @@ def get_buildings_with_decentral_heat_demand_in_mv_grid(mvgd, scenario): ) # merge residential and CTS buildings - buildings_decentral_heating = buildings_decentral_heating_res.append( - buildings_decentral_heating_cts + buildings_decentral_heating = pd.concat( + [buildings_decentral_heating_res, buildings_decentral_heating_cts] ).unique() return buildings_decentral_heating @@ -1330,8 +1330,8 @@ def determine_buildings_with_hp_in_mv_grid( random.seed(db.credentials()["--random-seed"]) new_hp_building = random.choice(possible_buildings) # add new building to building with HP - buildings_with_hp = buildings_with_hp.append( - pd.Index([new_hp_building]) + buildings_with_hp = pd.concat( + [buildings_with_hp, pd.Index([new_hp_building])] ) # determine if there are still possible buildings remaining_hp_cap = ( From 0a92c4235bec3b72a3878cb789dac807d12c26e7 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:37:46 +0200 Subject: [PATCH 423/787] Black --- src/egon/data/datasets/heat_supply/individual_heating.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index e464c6d1b..74299b707 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -1989,7 +1989,6 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): df_hp_cap_per_building_2019_db["scenario"] = "status2019" - # TODO debug duplicated building_ids duplicates = df_hp_cap_per_building_2019_db.loc[ df_hp_cap_per_building_2019_db.duplicated("building_id", keep=False) From d4eae8eb38749c0191e8ca028de69d556251e5a8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:38:17 +0200 Subject: [PATCH 424/787] Comment logging in osmtgmod to avoid problems with new versions --- src/egon/data/datasets/osmtgmod/__init__.py | 53 +++++++++++---------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index 8a325ba2c..21a84b73a 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -19,8 +19,9 @@ import egon.data.subprocess as subproc -def run(): +def run(): + sys.setrecursionlimit(5000) # execute osmTGmod data_config = egon.data.config.datasets() @@ -217,21 +218,21 @@ def osmtgmod( # ============================================================== # Setup logging # ============================================================== - log = logging.getLogger() - log.setLevel(logging.INFO) - logformat = logging.Formatter( - "%(asctime)s %(message)s", "%m/%d/%Y %H:%M:%S" - ) - sh = logging.StreamHandler() - sh.setFormatter(logformat) - log.addHandler(sh) - logging.info("\n\n======================\nego_otg\n======================") - logging.info("Logging to standard output...") - # catch up some log messages from evaluation of command line arguments - logging.info("Database: {}".format(config_database)) - logging.info( - "Path for configuration file and results: {}".format(config_basepath) - ) + # log = logging.getLogger() + # log.setLevel(logging.INFO) + # logformat = logging.Formatter( + # "%(asctime)s %(message)s", "%m/%d/%Y %H:%M:%S" + # ) + # sh = logging.StreamHandler() + # sh.setFormatter(logformat) + # log.addHandler(sh) + # logging.info("\n\n======================\nego_otg\n======================") + # logging.info("Logging to standard output...") + # # catch up some log messages from evaluation of command line arguments + # logging.info("Database: {}".format(config_database)) + # logging.info( + # "Path for configuration file and results: {}".format(config_basepath) + # ) # ============================================================== # read configuration from file and create folder structure # ============================================================== @@ -260,16 +261,16 @@ def osmtgmod( if not os.path.exists(result_dir): os.makedirs(result_dir) # start logging to file - logfile = os.path.join(config_basepath, config_database + ".log") - fh = logging.FileHandler(logfile) - fh.setFormatter(logformat) - log.addHandler(fh) - logging.info("Logging to file '{0}' is set up".format(logfile)) - logging.info( - "Now logging both to standard output and to file '{0}'...".format( - logfile - ) - ) + # logfile = os.path.join(config_basepath, config_database + ".log") + # fh = logging.FileHandler(logfile) + # fh.setFormatter(logformat) + # log.addHandler(fh) + # logging.info("Logging to file '{0}' is set up".format(logfile)) + # logging.info( + # "Now logging both to standard output and to file '{0}'...".format( + # logfile + # ) + # ) logging.info("\n\n======================\nego_otg\n======================") # copy config file logging.info( From f4963933d6cd78499b5354d87ca7ba86b48c9b6c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:49:29 +0200 Subject: [PATCH 425/787] Replace append with concat --- .../emobility/motorized_individual_travel/ev_allocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index a3e1c8346..8dc4687e6 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -105,7 +105,7 @@ def fix_missing_ags_municipality_regiostar(muns, rs7_data): f"based upon AGS {ags}." ) similar_entry.ags = ags - rs7_data = rs7_data.append(similar_entry) + rs7_data = pd.concat([rs7_data, similar_entry]) print("Consider to update RS7.") # VG250 entries missing: elif name == "VG250": From fcedaea72b1f0a533a5b5ac50bb826beabc6ef93 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:49:41 +0200 Subject: [PATCH 426/787] Black --- .../emobility/motorized_individual_travel/ev_allocation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index 8dc4687e6..f79d133f1 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -422,7 +422,7 @@ def allocate_evs_numbers(): # Import kba_data = read_kba_data() rs7_data = read_rs7_data() - + for scenario_name in config.settings()["egon-data"]["--scenarios"]: # Load scenario params scenario_parameters = get_sector_parameters( @@ -436,7 +436,6 @@ def allocate_evs_numbers(): scenario_variation_name, scenario_variation_parameters, ) in scenario_parameters.items(): - print(f" SCENARIO VARIATION: {scenario_variation_name}") # Get EV target ev_target = scenario_variation_parameters["ev_count"] From f3ee14d96de2a609c65527ec4718fd1ae4122d7d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:50:01 +0200 Subject: [PATCH 427/787] Replace append with concat --- src/egon/data/datasets/power_plants/assign_weather_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 958804967..8e0fd352a 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -89,7 +89,7 @@ def find_bus_id(power_plants, cfg): if len(power_plants_no_busId) > 0: power_plants_no_busId = assign_bus_id(power_plants_no_busId, cfg) - power_plants = power_plants.append(power_plants_no_busId) + power_plants = pd.concat([power_plants, power_plants_no_busId]) return power_plants From 8d789b0be96bf8f268fc70ab8c05086703e9c5cd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:50:29 +0200 Subject: [PATCH 428/787] Replace append with concat --- .../datasets/power_plants/conventional.py | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/power_plants/conventional.py b/src/egon/data/datasets/power_plants/conventional.py index c0440192b..30c6985b9 100644 --- a/src/egon/data/datasets/power_plants/conventional.py +++ b/src/egon/data/datasets/power_plants/conventional.py @@ -191,18 +191,25 @@ def match_nep_no_chp( # If a plant could be matched, add this to matched if len(selected) > 0: - matched = matched.append( - gpd.GeoDataFrame( - data={ - "source": "MaStR scaled with NEP 2021 list", - "MaStRNummer": selected.EinheitMastrNummer.head(1), - "carrier": ET, - "el_capacity": row.c2035_capacity, - "scenario": "eGon2035", - "geometry": selected.geometry.head(1), - "voltage_level": selected.voltage_level.head(1), - } - ) + matched = pd.concat( + [ + matched, + gpd.GeoDataFrame( + data={ + "source": "MaStR scaled with NEP 2021 list", + "MaStRNummer": selected.EinheitMastrNummer.head( + 1 + ), + "carrier": ET, + "el_capacity": row.c2035_capacity, + "scenario": "eGon2035", + "geometry": selected.geometry.head(1), + "voltage_level": selected.voltage_level.head( + 1 + ), + } + ), + ] ) # Drop matched power plant from nep From bf670b314b9630eb3e36214fd0c56aa04bf6adab Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:50:38 +0200 Subject: [PATCH 429/787] Balck --- src/egon/data/datasets/power_plants/conventional.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/conventional.py b/src/egon/data/datasets/power_plants/conventional.py index 30c6985b9..41226730f 100644 --- a/src/egon/data/datasets/power_plants/conventional.py +++ b/src/egon/data/datasets/power_plants/conventional.py @@ -144,11 +144,9 @@ def match_nep_no_chp( ) for ET in nep["carrier"].unique(): - for index, row in nep[ (nep["carrier"] == ET) & (nep["postcode"] != "None") ].iterrows(): - # Select plants from MaStR that match carrier, PLZ # and have a similar capacity # Create a copy of all power plants from MaStR From d1ee44b9bfdd061e40a3e155664c302d0469fee0 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:51:27 +0200 Subject: [PATCH 430/787] Replace append with concat --- .../data/datasets/power_plants/pv_ground_mounted.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_ground_mounted.py b/src/egon/data/datasets/power_plants/pv_ground_mounted.py index d4f80374b..debb832b6 100644 --- a/src/egon/data/datasets/power_plants/pv_ground_mounted.py +++ b/src/egon/data/datasets/power_plants/pv_ground_mounted.py @@ -435,7 +435,7 @@ def adapt_grid_level(pv_pot, max_dist_hv, con): pv_pot_mv_to_hv["dist_to_HV"] <= max_dist_hv ] pv_pot_mv_to_hv = pv_pot_mv_to_hv.drop(columns=["dist_to_HV"]) - pv_pot_hv = pv_pot_hv.append(pv_pot_mv_to_hv) + pv_pot_hv = pd.concat([pv_pot_hv, pv_pot_mv_to_hv]) # delete PVs which are now HV from MV dataframe for index, pot in pv_pot_mv_to_hv.iterrows(): @@ -711,8 +711,8 @@ def check_target( "and 'Agriculture'." ) - pv_per_distr_i = pv_per_distr_i.append( - pv_per_distr_i_2, ignore_index=True + pv_per_distr_i = pd.concat( + [pv_per_distr_i, pv_per_distr_i_2], ignore_index=True ) # assign grid level to pv_per_distr @@ -984,7 +984,7 @@ def run_methodology( pv_agri = pv_agri.append(agri_i) pv_exist = pv_exist.append(exist_i) if len(distr_i) > 0: - pv_per_distr = pv_per_distr.append(distr_i) + pv_per_distr = pd.concat([pv_per_distr, distr_i]) # 2) scenario: eGon100RE @@ -1176,8 +1176,8 @@ def insert_pv_parks( # prepare dataframe for integration in supply.egon_power_plants - pv_parks = pv_rora.append( - [pv_agri, pv_exist, pv_per_distr], ignore_index=True + pv_parks = pd.concat( + [pv_rora, pv_agri, pv_exist, pv_per_distr], ignore_index=True ) pv_parks["el_capacity"] = pv_parks["installed capacity in kW"] / 1000 pv_parks.rename(columns={"centroid": "geometry"}, inplace=True) From 14b6b915e5ad5bfce17875ae3466862dbc3fd56d Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:51:45 +0200 Subject: [PATCH 431/787] Black --- .../power_plants/pv_ground_mounted.py | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_ground_mounted.py b/src/egon/data/datasets/power_plants/pv_ground_mounted.py index debb832b6..8904682b1 100644 --- a/src/egon/data/datasets/power_plants/pv_ground_mounted.py +++ b/src/egon/data/datasets/power_plants/pv_ground_mounted.py @@ -9,7 +9,6 @@ def insert(): def mastr_existing_pv(pow_per_area): - """Import MaStR data from csv-files. Parameters @@ -141,7 +140,6 @@ def mastr_existing_pv(pow_per_area): return mastr def potential_areas(con, join_buffer): - """Import potential areas and choose and prepare areas suitable for PV ground mounted. @@ -293,7 +291,6 @@ def potential_areas(con, join_buffer): return potentials_rora, potentials_agri def select_pot_areas(mastr, potentials_pot): - """Select potential areas where there are existing pv parks (MaStR-data). @@ -343,7 +340,6 @@ def select_pot_areas(mastr, potentials_pot): return (pot_sel, mastr) def build_pv(pv_pot, pow_per_area): - """Build new pv parks in selected potential areas. Parameters @@ -374,7 +370,6 @@ def build_pv(pv_pot, pow_per_area): return pv_pot def adapt_grid_level(pv_pot, max_dist_hv, con): - """Check and if needed adapt grid level of newly built pv parks. Parameters @@ -403,7 +398,6 @@ def adapt_grid_level(pv_pot, max_dist_hv, con): ] if len(pv_pot_mv_to_hv) > 0: - # import data for HV substations sql = "SELECT point, voltage FROM grid.egon_hvmv_substation" @@ -449,12 +443,11 @@ def adapt_grid_level(pv_pot, max_dist_hv, con): ].apply(lambda x: x if x < max_cap_mv else max_cap_mv) pv_pot_mv["voltage_level"] = 5 - pv_pot = pv_pot_mv.append(pv_pot_hv) + pv_pot = pd.concat([pv_pot_mv, pv_pot_hv]) return pv_pot def build_additional_pv(potentials, pv, pow_per_area, con): - """Build additional pv parks if pv parks on selected potential areas do not hit the target value. @@ -535,7 +528,6 @@ def check_target( pow_per_area, con, ): - """Check target value per scenario and per state. Parameters @@ -585,7 +577,6 @@ def check_target( # linear scale farms to meet target if sum of installed capacity is # too high if total_pv_power >= target_power: - scale_factor = target_power / total_pv_power pv_rora_i["installed capacity in kW"] = ( pv_rora_i["installed capacity in kW"] * scale_factor @@ -614,7 +605,6 @@ def check_target( # build new pv parks if sum of installed capacity is below target # value elif total_pv_power < target_power: - rest_cap = target_power - total_pv_power ### @@ -658,7 +648,6 @@ def check_target( # build pv parks on potential areas agriculture if still necessary elif pv_per_distr_i["installed capacity in kW"].sum() < rest_cap: - rest_cap = ( target_power - total_pv_power @@ -776,7 +765,6 @@ def run_methodology( max_dist_hv=20000, show_map=False, ): - """Execute methodology to distribute pv ground mounted. Parameters @@ -889,7 +877,6 @@ def run_methodology( # check target value per state for i in nuts: - target_power = ( target[target["nuts"] == i]["capacity"].iloc[0] * 1000 ) @@ -1025,7 +1012,6 @@ def run_methodology( # ### create map to show distribution of installed capacity if show_map == True: - # 1) eGon2035 # get MV grid districts @@ -1155,7 +1141,6 @@ def run_methodology( def insert_pv_parks( pv_rora, pv_agri, pv_exist, pv_per_distr, scenario_name ): - """Write to database. Parameters @@ -1307,13 +1292,11 @@ def insert_pv_parks( or pv_per_distr["installed capacity in kW"].sum() > 0 or pv_exist["installed capacity in kW"].sum() > 0 ): - pv_parks = insert_pv_parks( pv_rora, pv_agri, pv_exist, pv_per_distr, "eGon2035" ) else: - pv_parks = gpd.GeoDataFrame() if ( @@ -1322,7 +1305,6 @@ def insert_pv_parks( or pv_per_distr_100RE["installed capacity in kW"].sum() > 0 or pv_exist_100RE["installed capacity in kW"].sum() > 0 ): - pv_parks_100RE = insert_pv_parks( pv_rora_100RE, pv_agri_100RE, @@ -1332,7 +1314,6 @@ def insert_pv_parks( ) else: - pv_parks_100RE = gpd.GeoDataFrame() return pv_parks, pv_parks_100RE From 16a2301dc28c1892b0c55128d12b51254a8a47a8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:52:12 +0200 Subject: [PATCH 432/787] Replace append with concat --- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index f9da3035f..45de4edc8 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -1224,7 +1224,9 @@ def allocate_pv( ) ) - chosen_buildings = q_buildings.index.append(add_buildings) + chosen_buildings = pd.concat( + [q_buildings.index, add_buildings] + ) else: chosen_buildings = rng.choice( From ea603703e8fdf72cf6faf752c1e3e5bea417b164 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 13:52:44 +0200 Subject: [PATCH 433/787] Replace append with concat --- .../data/datasets/power_plants/wind_farms.py | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/egon/data/datasets/power_plants/wind_farms.py b/src/egon/data/datasets/power_plants/wind_farms.py index 9d57d05c9..89c18a14f 100755 --- a/src/egon/data/datasets/power_plants/wind_farms.py +++ b/src/egon/data/datasets/power_plants/wind_farms.py @@ -101,8 +101,8 @@ def insert(): source, fed_state, ) - summary_t = summary_t.append(summary_state) - farms = farms.append(wind_farms_state) + summary_t = pd.concat([summary_t, summary_state]) + farms = pd.concat([farms, wind_farms_state]) generate_map() @@ -347,7 +347,7 @@ def match_district_se(x): wf_mv_to_hv = wf_mv_to_hv.drop(columns=["dist_to_HV"]) wf_mv_to_hv["voltage"] = "Hochspannung" - wf_hv = wf_hv.append(wf_mv_to_hv) + wf_hv = pd.concat([wf_hv, wf_mv_to_hv]) wf_mv = wf_mv[ (wf_mv["dist_to_HV"] > max_dist_hv) | (wf_mv["inst capacity [MW]"] < max_power_mv) @@ -362,7 +362,7 @@ def match_district_se(x): lambda x: x if x < max_power_mv else max_power_mv ) - wind_farms = wf_hv.append(wf_mv) + wind_farms = pd.concat([wf_hv, wf_mv]) # Adjust the total installed capacity to the scenario total_wind_power = ( @@ -376,14 +376,22 @@ def match_district_se(x): wf_hv["inst capacity [MW]"] = ( wf_hv["inst capacity [MW]"] * scale_factor ) - wind_farms = wf_hv.append(wf_mv) - summary = summary.append( - { - "state": fed_state, - "target": target_power, - "from existin WF": wind_farms["inst capacity [MW]"].sum(), - "MV districts": 0, - }, + wind_farms = pd.concat([wf_hv, wf_mv]) + summary = pd.concat( + [ + summary, + pd.DataFrame( + index=[summary.index.max() + 1], + data={ + "state": fed_state, + "target": target_power, + "from existin WF": wind_farms[ + "inst capacity [MW]" + ].sum(), + "MV districts": 0, + }, + ), + ], ignore_index=True, ) else: @@ -409,16 +417,24 @@ def match_district_se(x): scale_factor = (target_power - total_wind_power) / total_new_area extra_wf["inst capacity [MW]"] = extra_wf["area [km²]"] * scale_factor extra_wf["voltage"] = "Hochspannung" - summary = summary.append( - { - "state": fed_state, - "target": target_power, - "from existin WF": wind_farms["inst capacity [MW]"].sum(), - "MV districts": extra_wf["inst capacity [MW]"].sum(), - }, + summary = pd.concat( + [ + summary, + pd.DataFrame( + index=[summary.index.max() + 1], + data={ + "state": fed_state, + "target": target_power, + "from existin WF": wind_farms[ + "inst capacity [MW]" + ].sum(), + "MV districts": extra_wf["inst capacity [MW]"].sum(), + }, + ), + ], ignore_index=True, ) - wind_farms = wind_farms.append(extra_wf, ignore_index=True) + wind_farms = pd.concat([wind_farms, extra_wf], ignore_index=True) # Use Definition of thresholds for voltage level assignment wind_farms["voltage_level"] = 0 From f337dbb0265ffa826ade654418725eeed37f22ce Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 14:31:17 +0200 Subject: [PATCH 434/787] Combine pd.Index using union --- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 45de4edc8..53a7416b8 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -1224,9 +1224,7 @@ def allocate_pv( ) ) - chosen_buildings = pd.concat( - [q_buildings.index, add_buildings] - ) + chosen_buildings = q_buildings.index.union(add_buildings) else: chosen_buildings = rng.choice( From ffcb1d255cda64fc54da31bdacc1fee92645ae68 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 14:32:08 +0200 Subject: [PATCH 435/787] Replace append with concat --- src/egon/data/datasets/storages/__init__.py | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index b6e34bd14..4a1958814 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -181,21 +181,23 @@ def allocate_pumped_hydro(scn, export=True): print(f"{nep.elec_capacity.sum()} MW of {carrier} not matched") if nep.elec_capacity.sum() > 0: - # Get location using geolocator and city information located, unmatched = get_location(nep) # Bring both dataframes together - matched = matched.append( - located[ - [ - "carrier", - "el_capacity", - "scenario", - "geometry", - "source", - "MaStRNummer", - ] + matched = pd.concat( + [ + matched, + located[ + [ + "carrier", + "el_capacity", + "scenario", + "geometry", + "source", + "MaStRNummer", + ] + ], ], ignore_index=True, ) From 71419efa40acd409b787eb0c744dd2f4ce45b930 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 14:32:27 +0200 Subject: [PATCH 436/787] Black --- src/egon/data/datasets/storages/__init__.py | 29 ++++++++------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 4a1958814..63e8e81dc 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -52,7 +52,7 @@ def __init__(self, dependencies): create_tables, allocate_pumped_hydro_scn, allocate_pv_home_batteries_to_grids, - #allocate_home_batteries_to_buildings, + # allocate_home_batteries_to_buildings, ), ) @@ -77,7 +77,7 @@ def create_tables(): def allocate_pumped_hydro(scn, export=True): - """Allocates pumped_hydro plants for eGon2035 and scenario2019 scenarios + """Allocates pumped_hydro plants for eGon2035 and scenario2019 scenarios and either exports results to data base or returns as a dataframe Parameters @@ -97,14 +97,14 @@ def allocate_pumped_hydro(scn, export=True): cfg = config.datasets()["power_plants"] - nep = select_nep_pumped_hydro(scn= scn) + nep = select_nep_pumped_hydro(scn=scn) mastr = select_mastr_pumped_hydro() # Assign voltage level to MaStR mastr["voltage_level"] = assign_voltage_level( mastr.rename({"el_capacity": "Nettonennleistung"}, axis=1), cfg, - WORKING_DIR_MASTR_OLD + WORKING_DIR_MASTR_OLD, ) # Initalize DataFrame for matching power plants @@ -128,7 +128,7 @@ def allocate_pumped_hydro(scn, export=True): matched, buffer_capacity=0.1, consider_carrier=False, - scn=scn + scn=scn, ) # Match plants from NEP list using plz, @@ -311,7 +311,7 @@ def allocate_pumped_hydro_eGon100RE(): # Get allocation of pumped_hydro plants in eGon2035 scenario as the # reference for the distribution in eGon100RE scenario - allocation =allocate_pumped_hydro(scn="status2019", export=False) + allocation = allocate_pumped_hydro(scn="status2019", export=False) scaling_factor = capacity_phes / allocation.el_capacity.sum() @@ -355,7 +355,6 @@ def home_batteries_per_scenario(scenario): dataset = config.settings()["egon-data"]["--dataset-boundary"] if scenario == "eGon2035": - target_file = ( Path(".") / "data_bundle_egon_data" @@ -369,8 +368,8 @@ def home_batteries_per_scenario(scenario): index_col="Unnamed: 0", ) - # Select target value in MW - target = capacities_nep.Summe["PV-Batteriespeicher"]*1000 + # Select target value in MW + target = capacities_nep.Summe["PV-Batteriespeicher"] * 1000 else: target = db.select_dataframe( @@ -404,7 +403,7 @@ def home_batteries_per_scenario(scenario): battery["carrier"] = "home_battery" battery["scenario"] = scenario - if ((scenario == "eGon2035") | (scenario == "status2019")): + if (scenario == "eGon2035") | (scenario == "status2019"): source = "NEP" else: @@ -430,22 +429,16 @@ def home_batteries_per_scenario(scenario): def allocate_pv_home_batteries_to_grids(): - for scn in config.settings()["egon-data"]["--scenarios"]: home_batteries_per_scenario(scn) + def allocate_pumped_hydro_scn(): - if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: allocate_pumped_hydro(scn="eGon2035") if "status2019" in config.settings()["egon-data"]["--scenarios"]: allocate_pumped_hydro(scn="status2019") - + if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: allocate_pumped_hydro_eGon100RE() - - - - - From 1b82374734be89a5eebb1127d0978f0e29f36388 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 14:33:00 +0200 Subject: [PATCH 437/787] Replace append with concat --- .../data/datasets/storages/pumped_hydro.py | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 91b95729d..0f031f503 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -252,18 +252,21 @@ def match_storage_units( # If a plant could be matched, add this to matched if len(selected) > 0: - matched = matched.append( - gpd.GeoDataFrame( - data={ - "source": "MaStR scaled with NEP 2021 list", - "MaStRNummer": selected.EinheitMastrNummer.head(1), - "carrier": carrier, - "el_capacity": row.elec_capacity, - "scenario": scn, - "geometry": selected.geometry.head(1), - "voltage_level": selected.voltage_level.head(1), - } - ) + matched = pd.concat( + [ + matched, + gpd.GeoDataFrame( + data={ + "source": "MaStR scaled with NEP 2021 list", + "MaStRNummer": selected.EinheitMastrNummer.head(1), + "carrier": carrier, + "el_capacity": row.elec_capacity, + "scenario": scn, + "geometry": selected.geometry.head(1), + "voltage_level": selected.voltage_level.head(1), + } + ), + ] ) # Drop matched storage units from nep From befe77306d147c89173e12b4412407e23527a5ea Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 11 Jul 2023 14:33:12 +0200 Subject: [PATCH 438/787] Black --- src/egon/data/datasets/storages/pumped_hydro.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 0f031f503..68e10b888 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -46,7 +46,9 @@ def select_nep_pumped_hydro(scn): AND postcode != 'None'; """ ) - nep_ph.rename(columns={"c2035_capacity": "elec_capacity"}, inplace=True) + nep_ph.rename( + columns={"c2035_capacity": "elec_capacity"}, inplace=True + ) elif scn == "status2019": # Select plants with geolocation from list of conventional power plants nep_ph = db.select_dataframe( @@ -63,7 +65,7 @@ def select_nep_pumped_hydro(scn): nep_ph["elec_capacity"] = nep_ph["capacity"] else: raise SystemExit(f"{scn} not recognised") - + # Removing plants out of Germany nep_ph["postcode"] = nep_ph["postcode"].astype(str) nep_ph = nep_ph[~nep_ph["postcode"].str.contains("A")] @@ -213,7 +215,6 @@ def match_storage_units( for index, row in nep[ (nep["carrier"] == carrier) & (nep["postcode"] != "None") ].iterrows(): - # Select plants from MaStR that match carrier, PLZ # and have a similar capacity # Create a copy of all power plants from MaStR From e3a9b5250ad79fb85b0ff55fc4e0ceb5c31a1edd Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Jul 2023 13:12:22 +0200 Subject: [PATCH 439/787] Combine index using union function --- src/egon/data/datasets/heat_supply/individual_heating.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 74299b707..f0d3d4092 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -1145,8 +1145,8 @@ def get_buildings_with_decentral_heat_demand_in_mv_grid(mvgd, scenario): ) # merge residential and CTS buildings - buildings_decentral_heating = pd.concat( - [buildings_decentral_heating_res, buildings_decentral_heating_cts] + buildings_decentral_heating = buildings_decentral_heating_res.union( + buildings_decentral_heating_cts ).unique() return buildings_decentral_heating @@ -1330,8 +1330,8 @@ def determine_buildings_with_hp_in_mv_grid( random.seed(db.credentials()["--random-seed"]) new_hp_building = random.choice(possible_buildings) # add new building to building with HP - buildings_with_hp = pd.concat( - [buildings_with_hp, pd.Index([new_hp_building])] + buildings_with_hp = buildings_with_hp.union( + pd.Index([new_hp_building]) ) # determine if there are still possible buildings remaining_hp_cap = ( From 36aebb0a42b53efa35f20051b16568eba97006df Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Jul 2023 13:36:20 +0200 Subject: [PATCH 440/787] Update str function for new pandas version --- .../emobility/motorized_individual_travel/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index b78675fd6..96de96fde 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -204,8 +204,8 @@ def download_and_preprocess(): kba_data[ ["ags_reg_district", "reg_district"] ] = kba_data.reg_district.str.split( - " ", - 1, + pat=" ", + n=1, expand=True, ) kba_data.ags_reg_district = kba_data.ags_reg_district.astype("int") @@ -317,7 +317,7 @@ def import_csv(f): # Split simBEV id into type and id evs_unique[["type", "simbev_ev_id"]] = evs_unique[ "simbev_ev_id" - ].str.rsplit("_", 1, expand=True) + ].str.rsplit(pat="_", n=1, expand=True) evs_unique.simbev_ev_id = evs_unique.simbev_ev_id.astype(int) evs_unique["scenario"] = scenario_name @@ -370,8 +370,8 @@ def write_metadata_to_db(): "scenario": str, "eta_cp": float, "stepsize": int, - "start_date": np.datetime64, - "end_date": np.datetime64, + "start_date": "datetime64[ns]", + "end_date": "datetime64[ns]", "soc_min": float, "grid_timeseries": bool, "grid_timeseries_by_usecase": bool, From 300c5115e8df5a532ed1be89ddbc14fd004d8b94 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Jul 2023 13:36:36 +0200 Subject: [PATCH 441/787] Balck --- .../motorized_individual_travel/__init__.py | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 96de96fde..82f8ed919 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -455,31 +455,34 @@ def generate_model_data_tasks(scenario_name): return tasks tasks = ( - create_tables, - { - ( - download_and_preprocess, - allocate_evs_numbers, - ), - ( - extract_trip_file, - write_metadata_to_db, - write_evs_trips_to_db, - ), - }, - allocate_evs_to_grid_districts, - delete_model_data_from_db, ) - + create_tables, + { + ( + download_and_preprocess, + allocate_evs_numbers, + ), + ( + extract_trip_file, + write_metadata_to_db, + write_evs_trips_to_db, + ), + }, + allocate_evs_to_grid_districts, + delete_model_data_from_db, + ) + tasks_per_scenario = set() - + for scenario_name in config.settings()["egon-data"]["--scenarios"]: - tasks_per_scenario.update(generate_model_data_tasks(scenario_name=scenario_name)) - - tasks = tasks + (tasks_per_scenario,) - + tasks_per_scenario.update( + generate_model_data_tasks(scenario_name=scenario_name) + ) + + tasks = tasks + (tasks_per_scenario,) + super().__init__( name="MotorizedIndividualTravel", version="0.0.7", dependencies=dependencies, - tasks=tasks + tasks=tasks, ) From 4136f4197e1e39781f22f97aad26494cc4f38a69 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 13 Jul 2023 13:36:58 +0200 Subject: [PATCH 442/787] Adjust using groupby for new pandas version --- .../emobility/motorized_individual_travel/ev_allocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index f79d133f1..f4a6c93fc 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -333,7 +333,7 @@ def calc_evs_per_grid_district(ev_data_muns): # * pop_mun_in_mvgd_of_mun_total: relative pop share of mun which # intersects with MVGD in relation to total pop of mun mvgd_pop_per_mun_in_mvgd = ( - mvgd_pop_per_mun_in_mvgd.groupby(level=0) + mvgd_pop_per_mun_in_mvgd.groupby(level=0, as_index=False) .apply(lambda x: x / float(x.sum())) .reset_index() .rename(columns={"pop": "pop_share_mun_in_mvgd"}) From b8a1da45a4275eb67135397dcfe29b0538580f28 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 14 Jul 2023 08:57:31 +0200 Subject: [PATCH 443/787] correct units conventional gen --- src/egon/data/datasets/power_plants/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index db4731b35..59a25df09 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1006,7 +1006,9 @@ def fill_missing_bus_and_geom(gens, carrier): ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie"] ) ] - + + # convert from KW to MW + conv["Nettonennleistung"] = conv["Nettonennleistung"]/1000 # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[ From 3dd654d67abfce76a7c935924fd4d399eb3676b8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 09:09:31 +0200 Subject: [PATCH 444/787] Add geoalchemy dependency --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index e6ecc0f30..58f2af99e 100755 --- a/setup.py +++ b/setup.py @@ -88,6 +88,7 @@ def read(*names, **kwargs): "cdsapi", "click", #"entsoe-py >=0.3.1", + "GeoAlchemy2", "geopandas>=0.10.0", "geopy", "geovoronoi", From 1992aa47718304092c4e08bd3c8f1a8e562ed075 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 09:20:29 +0200 Subject: [PATCH 445/787] Set upper version limit for click --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 58f2af99e..20d2274a1 100755 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ def read(*names, **kwargs): "apache-airflow-providers-sendgrid", "atlite==0.2.5", "cdsapi", - "click", + "click<8.1", #"entsoe-py >=0.3.1", "GeoAlchemy2", "geopandas>=0.10.0", From ad7c3d2ba8ce67a85f5da76967514e6d94c7a49e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 10:27:56 +0200 Subject: [PATCH 446/787] Add missing package --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 20d2274a1..df7975200 100755 --- a/setup.py +++ b/setup.py @@ -83,6 +83,7 @@ def read(*names, **kwargs): install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', "apache-airflow>2.0", + "'apache-airflow[postgres]'", "apache-airflow-providers-sendgrid", "atlite==0.2.5", "cdsapi", From 0f70f36aac82c527c8d3ee50b34dbdee1ad4cac0 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 10:31:19 +0200 Subject: [PATCH 447/787] Remove double quotation marks --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index df7975200..4183c08da 100755 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def read(*names, **kwargs): install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', "apache-airflow>2.0", - "'apache-airflow[postgres]'", + "apache-airflow[postgres]", "apache-airflow-providers-sendgrid", "atlite==0.2.5", "cdsapi", From 37a5fac622110bde10720d41f2c9405e6dc4aa44 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 10:51:14 +0200 Subject: [PATCH 448/787] Remove duplicated datasets --- src/egon/data/airflow/dags/pipeline.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index 1260ac9c1..1b91ce9b5 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -113,7 +113,6 @@ is_paused_upon_creation=False, schedule_interval=None, ) as pipeline: - tasks = pipeline.task_dict setup = database.Setup() @@ -630,24 +629,6 @@ ] ) - mit_charging_infrastructure = MITChargingInfrastructure( - dependencies=[mv_grid_districts, hh_demand_buildings_setup] - ) - - # eMobility: heavy duty transport - heavy_duty_transport = HeavyDutyTransport( - dependencies=[vg250, setup_etrago, create_gas_polygons_egon2035] - ) - - cts_demand_buildings = CtsDemandBuildings( - dependencies=[ - osm_buildings_streets, - cts_electricity_demand_annual, - hh_demand_buildings_setup, - tasks["heat_demand_timeseries.export-etrago-cts-heat-profiles"], - ] - ) - # Create load areas load_areas = LoadArea( dependencies=[ From 99e6e0fabbef43c7daab31ad364286962d9203e9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 10:51:52 +0200 Subject: [PATCH 449/787] Avoid duplicate tasks when status2019 and eGon2035 are created --- src/egon/data/datasets/scenario_capacities.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index e83e64c4f..b46ac6e49 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -817,7 +817,11 @@ def eGon100_capacities(): if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: tasks = tasks + (insert_capacities_status2019, insert_data_nep) -if "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"]: +if ( + "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] +) and not ( + "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"] +): tasks = tasks + (insert_data_nep,) if "eGon100RE" in egon.data.config.settings()["egon-data"]["--scenarios"]: From 2f0984f4981c8c2c8cc7728287f102665150539e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 11:00:49 +0200 Subject: [PATCH 450/787] Avoid duplcated tasks when creating two scenarios --- .../data/datasets/power_plants/__init__.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index cfe43a852..d6229df23 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1006,9 +1006,9 @@ def fill_missing_bus_and_geom(gens, carrier): ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie"] ) ] - + # convert from KW to MW - conv["Nettonennleistung"] = conv["Nettonennleistung"]/1000 + conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[ @@ -1227,11 +1227,7 @@ def fill_missing_bus_and_geom(gens, carrier): ) if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + ( - power_plants_status_quo, - geocode_mastr_data, - pv_rooftop_to_buildings, - ) + tasks = tasks + (power_plants_status_quo,) if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] @@ -1244,15 +1240,13 @@ def fill_missing_bus_and_geom(gens, carrier): { wind_onshore.insert, pv_ground_mounted.insert, - ( - pv_rooftop_per_mv_grid, - geocode_mastr_data, - pv_rooftop_to_buildings, - ), + pv_rooftop_per_mv_grid, }, ) tasks = tasks + ( + geocode_mastr_data, + pv_rooftop_to_buildings, wind_offshore.insert, assign_weather_data.weatherId_and_busId, ) From bcec496ec83eeb5e076c22a5f4838c287ca923e3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 18 Jul 2023 11:39:12 +0200 Subject: [PATCH 451/787] Update function call for new importlib-ressourcs version --- src/egon/data/datasets/low_flex_scenario/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/low_flex_scenario/__init__.py b/src/egon/data/datasets/low_flex_scenario/__init__.py index db48117d0..c3b85ce86 100644 --- a/src/egon/data/datasets/low_flex_scenario/__init__.py +++ b/src/egon/data/datasets/low_flex_scenario/__init__.py @@ -3,7 +3,7 @@ """ from airflow.operators.postgres_operator import PostgresOperator from sqlalchemy.ext.declarative import declarative_base -import importlib_resources as resources +from importlib_resources import files from egon.data.datasets import Dataset @@ -21,9 +21,9 @@ def __init__(self, dependencies): { PostgresOperator( task_id="low_flex_eGon2035", - sql=resources.read_text( - __name__, "low_flex_eGon2035.sql" - ), + sql=files(__name__) + .joinpath("low_flex_eGon2035.sql") + .read_text(encoding="utf-8"), postgres_conn_id="egon_data", autocommit=True, ), From 7f2f83b1369a4bc946e4fb98610812bcc8121fb2 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 20 Jul 2023 08:44:40 +0200 Subject: [PATCH 452/787] Add webserver_config file --- src/egon/data/airflow/webserver_config.py | 131 ++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 src/egon/data/airflow/webserver_config.py diff --git a/src/egon/data/airflow/webserver_config.py b/src/egon/data/airflow/webserver_config.py new file mode 100644 index 000000000..075331d0a --- /dev/null +++ b/src/egon/data/airflow/webserver_config.py @@ -0,0 +1,131 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Default configuration for the Airflow webserver.""" +from __future__ import annotations + +import os + +from airflow.www.fab_security.manager import AUTH_DB + +# from airflow.www.fab_security.manager import AUTH_LDAP +# from airflow.www.fab_security.manager import AUTH_OAUTH +# from airflow.www.fab_security.manager import AUTH_OID +# from airflow.www.fab_security.manager import AUTH_REMOTE_USER + + +basedir = os.path.abspath(os.path.dirname(__file__)) + +# Flask-WTF flag for CSRF +WTF_CSRF_ENABLED = True +WTF_CSRF_TIME_LIMIT = None + +# ---------------------------------------------------- +# AUTHENTICATION CONFIG +# ---------------------------------------------------- +# For details on how to set up each of the following authentication, see +# http://flask-appbuilder.readthedocs.io/en/latest/security.html# authentication-methods +# for details. + +# The authentication type +# AUTH_OID : Is for OpenID +# AUTH_DB : Is for database +# AUTH_LDAP : Is for LDAP +# AUTH_REMOTE_USER : Is for using REMOTE_USER from web server +# AUTH_OAUTH : Is for OAuth +AUTH_TYPE = AUTH_DB + +# Uncomment to setup Full admin role name +# AUTH_ROLE_ADMIN = 'Admin' + +# Uncomment and set to desired role to enable access without authentication +AUTH_ROLE_PUBLIC = 'Admin' + +# Will allow user self registration +# AUTH_USER_REGISTRATION = True + +# The recaptcha it's automatically enabled for user self registration is active and the keys are necessary +# RECAPTCHA_PRIVATE_KEY = PRIVATE_KEY +# RECAPTCHA_PUBLIC_KEY = PUBLIC_KEY + +# Config for Flask-Mail necessary for user self registration +# MAIL_SERVER = 'smtp.gmail.com' +# MAIL_USE_TLS = True +# MAIL_USERNAME = 'yourappemail@gmail.com' +# MAIL_PASSWORD = 'passwordformail' +# MAIL_DEFAULT_SENDER = 'sender@gmail.com' + +# The default user self registration role +# AUTH_USER_REGISTRATION_ROLE = "Public" + +# When using OAuth Auth, uncomment to setup provider(s) info +# Google OAuth example: +# OAUTH_PROVIDERS = [{ +# 'name':'google', +# 'token_key':'access_token', +# 'icon':'fa-google', +# 'remote_app': { +# 'api_base_url':'https://www.googleapis.com/oauth2/v2/', +# 'client_kwargs':{ +# 'scope': 'email profile' +# }, +# 'access_token_url':'https://accounts.google.com/o/oauth2/token', +# 'authorize_url':'https://accounts.google.com/o/oauth2/auth', +# 'request_token_url': None, +# 'client_id': GOOGLE_KEY, +# 'client_secret': GOOGLE_SECRET_KEY, +# } +# }] + +# When using LDAP Auth, setup the ldap server +# AUTH_LDAP_SERVER = "ldap://ldapserver.new" + +# When using OpenID Auth, uncomment to setup OpenID providers. +# example for OpenID authentication +# OPENID_PROVIDERS = [ +# { 'name': 'Yahoo', 'url': 'https://me.yahoo.com' }, +# { 'name': 'AOL', 'url': 'http://openid.aol.com/' }, +# { 'name': 'Flickr', 'url': 'http://www.flickr.com/' }, +# { 'name': 'MyOpenID', 'url': 'https://www.myopenid.com' }] + +# ---------------------------------------------------- +# Theme CONFIG +# ---------------------------------------------------- +# Flask App Builder comes up with a number of predefined themes +# that you can use for Apache Airflow. +# http://flask-appbuilder.readthedocs.io/en/latest/customizing.html#changing-themes +# Please make sure to remove "navbar_color" configuration from airflow.cfg +# in order to fully utilize the theme. (or use that property in conjunction with theme) +# APP_THEME = "bootstrap-theme.css" # default bootstrap +# APP_THEME = "amelia.css" +# APP_THEME = "cerulean.css" +# APP_THEME = "cosmo.css" +# APP_THEME = "cyborg.css" +# APP_THEME = "darkly.css" +# APP_THEME = "flatly.css" +# APP_THEME = "journal.css" +# APP_THEME = "lumen.css" +# APP_THEME = "paper.css" +# APP_THEME = "readable.css" +# APP_THEME = "sandstone.css" +# APP_THEME = "simplex.css" +# APP_THEME = "slate.css" +# APP_THEME = "solar.css" +# APP_THEME = "spacelab.css" +# APP_THEME = "superhero.css" +# APP_THEME = "united.css" +# APP_THEME = "yeti.css" From f5a114c2a71efafb9ccc6d457bf89d0a278943d8 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 26 Jul 2023 14:27:14 +0200 Subject: [PATCH 453/787] include OCGT gen for foreign countries --- .../data/datasets/electrical_neighbours.py | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index efea7fc74..abf95c77c 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1399,21 +1399,21 @@ def map_carriers_entsoe(): "Biomass": "biomass", "Fossil Brown coal/Lignite": "lignite", "Fossil Coal-derived gas": "coal", - "Fossil Gas": "CH4_NG", + "Fossil Gas": "OCGT", "Fossil Hard coal": "coal", "Fossil Oil": "oil", "Fossil Oil shale": "oil", - "Fossil Peat": "biomass", + "Fossil Peat": "others", "Geothermal": "geo_thermal", "Hydro Pumped Storage": "Hydro Pumped Storage", "Hydro Run-of-river and poundage": "run_of_river", "Hydro Water Reservoir": "reservoir", - "Marine": "marine", + "Marine": "Other RES", "Nuclear": "nuclear", "Other": "others", - "Other renewable": "others", + "Other renewable": "Other RES", "Solar": "solar", - "Waste": "others", + "Waste": "Other RES", "Wind Offshore": "wind_offshore", "Wind Onshore": "wind_onshore", } @@ -1499,23 +1499,6 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): carrier_entsoe = map_carriers_entsoe() gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() - gen_sq = gen_sq.iloc[ - :, - gen_sq.columns.isin( - [ - "others", - "wind_offshore", - "wind_onshore", - "solar", - "reservoir", - "run_of_river", - "lignite", - "coal", - "oil", - "nuclear", - ] - ), - ] list_gen_sq = pd.DataFrame( dtype=int, columns=["carrier", "country", "capacity"] From 212bcd9c999e5b4012c5517aafd9386be4664cf2 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 28 Jul 2023 11:56:58 +0200 Subject: [PATCH 454/787] change carrier CH4 to gas --- src/egon/data/datasets/electrical_neighbours.py | 2 +- src/egon/data/datasets/power_plants/__init__.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index abf95c77c..555fcb809 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1399,7 +1399,7 @@ def map_carriers_entsoe(): "Biomass": "biomass", "Fossil Brown coal/Lignite": "lignite", "Fossil Coal-derived gas": "coal", - "Fossil Gas": "OCGT", + "Fossil Gas": "gas", "Fossil Hard coal": "coal", "Fossil Oil": "oil", "Fossil Oil shale": "oil", diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 59a25df09..11665af13 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -913,7 +913,8 @@ def power_plants_status_quo(scn_name="status2019"): DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} WHERE carrier IN ('wind_onshore', 'solar', 'biomass', 'run_of_river', 'reservoir', 'solar_rooftop', - 'wind_offshore', 'nuclear', 'coal', 'lignite', 'oil') + 'wind_offshore', 'nuclear', 'coal', 'lignite', 'oil', + 'gas') AND scenario = '{scn_name}' """ ) @@ -1003,7 +1004,8 @@ def fill_missing_bus_and_geom(gens, carrier): conv = conv[ conv.Energietraeger.isin( - ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie"] + ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie", + "Erdgas"] ) ] @@ -1023,12 +1025,14 @@ def fill_missing_bus_and_geom(gens, carrier): # rename carriers conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" conv.loc[conv.Energietraeger == "Steinkohle", "Energietraeger"] = "coal" + conv.loc[conv.Energietraeger == "Erdgas", "Energietraeger"] = "gas" conv.loc[ conv.Energietraeger == "Mineralölprodukte", "Energietraeger" ] = "oil" conv.loc[ conv.Energietraeger == "Kernenergie", "Energietraeger" ] = "nuclear" + # rename columns conv.rename( @@ -1056,7 +1060,7 @@ def fill_missing_bus_and_geom(gens, carrier): conv["voltage_level"] = assign_voltage_level_by_capacity( conv.rename(columns={"capacity": "Nettonennleistung"}) ) - + for i, row in conv.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, From f06914e12b91831eac0f6644860fe611b006b9fc Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 31 Jul 2023 11:52:18 +0200 Subject: [PATCH 455/787] include efficiency OCGT --- src/egon/data/datasets/scenario_parameters/parameters.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 6a046b98b..1e1dd806f 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -873,6 +873,10 @@ def gas(scenario): "biogas": global_settings(scenario)["fuel_costs"]["gas"], "chp_gas": read_costs(costs, "central gas CHP", "VOM"), } + # Insert effciencies in p.u. + parameters["efficiency"] = { + "OCGT": read_costs(costs, "OCGT", "efficiency"), + } else: print(f"Scenario name {scenario} is not valid.") From 76cb5c4d6f152cdac2ad31ac3991af08951923c0 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 1 Aug 2023 10:19:48 +0200 Subject: [PATCH 456/787] include OCGT for status2019 --- .../data/datasets/gas_neighbours/eGon2035.py | 176 ++++++++++++------ .../data/datasets/power_etrago/match_ocgt.py | 2 +- 2 files changed, 121 insertions(+), 57 deletions(-) diff --git a/src/egon/data/datasets/gas_neighbours/eGon2035.py b/src/egon/data/datasets/gas_neighbours/eGon2035.py index 7420a6faa..392872d91 100755 --- a/src/egon/data/datasets/gas_neighbours/eGon2035.py +++ b/src/egon/data/datasets/gas_neighbours/eGon2035.py @@ -15,6 +15,8 @@ from egon.data.datasets.electrical_neighbours import ( get_foreign_bus_id, get_map_buses, + entsoe_to_bus_etrago, + map_carriers_entsoe ) from egon.data.datasets.gas_neighbours.gas_abroad import ( insert_gas_grid_capacities, @@ -39,7 +41,7 @@ ] -def get_foreign_gas_bus_id(carrier="CH4"): +def get_foreign_gas_bus_id(carrier="CH4", scn_name = "eGon2035"): """Calculate the etrago bus id based on the geometry Map node_ids from TYNDP and etragos bus_id @@ -56,7 +58,6 @@ def get_foreign_gas_bus_id(carrier="CH4"): """ sources = config.datasets()["gas_neighbours"]["sources"] - scn_name = "eGon2035" bus_id = db.select_geodataframe( f""" @@ -1491,15 +1492,74 @@ def calculate_ocgt_capacities(): # Choose capacities for considered countries df_ocgt = df_ocgt[df_ocgt.index.str[:2].isin(countries)] - # Attribute bus0 and bus1 - df_ocgt["bus0"] = get_foreign_gas_bus_id()[df_ocgt.index] - df_ocgt["bus1"] = get_foreign_bus_id()[df_ocgt.index] + df_ocgt["bus0"] = get_foreign_gas_bus_id(scn_name= "status2019")[df_ocgt.index] + df_ocgt["bus1"] = get_foreign_bus_id(scenario="status2019")[df_ocgt.index] df_ocgt = df_ocgt.groupby(by=["bus0", "bus1"], as_index=False).sum() return df_ocgt +def calculate_ocgt_capacities_scenario2019(scn_name= "status2019"): + """ + Insert OCGT generators for foreign countries based on ENTSO-E data + + Parameters + ---------- + scn_name : str + The default is "status2019". + Returns + ------- + None. + + """ + scn_name= "status2019" + con=db.engine() + + carrier_entsoe = map_carriers_entsoe() + entsoe_to_bus = entsoe_to_bus_etrago() + gen_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" + ) + gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() + + ocgt = gen_sq["gas"].reset_index().rename(columns={"Index": "country", + "gas": "p_nom"}) + + # delete OCGT with p_nom = 0 + ocgt = ocgt[ocgt["p_nom"] > 0] + + # Find foreign bus to assign the generator + ocgt["bus1"] = ocgt.country.map(entsoe_to_bus) + + gas_foreign = gpd.read_postgis( + f"""SELECT * FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' + AND country <> 'DE' + AND carrier = 'CH4' + """, + con = con, + geom_col= "geom", + index_col = "bus_id") + + ac_foreign = gpd.read_postgis( + f"""SELECT * FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' + AND country <> 'DE' + AND carrier = 'AC' + """, + con = con, + geom_col= "geom", + index_col = "bus_id") + + ocgt["ac_geom"] = ocgt.apply(lambda x: ac_foreign.at[x.bus1, "geom"], axis=1) + + for index, df in ocgt.iterrows(): + distance = gas_foreign.distance(df["ac_geom"]) + ocgt.loc[index, "bus0"] = str(distance.idxmin()) + + return ocgt[["bus0", "bus1", "p_nom"]] + def insert_ocgt_abroad(): """Insert gas turbine capicities abroad for eGon2035 in the database @@ -1511,55 +1571,59 @@ def insert_ocgt_abroad(): Gas turbine capacities per foreign node """ - scn_name = "eGon2035" + scenarios = config.settings()["egon-data"]["--scenarios"] carrier = "OCGT" - - # Connect to local database - engine = db.engine() - - df_ocgt = calculate_ocgt_capacities() - - df_ocgt["p_nom_extendable"] = False - df_ocgt["carrier"] = carrier - df_ocgt["scn_name"] = scn_name - - buses = tuple( - db.select_dataframe( - f"""SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' AND country != 'DE'; - """ - )["bus_id"] - ) - - # Delete old entries - db.execute_sql( - f""" - DELETE FROM grid.egon_etrago_link WHERE "carrier" = '{carrier}' - AND scn_name = '{scn_name}' - AND bus0 IN {buses} AND bus1 IN {buses}; - """ - ) - - # read carrier information from scnario parameter data - scn_params = get_sector_parameters("gas", scn_name) - df_ocgt["efficiency"] = scn_params["efficiency"][carrier] - df_ocgt["marginal_cost"] = ( - scn_params["marginal_cost"][carrier] - / scn_params["efficiency"][carrier] - ) - - # Adjust p_nom - df_ocgt["p_nom"] = df_ocgt["p_nom"] / scn_params["efficiency"][carrier] - - # Select next id value - new_id = db.next_etrago_id("link") - df_ocgt["link_id"] = range(new_id, new_id + len(df_ocgt)) - - # Insert data to db - df_ocgt.to_sql( - "egon_etrago_link", - engine, - schema="grid", - index=False, - if_exists="append", - ) + + for scn_name in scenarios: + # Connect to local database + engine = db.engine() + scn_name = 'status2019' + if scn_name == 'status2019': + df_ocgt = calculate_ocgt_capacities_scenario2019() + else: + df_ocgt = calculate_ocgt_capacities() + df_ocgt["p_nom_extendable"] = False + df_ocgt["carrier"] = carrier + df_ocgt["scn_name"] = scn_name + + buses = tuple( + db.select_dataframe( + f"""SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' AND country != 'DE'; + """ + )["bus_id"] + ) + + # Delete old entries + db.execute_sql( + f""" + DELETE FROM grid.egon_etrago_link WHERE "carrier" = '{carrier}' + AND scn_name = '{scn_name}' + AND bus0 IN {buses} AND bus1 IN {buses}; + """ + ) + + # read carrier information from scnario parameter data + scn_params = get_sector_parameters("gas", scn_name) + df_ocgt["efficiency"] = scn_params["efficiency"][carrier] + df_ocgt["marginal_cost"] = ( + scn_params["marginal_cost"][carrier] + / scn_params["efficiency"][carrier] + ) + + # Adjust p_nom + if scn_name != "status2019": + df_ocgt["p_nom"] = df_ocgt["p_nom"] / scn_params["efficiency"][carrier] + + # Select next id value + new_id = db.next_etrago_id("link") + df_ocgt["link_id"] = range(new_id, new_id + len(df_ocgt)) + + # Insert data to db + df_ocgt.to_sql( + "egon_etrago_link", + engine, + schema="grid", + index=False, + if_exists="append", + ) diff --git a/src/egon/data/datasets/power_etrago/match_ocgt.py b/src/egon/data/datasets/power_etrago/match_ocgt.py index c0e17a246..3e04efee9 100755 --- a/src/egon/data/datasets/power_etrago/match_ocgt.py +++ b/src/egon/data/datasets/power_etrago/match_ocgt.py @@ -17,7 +17,7 @@ def insert_open_cycle_gas_turbines(): insert_open_cycle_gas_turbines_per_scenario(scenario) -def insert_open_cycle_gas_turbines_per_scenario(scn_name): +def insert_open_cycle_gas_turbines_per_scenario(scn_name="eGon2035"): """Insert gas turbine links in egon_etrago_link table. Parameters From d605e6a7229e68a715f7edbe4128af05383fe6f9 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 1 Aug 2023 10:24:15 +0200 Subject: [PATCH 457/787] using black --- .../data/datasets/gas_neighbours/eGon2035.py | 80 +++++++++++-------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/src/egon/data/datasets/gas_neighbours/eGon2035.py b/src/egon/data/datasets/gas_neighbours/eGon2035.py index 392872d91..ef88bc7db 100755 --- a/src/egon/data/datasets/gas_neighbours/eGon2035.py +++ b/src/egon/data/datasets/gas_neighbours/eGon2035.py @@ -16,7 +16,7 @@ get_foreign_bus_id, get_map_buses, entsoe_to_bus_etrago, - map_carriers_entsoe + map_carriers_entsoe, ) from egon.data.datasets.gas_neighbours.gas_abroad import ( insert_gas_grid_capacities, @@ -41,7 +41,7 @@ ] -def get_foreign_gas_bus_id(carrier="CH4", scn_name = "eGon2035"): +def get_foreign_gas_bus_id(carrier="CH4", scn_name="eGon2035"): """Calculate the etrago bus id based on the geometry Map node_ids from TYNDP and etragos bus_id @@ -1286,7 +1286,6 @@ def calculate_ch4_grid_capacities(): schema = sources["buses"]["schema"] table = sources["buses"]["table"] for country_code in [e for e in countries if e not in ("GB", "SE", "UK")]: - # Select cross-bording links cap_DE = db.select_dataframe( f"""SELECT link_id, bus0, bus1 @@ -1493,13 +1492,16 @@ def calculate_ocgt_capacities(): # Choose capacities for considered countries df_ocgt = df_ocgt[df_ocgt.index.str[:2].isin(countries)] # Attribute bus0 and bus1 - df_ocgt["bus0"] = get_foreign_gas_bus_id(scn_name= "status2019")[df_ocgt.index] + df_ocgt["bus0"] = get_foreign_gas_bus_id(scn_name="status2019")[ + df_ocgt.index + ] df_ocgt["bus1"] = get_foreign_bus_id(scenario="status2019")[df_ocgt.index] df_ocgt = df_ocgt.groupby(by=["bus0", "bus1"], as_index=False).sum() return df_ocgt -def calculate_ocgt_capacities_scenario2019(scn_name= "status2019"): + +def calculate_ocgt_capacities_scenario2019(scn_name="status2019"): """ Insert OCGT generators for foreign countries based on ENTSO-E data @@ -1513,22 +1515,25 @@ def calculate_ocgt_capacities_scenario2019(scn_name= "status2019"): None. """ - scn_name= "status2019" - con=db.engine() + scn_name = "status2019" + con = db.engine() carrier_entsoe = map_carriers_entsoe() entsoe_to_bus = entsoe_to_bus_etrago() gen_sq = pd.read_csv( "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" - ) + ) gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() - ocgt = gen_sq["gas"].reset_index().rename(columns={"Index": "country", - "gas": "p_nom"}) - + ocgt = ( + gen_sq["gas"] + .reset_index() + .rename(columns={"Index": "country", "gas": "p_nom"}) + ) + # delete OCGT with p_nom = 0 ocgt = ocgt[ocgt["p_nom"] > 0] - + # Find foreign bus to assign the generator ocgt["bus1"] = ocgt.country.map(entsoe_to_bus) @@ -1538,28 +1543,33 @@ def calculate_ocgt_capacities_scenario2019(scn_name= "status2019"): AND country <> 'DE' AND carrier = 'CH4' """, - con = con, - geom_col= "geom", - index_col = "bus_id") - + con=con, + geom_col="geom", + index_col="bus_id", + ) + ac_foreign = gpd.read_postgis( f"""SELECT * FROM grid.egon_etrago_bus WHERE scn_name = '{scn_name}' AND country <> 'DE' AND carrier = 'AC' """, - con = con, - geom_col= "geom", - index_col = "bus_id") - - ocgt["ac_geom"] = ocgt.apply(lambda x: ac_foreign.at[x.bus1, "geom"], axis=1) - + con=con, + geom_col="geom", + index_col="bus_id", + ) + + ocgt["ac_geom"] = ocgt.apply( + lambda x: ac_foreign.at[x.bus1, "geom"], axis=1 + ) + for index, df in ocgt.iterrows(): distance = gas_foreign.distance(df["ac_geom"]) ocgt.loc[index, "bus0"] = str(distance.idxmin()) - + return ocgt[["bus0", "bus1", "p_nom"]] - + + def insert_ocgt_abroad(): """Insert gas turbine capicities abroad for eGon2035 in the database @@ -1573,19 +1583,19 @@ def insert_ocgt_abroad(): """ scenarios = config.settings()["egon-data"]["--scenarios"] carrier = "OCGT" - + for scn_name in scenarios: # Connect to local database engine = db.engine() - scn_name = 'status2019' - if scn_name == 'status2019': + scn_name = "status2019" + if scn_name == "status2019": df_ocgt = calculate_ocgt_capacities_scenario2019() else: df_ocgt = calculate_ocgt_capacities() df_ocgt["p_nom_extendable"] = False df_ocgt["carrier"] = carrier df_ocgt["scn_name"] = scn_name - + buses = tuple( db.select_dataframe( f"""SELECT bus_id FROM grid.egon_etrago_bus @@ -1593,7 +1603,7 @@ def insert_ocgt_abroad(): """ )["bus_id"] ) - + # Delete old entries db.execute_sql( f""" @@ -1602,7 +1612,7 @@ def insert_ocgt_abroad(): AND bus0 IN {buses} AND bus1 IN {buses}; """ ) - + # read carrier information from scnario parameter data scn_params = get_sector_parameters("gas", scn_name) df_ocgt["efficiency"] = scn_params["efficiency"][carrier] @@ -1610,15 +1620,17 @@ def insert_ocgt_abroad(): scn_params["marginal_cost"][carrier] / scn_params["efficiency"][carrier] ) - + # Adjust p_nom if scn_name != "status2019": - df_ocgt["p_nom"] = df_ocgt["p_nom"] / scn_params["efficiency"][carrier] - + df_ocgt["p_nom"] = ( + df_ocgt["p_nom"] / scn_params["efficiency"][carrier] + ) + # Select next id value new_id = db.next_etrago_id("link") df_ocgt["link_id"] = range(new_id, new_id + len(df_ocgt)) - + # Insert data to db df_ocgt.to_sql( "egon_etrago_link", From 29ade7fc21d1b71e7acd4e12454503712e1f42f6 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 3 Aug 2023 13:40:00 +0200 Subject: [PATCH 458/787] update carrier names --- .../data/datasets/electrical_neighbours.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/egon/data/datasets/electrical_neighbours.py diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py old mode 100755 new mode 100644 index 555fcb809..c5ad1e471 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1399,18 +1399,18 @@ def map_carriers_entsoe(): "Biomass": "biomass", "Fossil Brown coal/Lignite": "lignite", "Fossil Coal-derived gas": "coal", - "Fossil Gas": "gas", + "Fossil Gas": "OCGT", "Fossil Hard coal": "coal", "Fossil Oil": "oil", "Fossil Oil shale": "oil", - "Fossil Peat": "others", + "Fossil Peat": "other_non_renewable", "Geothermal": "geo_thermal", "Hydro Pumped Storage": "Hydro Pumped Storage", "Hydro Run-of-river and poundage": "run_of_river", "Hydro Water Reservoir": "reservoir", "Marine": "Other RES", "Nuclear": "nuclear", - "Other": "others", + "Other": "other_non_renewable", "Other renewable": "Other RES", "Solar": "solar", "Waste": "Other RES", @@ -1494,12 +1494,13 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): AND scn_name = '{scn_name}' """ ) - entsoe_to_bus = entsoe_to_bus_etrago() - carrier_entsoe = map_carriers_entsoe() gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() + # Filter generators modeled as storage and geothermal + gen_sq = gen_sq.loc[:,~gen_sq.columns.isin(["Hydro Pumped Storage", "reservoir", "geo_thermal"])] + list_gen_sq = pd.DataFrame( dtype=int, columns=["carrier", "country", "capacity"] ) @@ -1519,6 +1520,14 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): # Add marginal costs list_gen_sq = add_marginal_costs(list_gen_sq) + # assign marginal cost for OCGTs + scn_params_gas = get_sector_parameters("gas", scn_name) + efficiency_ocgt = scn_params_gas["efficiency"]["OCGT"] + list_gen_sq.loc[list_gen_sq.carrier=="OCGT","marginal_cost"] = ( + scn_params_gas["marginal_cost"]["OCGT"] + / efficiency_ocgt + ) + # Find foreign bus to assign the generator list_gen_sq["bus"] = list_gen_sq.country.map(entsoe_to_bus) From 2b081c32c792e7735c7c2dac68da4df58aeb021c Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 3 Aug 2023 14:10:50 +0200 Subject: [PATCH 459/787] no modification to match_ocgt.py --- .../data/datasets/gas_neighbours/eGon2035.py | 178 +++++------------- .../data/datasets/power_etrago/match_ocgt.py | 2 +- 2 files changed, 51 insertions(+), 129 deletions(-) diff --git a/src/egon/data/datasets/gas_neighbours/eGon2035.py b/src/egon/data/datasets/gas_neighbours/eGon2035.py index ef88bc7db..04329d95b 100755 --- a/src/egon/data/datasets/gas_neighbours/eGon2035.py +++ b/src/egon/data/datasets/gas_neighbours/eGon2035.py @@ -15,8 +15,6 @@ from egon.data.datasets.electrical_neighbours import ( get_foreign_bus_id, get_map_buses, - entsoe_to_bus_etrago, - map_carriers_entsoe, ) from egon.data.datasets.gas_neighbours.gas_abroad import ( insert_gas_grid_capacities, @@ -41,7 +39,7 @@ ] -def get_foreign_gas_bus_id(carrier="CH4", scn_name="eGon2035"): +def get_foreign_gas_bus_id(carrier="CH4"): """Calculate the etrago bus id based on the geometry Map node_ids from TYNDP and etragos bus_id @@ -58,6 +56,7 @@ def get_foreign_gas_bus_id(carrier="CH4", scn_name="eGon2035"): """ sources = config.datasets()["gas_neighbours"]["sources"] + scn_name = "eGon2035" bus_id = db.select_geodataframe( f""" @@ -1491,151 +1490,74 @@ def calculate_ocgt_capacities(): # Choose capacities for considered countries df_ocgt = df_ocgt[df_ocgt.index.str[:2].isin(countries)] + # Attribute bus0 and bus1 - df_ocgt["bus0"] = get_foreign_gas_bus_id(scn_name="status2019")[ - df_ocgt.index - ] - df_ocgt["bus1"] = get_foreign_bus_id(scenario="status2019")[df_ocgt.index] + df_ocgt["bus0"] = get_foreign_gas_bus_id()[df_ocgt.index] + df_ocgt["bus1"] = get_foreign_bus_id()[df_ocgt.index] df_ocgt = df_ocgt.groupby(by=["bus0", "bus1"], as_index=False).sum() return df_ocgt +def insert_ocgt_abroad(): + """Insert gas turbine capicities abroad for eGon2035 in the database -def calculate_ocgt_capacities_scenario2019(scn_name="status2019"): - """ - Insert OCGT generators for foreign countries based on ENTSO-E data + This function inserts data in the database and has no return. Parameters ---------- - scn_name : str - The default is "status2019". - - Returns - ------- - None. + df_ocgt: pandas.DataFrame + Gas turbine capacities per foreign node """ - scn_name = "status2019" - con = db.engine() - - carrier_entsoe = map_carriers_entsoe() - entsoe_to_bus = entsoe_to_bus_etrago() - gen_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" - ) - gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() + scn_name = "eGon2035" + carrier = "OCGT" - ocgt = ( - gen_sq["gas"] - .reset_index() - .rename(columns={"Index": "country", "gas": "p_nom"}) - ) + # Connect to local database + engine = db.engine() - # delete OCGT with p_nom = 0 - ocgt = ocgt[ocgt["p_nom"] > 0] + df_ocgt = calculate_ocgt_capacities() - # Find foreign bus to assign the generator - ocgt["bus1"] = ocgt.country.map(entsoe_to_bus) + df_ocgt["p_nom_extendable"] = False + df_ocgt["carrier"] = carrier + df_ocgt["scn_name"] = scn_name - gas_foreign = gpd.read_postgis( - f"""SELECT * FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' - AND country <> 'DE' - AND carrier = 'CH4' - """, - con=con, - geom_col="geom", - index_col="bus_id", + buses = tuple( + db.select_dataframe( + f"""SELECT bus_id FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' AND country != 'DE'; + """ + )["bus_id"] ) - ac_foreign = gpd.read_postgis( - f"""SELECT * FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' - AND country <> 'DE' - AND carrier = 'AC' - """, - con=con, - geom_col="geom", - index_col="bus_id", + # Delete old entries + db.execute_sql( + f""" + DELETE FROM grid.egon_etrago_link WHERE "carrier" = '{carrier}' + AND scn_name = '{scn_name}' + AND bus0 IN {buses} AND bus1 IN {buses}; + """ ) - ocgt["ac_geom"] = ocgt.apply( - lambda x: ac_foreign.at[x.bus1, "geom"], axis=1 + # read carrier information from scnario parameter data + scn_params = get_sector_parameters("gas", scn_name) + df_ocgt["efficiency"] = scn_params["efficiency"][carrier] + df_ocgt["marginal_cost"] = ( + scn_params["marginal_cost"][carrier] + / scn_params["efficiency"][carrier] ) - for index, df in ocgt.iterrows(): - distance = gas_foreign.distance(df["ac_geom"]) - ocgt.loc[index, "bus0"] = str(distance.idxmin()) + # Adjust p_nom + df_ocgt["p_nom"] = df_ocgt["p_nom"] / scn_params["efficiency"][carrier] - return ocgt[["bus0", "bus1", "p_nom"]] - - -def insert_ocgt_abroad(): - """Insert gas turbine capicities abroad for eGon2035 in the database - - This function inserts data in the database and has no return. - - Parameters - ---------- - df_ocgt: pandas.DataFrame - Gas turbine capacities per foreign node - - """ - scenarios = config.settings()["egon-data"]["--scenarios"] - carrier = "OCGT" - - for scn_name in scenarios: - # Connect to local database - engine = db.engine() - scn_name = "status2019" - if scn_name == "status2019": - df_ocgt = calculate_ocgt_capacities_scenario2019() - else: - df_ocgt = calculate_ocgt_capacities() - df_ocgt["p_nom_extendable"] = False - df_ocgt["carrier"] = carrier - df_ocgt["scn_name"] = scn_name - - buses = tuple( - db.select_dataframe( - f"""SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' AND country != 'DE'; - """ - )["bus_id"] - ) - - # Delete old entries - db.execute_sql( - f""" - DELETE FROM grid.egon_etrago_link WHERE "carrier" = '{carrier}' - AND scn_name = '{scn_name}' - AND bus0 IN {buses} AND bus1 IN {buses}; - """ - ) - - # read carrier information from scnario parameter data - scn_params = get_sector_parameters("gas", scn_name) - df_ocgt["efficiency"] = scn_params["efficiency"][carrier] - df_ocgt["marginal_cost"] = ( - scn_params["marginal_cost"][carrier] - / scn_params["efficiency"][carrier] - ) + # Select next id value + new_id = db.next_etrago_id("link") + df_ocgt["link_id"] = range(new_id, new_id + len(df_ocgt)) - # Adjust p_nom - if scn_name != "status2019": - df_ocgt["p_nom"] = ( - df_ocgt["p_nom"] / scn_params["efficiency"][carrier] - ) - - # Select next id value - new_id = db.next_etrago_id("link") - df_ocgt["link_id"] = range(new_id, new_id + len(df_ocgt)) - - # Insert data to db - df_ocgt.to_sql( - "egon_etrago_link", - engine, - schema="grid", - index=False, - if_exists="append", - ) + # Insert data to db + df_ocgt.to_sql( + "egon_etrago_link", + engine, + schema="grid", + index=False, + if_exists="append", + ) diff --git a/src/egon/data/datasets/power_etrago/match_ocgt.py b/src/egon/data/datasets/power_etrago/match_ocgt.py index 3e04efee9..c0e17a246 100755 --- a/src/egon/data/datasets/power_etrago/match_ocgt.py +++ b/src/egon/data/datasets/power_etrago/match_ocgt.py @@ -17,7 +17,7 @@ def insert_open_cycle_gas_turbines(): insert_open_cycle_gas_turbines_per_scenario(scenario) -def insert_open_cycle_gas_turbines_per_scenario(scn_name="eGon2035"): +def insert_open_cycle_gas_turbines_per_scenario(scn_name): """Insert gas turbine links in egon_etrago_link table. Parameters From 13986dd79479645131dc9b5cdb1b74b909f0f67a Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 8 Aug 2023 08:53:00 +0200 Subject: [PATCH 460/787] Apply black --- src/egon/data/datasets/power_plants/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 11665af13..6050ad1b2 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1004,13 +1004,18 @@ def fill_missing_bus_and_geom(gens, carrier): conv = conv[ conv.Energietraeger.isin( - ["Braunkohle", "Mineralölprodukte", "Steinkohle", "Kernenergie", - "Erdgas"] + [ + "Braunkohle", + "Mineralölprodukte", + "Steinkohle", + "Kernenergie", + "Erdgas", + ] ) ] - + # convert from KW to MW - conv["Nettonennleistung"] = conv["Nettonennleistung"]/1000 + conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[ @@ -1032,7 +1037,6 @@ def fill_missing_bus_and_geom(gens, carrier): conv.loc[ conv.Energietraeger == "Kernenergie", "Energietraeger" ] = "nuclear" - # rename columns conv.rename( @@ -1060,7 +1064,7 @@ def fill_missing_bus_and_geom(gens, carrier): conv["voltage_level"] = assign_voltage_level_by_capacity( conv.rename(columns={"capacity": "Nettonennleistung"}) ) - + for i, row in conv.iterrows(): entry = EgonPowerPlants( sources={"el_capacity": "MaStR"}, From 59db3642f53cbe72d79dfafa4c10b1ee04e2a730 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 8 Aug 2023 10:50:51 +0200 Subject: [PATCH 461/787] correct marginal costs --- .../data/datasets/electrical_neighbours.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index c5ad1e471..ae63609b2 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1403,17 +1403,17 @@ def map_carriers_entsoe(): "Fossil Hard coal": "coal", "Fossil Oil": "oil", "Fossil Oil shale": "oil", - "Fossil Peat": "other_non_renewable", + "Fossil Peat": "others", "Geothermal": "geo_thermal", "Hydro Pumped Storage": "Hydro Pumped Storage", "Hydro Run-of-river and poundage": "run_of_river", "Hydro Water Reservoir": "reservoir", - "Marine": "Other RES", + "Marine": "Others", "Nuclear": "nuclear", - "Other": "other_non_renewable", - "Other renewable": "Other RES", + "Other": "others", + "Other renewable": "Others", "Solar": "solar", - "Waste": "Other RES", + "Waste": "Others", "Wind Offshore": "wind_offshore", "Wind Onshore": "wind_onshore", } @@ -1499,7 +1499,9 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() # Filter generators modeled as storage and geothermal - gen_sq = gen_sq.loc[:,~gen_sq.columns.isin(["Hydro Pumped Storage", "reservoir", "geo_thermal"])] + gen_sq = gen_sq.loc[ + :, ~gen_sq.columns.isin(["Hydro Pumped Storage", "geo_thermal"]) + ] list_gen_sq = pd.DataFrame( dtype=int, columns=["carrier", "country", "capacity"] @@ -1522,10 +1524,9 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): # assign marginal cost for OCGTs scn_params_gas = get_sector_parameters("gas", scn_name) - efficiency_ocgt = scn_params_gas["efficiency"]["OCGT"] - list_gen_sq.loc[list_gen_sq.carrier=="OCGT","marginal_cost"] = ( - scn_params_gas["marginal_cost"]["OCGT"] - / efficiency_ocgt + list_gen_sq.loc[list_gen_sq.carrier == "OCGT", "marginal_cost"] = ( + scn_params_gas["marginal_cost"]["CH4"] + + scn_params_gas["marginal_cost"]["OCGT"] ) # Find foreign bus to assign the generator From c031d43bb86df29c51e1e74ef7bb5e0983c03c7a Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 9 Aug 2023 16:12:38 +0200 Subject: [PATCH 462/787] include efficiency in marginal price calculation --- .../data/datasets/electrical_neighbours.py | 13 +++---------- .../scenario_parameters/parameters.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index ae63609b2..b93563c5b 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1408,12 +1408,12 @@ def map_carriers_entsoe(): "Hydro Pumped Storage": "Hydro Pumped Storage", "Hydro Run-of-river and poundage": "run_of_river", "Hydro Water Reservoir": "reservoir", - "Marine": "Others", + "Marine": "others", "Nuclear": "nuclear", "Other": "others", - "Other renewable": "Others", + "Other renewable": "others", "Solar": "solar", - "Waste": "Others", + "Waste": "others", "Wind Offshore": "wind_offshore", "Wind Onshore": "wind_onshore", } @@ -1522,13 +1522,6 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): # Add marginal costs list_gen_sq = add_marginal_costs(list_gen_sq) - # assign marginal cost for OCGTs - scn_params_gas = get_sector_parameters("gas", scn_name) - list_gen_sq.loc[list_gen_sq.carrier == "OCGT", "marginal_cost"] = ( - scn_params_gas["marginal_cost"]["CH4"] - + scn_params_gas["marginal_cost"]["OCGT"] - ) - # Find foreign bus to assign the generator list_gen_sq["bus"] = list_gen_sq.country.map(entsoe_to_bus) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 1e1dd806f..045c9970e 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -314,27 +314,32 @@ def electricity(scenario): # marginal cost can include fuel, C02 and operation and maintenance costs parameters["marginal_cost"] = { "oil": global_settings(scenario)["fuel_costs"]["oil"] + / read_costs(costs, "oil", "efficiency") + read_costs(costs, "oil", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["oil"], "other_non_renewable": global_settings(scenario)["fuel_costs"][ "gas" - ] + ] / read_costs(costs, "OCGT", "efficiency") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"][ "other_non_renewable" ], "lignite": global_settings(scenario)["fuel_costs"]["lignite"] + / read_costs(costs, "lignite", "efficiency") + read_costs(costs, "lignite", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["lignite"], "coal": global_settings(scenario)["fuel_costs"]["coal"] + / read_costs(costs, "coal", "efficiency") + read_costs(costs, "coal", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["coal"], "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] + / read_costs(costs, "nuclear", "efficiency") + read_costs(costs, "nuclear", "VOM"), "biomass": global_settings(scenario)["fuel_costs"]["biomass"] + / read_costs(costs, "biomass", "efficiency") + read_costs(costs, "biomass CHP", "VOM"), "wind_offshore": read_costs(costs, "offwind", "VOM"), "wind_onshore": read_costs(costs, "onwind", "VOM"), @@ -630,27 +635,37 @@ def electricity(scenario): parameters["marginal_cost"] = { "oil": global_settings(scenario)["fuel_costs"]["oil"] + / read_costs(costs, "oil", "efficiency") + read_costs(costs, "oil", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["oil"], "other_non_renewable": global_settings(scenario)["fuel_costs"][ "gas" - ] + ] / read_costs(costs, "OCGT", "efficiency") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"][ "other_non_renewable" ], "lignite": global_settings(scenario)["fuel_costs"]["lignite"] + / read_costs(costs, "lignite", "efficiency") + read_costs(costs, "lignite", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["lignite"], "coal": global_settings(scenario)["fuel_costs"]["coal"] + / read_costs(costs, "coal", "efficiency") + read_costs(costs, "coal", "VOM") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"]["coal"], + "OCGT": global_settings(scenario)["fuel_costs"]["gas"] + / read_costs(costs, "OCGT", "efficiency") + + read_costs(costs, "OCGT", "VOM") + + global_settings(scenario)["co2_costs"] + * global_settings(scenario)["co2_emissions"]["gas"], "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] + / read_costs(costs, "nuclear", "efficiency") + read_costs(costs, "nuclear", "VOM"), "biomass": global_settings(scenario)["fuel_costs"]["biomass"] + / read_costs(costs, "biomass CHP", "efficiency") + read_costs(costs, "biomass CHP", "VOM"), "wind_offshore": read_costs(costs, "offwind", "VOM"), "wind_onshore": read_costs(costs, "onwind", "VOM"), From fe91eaebcd0d7b6308d090e6bfbc01d5f85154de Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 10 Aug 2023 13:42:26 +0200 Subject: [PATCH 463/787] use efficiency on CO2 costs --- .../scenario_parameters/parameters.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 045c9970e..d2b146dac 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -317,24 +317,27 @@ def electricity(scenario): / read_costs(costs, "oil", "efficiency") + read_costs(costs, "oil", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["oil"], + * global_settings(scenario)["co2_emissions"]["oil"] + / read_costs(costs, "oil", "efficiency"), "other_non_renewable": global_settings(scenario)["fuel_costs"][ "gas" ] / read_costs(costs, "OCGT", "efficiency") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"][ "other_non_renewable" - ], + ] / read_costs(costs, "OCGT", "efficiency"), "lignite": global_settings(scenario)["fuel_costs"]["lignite"] / read_costs(costs, "lignite", "efficiency") + read_costs(costs, "lignite", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["lignite"], + * global_settings(scenario)["co2_emissions"]["lignite"] + / read_costs(costs, "lignite", "efficiency"), "coal": global_settings(scenario)["fuel_costs"]["coal"] / read_costs(costs, "coal", "efficiency") + read_costs(costs, "coal", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["coal"], + * global_settings(scenario)["co2_emissions"]["coal"] + / read_costs(costs, "coal", "efficiency"), "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] / read_costs(costs, "nuclear", "efficiency") + read_costs(costs, "nuclear", "VOM"), @@ -638,29 +641,33 @@ def electricity(scenario): / read_costs(costs, "oil", "efficiency") + read_costs(costs, "oil", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["oil"], + * global_settings(scenario)["co2_emissions"]["oil"] + / read_costs(costs, "oil", "efficiency"), "other_non_renewable": global_settings(scenario)["fuel_costs"][ "gas" ] / read_costs(costs, "OCGT", "efficiency") + global_settings(scenario)["co2_costs"] * global_settings(scenario)["co2_emissions"][ "other_non_renewable" - ], + ] / read_costs(costs, "OCGT", "efficiency"), "lignite": global_settings(scenario)["fuel_costs"]["lignite"] / read_costs(costs, "lignite", "efficiency") + read_costs(costs, "lignite", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["lignite"], + * global_settings(scenario)["co2_emissions"]["lignite"] + / read_costs(costs, "lignite", "efficiency"), "coal": global_settings(scenario)["fuel_costs"]["coal"] / read_costs(costs, "coal", "efficiency") + read_costs(costs, "coal", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["coal"], + * global_settings(scenario)["co2_emissions"]["coal"] + / read_costs(costs, "coal", "efficiency"), "OCGT": global_settings(scenario)["fuel_costs"]["gas"] / read_costs(costs, "OCGT", "efficiency") + read_costs(costs, "OCGT", "VOM") + global_settings(scenario)["co2_costs"] - * global_settings(scenario)["co2_emissions"]["gas"], + * global_settings(scenario)["co2_emissions"]["gas"] + / read_costs(costs, "OCGT", "efficiency"), "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"] / read_costs(costs, "nuclear", "efficiency") + read_costs(costs, "nuclear", "VOM"), From 0b00b9345943f71c23bb0785ddb4bd0939c7358f Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 10 Aug 2023 15:54:43 +0200 Subject: [PATCH 464/787] Copy airflow's webserver_config --- src/egon/data/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index d9e98ef77..ba66f006a 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -15,6 +15,7 @@ Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration """ import os +import shutil import socket import subprocess import sys @@ -328,6 +329,12 @@ def render(template, target, update=True, inserts={}, **more_inserts): ) (Path(".") / "docker" / "database-data").mkdir(parents=True, exist_ok=True) + # Copy webserver_config.py to disable authentification on webinterface + shutil.copy2( + os.path.dirname(egon.data.airflow.__file__) + "/webserver_config.py", + Path(".") / "airflow/webserver_config.py", + ) + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: code = s.connect_ex( (options["--database-host"], int(options["--database-port"])) From 9600e972e8cd8844da17301491c85989fb58a024 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 14 Aug 2023 11:48:32 +0200 Subject: [PATCH 465/787] make entsoe-py work --- .../data/datasets/electrical_neighbours.py | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index efea7fc74..0c9b408ff 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -3,7 +3,7 @@ import zipfile -# import entsoe +import entsoe import requests import logging @@ -19,6 +19,7 @@ from egon.data.datasets.fix_ehv_subnetworks import select_bus_id from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.scenario_parameters import get_sector_parameters +from os import path def get_cross_border_buses(scenario, sources): @@ -1272,9 +1273,9 @@ def tyndp_demand(): session.commit() -def entsoe_historic_generation_capacities( - entsoe_token=None, year_start="20190101", year_end="20200101" -): +def entsoe_historic_generation_capacities(year_start="20190101", year_end="20200101"): + + entsoe_token = open(path.join(path.expanduser('~'), ".entsoe-token"), "r").read(36) client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1316,7 +1317,7 @@ def entsoe_historic_generation_capacities( pass if not_retrieved: - logger.warning( + logging.warning( f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) df = pd.concat(dfs) @@ -1326,9 +1327,8 @@ def entsoe_historic_generation_capacities( return df -def entsoe_historic_demand( - entsoe_token=None, year_start="20190101", year_end="20200101" -): +def entsoe_historic_demand(year_start="20190101", year_end="20200101"): + entsoe_token = open(path.join(path.expanduser('~'), ".entsoe-token"), "r").read(36) client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1377,7 +1377,7 @@ def entsoe_historic_demand( not_retrieved.append(country) pass if not_retrieved: - logger.warning( + logging.warning( f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) @@ -1443,7 +1443,7 @@ def entsoe_to_bus_etrago(): return map_entsoe.map(for_bus) -def insert_generators_sq(gen_sq=None, scn_name="status2019"): +def insert_generators_sq(scn_name="status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1460,11 +1460,8 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): None. """ - ################# TEMPORAL #################### - gen_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" - ) - ################# TEMPORAL #################### + + gen_sq = entsoe_historic_generation_capacities() targets = config.datasets()["electrical_neighbours"]["targets"] # Delete existing data @@ -1616,7 +1613,7 @@ def insert_generators_sq(gen_sq=None, scn_name="status2019"): return -def insert_loads_sq(load_sq=None, scn_name="status2019"): +def insert_loads_sq(scn_name="status2019"): """ Copy load timeseries data from entso-e. @@ -1628,11 +1625,7 @@ def insert_loads_sq(load_sq=None, scn_name="status2019"): sources = config.datasets()["electrical_neighbours"]["sources"] targets = config.datasets()["electrical_neighbours"]["targets"] - ################# TEMPORAL #################### - load_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" - ) - ################# TEMPORAL #################### + load_sq = entsoe_historic_demand() # Delete existing data db.execute_sql( @@ -1715,7 +1708,7 @@ class ElectricalNeighbours(Dataset): def __init__(self, dependencies): super().__init__( name="ElectricalNeighbours", - version="0.0.9", + version="0.0.10", dependencies=dependencies, tasks=tasks, ) From 182eef5cfb9ab3c182daca284ed925ebbf02ab6f Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 14 Aug 2023 11:49:30 +0200 Subject: [PATCH 466/787] use Black --- src/egon/data/datasets/electrical_neighbours.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 0c9b408ff..b6ce601e5 100755 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1273,9 +1273,12 @@ def tyndp_demand(): session.commit() -def entsoe_historic_generation_capacities(year_start="20190101", year_end="20200101"): - - entsoe_token = open(path.join(path.expanduser('~'), ".entsoe-token"), "r").read(36) +def entsoe_historic_generation_capacities( + year_start="20190101", year_end="20200101" +): + entsoe_token = open( + path.join(path.expanduser("~"), ".entsoe-token"), "r" + ).read(36) client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1328,7 +1331,9 @@ def entsoe_historic_generation_capacities(year_start="20190101", year_end="20200 def entsoe_historic_demand(year_start="20190101", year_end="20200101"): - entsoe_token = open(path.join(path.expanduser('~'), ".entsoe-token"), "r").read(36) + entsoe_token = open( + path.join(path.expanduser("~"), ".entsoe-token"), "r" + ).read(36) client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") From a808c7b8aaf76e1dc488841027cc5569e883a27b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 14 Aug 2023 15:29:12 +0200 Subject: [PATCH 467/787] Update dependencies --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4183c08da..598e1d2e0 100755 --- a/setup.py +++ b/setup.py @@ -93,7 +93,7 @@ def read(*names, **kwargs): "geopandas>=0.10.0", "geopy", "geovoronoi", - "importlib-resources", + "importlib-resources<6.0", "loguru", "markupsafe", "matplotlib", @@ -112,6 +112,7 @@ def read(*names, **kwargs): "rtree", "saio", "seaborn", + "setuptools>60.0", "shapely", "snakemake<7", "sqlalchemy", From 56b33ab093b1becda93d2e853ed61d5c9a74b8fd Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 15 Aug 2023 09:18:50 +0200 Subject: [PATCH 468/787] include entoe-py in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 598e1d2e0..07ce36552 100755 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def read(*names, **kwargs): "atlite==0.2.5", "cdsapi", "click<8.1", - #"entsoe-py >=0.3.1", + "entsoe-py >=0.5.5", "GeoAlchemy2", "geopandas>=0.10.0", "geopy", From dce18002348fd04b1f1b9d7352f5c79065e8d159 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 15 Aug 2023 10:16:36 +0200 Subject: [PATCH 469/787] include instructions to use entsoe-py token --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index e2e4a2509..38cb528af 100644 --- a/README.rst +++ b/README.rst @@ -137,6 +137,15 @@ packages are required too. Right now these are: You also have to agree on the `terms of use `_ +* To download generation and demand data from entsoe you need to register in + the `entsoe platform `_. Once the user is + created, a personal token can be generated to access the available data. This + token must be saved in a text file called *.entsoe-token* in the home directory. + In Ubuntu you can go to the home directory by typing :code:`cd ~` in a + terminal. To create the file execute :code:`nano ".entsoe-token"` and then + paste your personal token (36 characters). Finally press :code:`CRL + x` to + save and exit. + * Make sure you have enough free disk space (~350 GB) in your working directory. From 76be0955d117ea96cf5a490356d997373b6d0761 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 15 Aug 2023 12:01:40 +0200 Subject: [PATCH 470/787] include bk opcion when entsoe fails --- .../data/datasets/electrical_neighbours.py | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 85df7915b..c983a6fe5 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1492,8 +1492,16 @@ def insert_generators_sq(scn_name="status2019"): None. """ - - gen_sq = entsoe_historic_generation_capacities() + try: + gen_sq = entsoe_historic_generation_capacities() + except: + logging.warning( + """Generation data from entsoe could not be retrieved. + Backup data is used instead""" + ) + gen_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" + ) targets = config.datasets()["electrical_neighbours"]["targets"] # Delete existing data @@ -1642,8 +1650,16 @@ def insert_loads_sq(scn_name="status2019"): """ sources = config.datasets()["electrical_neighbours"]["sources"] targets = config.datasets()["electrical_neighbours"]["targets"] - - load_sq = entsoe_historic_demand() + try: + load_sq = entsoe_historic_demand() + except: + logging.warning( + """Demand data from entsoe could not be retrieved. + Backup data is used instead""" + ) + load_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" + ) # Delete existing data db.execute_sql( From 1d303cb0e04c1fabc250ea567c48da6576cf29ac Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 13 Sep 2023 14:07:27 +0200 Subject: [PATCH 471/787] gas grid just one bus for status2019 --- src/egon/data/datasets/gas_grid.py | 62 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 4efc5382c..608ecc503 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -22,6 +22,7 @@ import json import os +from sqlalchemy.orm import sessionmaker from geoalchemy2.types import Geometry from shapely import geometry import geopandas @@ -1008,6 +1009,65 @@ def insert_gas_data_eGon100RE(): ) +def insert_gas_data_status2019(): + """ + Function to deal with the gas network for the status2019 scenario. + For this scenario just one CH4 bus is consider in the center of Germany. + Since OCGTs in the foreign countries are modelled as generators and not + as links between the gas and electricity sectors, CH4 foreign buses are + considered not necessary. + + This function does not require any input. + + Returns + ------- + None. + + """ + scn_name = "status2019" + + # delete old entries + db.execute_sql( + f""" + DELETE FROM grid.egon_etrago_link + WHERE carrier = 'CH4' AND scn_name = '{scn_name}' + """ + ) + db.execute_sql( + f""" + DELETE FROM grid.egon_etrago_bus + WHERE carrier = 'CH4' AND scn_name = '{scn_name}' + """ + ) + + # Select next id value + new_id = db.next_etrago_id("bus") + + df = pd.DataFrame( + index=[new_id], + data={ + "scn_name": scn_name, + "v_nom": 1, + "carrier": "CH4", + "v_mag_pu_set": 1, + "v_mag_pu_min": 0, + "v_mag_pu_max": np.inf, + "x": 10, + "y": 51, + "country": "DE", + }, + ) + gdf = geopandas.GeoDataFrame( + df, geometry=geopandas.points_from_xy(df.x, df.y, crs=4326) + ).rename_geometry("geom") + + gdf.index.name = "bus_id" + + gdf.reset_index().to_postgis( + "egon_etrago_bus", schema="grid", con=db.engine(), if_exists="append" + ) + + class GasNodesAndPipes(Dataset): """ Insert the CH4 buses and links into the database. @@ -1034,7 +1094,7 @@ class GasNodesAndPipes(Dataset): #: version: str = "0.0.9" - tasks = (insert_gas_data,) + tasks = (insert_gas_data_status2019,) if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: tasks = tasks + (insert_gas_data_eGon2035,) From bc0eb256c564397ab4794a7a57fda521527f28c5 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 14 Sep 2023 09:57:26 +0200 Subject: [PATCH 472/787] fix download path VG250 --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index c630980c8..326b69f22 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -21,7 +21,7 @@ openstreetmap: vg250: original_data: source: - url: "https://datenX.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip" + url: "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip" target: file: "vg250_01-01.geo84.shape.ebenen.zip" processed: From 69500fa232d026c9e61a8f0e9352bdfc7421bba8 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 14 Sep 2023 11:42:23 +0200 Subject: [PATCH 473/787] Remove python3.7 from setup.py --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 598e1d2e0..c7cebc39d 100755 --- a/setup.py +++ b/setup.py @@ -59,7 +59,6 @@ def read(*names, **kwargs): "Operating System :: Microsoft :: Windows", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", # uncomment if you test on these interpreters: @@ -79,7 +78,7 @@ def read(*names, **kwargs): keywords=[ # eg: 'keyword1', 'keyword2', 'keyword3', ], - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', "apache-airflow>2.0", From 402ea4675ba07321488f79a3a4c4a36c7f760e22 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 14 Sep 2023 11:42:48 +0200 Subject: [PATCH 474/787] Do not run test for python3.7 --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 160ddd430..34d88c305 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,12 +25,9 @@ jobs: strategy: matrix: python-version: - - "3.7" - "3.8" platform: [ubuntu-latest, macos-latest] exclude: - - platform: macos-latest - python-version: "3.7" - platform: macos-latest python-version: "3.8" max-parallel: 4 From 298bdf693568b2feba1edbb3bd2ee31d0ac0e21e Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 14 Sep 2023 14:43:33 +0200 Subject: [PATCH 475/787] include missing parameters for new lines --- src/egon/data/datasets/fix_ehv_subnetworks.py | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 1e3a8c2ab..389906130 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -36,7 +36,7 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): if bus_id.empty: if find_closest: bus_id = db.select_dataframe( - f""" + f""" SELECT bus_id, st_distance(geom, 'SRID=4326;POINT({x} {y})'::geometry) FROM grid.egon_etrago_bus WHERE v_nom = {v_nom} @@ -44,7 +44,8 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): AND carrier = '{carrier}' ORDER BY st_distance Limit 1 - """) + """ + ) return bus_id.bus_id[0] else: return None @@ -91,8 +92,12 @@ def drop_bus(x, y, v_nom, scn_name): def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): - bus0 = select_bus_id(x0, y0, v_nom, scn_name, carrier="AC", find_closest= True) - bus1 = select_bus_id(x1, y1, v_nom, scn_name, carrier="AC", find_closest= True) + bus0 = select_bus_id( + x0, y0, v_nom, scn_name, carrier="AC", find_closest=True + ) + bus1 = select_bus_id( + x1, y1, v_nom, scn_name, carrier="AC", find_closest=True + ) df = pd.DataFrame( index=[db.next_etrago_id("line")], @@ -113,15 +118,26 @@ def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): if v_nom == 220: s_nom = 520 x_per_km = 0.001 * 2 * np.pi * 50 + r_per_km = 0.097 # based on average r from similar lines + b_per_km = 3.066e-6 # based on average b from similar lines + cost_km = 40.697 # based on average costs from similar lines elif v_nom == 380: s_nom = 1790 x_per_km = 0.0008 * 2 * np.pi * 50 + r_per_km = 0.024 # based on average r from similar lines + b_per_km = 3.803e-6 # based on average b from similar lines + cost_km = 40.697 # based on average costs from similar lines gdf["s_nom"] = s_nom * gdf["cables"] / 3 + gdf["s_nom_extendable"] = True + gdf["lifetime"] = 40 + gdf["s_nom_min"] = s_nom gdf["x"] = (x_per_km * gdf["length"]) / (gdf["cables"] / 3) - + gdf["r"] = (r_per_km * gdf["length"]) / (gdf["cables"] / 3) + gdf["b"] = (b_per_km * gdf["length"]) * (gdf["cables"] / 3) + gdf["capital_cost"] = (cost_km * gdf["length"]) * (gdf["cables"] / 3) gdf.index.name = "line_id" gdf.reset_index().to_postgis( @@ -147,8 +163,12 @@ def drop_line(x0, y0, x1, y1, v_nom, scn_name): def add_trafo(x, y, v_nom0, v_nom1, scn_name, n=1): - bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC", find_closest= True) - bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC", find_closest= True) + bus0 = select_bus_id( + x, y, v_nom0, scn_name, carrier="AC", find_closest=True + ) + bus1 = select_bus_id( + x, y, v_nom1, scn_name, carrier="AC", find_closest=True + ) df = pd.DataFrame( index=[db.next_etrago_id("line")], From f618dadf663bfdef78e33bd7c43b04f9ad851f50 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 14 Sep 2023 15:07:23 +0200 Subject: [PATCH 476/787] fix indentation problem --- src/egon/data/datasets/electrical_neighbours.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index c983a6fe5..3bfa54ecf 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1657,9 +1657,9 @@ def insert_loads_sq(scn_name="status2019"): """Demand data from entsoe could not be retrieved. Backup data is used instead""" ) - load_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" - ) + load_sq = pd.read_csv( + "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" + ) # Delete existing data db.execute_sql( From 34fc0ebbd0b473df7ea7e5e16a32bc8303eed640 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 18 Sep 2023 11:01:10 +0200 Subject: [PATCH 477/787] Refer to disaggregator branch that includes updates for new pandas version --- src/egon/data/datasets.yml | 2 +- src/egon/data/datasets/demandregio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 326b69f22..eedf7b624 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -90,7 +90,7 @@ map_zensus_vg250: demandregio_installation: sources: git-repository: "https://github.com/openego/disaggregator.git" - branch: "features/pip_install" + branch: "features/pandas-update" targets: path: 'demandregio-disaggregator' diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 3756c7e90..ef8b384d2 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -35,7 +35,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.5", + version="0.0.6", dependencies=dependencies, tasks=( clone_and_install, From 4966f8e515fc58d9cf2e8fa631085aa391e82e6c Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Mon, 18 Sep 2023 11:01:10 +0200 Subject: [PATCH 478/787] Refer to disaggregator branch that includes updates for new pandas version --- src/egon/data/datasets.yml | 2 +- src/egon/data/datasets/demandregio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index c630980c8..740312375 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -90,7 +90,7 @@ map_zensus_vg250: demandregio_installation: sources: git-repository: "https://github.com/openego/disaggregator.git" - branch: "features/pip_install" + branch: "features/pandas-update" targets: path: 'demandregio-disaggregator' diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 3756c7e90..ef8b384d2 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -35,7 +35,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.5", + version="0.0.6", dependencies=dependencies, tasks=( clone_and_install, From 5643dc1656729a7b84a867e1f3de8438ee962da3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 20 Sep 2023 08:47:15 +0200 Subject: [PATCH 479/787] Update version of atlite --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 85e998f96..c93030be2 100755 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ def read(*names, **kwargs): "apache-airflow>2.0", "apache-airflow[postgres]", "apache-airflow-providers-sendgrid", - "atlite==0.2.5", + "atlite==0.2.11", "cdsapi", "click<8.1", "entsoe-py >=0.5.5", From a3dc6e0c6a2e7cdea7a70b076bc00d5705feefda Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 14 Sep 2023 14:43:33 +0200 Subject: [PATCH 480/787] include missing parameters for new lines --- src/egon/data/datasets/fix_ehv_subnetworks.py | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 1e3a8c2ab..389906130 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -36,7 +36,7 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): if bus_id.empty: if find_closest: bus_id = db.select_dataframe( - f""" + f""" SELECT bus_id, st_distance(geom, 'SRID=4326;POINT({x} {y})'::geometry) FROM grid.egon_etrago_bus WHERE v_nom = {v_nom} @@ -44,7 +44,8 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): AND carrier = '{carrier}' ORDER BY st_distance Limit 1 - """) + """ + ) return bus_id.bus_id[0] else: return None @@ -91,8 +92,12 @@ def drop_bus(x, y, v_nom, scn_name): def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): - bus0 = select_bus_id(x0, y0, v_nom, scn_name, carrier="AC", find_closest= True) - bus1 = select_bus_id(x1, y1, v_nom, scn_name, carrier="AC", find_closest= True) + bus0 = select_bus_id( + x0, y0, v_nom, scn_name, carrier="AC", find_closest=True + ) + bus1 = select_bus_id( + x1, y1, v_nom, scn_name, carrier="AC", find_closest=True + ) df = pd.DataFrame( index=[db.next_etrago_id("line")], @@ -113,15 +118,26 @@ def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): if v_nom == 220: s_nom = 520 x_per_km = 0.001 * 2 * np.pi * 50 + r_per_km = 0.097 # based on average r from similar lines + b_per_km = 3.066e-6 # based on average b from similar lines + cost_km = 40.697 # based on average costs from similar lines elif v_nom == 380: s_nom = 1790 x_per_km = 0.0008 * 2 * np.pi * 50 + r_per_km = 0.024 # based on average r from similar lines + b_per_km = 3.803e-6 # based on average b from similar lines + cost_km = 40.697 # based on average costs from similar lines gdf["s_nom"] = s_nom * gdf["cables"] / 3 + gdf["s_nom_extendable"] = True + gdf["lifetime"] = 40 + gdf["s_nom_min"] = s_nom gdf["x"] = (x_per_km * gdf["length"]) / (gdf["cables"] / 3) - + gdf["r"] = (r_per_km * gdf["length"]) / (gdf["cables"] / 3) + gdf["b"] = (b_per_km * gdf["length"]) * (gdf["cables"] / 3) + gdf["capital_cost"] = (cost_km * gdf["length"]) * (gdf["cables"] / 3) gdf.index.name = "line_id" gdf.reset_index().to_postgis( @@ -147,8 +163,12 @@ def drop_line(x0, y0, x1, y1, v_nom, scn_name): def add_trafo(x, y, v_nom0, v_nom1, scn_name, n=1): - bus0 = select_bus_id(x, y, v_nom0, scn_name, carrier="AC", find_closest= True) - bus1 = select_bus_id(x, y, v_nom1, scn_name, carrier="AC", find_closest= True) + bus0 = select_bus_id( + x, y, v_nom0, scn_name, carrier="AC", find_closest=True + ) + bus1 = select_bus_id( + x, y, v_nom1, scn_name, carrier="AC", find_closest=True + ) df = pd.DataFrame( index=[db.next_etrago_id("line")], From 168ef39c089095ac584f3977defa64a3f6c939fd Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 2 Oct 2023 12:02:56 +0200 Subject: [PATCH 481/787] use values from osmTGmod --- src/egon/data/datasets/fix_ehv_subnetworks.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 389906130..a83f03157 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -4,10 +4,11 @@ import numpy as np import pandas as pd -from egon.data import db, config +from egon.data import config, db from egon.data.config import settings from egon.data.datasets import Dataset from egon.data.datasets.etrago_setup import link_geom_from_buses +from egon.data.datasets.scenario_parameters import get_sector_parameters class FixEhvSubnetworks(Dataset): @@ -92,6 +93,7 @@ def drop_bus(x, y, v_nom, scn_name): def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): + parameters = get_sector_parameters("electricity", scenario=scn_name) bus0 = select_bus_id( x0, y0, v_nom, scn_name, carrier="AC", find_closest=True ) @@ -115,31 +117,32 @@ def add_line(x0, y0, x1, y1, v_nom, scn_name, cables): gdf["length"] = gdf.to_crs(3035).topo.length.mul(1e-3) + # all the values used for x, r and b are taken from the electrical values + # reference table from oemtgmod: github.com/wupperinst/osmTGmod if v_nom == 220: s_nom = 520 x_per_km = 0.001 * 2 * np.pi * 50 - r_per_km = 0.097 # based on average r from similar lines - b_per_km = 3.066e-6 # based on average b from similar lines - cost_km = 40.697 # based on average costs from similar lines + r_per_km = 0.05475 + b_per_km = 11 * 2 * np.pi * 50 * 1e-9 + cost_per_km = parameters["capital_cost"]["ac_ehv_overhead_line"] elif v_nom == 380: s_nom = 1790 x_per_km = 0.0008 * 2 * np.pi * 50 - r_per_km = 0.024 # based on average r from similar lines - b_per_km = 3.803e-6 # based on average b from similar lines - cost_km = 40.697 # based on average costs from similar lines + r_per_km = 0.027375 + b_per_km = 14 * 2 * np.pi * 50 * 1e-9 + cost_per_km = parameters["capital_cost"]["ac_ehv_overhead_line"] gdf["s_nom"] = s_nom * gdf["cables"] / 3 gdf["s_nom_extendable"] = True - gdf["lifetime"] = 40 - gdf["s_nom_min"] = s_nom + gdf["lifetime"] = parameters["lifetime"]["ac_ehv_overhead_line"] + gdf["s_nom_min"] = s_nom * gdf["cables"] / 3 gdf["x"] = (x_per_km * gdf["length"]) / (gdf["cables"] / 3) gdf["r"] = (r_per_km * gdf["length"]) / (gdf["cables"] / 3) gdf["b"] = (b_per_km * gdf["length"]) * (gdf["cables"] / 3) - gdf["capital_cost"] = (cost_km * gdf["length"]) * (gdf["cables"] / 3) + gdf["capital_cost"] = (cost_per_km * gdf["length"]) * (gdf["cables"] / 3) gdf.index.name = "line_id" - gdf.reset_index().to_postgis( "egon_etrago_line", schema="grid", con=db.engine(), if_exists="append" ) From c1f09666769544e901ad78cb44ebdd2458da0bd4 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 10 Oct 2023 19:42:39 +0200 Subject: [PATCH 482/787] Import missing package --- src/egon/data/datasets/hydrogen_etrago/bus.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py index 37d5db481..6d416e030 100755 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -13,6 +13,7 @@ potential H2 saltcaverns. """ +import datetime from geoalchemy2 import Geometry from sqlalchemy import BigInteger, Column, Text From bb1f08cd5e1074dee4849535811324a83f2dccd3 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 11 Oct 2023 12:16:57 +0200 Subject: [PATCH 483/787] Import json package --- src/egon/data/datasets/hydrogen_etrago/bus.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py index 6d416e030..a2d101bf0 100755 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -14,6 +14,7 @@ """ import datetime +import json from geoalchemy2 import Geometry from sqlalchemy import BigInteger, Column, Text From 46eaadf3f97af75910b08622c84a6f191445e5ac Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 19 Oct 2023 09:04:36 +0200 Subject: [PATCH 484/787] Add zensus_population_id to joined dataframe In previous pandas versions, zensus_population_id was kept as the index. This behavior changes in pandas >2, so this change is required to not lose the id. --- src/egon/data/datasets/district_heating_areas/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 6552228ad..9efa5d5a4 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -427,6 +427,7 @@ def area_grouping( join, join_2[ [ + "zensus_population_id", "residential_and_service_demand", "geom_polygon", "area_id", From 25450e451083060e61b4753e82ad468db270ba00 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 19 Oct 2023 09:06:00 +0200 Subject: [PATCH 485/787] Drop unused zensus_population_id before inserting into the database --- src/egon/data/datasets/district_heating_areas/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 9efa5d5a4..18cd03f69 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -673,7 +673,9 @@ def district_heating_areas(scenario_name, plotting=False): f"""DELETE FROM demand.egon_district_heating_areas WHERE scenario = '{scenario_name}'""" ) - areas_dissolved.reset_index().to_postgis( + areas_dissolved.reset_index().drop( + "zensus_population_id", axis="columns" + ).to_postgis( "egon_district_heating_areas", schema="demand", con=db.engine(), From 063c839d1319eb25d98dadf94c18d026e476f1f9 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 19 Oct 2023 09:06:27 +0200 Subject: [PATCH 486/787] Increase version number --- src/egon/data/datasets/district_heating_areas/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 18cd03f69..ce906ba2c 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -46,7 +46,7 @@ def __init__(self, dependencies): super().__init__( name="district-heating-areas", # version=self.target_files + "_0.0", - version="0.0.3", # maybe rethink the naming + version="0.0.4", # maybe rethink the naming dependencies=dependencies, tasks=(create_tables, demarcation), ) From 869e4eb16e9008403cb6ac9005db75ba4db58a19 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 19 Oct 2023 13:33:56 +0200 Subject: [PATCH 487/787] assure dumb charging for status2019 --- .../model_timeseries.py | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index c6418453e..d0ca585ab 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -734,7 +734,15 @@ def write_load( # * load timeseries: # * regular (flex): use driving load # * lowflex: use dumb charging load - if write_lowflex_model is False: + # * status2019: also dumb charging + + if scenario_name=='status2019': + write_load( + scenario_name=scenario_name, + connection_bus_id=etrago_bus.bus_id, + load_ts=hourly_load_time_series_df.load_time_series.to_list(), + + else write_lowflex_model is False: emob_bus_id = write_bus(scenario_name=scenario_name) write_link(scenario_name=scenario_name) write_store(scenario_name=scenario_name) @@ -745,22 +753,18 @@ def write_load( hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501 ), ) - elif scenario_name=='status2019': - write_load( - scenario_name=scenario_name, - connection_bus_id=etrago_bus.bus_id, - load_ts=hourly_load_time_series_df.load_time_series.to_list(), - ) - else: - # Get lowflex scenario name - lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][ - "names" - ][scenario_name] - write_load( - scenario_name=lowflex_scenario_name, - connection_bus_id=etrago_bus.bus_id, - load_ts=hourly_load_time_series_df.load_time_series.to_list(), + ) + else: + # Get lowflex scenario name + lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][ + "names" + ][scenario_name] + write_load( + scenario_name=lowflex_scenario_name, + connection_bus_id=etrago_bus.bus_id, + load_ts=hourly_load_time_series_df.load_time_series.to_list(), + ) def write_to_file(): """Write model data to file (for debugging purposes)""" From 8ccdc59bfdd2e5d993e90cf9ba8c50c88e80c7b5 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 19 Oct 2023 13:45:48 +0200 Subject: [PATCH 488/787] My coding was not very good looking --- .../emobility/motorized_individual_travel/model_timeseries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index d0ca585ab..958b8b271 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -741,8 +741,8 @@ def write_load( scenario_name=scenario_name, connection_bus_id=etrago_bus.bus_id, load_ts=hourly_load_time_series_df.load_time_series.to_list(), - - else write_lowflex_model is False: + else: + if write_lowflex_model is False: emob_bus_id = write_bus(scenario_name=scenario_name) write_link(scenario_name=scenario_name) write_store(scenario_name=scenario_name) From e0bc8dfff0cd342926b2ebfdb86c1c722e71312e Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 19 Oct 2023 13:52:38 +0200 Subject: [PATCH 489/787] Change intendation of if-block --- .../model_timeseries.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index 958b8b271..af0f1ee2c 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -741,20 +741,20 @@ def write_load( scenario_name=scenario_name, connection_bus_id=etrago_bus.bus_id, load_ts=hourly_load_time_series_df.load_time_series.to_list(), + ) else: if write_lowflex_model is False: - emob_bus_id = write_bus(scenario_name=scenario_name) - write_link(scenario_name=scenario_name) - write_store(scenario_name=scenario_name) - write_load( - scenario_name=scenario_name, - connection_bus_id=emob_bus_id, - load_ts=( - hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501 - ), - ) + emob_bus_id = write_bus(scenario_name=scenario_name) + write_link(scenario_name=scenario_name) + write_store(scenario_name=scenario_name) + write_load( + scenario_name=scenario_name, + connection_bus_id=emob_bus_id, + load_ts=( + hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501 + ), + ) - ) else: # Get lowflex scenario name lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][ From 6591257771911fb50ec946021ff5cdf92ac08583 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Thu, 19 Oct 2023 13:53:51 +0200 Subject: [PATCH 490/787] Update version number --- .../datasets/emobility/motorized_individual_travel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 82f8ed919..7e264cd0b 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -482,7 +482,7 @@ def generate_model_data_tasks(scenario_name): super().__init__( name="MotorizedIndividualTravel", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=tasks, ) From 2dd55ef6214ff3459afb0735e84e10e5d48362b1 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 20 Oct 2023 10:46:10 +0200 Subject: [PATCH 491/787] set cyclic to True for storages --- src/egon/data/datasets/scenario_parameters/parameters.py | 6 ++++++ src/egon/data/datasets/storages_etrago/__init__.py | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index d2b146dac..91e7b6bc0 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -184,12 +184,14 @@ def electricity(scenario): ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, "pumped_hydro": { "store": read_costs(costs, "PHS", "efficiency") ** 0.5, "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, } # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data! @@ -363,12 +365,14 @@ def electricity(scenario): ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, "pumped_hydro": { "store": read_costs(costs, "PHS", "efficiency") ** 0.5, "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, } # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data! @@ -510,12 +514,14 @@ def electricity(scenario): ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, "pumped_hydro": { "store": read_costs(costs, "PHS", "efficiency") ** 0.5, "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5, "standing_loss": 0, "max_hours": 6, + "cyclic_state_of_charge": True, }, } # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data! diff --git a/src/egon/data/datasets/storages_etrago/__init__.py b/src/egon/data/datasets/storages_etrago/__init__.py index 86c8b8f82..f4f8790cc 100644 --- a/src/egon/data/datasets/storages_etrago/__init__.py +++ b/src/egon/data/datasets/storages_etrago/__init__.py @@ -25,7 +25,6 @@ def __init__(self, dependencies): def insert_PHES(): - # Get datasets configuration sources = config.datasets()["storage_etrago"]["sources"] targets = config.datasets()["storage_etrago"]["targets"] @@ -67,6 +66,7 @@ def insert_PHES(): phes["efficiency_store"] = parameters["store"] phes["efficiency_dispatch"] = parameters["dispatch"] phes["standing_loss"] = parameters["standing_loss"] + phes["cyclic_state_of_charge"] = parameters["cyclic_state_of_charge"] # Write data to db phes.to_sql( @@ -79,7 +79,6 @@ def insert_PHES(): def extendable_batteries_per_scenario(scenario): - # Get datasets configuration sources = config.datasets()["storage_etrago"]["sources"] targets = config.datasets()["storage_etrago"]["targets"] @@ -156,6 +155,10 @@ def extendable_batteries_per_scenario(scenario): "electricity", scenario )["efficiency"]["battery"]["standing_loss"] + extendable_batteries["cyclic_state_of_charge"] = get_sector_parameters( + "electricity", scenario + )["efficiency"]["battery"]["cyclic_state_of_charge"] + extendable_batteries["carrier"] = "battery" # Merge dataframes to fill p_nom_min column @@ -178,4 +181,4 @@ def extendable_batteries_per_scenario(scenario): def extendable_batteries(): for scn in config.settings()["egon-data"]["--scenarios"]: - extendable_batteries_per_scenario(scn) \ No newline at end of file + extendable_batteries_per_scenario(scn) From f8b91bead4e0bdbfdf88040ab68610647418ddde Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 30 Oct 2023 13:13:37 +0100 Subject: [PATCH 492/787] upgrade versions pandas and pypsa --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c93030be2..e4d4616e1 100755 --- a/setup.py +++ b/setup.py @@ -100,10 +100,10 @@ def read(*names, **kwargs): "numpy", "omi", "openpyxl", - "pandas>1.2.0", + "pandas>2.0.0", "psycopg2", "pyaml", - "pypsa==0.17.1", + "pypsa==0.20.1", "pydantic<2.0", "rasterio", "requests", From a7aad6105e4a226a12ab4693e3b2767b545e4837 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 1 Nov 2023 12:05:49 +0100 Subject: [PATCH 493/787] Correctly scale el_capacity from MaStR to MW --- src/egon/data/datasets/chp/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 9b865561b..1a5329717 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -433,7 +433,7 @@ def insert_chp_statusquo(): }, source_id={"MastrNummer": row.EinheitMastrNummer}, carrier=map_carrier().loc[row.Energietraeger], - el_capacity=row.Nettonennleistung, + el_capacity=row.Nettonennleistung / 1000, th_capacity=row.ThermischeNutzleistung / 1000, scenario="status2019", district_heating=row.district_heating, @@ -688,5 +688,5 @@ def insert_chp_egon100re(): class Chp(Dataset): def __init__(self, dependencies): super().__init__( - name="Chp", version="0.0.7", dependencies=dependencies, tasks=tasks + name="Chp", version="0.0.8", dependencies=dependencies, tasks=tasks ) From 9613f4fec99d72fdad6b8b08b9f4cf8ac99ccaea Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 30 Oct 2023 11:47:15 +0100 Subject: [PATCH 494/787] adjust voronoi for just 1 ch4 bus --- src/egon/data/datasets/gas_areas.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 436012248..4e0abb9d1 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -96,7 +96,6 @@ def __init__(self, dependencies): ) - Base = declarative_base() @@ -141,7 +140,8 @@ def voronoi_egon100RE(): """ for carrier in ["CH4", "H2_grid", "H2_saltcavern"]: create_voronoi("eGon100RE", carrier) - + + def voronoi_status2019(): """ Create voronoi polygons for all gas carriers in status2019 scenario @@ -191,16 +191,21 @@ def create_voronoi(scn_name, carrier): if len(buses) == 0: return - buses["x"] = buses.geometry.x - buses["y"] = buses.geometry.y # generate voronois - gdf = get_voronoi_geodataframe(buses, boundary.geometry.iloc[0]) - # set scn_name + if len(buses) == 1: + gdf = buses.copy() + gdf.at[0, "geom"] = boundary.at[0, "geometry"] + else: + buses["x"] = buses.geometry.x + buses["y"] = buses.geometry.y + gdf = get_voronoi_geodataframe(buses, boundary.geometry.iloc[0]) + gdf.rename_geometry("geom", inplace=True) + gdf.drop(columns=["id"], inplace=True) + + # set scn_name and carrier gdf["scn_name"] = scn_name gdf["carrier"] = carrier - gdf.rename_geometry("geom", inplace=True) - gdf.drop(columns=["id"], inplace=True) # Insert data to db gdf.set_crs(epsg=4326).to_postgis( f"egon_gas_voronoi", From 489eebeed1513adf8cb08570803cbe2f301566da Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Fri, 17 Nov 2023 10:13:47 +0100 Subject: [PATCH 495/787] make eGon2035 usable again --- src/egon/data/datasets/gas_grid.py | 109 +++++------------------------ 1 file changed, 18 insertions(+), 91 deletions(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 608ecc503..4c8b83d43 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -160,14 +160,14 @@ def ch4_nodes_number_G(gas_nodes_list): def insert_CH4_nodes_list(gas_nodes_list): """ - Insert list of German CH4 nodes into the database for status2019 + Insert list of German CH4 nodes into the database for eGon2035 Insert the list of German CH4 nodes into the database by executing the following steps: * Receive the buses as parameter (from SciGRID_gas IGGIELGN data) * Add the missing information: scn_name and carrier * Clean the database table grid.egon_etrago_bus of the - CH4 buses of the specific scenario (status2019) in Germany + CH4 buses of the specific scenario (eGon2035) in Germany * Insert the buses in the table grid.egon_etrago_bus Parameters @@ -222,7 +222,7 @@ def insert_CH4_nodes_list(gas_nodes_list): # A completer avec nodes related to pipelines which have an end in the selected area et evt deplacer ds define_gas_nodes_list # Add missing columns - c = {"scn_name": "status2019", "carrier": "CH4"} + c = {"scn_name": "eGon2035", "carrier": "CH4"} gas_nodes_list = gas_nodes_list.assign(**c) gas_nodes_list = geopandas.GeoDataFrame( @@ -260,11 +260,11 @@ def insert_CH4_nodes_list(gas_nodes_list): ) -def insert_gas_buses_abroad(scn_name="status2019"): +def insert_gas_buses_abroad(scn_name="eGon2035"): """ - Insert CH4 buses in neighbouring countries to database for status2019 + Insert CH4 buses in neighbouring countries to database for eGon2035 - For the scenario status2019, insert central CH4 buses in foreign + For the scenario eGon2035, insert central CH4 buses in foreign countries to the database. The considered foreign countries are the direct neighbouring countries, with the addition of Russia that is considered as a source of fossil CH4. @@ -278,7 +278,7 @@ def insert_gas_buses_abroad(scn_name="status2019"): * Addition of the missing information: scn_name and carrier * Attribution of an id to each bus * Cleaning of the database table grid.egon_etrago_bus of the - CH4 buses of the specific scenario (status2019) out of Germany + CH4 buses of the specific scenario (eGon2035) out of Germany * Insertion of the neighbouring buses in the table grid.egon_etrago_bus. Returns @@ -320,7 +320,7 @@ def insert_gas_buses_abroad(scn_name="status2019"): "geom", ] ) - gdf_abroad_buses["scn_name"] = "status2019" + gdf_abroad_buses["scn_name"] = "eGon2035" gdf_abroad_buses["carrier"] = main_gas_carrier gdf_abroad_buses["bus_id"] = range(new_id, new_id + len(gdf_abroad_buses)) @@ -388,14 +388,14 @@ def insert_gas_buses_abroad(scn_name="status2019"): def insert_gas_pipeline_list( - gas_nodes_list, abroad_gas_nodes_list, scn_name="status2019" + gas_nodes_list, abroad_gas_nodes_list, scn_name="eGon2035" ): """ Insert list of gas pipelines into the database The gas pipelines, modelled as Pypsa links are red from the IGGIELGN_PipeSegments csv file previously downloded in the function :py:func:`download_SciGRID_gas_data`, - adapted and inserted in the database for the status2019 scenario. + adapted and inserted in the database for the eGon2035 scenario. The manual corrections allows to: * Delete gas pipelines disconnected of the rest of the gas grid * Connect one pipeline (also connected to Norway) disconnected of @@ -802,7 +802,7 @@ def insert_gas_pipeline_list( def remove_isolated_gas_buses(): """ - Delete CH4 buses which are disconnected of the CH4 grid for the status2019 scenario + Delete CH4 buses which are disconnected of the CH4 grid for the eGon2035 scenario This function deletes directly in the database and has no return. @@ -813,15 +813,15 @@ def remove_isolated_gas_buses(): f""" DELETE FROM {targets['buses']['schema']}.{targets['buses']['table']} WHERE "carrier" = 'CH4' - AND scn_name = 'status2019' + AND scn_name = 'eGon2035' AND country = 'DE' AND "bus_id" NOT IN (SELECT bus0 FROM {targets['links']['schema']}.{targets['links']['table']} - WHERE scn_name = 'status2019' + WHERE scn_name = 'eGon2035' AND carrier = 'CH4') AND "bus_id" NOT IN (SELECT bus1 FROM {targets['links']['schema']}.{targets['links']['table']} - WHERE scn_name = 'status2019' + WHERE scn_name = 'eGon2035' AND carrier = 'CH4'); """ ) @@ -829,10 +829,10 @@ def remove_isolated_gas_buses(): def insert_gas_data(): """ - Overall function for importing methane data for status2019 + Overall function for importing methane data for eGon2035 This function import the methane data (buses and pipelines) for - status2019, by executing the following steps: + eGon2035, by executing the following steps: * Download the SciGRID_gas datasets with the function :py:func:`download_SciGRID_gas_data` * Define CH4 buses with the function :py:func:`define_gas_nodes_list` * Insert the CH4 buses in Germany into the database with the @@ -858,79 +858,6 @@ def insert_gas_data(): remove_isolated_gas_buses() -def insert_gas_data_eGon2035(): - """ - Overall function for importing methane data for eGon100RE - - This function import the methane data (buses and pipelines) for - eGon2035, by copying the CH4 buses from the status2019 scenario using - the function :py:func:`copy_and_modify_buses ` - from the module :py:mod:`etrago_helpers `. The methane - pipelines are also copied and their capacities are adapted: one - share of the methane grid is retroffited into an hydrogen grid, so - the methane pieplines nominal capacities are reduced from this share - (calculated in the pyspa-eur-sec run). - - This function inserts data into the database and has no return. - - """ - # copy buses - copy_and_modify_buses("status2019", "eGon2035", {"carrier": ["CH4"]}) - - # get CH4 pipelines and modify their nominal capacity with the - # retrofitting factor - gdf = db.select_geodataframe( - f""" - SELECT * FROM grid.egon_etrago_link - WHERE carrier = 'CH4' AND scn_name = 'status2019' AND - bus0 IN ( - SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = 'status2019' AND country = 'DE' - ) AND bus1 IN ( - SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = 'status2019' AND country = 'DE' - ); - """, - epsg=4326, - geom_col="topo", - ) - - # Update scenario specific information - scn_name = "eGon2035" - gdf["scn_name"] = scn_name - scn_params = get_sector_parameters("gas", scn_name) - - for param in ["capital_cost", "marginal_cost", "efficiency"]: - try: - gdf.loc[:, param] = scn_params[param]["CH4"] - except KeyError: - pass - - # delete old entries - db.execute_sql( - f""" - DELETE FROM grid.egon_etrago_link - WHERE carrier = 'CH4' AND scn_name = '{scn_name}' AND - bus0 NOT IN ( - SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' AND country != 'DE' - ) AND bus1 NOT IN ( - SELECT bus_id FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' AND country != 'DE' - ); - """ - ) - - gdf.to_postgis( - "egon_etrago_link", - schema="grid", - if_exists="append", - con=db.engine(), - index=False, - dtype={"geom": Geometry(), "topo": Geometry()}, - ) - - def insert_gas_data_eGon100RE(): """ Overall function for importing methane data for eGon100RE @@ -1092,12 +1019,12 @@ class GasNodesAndPipes(Dataset): #: name: str = "GasNodesAndPipes" #: - version: str = "0.0.9" + version: str = "0.0.10" tasks = (insert_gas_data_status2019,) if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (insert_gas_data_eGon2035,) + tasks = tasks + (insert_gas_data,) if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: tasks = tasks + (insert_gas_data_eGon100RE,) From b5c65def00aaed6ae37dcb62fe0a6419e2b2d5a2 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Wed, 22 Nov 2023 14:53:55 +0100 Subject: [PATCH 496/787] include explanation voronois --- src/egon/data/datasets/gas_areas.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 4e0abb9d1..e8d907ad7 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -192,6 +192,9 @@ def create_voronoi(scn_name, carrier): return # generate voronois + # For some scenarios it is defined that there is only 1 bus (e.g. gas). It + # means that there will be just 1 voronoi covering the entire german + # territory. For other scenarios with more buses, voronois are calculated. if len(buses) == 1: gdf = buses.copy() gdf.at[0, "geom"] = boundary.at[0, "geometry"] From 9f9e23a8c4d3b38bead4efddf4f0f22397ab3812 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 12 Dec 2023 11:47:53 +0100 Subject: [PATCH 497/787] Update deposit id to new zenodo repo --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index eedf7b624..333c1e30a 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -542,7 +542,7 @@ solar_rooftop: data-bundle: sources: zenodo: - deposit_id: 1095882 + deposit_id: 10226009 deposit_id_powerd: 1214744 targets: file: From 7a054f5dd9a8eddda75e04de90808e075baee456 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 12 Dec 2023 11:54:46 +0100 Subject: [PATCH 498/787] Remove downloding powerd_data_bundle These files are now part of data_bundle_egon_data --- src/egon/data/datasets.yml | 3 --- .../data/datasets/data_bundle/__init__.py | 21 +------------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 333c1e30a..462732949 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -543,12 +543,9 @@ data-bundle: sources: zenodo: deposit_id: 10226009 - deposit_id_powerd: 1214744 targets: file: 'data_bundle_egon_data.zip' - file_powerd: - 'data_bundle_powerd_data.zip' pypsa-technology-data: sources: diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index 178a3e17a..d4808379a 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -33,33 +33,14 @@ def download(): with zipfile.ZipFile(target_file, "r") as zip_ref: zip_ref.extractall(".") - - powerd_data_bundle_path = Path(".") / "data_bundle_powerd_data" - # Delete folder if it already exists - if powerd_data_bundle_path.exists() and powerd_data_bundle_path.is_dir(): - shutil.rmtree(powerd_data_bundle_path) - - url = f"""https://sandbox.zenodo.org/record/{sources['deposit_id_powerd']}/files/data_bundle_powerd_data.zip""" - target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file_powerd"] - - # Retrieve files - urlretrieve(url, target_file) - - with zipfile.ZipFile(target_file, "r") as zip_ref: - zip_ref.extractall(".") - - class DataBundle(Dataset): def __init__(self, dependencies): deposit_id = egon.data.config.datasets()["data-bundle"]["sources"][ "zenodo" ]["deposit_id"] - deposit_id_powerd = egon.data.config.datasets()["data-bundle"]["sources"][ - "zenodo" - ]["deposit_id"] super().__init__( name="DataBundle", - version=str(deposit_id) + str(deposit_id_powerd) + "-0.0.1", + version=str(deposit_id) + "-0.0.1", dependencies=dependencies, tasks=(download), ) From aea0b8c346e361d653f53baa5f0f8cd689d80c61 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 12 Dec 2023 11:55:52 +0100 Subject: [PATCH 499/787] Update version number --- src/egon/data/datasets/data_bundle/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index d4808379a..a143ca44b 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -40,7 +40,7 @@ def __init__(self, dependencies): ]["deposit_id"] super().__init__( name="DataBundle", - version=str(deposit_id) + "-0.0.1", + version=str(deposit_id) + "-0.0.2", dependencies=dependencies, tasks=(download), ) From c6651602a31db3ebf3bebd1e07261b7bddd1b244 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 12 Dec 2023 11:56:18 +0100 Subject: [PATCH 500/787] Access file from data_bundle_egon_data --- src/egon/data/datasets/electrical_neighbours.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 3bfa54ecf..0daed54fd 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1500,7 +1500,7 @@ def insert_generators_sq(scn_name="status2019"): Backup data is used instead""" ) gen_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/gen_entsoe.csv", index_col="Index" + "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" ) targets = config.datasets()["electrical_neighbours"]["targets"] @@ -1658,7 +1658,7 @@ def insert_loads_sq(scn_name="status2019"): Backup data is used instead""" ) load_sq = pd.read_csv( - "data_bundle_powerd_data/entsoe/load_entsoe.csv", index_col="Index" + "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" ) # Delete existing data From 9ab303a92ab6b6eb69a7898ed885e0f56558689b Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Tue, 12 Dec 2023 11:56:47 +0100 Subject: [PATCH 501/787] Access wind_ffhsore status2019 file from data_bundle_egon_data --- src/egon/data/datasets/power_plants/wind_offshore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 02a3e777e..68cb09d59 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -190,7 +190,7 @@ def insert(): elif scenario == "status2019": offshore_path = ( Path(".") - / "data_bundle_powerd_data" + / "data_bundle_egon_data" / "wind_offshore_status2019" / cfg["sources"]["wind_offshore_status2019"] ) From b57fb9878f3a547430e3c1e6c211bf7027de03c3 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 18 Dec 2023 15:33:11 +0100 Subject: [PATCH 502/787] change sandbox to zenodo --- src/egon/data/datasets/data_bundle/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index a143ca44b..ce16f3fdc 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -24,7 +24,7 @@ def download(): shutil.rmtree(data_bundle_path) # Get parameters from config and set download URL sources = egon.data.config.datasets()["data-bundle"]["sources"]["zenodo"] - url = f"""https://sandbox.zenodo.org/record/{sources['deposit_id']}/files/data_bundle_egon_data.zip""" + url = f"""https://zenodo.org/record/{sources['deposit_id']}/files/data_bundle_egon_data.zip""" target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file"] # Retrieve files @@ -33,6 +33,7 @@ def download(): with zipfile.ZipFile(target_file, "r") as zip_ref: zip_ref.extractall(".") + class DataBundle(Dataset): def __init__(self, dependencies): deposit_id = egon.data.config.datasets()["data-bundle"]["sources"][ From 682c9ecc301f01f1e17cb85abda5e62419dcca27 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 5 Jan 2024 17:51:28 +0100 Subject: [PATCH 503/787] Add SQL-script to update transformer s_nom As s_nom had way too high s_nom values, s_nom is now derived as sum of all lower-voltage side connected line s_nom ratings. --- src/egon/data/datasets/osmtgmod/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index 21a84b73a..e6e2fd268 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -772,6 +772,25 @@ def to_pypsa(): ) +def fix_transformer_snom(): + db.execute_sql( + """ + UPDATE grid.egon_etrago_transformer AS t + SET s_nom = CAST( + LEAST( + (SELECT SUM(COALESCE(l.s_nom,0)) + FROM grid.egon_etrago_line AS l + WHERE (l.bus0 = t.bus0 OR l.bus1 = t.bus0) + AND l.scn_name = t.scn_name), + (SELECT SUM(COALESCE(l.s_nom,0)) + FROM grid.egon_etrago_line AS l + WHERE (l.bus0 = t.bus1 OR l.bus1 = t.bus1) + AND l.scn_name = t.scn_name) + ) AS smallint + ); + """) + + class Osmtgmod(Dataset): def __init__(self, dependencies): super().__init__( From a01e9554b0fd70b529228666fe69b2dd84d4a025 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 5 Jan 2024 17:53:51 +0100 Subject: [PATCH 504/787] Add function to dataset and bump version --- src/egon/data/datasets/osmtgmod/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index e6e2fd268..4ac7328d1 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -795,7 +795,7 @@ class Osmtgmod(Dataset): def __init__(self, dependencies): super().__init__( name="Osmtgmod", - version="0.0.5", + version="0.0.6", dependencies=dependencies, tasks=( import_osm_data, @@ -804,5 +804,6 @@ def __init__(self, dependencies): extract, to_pypsa, }, + fix_transformer_snom, ), ) From f18d6272808efcf1d1e562a9103e8e42fd85e45f Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 5 Jan 2024 18:04:00 +0100 Subject: [PATCH 505/787] Update OSM links for first dump in 2024 --- src/egon/data/datasets.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 462732949..4cf469f46 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1,13 +1,13 @@ openstreetmap: original_data: source: - url: "https://download.geofabrik.de/europe/germany-200101.osm.pbf" - url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-200101.osm.pbf" + url: "https://download.geofabrik.de/europe/germany-240101.osm.pbf" + url_testmode: "https://download.geofabrik.de/europe/germany/schleswig-holstein-240101.osm.pbf" stylefile: "oedb.style" target: table_prefix: "osm" - file: "germany-200101.osm.pbf" - file_testmode: "schleswig-holstein-200101.osm.pbf" + file: "germany-240101.osm.pbf" + file_testmode: "schleswig-holstein-240101.osm.pbf" processed: schema: "openstreetmap" tables: From 096998126d8cfb35bdf01096e3ac5d64888becf4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 5 Jan 2024 18:04:23 +0100 Subject: [PATCH 506/787] Bump OSM dataset version --- src/egon/data/datasets/osm/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/osm/__init__.py b/src/egon/data/datasets/osm/__init__.py index b0cfaa11b..1fbbc3223 100644 --- a/src/egon/data/datasets/osm/__init__.py +++ b/src/egon/data/datasets/osm/__init__.py @@ -299,7 +299,7 @@ class OpenStreetMap(Dataset): def __init__(self, dependencies): super().__init__( name="OpenStreetMap", - version="0.0.4", + version="0.0.5", dependencies=dependencies, tasks=(download, to_postgres, modify_tables, add_metadata), ) From e1f28b2d782d5d334742767d89efa59fede97f59 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 10:08:21 +0100 Subject: [PATCH 507/787] Update zenodo URLs of MaStR data --- src/egon/data/datasets.yml | 4 ++-- src/egon/data/datasets/mastr.py | 8 ++++---- src/egon/data/datasets_original.yml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 462732949..7f6a584a7 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -295,7 +295,7 @@ mastr: - "gsgk" - "storage" file_basename: "bnetza_mastr" - deposit_id: 808086 + deposit_id: 10480930 mastr_new: technologies: @@ -306,7 +306,7 @@ mastr_new: - "combustion" - "nuclear" file_basename: "bnetza_mastr" - deposit_id: 1132987 + deposit_id: 10480958 egon2021_date_max: "2021-12-31 23:59:00" status2019_date_max: "2019-12-31 23:59:00" diff --git a/src/egon/data/datasets/mastr.py b/src/egon/data/datasets/mastr.py index 32f38b3d7..21c819ef5 100644 --- a/src/egon/data/datasets/mastr.py +++ b/src/egon/data/datasets/mastr.py @@ -2,15 +2,15 @@ Download Marktstammdatenregister (MaStR) datasets unit registry. It incorporates two different datasets: -Dump 2021-05-03 -* Source: https://sandbox.zenodo.org/record/808086 +Dump 2021-04-30 +* Source: https://zenodo.org/records/10480930 * Used technologies: PV plants, wind turbines, biomass, hydro plants, combustion, nuclear, gsgk, storage * Data is further processed in dataset :py:class:`egon.data.datasets.power_plants.PowerPlants` Dump 2022-11-17 -* Source: https://sandbox.zenodo.org/record/1132839 +* Source: https://zenodo.org/records/10480958 * Used technologies: PV plants, wind turbines, biomass, hydro plants * Data is further processed in module :py:mod:`egon.data.datasets.power_plants.mastr` `PowerPlants` @@ -39,7 +39,7 @@ def download(dataset_name, download_dir): # Get parameters from config and set download URL data_config = egon.data.config.datasets()[dataset_name] zenodo_files_url = ( - f"https://sandbox.zenodo.org/record/" + f"https://zenodo.org/record/" f"{data_config['deposit_id']}/files/" ) diff --git a/src/egon/data/datasets_original.yml b/src/egon/data/datasets_original.yml index 83d46126d..beb79027d 100755 --- a/src/egon/data/datasets_original.yml +++ b/src/egon/data/datasets_original.yml @@ -295,7 +295,7 @@ mastr: - "gsgk" - "storage" file_basename: "bnetza_mastr" - deposit_id: 808086 + deposit_id: 10480930 mastr_new: technologies: @@ -304,7 +304,7 @@ mastr_new: - "solar" - "biomass" file_basename: "bnetza_mastr" - deposit_id: 1132987 + deposit_id: 10480958 re_potential_areas: target: From 8f68720d85c05bda5d37831851db4ec018d44ebf Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 10:09:59 +0100 Subject: [PATCH 508/787] Bump mastr dataset version to 0.0.2 --- src/egon/data/datasets/mastr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/mastr.py b/src/egon/data/datasets/mastr.py index 21c819ef5..3c1d6b5d8 100644 --- a/src/egon/data/datasets/mastr.py +++ b/src/egon/data/datasets/mastr.py @@ -69,7 +69,7 @@ def download(dataset_name, download_dir): mastr_data_setup = partial( Dataset, name="MastrData", - version="0.0.1", + version="0.0.2", dependencies=[], tasks=(download_mastr_data,), ) From 6385ca366a7a203f7a51d597341ad543a8be8dbe Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 10:10:30 +0100 Subject: [PATCH 509/787] Update changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7b685f99a..de4c74ee4 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -729,6 +729,7 @@ Bug Fixes `#1098 `_ * Fix conversion factor for CH4 loads abroad in eGon2035 `#1104 `_ +* Fix URLs of MaStR datasets .. _PR #692: https://github.com/openego/eGon-data/pull/692 .. _#343: https://github.com/openego/eGon-data/issues/343 From 607578690eccd07db62169a0218aab78377bd855 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 15:02:42 +0100 Subject: [PATCH 510/787] Update deposit id of mastr to new release --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index dba2feb8d..ee8d8aed4 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -306,7 +306,7 @@ mastr_new: - "combustion" - "nuclear" file_basename: "bnetza_mastr" - deposit_id: 10480958 + deposit_id: 10491882 egon2021_date_max: "2021-12-31 23:59:00" status2019_date_max: "2019-12-31 23:59:00" From 85d7a31a235b2620547d43a4974c390f41e4fe2c Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 15:03:54 +0100 Subject: [PATCH 511/787] Introduce new upper date threshold for sq2023 scn --- src/egon/data/datasets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index ee8d8aed4..c8bbd60e2 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -309,6 +309,7 @@ mastr_new: deposit_id: 10491882 egon2021_date_max: "2021-12-31 23:59:00" status2019_date_max: "2019-12-31 23:59:00" + status2023_date_max: "2023-12-31 23:59:00" re_potential_areas: target: From 61e34a7de1eeaf381056ee569f416aa3e30fa0e9 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 15:06:43 +0100 Subject: [PATCH 512/787] Use new upper date threshold for sq2023 scn --- src/egon/data/datasets/chp/__init__.py | 1384 ++++++++--------- .../data/datasets/power_plants/__init__.py | 2 +- src/egon/data/datasets/power_plants/mastr.py | 2 +- .../power_plants/pv_rooftop_buildings.py | 2 +- 4 files changed, 695 insertions(+), 695 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 1a5329717..8f6929b97 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -1,692 +1,692 @@ -""" -The central module containing all code dealing with combined heat and power -(CHP) plants. -""" - -from pathlib import Path - -from geoalchemy2 import Geometry -from shapely.ops import nearest_points -from sqlalchemy import Boolean, Column, Float, Integer, Sequence, String -from sqlalchemy.dialects.postgresql import JSONB -from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.orm import sessionmaker -import geopandas as gpd -import pandas as pd -import pypsa - -from egon.data import config, db -from egon.data.datasets import Dataset -from egon.data.datasets.chp.match_nep import insert_large_chp, map_carrier -from egon.data.datasets.chp.small_chp import ( - assign_use_case, - existing_chp_smaller_10mw, - extension_per_federal_state, - extension_to_areas, - select_target, -) -from egon.data.datasets.mastr import ( - WORKING_DIR_MASTR_OLD, - WORKING_DIR_MASTR_NEW, -) -from egon.data.datasets.power_plants import ( - assign_bus_id, - assign_voltage_level, - filter_mastr_geometry, - scale_prox2now, -) - -Base = declarative_base() - - -class EgonChp(Base): - __tablename__ = "egon_chp_plants" - __table_args__ = {"schema": "supply"} - id = Column(Integer, Sequence("chp_seq"), primary_key=True) - sources = Column(JSONB) - source_id = Column(JSONB) - carrier = Column(String) - district_heating = Column(Boolean) - el_capacity = Column(Float) - th_capacity = Column(Float) - electrical_bus_id = Column(Integer) - district_heating_area_id = Column(Integer) - ch4_bus_id = Column(Integer) - voltage_level = Column(Integer) - scenario = Column(String) - geom = Column(Geometry("POINT", 4326)) - - -class EgonMaStRConventinalWithoutChp(Base): - __tablename__ = "egon_mastr_conventional_without_chp" - __table_args__ = {"schema": "supply"} - id = Column(Integer, Sequence("mastr_conventional_seq"), primary_key=True) - EinheitMastrNummer = Column(String) - carrier = Column(String) - el_capacity = Column(Float) - plz = Column(Integer) - city = Column(String) - federal_state = Column(String) - geometry = Column(Geometry("POINT", 4326)) - - -def create_tables(): - """Create tables for chp data - Returns - ------- - None. - """ - - db.execute_sql("CREATE SCHEMA IF NOT EXISTS supply;") - engine = db.engine() - EgonChp.__table__.drop(bind=engine, checkfirst=True) - EgonChp.__table__.create(bind=engine, checkfirst=True) - EgonMaStRConventinalWithoutChp.__table__.drop(bind=engine, checkfirst=True) - EgonMaStRConventinalWithoutChp.__table__.create( - bind=engine, checkfirst=True - ) - - -def nearest( - row, - df, - centroid=False, - row_geom_col="geometry", - df_geom_col="geometry", - src_column=None, -): - """ - Finds the nearest point and returns the specified column values - - Parameters - ---------- - row : pandas.Series - Data to which the nearest data of df is assigned. - df : pandas.DataFrame - Data which includes all options for the nearest neighbor alogrithm. - centroid : boolean - Use centroid geoemtry. The default is False. - row_geom_col : str, optional - Name of row's geometry column. The default is 'geometry'. - df_geom_col : str, optional - Name of df's geometry column. The default is 'geometry'. - src_column : str, optional - Name of returned df column. The default is None. - - Returns - ------- - value : pandas.Series - Values of specified column of df - - """ - - if centroid: - unary_union = df.centroid.unary_union - else: - unary_union = df[df_geom_col].unary_union - # Find the geometry that is closest - nearest = ( - df[df_geom_col] == nearest_points(row[row_geom_col], unary_union)[1] - ) - - # Get the corresponding value from df (matching is based on the geometry) - value = df[nearest][src_column].values[0] - - return value - - -def assign_heat_bus(): - """Selects heat_bus for chps used in district heating. - - Parameters - ---------- - scenario : str, optional - Name of the corresponding scenario. The default is 'eGon2035'. - - Returns - ------- - None. - - """ - sources = config.datasets()["chp_location"]["sources"] - target = config.datasets()["chp_location"]["targets"]["chp_table"] - - for scenario in config.settings()["egon-data"]["--scenarios"]: - # Select CHP with use_case = 'district_heating' - chp = db.select_geodataframe( - f""" - SELECT * FROM - {target['schema']}.{target['table']} - WHERE scenario = '{scenario}' - AND district_heating = True - """, - index_col="id", - epsg=4326, - ) - - # Select district heating areas and their centroid - district_heating = db.select_geodataframe( - f""" - SELECT area_id, ST_Centroid(geom_polygon) as geom - FROM - {sources['district_heating_areas']['schema']}. - {sources['district_heating_areas']['table']} - WHERE scenario = '{scenario}' - """, - epsg=4326, - ) - - # Assign district heating area_id to district_heating_chp - # According to nearest centroid of district heating area - chp["district_heating_area_id"] = chp.apply( - nearest, - df=district_heating, - row_geom_col="geom", - df_geom_col="geom", - centroid=True, - src_column="area_id", - axis=1, - ) - - # Drop district heating CHP without heat_bus_id - db.execute_sql( - f""" - DELETE FROM {target['schema']}.{target['table']} - WHERE scenario = '{scenario}' - AND district_heating = True - """ - ) - - # Insert district heating CHP with heat_bus_id - session = sessionmaker(bind=db.engine())() - for i, row in chp.iterrows(): - if row.carrier != "biomass": - entry = EgonChp( - id=i, - sources=row.sources, - source_id=row.source_id, - carrier=row.carrier, - el_capacity=row.el_capacity, - th_capacity=row.th_capacity, - electrical_bus_id=row.electrical_bus_id, - ch4_bus_id=row.ch4_bus_id, - district_heating_area_id=row.district_heating_area_id, - district_heating=row.district_heating, - voltage_level=row.voltage_level, - scenario=scenario, - geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", - ) - else: - entry = EgonChp( - id=i, - sources=row.sources, - source_id=row.source_id, - carrier=row.carrier, - el_capacity=row.el_capacity, - th_capacity=row.th_capacity, - electrical_bus_id=row.electrical_bus_id, - district_heating_area_id=row.district_heating_area_id, - district_heating=row.district_heating, - voltage_level=row.voltage_level, - scenario=scenario, - geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", - ) - session.add(entry) - session.commit() - - -def insert_biomass_chp(scenario): - """Insert biomass chp plants of future scenario - - Parameters - ---------- - scenario : str - Name of scenario. - - Returns - ------- - None. - - """ - cfg = config.datasets()["chp_location"] - - # import target values from NEP 2021, scneario C 2035 - target = select_target("biomass", scenario) - - # import data for MaStR - mastr = pd.read_csv( - WORKING_DIR_MASTR_OLD / cfg["sources"]["mastr_biomass"] - ).query("EinheitBetriebsstatus=='InBetrieb'") - - # Drop entries without federal state or 'AusschließlichWirtschaftszone' - mastr = mastr[ - mastr.Bundesland.isin( - pd.read_sql( - f"""SELECT DISTINCT ON (gen) - REPLACE(REPLACE(gen, '-', ''), 'ü', 'ue') as states - FROM {cfg['sources']['vg250_lan']['schema']}. - {cfg['sources']['vg250_lan']['table']}""", - con=db.engine(), - ).states.values - ) - ] - - # Scaling will be done per federal state in case of eGon2035 scenario. - if scenario == "eGon2035": - level = "federal_state" - else: - level = "country" - # Choose only entries with valid geometries inside DE/test mode - mastr_loc = filter_mastr_geometry(mastr).set_geometry("geometry") - - # Scale capacities to meet target values - mastr_loc = scale_prox2now(mastr_loc, target, level=level) - - # Assign bus_id - if len(mastr_loc) > 0: - mastr_loc["voltage_level"] = assign_voltage_level( - mastr_loc, cfg, WORKING_DIR_MASTR_OLD - ) - mastr_loc = assign_bus_id(mastr_loc, cfg) - mastr_loc = assign_use_case(mastr_loc, cfg["sources"], scenario) - - # Insert entries with location - session = sessionmaker(bind=db.engine())() - for i, row in mastr_loc.iterrows(): - if row.ThermischeNutzleistung > 0: - entry = EgonChp( - sources={ - "chp": "MaStR", - "el_capacity": "MaStR scaled with NEP 2021", - "th_capacity": "MaStR", - }, - source_id={"MastrNummer": row.EinheitMastrNummer}, - carrier="biomass", - el_capacity=row.Nettonennleistung, - th_capacity=row.ThermischeNutzleistung / 1000, - scenario=scenario, - district_heating=row.district_heating, - electrical_bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", - ) - session.add(entry) - session.commit() - - -def insert_chp_statusquo(): - cfg = config.datasets()["chp_location"] - - # import data for MaStR - mastr = pd.read_csv( - WORKING_DIR_MASTR_NEW / "bnetza_mastr_combustion_cleaned.csv" - ) - - mastr = mastr.loc[mastr.ThermischeNutzleistung > 0] - - mastr = mastr.loc[ - mastr.Energietraeger.isin( - [ - "Erdgas", - "Mineralölprodukte", - "andere Gase", - "nicht biogener Abfall", - "Braunkohle", - "Steinkohle", - ] - ) - ] - - mastr.Inbetriebnahmedatum = pd.to_datetime(mastr.Inbetriebnahmedatum) - mastr.DatumEndgueltigeStilllegung = pd.to_datetime( - mastr.DatumEndgueltigeStilllegung - ) - mastr = mastr.loc[ - mastr.Inbetriebnahmedatum - <= config.datasets()["mastr_new"]["status2019_date_max"] - ] - - mastr = mastr.loc[ - ( - mastr.DatumEndgueltigeStilllegung - >= config.datasets()["mastr_new"]["status2019_date_max"] - ) - | (mastr.DatumEndgueltigeStilllegung.isnull()) - ] - - mastr.groupby("Energietraeger").Nettonennleistung.sum().mul(1e-6) - - geom_municipalities = db.select_geodataframe( - """ - SELECT gen, ST_UNION(geometry) as geom - FROM boundaries.vg250_gem - GROUP BY gen - """ - ).set_index("gen") - - # Assing Laengengrad and Breitengrad to chps without location data - # based on the centroid of the municipaltiy - idx_no_location = mastr[ - (mastr.Laengengrad.isnull()) - & (mastr.Gemeinde.isin(geom_municipalities.index)) - ].index - - mastr.loc[idx_no_location, "Laengengrad"] = ( - geom_municipalities.to_crs(epsg="4326").centroid.x.loc[ - mastr.Gemeinde[idx_no_location] - ] - ).values - - mastr.loc[idx_no_location, "Breitengrad"] = ( - geom_municipalities.to_crs(epsg="4326").centroid.y.loc[ - mastr.Gemeinde[idx_no_location] - ] - ).values - - if ( - config.settings()["egon-data"]["--dataset-boundary"] - == "Schleswig-Holstein" - ): - dropped_capacity = mastr[ - (mastr.Laengengrad.isnull()) - & (mastr.Bundesland == "SchleswigHolstein") - ].Nettonennleistung.sum() - - else: - dropped_capacity = mastr[ - (mastr.Laengengrad.isnull()) - ].Nettonennleistung.sum() - - print( - f""" - CHPs with a total installed electrical capacity of {dropped_capacity} kW are dropped - because of missing or wrong location data - """ - ) - - mastr = mastr[~mastr.Laengengrad.isnull()] - mastr = filter_mastr_geometry(mastr).set_geometry("geometry") - - # Assign bus_id - if len(mastr) > 0: - mastr["voltage_level"] = assign_voltage_level( - mastr, cfg, WORKING_DIR_MASTR_NEW - ) - - gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus - - mastr = assign_bus_id(mastr, cfg, drop_missing=True) - - mastr["gas_bus_id"] = gas_bus_id - - mastr = assign_use_case(mastr, cfg["sources"], "status2019") - - # Insert entries with location - session = sessionmaker(bind=db.engine())() - for i, row in mastr.iterrows(): - if row.ThermischeNutzleistung > 0: - entry = EgonChp( - sources={ - "chp": "MaStR", - "el_capacity": "MaStR", - "th_capacity": "MaStR", - }, - source_id={"MastrNummer": row.EinheitMastrNummer}, - carrier=map_carrier().loc[row.Energietraeger], - el_capacity=row.Nettonennleistung / 1000, - th_capacity=row.ThermischeNutzleistung / 1000, - scenario="status2019", - district_heating=row.district_heating, - electrical_bus_id=row.bus_id, - ch4_bus_id=row.gas_bus_id, - voltage_level=row.voltage_level, - geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", - ) - session.add(entry) - session.commit() - - -def insert_chp_egon2035(): - """Insert CHP plants for eGon2035 considering NEP and MaStR data - - Returns - ------- - None. - - """ - - sources = config.datasets()["chp_location"]["sources"] - - targets = config.datasets()["chp_location"]["targets"] - - insert_biomass_chp("eGon2035") - - # Insert large CHPs based on NEP's list of conventional power plants - MaStR_konv = insert_large_chp(sources, targets["chp_table"], EgonChp) - - # Insert smaller CHPs (< 10MW) based on existing locations from MaStR - existing_chp_smaller_10mw(sources, MaStR_konv, EgonChp) - - gpd.GeoDataFrame( - MaStR_konv[ - [ - "EinheitMastrNummer", - "el_capacity", - "geometry", - "carrier", - "plz", - "city", - "federal_state", - ] - ] - ).to_postgis( - targets["mastr_conventional_without_chp"]["table"], - schema=targets["mastr_conventional_without_chp"]["schema"], - con=db.engine(), - if_exists="replace", - ) - - -def extension_BW(): - extension_per_federal_state("BadenWuerttemberg", EgonChp) - - -def extension_BY(): - extension_per_federal_state("Bayern", EgonChp) - - -def extension_HB(): - extension_per_federal_state("Bremen", EgonChp) - - -def extension_BB(): - extension_per_federal_state("Brandenburg", EgonChp) - - -def extension_HH(): - extension_per_federal_state("Hamburg", EgonChp) - - -def extension_HE(): - extension_per_federal_state("Hessen", EgonChp) - - -def extension_MV(): - extension_per_federal_state("MecklenburgVorpommern", EgonChp) - - -def extension_NS(): - extension_per_federal_state("Niedersachsen", EgonChp) - - -def extension_NW(): - extension_per_federal_state("NordrheinWestfalen", EgonChp) - - -def extension_SN(): - extension_per_federal_state("Sachsen", EgonChp) - - -def extension_TH(): - extension_per_federal_state("Thueringen", EgonChp) - - -def extension_SL(): - extension_per_federal_state("Saarland", EgonChp) - - -def extension_ST(): - extension_per_federal_state("SachsenAnhalt", EgonChp) - - -def extension_RP(): - extension_per_federal_state("RheinlandPfalz", EgonChp) - - -def extension_BE(): - extension_per_federal_state("Berlin", EgonChp) - - -def extension_SH(): - extension_per_federal_state("SchleswigHolstein", EgonChp) - - -def insert_chp_egon100re(): - """Insert CHP plants for eGon100RE considering results from pypsa-eur-sec - - Returns - ------- - None. - - """ - - sources = config.datasets()["chp_location"]["sources"] - - db.execute_sql( - f""" - DELETE FROM {EgonChp.__table__.schema}.{EgonChp.__table__.name} - WHERE scenario = 'eGon100RE' - """ - ) - - # select target values from pypsa-eur-sec - additional_capacity = db.select_dataframe( - """ - SELECT capacity - FROM supply.egon_scenario_capacities - WHERE scenario_name = 'eGon100RE' - AND carrier = 'urban_central_gas_CHP' - """ - ).capacity[0] - - if config.settings()["egon-data"]["--dataset-boundary"] != "Everything": - additional_capacity /= 16 - target_file = ( - Path(".") - / "data_bundle_egon_data" - / "pypsa_eur_sec" - / "2022-07-26-egondata-integration" - / "postnetworks" - / "elec_s_37_lv2.0__Co2L0-1H-T-H-B-I-dist1_2050.nc" - ) - - network = pypsa.Network(str(target_file)) - chp_index = "DE0 0 urban central gas CHP" - - standard_chp_th = 10 - standard_chp_el = ( - standard_chp_th - * network.links.loc[chp_index, "efficiency"] - / network.links.loc[chp_index, "efficiency2"] - ) - - areas = db.select_geodataframe( - f""" - SELECT - residential_and_service_demand as demand, area_id, - ST_Transform(ST_PointOnSurface(geom_polygon), 4326) as geom - FROM - {sources['district_heating_areas']['schema']}. - {sources['district_heating_areas']['table']} - WHERE scenario = 'eGon100RE' - """ - ) - - existing_chp = pd.DataFrame( - data={ - "el_capacity": standard_chp_el, - "th_capacity": standard_chp_th, - "voltage_level": 5, - }, - index=range(1), - ) - - flh = ( - network.links_t.p0[chp_index].sum() - / network.links.p_nom_opt[chp_index] - ) - - extension_to_areas( - areas, - additional_capacity, - existing_chp, - flh, - EgonChp, - district_heating=True, - scenario="eGon100RE", - ) - - -tasks = (create_tables,) - -insert_per_scenario = set() - -if "status2019" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.add(insert_chp_statusquo) - -if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.add(insert_chp_egon2035) - -if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.add(insert_chp_egon100re) - -tasks = tasks + (insert_per_scenario, assign_heat_bus) - -extension = set() - -if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - # Add one task per federal state for small CHP extension - if ( - config.settings()["egon-data"]["--dataset-boundary"] - == "Schleswig-Holstein" - ): - extension = extension_SH - else: - extension = { - extension_BW, - extension_BY, - extension_HB, - extension_BB, - extension_HE, - extension_MV, - extension_NS, - extension_NW, - extension_SH, - extension_HH, - extension_RP, - extension_SL, - extension_SN, - extension_ST, - extension_TH, - extension_BE, - } - -if extension != set(): - tasks = tasks + (extension,) - - -class Chp(Dataset): - def __init__(self, dependencies): - super().__init__( - name="Chp", version="0.0.8", dependencies=dependencies, tasks=tasks - ) +""" +The central module containing all code dealing with combined heat and power +(CHP) plants. +""" + +from pathlib import Path + +from geoalchemy2 import Geometry +from shapely.ops import nearest_points +from sqlalchemy import Boolean, Column, Float, Integer, Sequence, String +from sqlalchemy.dialects.postgresql import JSONB +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker +import geopandas as gpd +import pandas as pd +import pypsa + +from egon.data import config, db +from egon.data.datasets import Dataset +from egon.data.datasets.chp.match_nep import insert_large_chp, map_carrier +from egon.data.datasets.chp.small_chp import ( + assign_use_case, + existing_chp_smaller_10mw, + extension_per_federal_state, + extension_to_areas, + select_target, +) +from egon.data.datasets.mastr import ( + WORKING_DIR_MASTR_OLD, + WORKING_DIR_MASTR_NEW, +) +from egon.data.datasets.power_plants import ( + assign_bus_id, + assign_voltage_level, + filter_mastr_geometry, + scale_prox2now, +) + +Base = declarative_base() + + +class EgonChp(Base): + __tablename__ = "egon_chp_plants" + __table_args__ = {"schema": "supply"} + id = Column(Integer, Sequence("chp_seq"), primary_key=True) + sources = Column(JSONB) + source_id = Column(JSONB) + carrier = Column(String) + district_heating = Column(Boolean) + el_capacity = Column(Float) + th_capacity = Column(Float) + electrical_bus_id = Column(Integer) + district_heating_area_id = Column(Integer) + ch4_bus_id = Column(Integer) + voltage_level = Column(Integer) + scenario = Column(String) + geom = Column(Geometry("POINT", 4326)) + + +class EgonMaStRConventinalWithoutChp(Base): + __tablename__ = "egon_mastr_conventional_without_chp" + __table_args__ = {"schema": "supply"} + id = Column(Integer, Sequence("mastr_conventional_seq"), primary_key=True) + EinheitMastrNummer = Column(String) + carrier = Column(String) + el_capacity = Column(Float) + plz = Column(Integer) + city = Column(String) + federal_state = Column(String) + geometry = Column(Geometry("POINT", 4326)) + + +def create_tables(): + """Create tables for chp data + Returns + ------- + None. + """ + + db.execute_sql("CREATE SCHEMA IF NOT EXISTS supply;") + engine = db.engine() + EgonChp.__table__.drop(bind=engine, checkfirst=True) + EgonChp.__table__.create(bind=engine, checkfirst=True) + EgonMaStRConventinalWithoutChp.__table__.drop(bind=engine, checkfirst=True) + EgonMaStRConventinalWithoutChp.__table__.create( + bind=engine, checkfirst=True + ) + + +def nearest( + row, + df, + centroid=False, + row_geom_col="geometry", + df_geom_col="geometry", + src_column=None, +): + """ + Finds the nearest point and returns the specified column values + + Parameters + ---------- + row : pandas.Series + Data to which the nearest data of df is assigned. + df : pandas.DataFrame + Data which includes all options for the nearest neighbor alogrithm. + centroid : boolean + Use centroid geoemtry. The default is False. + row_geom_col : str, optional + Name of row's geometry column. The default is 'geometry'. + df_geom_col : str, optional + Name of df's geometry column. The default is 'geometry'. + src_column : str, optional + Name of returned df column. The default is None. + + Returns + ------- + value : pandas.Series + Values of specified column of df + + """ + + if centroid: + unary_union = df.centroid.unary_union + else: + unary_union = df[df_geom_col].unary_union + # Find the geometry that is closest + nearest = ( + df[df_geom_col] == nearest_points(row[row_geom_col], unary_union)[1] + ) + + # Get the corresponding value from df (matching is based on the geometry) + value = df[nearest][src_column].values[0] + + return value + + +def assign_heat_bus(): + """Selects heat_bus for chps used in district heating. + + Parameters + ---------- + scenario : str, optional + Name of the corresponding scenario. The default is 'eGon2035'. + + Returns + ------- + None. + + """ + sources = config.datasets()["chp_location"]["sources"] + target = config.datasets()["chp_location"]["targets"]["chp_table"] + + for scenario in config.settings()["egon-data"]["--scenarios"]: + # Select CHP with use_case = 'district_heating' + chp = db.select_geodataframe( + f""" + SELECT * FROM + {target['schema']}.{target['table']} + WHERE scenario = '{scenario}' + AND district_heating = True + """, + index_col="id", + epsg=4326, + ) + + # Select district heating areas and their centroid + district_heating = db.select_geodataframe( + f""" + SELECT area_id, ST_Centroid(geom_polygon) as geom + FROM + {sources['district_heating_areas']['schema']}. + {sources['district_heating_areas']['table']} + WHERE scenario = '{scenario}' + """, + epsg=4326, + ) + + # Assign district heating area_id to district_heating_chp + # According to nearest centroid of district heating area + chp["district_heating_area_id"] = chp.apply( + nearest, + df=district_heating, + row_geom_col="geom", + df_geom_col="geom", + centroid=True, + src_column="area_id", + axis=1, + ) + + # Drop district heating CHP without heat_bus_id + db.execute_sql( + f""" + DELETE FROM {target['schema']}.{target['table']} + WHERE scenario = '{scenario}' + AND district_heating = True + """ + ) + + # Insert district heating CHP with heat_bus_id + session = sessionmaker(bind=db.engine())() + for i, row in chp.iterrows(): + if row.carrier != "biomass": + entry = EgonChp( + id=i, + sources=row.sources, + source_id=row.source_id, + carrier=row.carrier, + el_capacity=row.el_capacity, + th_capacity=row.th_capacity, + electrical_bus_id=row.electrical_bus_id, + ch4_bus_id=row.ch4_bus_id, + district_heating_area_id=row.district_heating_area_id, + district_heating=row.district_heating, + voltage_level=row.voltage_level, + scenario=scenario, + geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", + ) + else: + entry = EgonChp( + id=i, + sources=row.sources, + source_id=row.source_id, + carrier=row.carrier, + el_capacity=row.el_capacity, + th_capacity=row.th_capacity, + electrical_bus_id=row.electrical_bus_id, + district_heating_area_id=row.district_heating_area_id, + district_heating=row.district_heating, + voltage_level=row.voltage_level, + scenario=scenario, + geom=f"SRID=4326;POINT({row.geom.x} {row.geom.y})", + ) + session.add(entry) + session.commit() + + +def insert_biomass_chp(scenario): + """Insert biomass chp plants of future scenario + + Parameters + ---------- + scenario : str + Name of scenario. + + Returns + ------- + None. + + """ + cfg = config.datasets()["chp_location"] + + # import target values from NEP 2021, scneario C 2035 + target = select_target("biomass", scenario) + + # import data for MaStR + mastr = pd.read_csv( + WORKING_DIR_MASTR_OLD / cfg["sources"]["mastr_biomass"] + ).query("EinheitBetriebsstatus=='InBetrieb'") + + # Drop entries without federal state or 'AusschließlichWirtschaftszone' + mastr = mastr[ + mastr.Bundesland.isin( + pd.read_sql( + f"""SELECT DISTINCT ON (gen) + REPLACE(REPLACE(gen, '-', ''), 'ü', 'ue') as states + FROM {cfg['sources']['vg250_lan']['schema']}. + {cfg['sources']['vg250_lan']['table']}""", + con=db.engine(), + ).states.values + ) + ] + + # Scaling will be done per federal state in case of eGon2035 scenario. + if scenario == "eGon2035": + level = "federal_state" + else: + level = "country" + # Choose only entries with valid geometries inside DE/test mode + mastr_loc = filter_mastr_geometry(mastr).set_geometry("geometry") + + # Scale capacities to meet target values + mastr_loc = scale_prox2now(mastr_loc, target, level=level) + + # Assign bus_id + if len(mastr_loc) > 0: + mastr_loc["voltage_level"] = assign_voltage_level( + mastr_loc, cfg, WORKING_DIR_MASTR_OLD + ) + mastr_loc = assign_bus_id(mastr_loc, cfg) + mastr_loc = assign_use_case(mastr_loc, cfg["sources"], scenario) + + # Insert entries with location + session = sessionmaker(bind=db.engine())() + for i, row in mastr_loc.iterrows(): + if row.ThermischeNutzleistung > 0: + entry = EgonChp( + sources={ + "chp": "MaStR", + "el_capacity": "MaStR scaled with NEP 2021", + "th_capacity": "MaStR", + }, + source_id={"MastrNummer": row.EinheitMastrNummer}, + carrier="biomass", + el_capacity=row.Nettonennleistung, + th_capacity=row.ThermischeNutzleistung / 1000, + scenario=scenario, + district_heating=row.district_heating, + electrical_bus_id=row.bus_id, + voltage_level=row.voltage_level, + geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", + ) + session.add(entry) + session.commit() + + +def insert_chp_statusquo(): + cfg = config.datasets()["chp_location"] + + # import data for MaStR + mastr = pd.read_csv( + WORKING_DIR_MASTR_NEW / "bnetza_mastr_combustion_cleaned.csv" + ) + + mastr = mastr.loc[mastr.ThermischeNutzleistung > 0] + + mastr = mastr.loc[ + mastr.Energietraeger.isin( + [ + "Erdgas", + "Mineralölprodukte", + "andere Gase", + "nicht biogener Abfall", + "Braunkohle", + "Steinkohle", + ] + ) + ] + + mastr.Inbetriebnahmedatum = pd.to_datetime(mastr.Inbetriebnahmedatum) + mastr.DatumEndgueltigeStilllegung = pd.to_datetime( + mastr.DatumEndgueltigeStilllegung + ) + mastr = mastr.loc[ + mastr.Inbetriebnahmedatum + <= config.datasets()["mastr_new"]["status2023_date_max"] + ] + + mastr = mastr.loc[ + ( + mastr.DatumEndgueltigeStilllegung + >= config.datasets()["mastr_new"]["status2023_date_max"] + ) + | (mastr.DatumEndgueltigeStilllegung.isnull()) + ] + + mastr.groupby("Energietraeger").Nettonennleistung.sum().mul(1e-6) + + geom_municipalities = db.select_geodataframe( + """ + SELECT gen, ST_UNION(geometry) as geom + FROM boundaries.vg250_gem + GROUP BY gen + """ + ).set_index("gen") + + # Assing Laengengrad and Breitengrad to chps without location data + # based on the centroid of the municipaltiy + idx_no_location = mastr[ + (mastr.Laengengrad.isnull()) + & (mastr.Gemeinde.isin(geom_municipalities.index)) + ].index + + mastr.loc[idx_no_location, "Laengengrad"] = ( + geom_municipalities.to_crs(epsg="4326").centroid.x.loc[ + mastr.Gemeinde[idx_no_location] + ] + ).values + + mastr.loc[idx_no_location, "Breitengrad"] = ( + geom_municipalities.to_crs(epsg="4326").centroid.y.loc[ + mastr.Gemeinde[idx_no_location] + ] + ).values + + if ( + config.settings()["egon-data"]["--dataset-boundary"] + == "Schleswig-Holstein" + ): + dropped_capacity = mastr[ + (mastr.Laengengrad.isnull()) + & (mastr.Bundesland == "SchleswigHolstein") + ].Nettonennleistung.sum() + + else: + dropped_capacity = mastr[ + (mastr.Laengengrad.isnull()) + ].Nettonennleistung.sum() + + print( + f""" + CHPs with a total installed electrical capacity of {dropped_capacity} kW are dropped + because of missing or wrong location data + """ + ) + + mastr = mastr[~mastr.Laengengrad.isnull()] + mastr = filter_mastr_geometry(mastr).set_geometry("geometry") + + # Assign bus_id + if len(mastr) > 0: + mastr["voltage_level"] = assign_voltage_level( + mastr, cfg, WORKING_DIR_MASTR_NEW + ) + + gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus + + mastr = assign_bus_id(mastr, cfg, drop_missing=True) + + mastr["gas_bus_id"] = gas_bus_id + + mastr = assign_use_case(mastr, cfg["sources"], "status2019") + + # Insert entries with location + session = sessionmaker(bind=db.engine())() + for i, row in mastr.iterrows(): + if row.ThermischeNutzleistung > 0: + entry = EgonChp( + sources={ + "chp": "MaStR", + "el_capacity": "MaStR", + "th_capacity": "MaStR", + }, + source_id={"MastrNummer": row.EinheitMastrNummer}, + carrier=map_carrier().loc[row.Energietraeger], + el_capacity=row.Nettonennleistung / 1000, + th_capacity=row.ThermischeNutzleistung / 1000, + scenario="status2019", + district_heating=row.district_heating, + electrical_bus_id=row.bus_id, + ch4_bus_id=row.gas_bus_id, + voltage_level=row.voltage_level, + geom=f"SRID=4326;POINT({row.Laengengrad} {row.Breitengrad})", + ) + session.add(entry) + session.commit() + + +def insert_chp_egon2035(): + """Insert CHP plants for eGon2035 considering NEP and MaStR data + + Returns + ------- + None. + + """ + + sources = config.datasets()["chp_location"]["sources"] + + targets = config.datasets()["chp_location"]["targets"] + + insert_biomass_chp("eGon2035") + + # Insert large CHPs based on NEP's list of conventional power plants + MaStR_konv = insert_large_chp(sources, targets["chp_table"], EgonChp) + + # Insert smaller CHPs (< 10MW) based on existing locations from MaStR + existing_chp_smaller_10mw(sources, MaStR_konv, EgonChp) + + gpd.GeoDataFrame( + MaStR_konv[ + [ + "EinheitMastrNummer", + "el_capacity", + "geometry", + "carrier", + "plz", + "city", + "federal_state", + ] + ] + ).to_postgis( + targets["mastr_conventional_without_chp"]["table"], + schema=targets["mastr_conventional_without_chp"]["schema"], + con=db.engine(), + if_exists="replace", + ) + + +def extension_BW(): + extension_per_federal_state("BadenWuerttemberg", EgonChp) + + +def extension_BY(): + extension_per_federal_state("Bayern", EgonChp) + + +def extension_HB(): + extension_per_federal_state("Bremen", EgonChp) + + +def extension_BB(): + extension_per_federal_state("Brandenburg", EgonChp) + + +def extension_HH(): + extension_per_federal_state("Hamburg", EgonChp) + + +def extension_HE(): + extension_per_federal_state("Hessen", EgonChp) + + +def extension_MV(): + extension_per_federal_state("MecklenburgVorpommern", EgonChp) + + +def extension_NS(): + extension_per_federal_state("Niedersachsen", EgonChp) + + +def extension_NW(): + extension_per_federal_state("NordrheinWestfalen", EgonChp) + + +def extension_SN(): + extension_per_federal_state("Sachsen", EgonChp) + + +def extension_TH(): + extension_per_federal_state("Thueringen", EgonChp) + + +def extension_SL(): + extension_per_federal_state("Saarland", EgonChp) + + +def extension_ST(): + extension_per_federal_state("SachsenAnhalt", EgonChp) + + +def extension_RP(): + extension_per_federal_state("RheinlandPfalz", EgonChp) + + +def extension_BE(): + extension_per_federal_state("Berlin", EgonChp) + + +def extension_SH(): + extension_per_federal_state("SchleswigHolstein", EgonChp) + + +def insert_chp_egon100re(): + """Insert CHP plants for eGon100RE considering results from pypsa-eur-sec + + Returns + ------- + None. + + """ + + sources = config.datasets()["chp_location"]["sources"] + + db.execute_sql( + f""" + DELETE FROM {EgonChp.__table__.schema}.{EgonChp.__table__.name} + WHERE scenario = 'eGon100RE' + """ + ) + + # select target values from pypsa-eur-sec + additional_capacity = db.select_dataframe( + """ + SELECT capacity + FROM supply.egon_scenario_capacities + WHERE scenario_name = 'eGon100RE' + AND carrier = 'urban_central_gas_CHP' + """ + ).capacity[0] + + if config.settings()["egon-data"]["--dataset-boundary"] != "Everything": + additional_capacity /= 16 + target_file = ( + Path(".") + / "data_bundle_egon_data" + / "pypsa_eur_sec" + / "2022-07-26-egondata-integration" + / "postnetworks" + / "elec_s_37_lv2.0__Co2L0-1H-T-H-B-I-dist1_2050.nc" + ) + + network = pypsa.Network(str(target_file)) + chp_index = "DE0 0 urban central gas CHP" + + standard_chp_th = 10 + standard_chp_el = ( + standard_chp_th + * network.links.loc[chp_index, "efficiency"] + / network.links.loc[chp_index, "efficiency2"] + ) + + areas = db.select_geodataframe( + f""" + SELECT + residential_and_service_demand as demand, area_id, + ST_Transform(ST_PointOnSurface(geom_polygon), 4326) as geom + FROM + {sources['district_heating_areas']['schema']}. + {sources['district_heating_areas']['table']} + WHERE scenario = 'eGon100RE' + """ + ) + + existing_chp = pd.DataFrame( + data={ + "el_capacity": standard_chp_el, + "th_capacity": standard_chp_th, + "voltage_level": 5, + }, + index=range(1), + ) + + flh = ( + network.links_t.p0[chp_index].sum() + / network.links.p_nom_opt[chp_index] + ) + + extension_to_areas( + areas, + additional_capacity, + existing_chp, + flh, + EgonChp, + district_heating=True, + scenario="eGon100RE", + ) + + +tasks = (create_tables,) + +insert_per_scenario = set() + +if "status2019" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_statusquo) + +if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_egon2035) + +if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add(insert_chp_egon100re) + +tasks = tasks + (insert_per_scenario, assign_heat_bus) + +extension = set() + +if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: + # Add one task per federal state for small CHP extension + if ( + config.settings()["egon-data"]["--dataset-boundary"] + == "Schleswig-Holstein" + ): + extension = extension_SH + else: + extension = { + extension_BW, + extension_BY, + extension_HB, + extension_BB, + extension_HE, + extension_MV, + extension_NS, + extension_NW, + extension_SH, + extension_HH, + extension_RP, + extension_SL, + extension_SN, + extension_ST, + extension_TH, + extension_BE, + } + +if extension != set(): + tasks = tasks + (extension,) + + +class Chp(Dataset): + def __init__(self, dependencies): + super().__init__( + name="Chp", version="0.0.8", dependencies=dependencies, tasks=tasks + ) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 801abb39f..37d5594f4 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1020,7 +1020,7 @@ def fill_missing_bus_and_geom(gens, carrier): conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[ conv["Inbetriebnahmedatum"] - < egon.data.config.datasets()["mastr_new"]["status2019_date_max"] + < egon.data.config.datasets()["mastr_new"]["status2023_date_max"] ] # drop chp generators diff --git a/src/egon/data/datasets/power_plants/mastr.py b/src/egon/data/datasets/power_plants/mastr.py index 9eda90703..1208311a4 100644 --- a/src/egon/data/datasets/power_plants/mastr.py +++ b/src/egon/data/datasets/power_plants/mastr.py @@ -317,7 +317,7 @@ def voltage_levels(p: float) -> int: # (eGon2021 scenario) len_old = len(units) ts = pd.Timestamp( - egon.data.config.datasets()["mastr_new"]["status2019_date_max"] + egon.data.config.datasets()["mastr_new"]["status2023_date_max"] ) units = units.loc[pd.to_datetime(units.Inbetriebnahmedatum) <= ts] print( diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 53a7416b8..cd1288c99 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2782,7 +2782,7 @@ def pv_rooftop_to_buildings(): mastr_gdf = load_mastr_data() - ts = pd.Timestamp(config.datasets()["mastr_new"]["status2019_date_max"]) + ts = pd.Timestamp(config.datasets()["mastr_new"]["status2023_date_max"]) mastr_gdf = mastr_gdf.loc[ pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts From db1373372081500e141ac0fdade6467e3f4d9281 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 15:07:47 +0100 Subject: [PATCH 513/787] Bump mastr dataset version to 0.0.3 --- src/egon/data/datasets/mastr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/mastr.py b/src/egon/data/datasets/mastr.py index 3c1d6b5d8..8f46fbf77 100644 --- a/src/egon/data/datasets/mastr.py +++ b/src/egon/data/datasets/mastr.py @@ -69,7 +69,7 @@ def download(dataset_name, download_dir): mastr_data_setup = partial( Dataset, name="MastrData", - version="0.0.2", + version="0.0.3", dependencies=[], tasks=(download_mastr_data,), ) From 9693153ce696a0302d26b7440f20b8f6b71d383e Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 11 Jan 2024 15:08:54 +0100 Subject: [PATCH 514/787] Update changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de4c74ee4..e81e7de7b 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -486,6 +486,7 @@ Changed `#1026 `_ * Change hgv data source to use database `#1086 `_ +* Add new MaStR dataset for SQ2023 scenario .. _#799: https://github.com/openego/eGon-data/issues/799 From 304d91cb430d6a23c25821410187cdfab68d31a5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 12 Jan 2024 11:24:11 +0100 Subject: [PATCH 515/787] Update depricated PythonOperator import --- src/egon/data/datasets/__init__.py | 2 +- .../data/datasets/electricity_demand_timeseries/hh_profiles.py | 2 +- .../datasets/emobility/motorized_individual_travel/__init__.py | 2 +- src/egon/data/datasets/heat_supply/individual_heating.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 256db5769..69f584928 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -9,7 +9,7 @@ import re from airflow.models.baseoperator import BaseOperator as Operator -from airflow.operators.python_operator import PythonOperator +from airflow.operators.python import PythonOperator from sqlalchemy import Column, ForeignKey, Integer, String, Table, orm, tuple_ from sqlalchemy.ext.declarative import declarative_base diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 67aa44014..cf9f66298 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -126,7 +126,7 @@ import os import random -from airflow.operators.python_operator import PythonOperator +from airflow.operators.python import PythonOperator from sqlalchemy import ARRAY, Column, Float, Integer, String from sqlalchemy.dialects.postgresql import CHAR, INTEGER, REAL from sqlalchemy.ext.declarative import declarative_base diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 7e264cd0b..797176fa4 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -77,7 +77,7 @@ import os import tarfile -from airflow.operators.python_operator import PythonOperator +from airflow.operators.python import PythonOperator from psycopg2.extensions import AsIs, register_adapter import numpy as np import pandas as pd diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index f0d3d4092..fa437c744 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -184,7 +184,7 @@ import os import random -from airflow.operators.python_operator import PythonOperator +from airflow.operators.python import PythonOperator from psycopg2.extensions import AsIs, register_adapter from sqlalchemy import ARRAY, REAL, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base From ce3bca5d600e17e9dbd7d084d211da76e4c04851 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Fri, 12 Jan 2024 11:29:15 +0100 Subject: [PATCH 516/787] Add status2023 ref timestamp to PV rooftop for lifetime calculation --- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index cd1288c99..9c0fa79a0 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -161,6 +161,7 @@ SCENARIOS = config.settings()["egon-data"]["--scenarios"] SCENARIO_TIMESTAMP = { "status2019": pd.Timestamp("2020-01-01", tz="UTC"), + "status2023": pd.Timestamp("2024-01-01", tz="UTC"), "eGon2035": pd.Timestamp("2035-01-01", tz="UTC"), "eGon100RE": pd.Timestamp("2050-01-01", tz="UTC"), } From 2ef22f9c4856833eeeee2659d14d1fd40de342d0 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Fri, 12 Jan 2024 13:26:39 +0100 Subject: [PATCH 517/787] Add status2023 scenario - use eGon2035 trip data --- src/egon/data/datasets.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index dba2feb8d..9fd019002 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1128,6 +1128,9 @@ emobility_mit: status2019: file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" file_metadata: "metadata_simbev_run.json" + status2023: + file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" + file_metadata: "metadata_simbev_run.json" eGon2035: file: "eGon2035_RS7_min2k_2022-06-01_175429_simbev_run.tar.gz" file_metadata: "metadata_simbev_run.json" From 93be104d561e1593f0b0b2e52da6bc604b6f7dce Mon Sep 17 00:00:00 2001 From: nesnoj Date: Fri, 12 Jan 2024 13:27:28 +0100 Subject: [PATCH 518/787] Add emob MIT counts and shares for status2023 scenario --- .../datasets/scenario_parameters/parameters.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 91e7b6bc0..83f1b9d54 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -1006,6 +1006,22 @@ def mobility(scenario): } } + elif scenario == "status2023": + parameters = { + "motorized_individual_travel": { + "status2023": { + "ev_count": 2577664, + "bev_mini_share": 0.1535, + "bev_medium_share": 0.3412, + "bev_luxury_share": 0.1017, + "phev_mini_share": 0.1038, + "phev_medium_share": 0.2310, + "phev_luxury_share": 0.0688, + "model_parameters": {}, + } + } + } + else: print(f"Scenario name {scenario} is not valid.") parameters = dict() From df511e862b5af6747f319eb706b79054d6955233 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Fri, 12 Jan 2024 13:32:51 +0100 Subject: [PATCH 519/787] Use latest vehicle registration data from KBA for status2023 scenario --- src/egon/data/datasets.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 9fd019002..d5745978b 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1118,9 +1118,9 @@ emobility_mit: file_processed: "regiostar-referenzdateien_preprocessed.csv" sheet: "ReferenzGebietsstand2020" KBA: - url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2020_xlsx.xlsx?__blob=publicationFile&v=2" - file: "fz1_2020_xlsx.xlsx" - file_processed: "fz1_2020_preprocessed.csv" + url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2023.xlsx?__blob=publicationFile&v=2" + file: "fz1_2023.xlsx" + file_processed: "fz1_2023_preprocessed.csv" sheet: "FZ1.1" columns: "D, J:N" skiprows: 8 From 755d889127de79c40cad7bb6fe6168fd7407f378 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Fri, 12 Jan 2024 13:56:48 +0100 Subject: [PATCH 520/787] Adapt emob MIT model timeseries generation to include status2023 scenario --- .../motorized_individual_travel/__init__.py | 3 +++ .../motorized_individual_travel/model_timeseries.py | 12 +++++++++++- .../data/datasets/scenario_parameters/parameters.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 7e264cd0b..cead1004a 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -110,6 +110,7 @@ delete_model_data_from_db, generate_model_data_bunch, generate_model_data_status2019_remaining, + generate_model_data_status2023_remaining, generate_model_data_eGon100RE_remaining, generate_model_data_eGon2035_remaining, read_simbev_metadata_file, @@ -448,6 +449,8 @@ def generate_model_data_tasks(scenario_name): if scenario_name == "status2019": tasks.add(generate_model_data_status2019_remaining) + if scenario_name == "status2023": + tasks.add(generate_model_data_status2023_remaining) elif scenario_name == "eGon2035": tasks.add(generate_model_data_eGon2035_remaining) elif scenario_name == "eGon100RE": diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index af0f1ee2c..2a62c15b4 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -735,8 +735,9 @@ def write_load( # * regular (flex): use driving load # * lowflex: use dumb charging load # * status2019: also dumb charging + # * status2023: also dumb charging - if scenario_name=='status2019': + if scenario_name in ["status2019", "status2023"]: write_load( scenario_name=scenario_name, connection_bus_id=etrago_bus.bus_id, @@ -1077,6 +1078,15 @@ def generate_model_data_status2019_remaining(): bunch=range(MVGD_MIN_COUNT, len(load_grid_district_ids())), ) +def generate_model_data_status2023_remaining(): + """Generates timeseries for status2019 scenario for grid districts which + has not been processed in the parallel tasks before. + """ + generate_model_data_bunch( + scenario_name="status2023", + bunch=range(MVGD_MIN_COUNT, len(load_grid_district_ids())), + ) + def generate_model_data_eGon2035_remaining(): """Generates timeseries for eGon2035 scenario for grid districts which has not been processed in the parallel tasks before. diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 83f1b9d54..0df040420 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -135,7 +135,7 @@ def global_settings(scenario): "nuclear": 0.47*3.6, # [EUR/MWh] "biomass": read_costs(read_csv(2020), "biomass", "fuel"), }, - "co2_costs": 24.7, # [EUR/t_CO2], source: + "co2_costs": 24.7, # [EUR/t_CO2], source: #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 "waste": 0.165, # [t_CO2/MW_th] From c497b984ee66f6baae4381be5bb57d3350bdbb8a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 15 Jan 2024 23:05:58 +0100 Subject: [PATCH 521/787] Add SQ2023 electrical neighbours --- .../data/datasets/electrical_neighbours.py | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 0daed54fd..524966d70 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -11,6 +11,7 @@ import pandas as pd from shapely.geometry import LineString from sqlalchemy.orm import sessionmaker +from functools import partial import egon.data.datasets.etrago_setup as etrago import egon.data.datasets.scenario_parameters.parameters as scenario_parameters @@ -1492,8 +1493,16 @@ def insert_generators_sq(scn_name="status2019"): None. """ + + if scn_name == "status2019": + year_start_end = {"year_start": "20190101", "year_end": "20200101"} + elif scn_name == "status2023": + year_start_end = {"year_start": "20230101", "year_end": "20240101"} + else: + raise ValueError("No valid scenario name!") + try: - gen_sq = entsoe_historic_generation_capacities() + gen_sq = entsoe_historic_generation_capacities(**year_start_end) except: logging.warning( """Generation data from entsoe could not be retrieved. @@ -1650,8 +1659,16 @@ def insert_loads_sq(scn_name="status2019"): """ sources = config.datasets()["electrical_neighbours"]["sources"] targets = config.datasets()["electrical_neighbours"]["targets"] + + if scn_name == "status2019": + year_start_end = {"year_start": "20190101", "year_end": "20200101"} + elif scn_name == "status2023": + year_start_end = {"year_start": "20230101", "year_end": "20240101"} + else: + raise ValueError("No valid scenario name!") + try: - load_sq = entsoe_historic_demand() + load_sq = entsoe_historic_demand(**year_start_end) except: logging.warning( """Demand data from entsoe could not be retrieved. @@ -1733,7 +1750,20 @@ def insert_loads_sq(scn_name="status2019"): insert_per_scenario.update([tyndp_generation, tyndp_demand]) if "status2019" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update([insert_generators_sq, insert_loads_sq]) + insert_per_scenario.update( + [ + partial(insert_generators_sq(scn_name="status2019")), + partial(insert_loads_sq(scn_name="status2019")), + ] + ) + +if "status2023" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.update( + [ + partial(insert_generators_sq(scn_name="status2023")), + partial(insert_loads_sq(scn_name="status2023")), + ] + ) tasks = tasks + (insert_per_scenario,) From e729dec44db40a30d076a70e80ffd347288a9835 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Tue, 16 Jan 2024 16:21:42 +0100 Subject: [PATCH 522/787] Bump emob dataset version to 0.0.9 --- .../datasets/emobility/motorized_individual_travel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index cead1004a..cf3c77df0 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -485,7 +485,7 @@ def generate_model_data_tasks(scenario_name): super().__init__( name="MotorizedIndividualTravel", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=tasks, ) From a7f1f15c6e892fa2fc2b65469a61ae5a59fd81b1 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Tue, 16 Jan 2024 16:26:35 +0100 Subject: [PATCH 523/787] Add emob scenario variation for status2023 --- src/egon/data/datasets.yml | 1 + .../emobility/motorized_individual_travel/model_timeseries.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index d5745978b..3f34bf26c 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1141,6 +1141,7 @@ emobility_mit: # used scenario variation (available scenarios see parameters.py) variation: status2019: "status2019" + status2023: "status2023" eGon2035: "NEP C 2035" eGon100RE: "Reference 2050" # name of low-flex scenario diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index 2a62c15b4..a81022d04 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -1079,7 +1079,7 @@ def generate_model_data_status2019_remaining(): ) def generate_model_data_status2023_remaining(): - """Generates timeseries for status2019 scenario for grid districts which + """Generates timeseries for status2023 scenario for grid districts which has not been processed in the parallel tasks before. """ generate_model_data_bunch( From 54987269578368916f0d158939f8a64715b2f928 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Tue, 16 Jan 2024 16:46:03 +0100 Subject: [PATCH 524/787] Update changelog --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de4c74ee4..f58c202d4 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -486,6 +486,8 @@ Changed `#1026 `_ * Change hgv data source to use database `#1086 `_ +* Add eMob MIT for SQ2023 scenario + `#176 `_ .. _#799: https://github.com/openego/eGon-data/issues/799 From 09c3922a82921102d7325d8e5318330c582c579c Mon Sep 17 00:00:00 2001 From: nesnoj Date: Tue, 16 Jan 2024 17:11:49 +0100 Subject: [PATCH 525/787] Fix CRS in ERA5 transformation --- src/egon/data/datasets/era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index b766e9e3e..6b5624e21 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -81,7 +81,7 @@ def import_cutout(boundary="Europe"): "SELECT geometry as geom FROM boundaries.vg250_sta_bbox", db.engine(), ) - .to_crs(4623) + .to_crs(4326) .geom ) xs = slice(geom_de.bounds.minx[0], geom_de.bounds.maxx[0]) From 7fbf29d296608c007112eb6756267d0678783b13 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Tue, 16 Jan 2024 17:11:57 +0100 Subject: [PATCH 526/787] Update changelog --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7b685f99a..d30d5f9c5 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -729,6 +729,8 @@ Bug Fixes `#1098 `_ * Fix conversion factor for CH4 loads abroad in eGon2035 `#1104 `_ +* Fix CRS in ERA5 transformation + `#179 `_ .. _PR #692: https://github.com/openego/eGon-data/pull/692 .. _#343: https://github.com/openego/eGon-data/issues/343 From 912c56231c4bc99de8bf56a837c346478f590666 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 18:42:16 +0100 Subject: [PATCH 527/787] Add wrapped_partial function for dynamic tasks Partials need to be updated with further information like __module__, __name__. This info is copied from the actual function. --- src/egon/data/datasets/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 256db5769..a45ea5a71 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -4,7 +4,7 @@ from collections import abc from dataclasses import dataclass -from functools import reduce +from functools import partial, reduce, update_wrapper from typing import Callable, Iterable, Set, Tuple, Union import re @@ -19,6 +19,13 @@ SCHEMA = "metadata" +def wrapped_partial(func, *args, **kwargs): + partial_func = partial(func, *args, **kwargs) + # update partial to look like func + update_wrapper(partial_func, func) + return partial_func + + def setup(): """Create the database structure for storing dataset information.""" # TODO: Move this into a task generating the initial database structure. From e9a1c352eda65bb82d4b45c7dae305ddd54d30f1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 18:47:55 +0100 Subject: [PATCH 528/787] Replace partial by wrapped_partial --- src/egon/data/datasets/electrical_neighbours.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 524966d70..8d7f533ac 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -11,12 +11,11 @@ import pandas as pd from shapely.geometry import LineString from sqlalchemy.orm import sessionmaker -from functools import partial import egon.data.datasets.etrago_setup as etrago import egon.data.datasets.scenario_parameters.parameters as scenario_parameters from egon.data import config, db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.fix_ehv_subnetworks import select_bus_id from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.scenario_parameters import get_sector_parameters @@ -1752,16 +1751,15 @@ def insert_loads_sq(scn_name="status2019"): if "status2019" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - partial(insert_generators_sq(scn_name="status2019")), - partial(insert_loads_sq(scn_name="status2019")), + wrapped_partial(insert_generators_sq, scn_name="status2019"), + wrapped_partial(insert_loads_sq, scn_name="status2019"), ] ) - -if "status2023" in config.settings()["egon-data"]["--scenarios"]: +elif "status2023" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - partial(insert_generators_sq(scn_name="status2023")), - partial(insert_loads_sq(scn_name="status2023")), + wrapped_partial(insert_generators_sq, scn_name="status2023"), + wrapped_partial(insert_loads_sq, scn_name="status2023"), ] ) From 93c745a0d2c96781607ec2c8409910747a90fad2 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:03:03 +0100 Subject: [PATCH 529/787] Add optional postfix for new partial function --- src/egon/data/datasets/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index a45ea5a71..34254bb38 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -20,9 +20,14 @@ def wrapped_partial(func, *args, **kwargs): + """Like :func:`functools.partial`, but preserves the original function's + name and docstring. Also allows to add a postfix to the function's name. + """ + postfix = kwargs.pop("postfix", None) partial_func = partial(func, *args, **kwargs) - # update partial to look like func update_wrapper(partial_func, func) + if postfix: + partial_func.__name__ = f"{func.__name__}{postfix}" return partial_func From ad75218106b81419858a0aafb8d2648b0275b897 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:04:31 +0100 Subject: [PATCH 530/787] Use postfix for wrapped_partials --- src/egon/data/datasets/electrical_neighbours.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 8d7f533ac..269470f7d 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1751,15 +1751,15 @@ def insert_loads_sq(scn_name="status2019"): if "status2019" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - wrapped_partial(insert_generators_sq, scn_name="status2019"), - wrapped_partial(insert_loads_sq, scn_name="status2019"), + wrapped_partial(insert_generators_sq, scn_name="status2019", postfix="_19"), + wrapped_partial(insert_loads_sq, scn_name="status2019", postfix="_19"), ] ) elif "status2023" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - wrapped_partial(insert_generators_sq, scn_name="status2023"), - wrapped_partial(insert_loads_sq, scn_name="status2023"), + wrapped_partial(insert_generators_sq, scn_name="status2023", postfix="_23"), + wrapped_partial(insert_loads_sq, scn_name="status2023", postfix="_23"), ] ) From 38e5b6e18d0ff914778609e4b642739dfb3ac0f8 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:05:21 +0100 Subject: [PATCH 531/787] Black&Isort --- .../data/datasets/electrical_neighbours.py | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 269470f7d..53625e8b2 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1,25 +1,24 @@ """The central module containing all code dealing with electrical neighbours """ +from os import path +import logging import zipfile +from shapely.geometry import LineString +from sqlalchemy.orm import sessionmaker import entsoe -import requests -import logging - import geopandas as gpd import pandas as pd -from shapely.geometry import LineString -from sqlalchemy.orm import sessionmaker +import requests -import egon.data.datasets.etrago_setup as etrago -import egon.data.datasets.scenario_parameters.parameters as scenario_parameters from egon.data import config, db from egon.data.datasets import Dataset, wrapped_partial -from egon.data.datasets.fix_ehv_subnetworks import select_bus_id from egon.data.datasets.fill_etrago_gen import add_marginal_costs +from egon.data.datasets.fix_ehv_subnetworks import select_bus_id from egon.data.datasets.scenario_parameters import get_sector_parameters -from os import path +import egon.data.datasets.etrago_setup as etrago +import egon.data.datasets.scenario_parameters.parameters as scenario_parameters def get_cross_border_buses(scenario, sources): @@ -1751,15 +1750,23 @@ def insert_loads_sq(scn_name="status2019"): if "status2019" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - wrapped_partial(insert_generators_sq, scn_name="status2019", postfix="_19"), - wrapped_partial(insert_loads_sq, scn_name="status2019", postfix="_19"), + wrapped_partial( + insert_generators_sq, scn_name="status2019", postfix="_19" + ), + wrapped_partial( + insert_loads_sq, scn_name="status2019", postfix="_19" + ), ] ) elif "status2023" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ - wrapped_partial(insert_generators_sq, scn_name="status2023", postfix="_23"), - wrapped_partial(insert_loads_sq, scn_name="status2023", postfix="_23"), + wrapped_partial( + insert_generators_sq, scn_name="status2023", postfix="_23" + ), + wrapped_partial( + insert_loads_sq, scn_name="status2023", postfix="_23" + ), ] ) From 0800832d620c1e36897878044fa85da7c135ab27 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:11:15 +0100 Subject: [PATCH 532/787] Allow for electrical_neighbours status2019 and 2023 in same pipeline --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 53625e8b2..e906bfb0e 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1758,7 +1758,7 @@ def insert_loads_sq(scn_name="status2019"): ), ] ) -elif "status2023" in config.settings()["egon-data"]["--scenarios"]: +if "status2023" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.update( [ wrapped_partial( From 670c100e66f96d3367735ec6ab494e143ebbbc4c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:13:48 +0100 Subject: [PATCH 533/787] Bump version number for ElectricalNeighbours --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index e906bfb0e..992ef31f5 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1777,7 +1777,7 @@ class ElectricalNeighbours(Dataset): def __init__(self, dependencies): super().__init__( name="ElectricalNeighbours", - version="0.0.10", + version="0.0.11", dependencies=dependencies, tasks=tasks, ) From d953e710a872465cff9c0c908beead81d9bd74a8 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 21:36:50 +0100 Subject: [PATCH 534/787] Fix entsoe-py >= v.0.6.2 This is due to changes in the timeseries data at the API to avoid parsing errors. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e4d4616e1..9f3d203e9 100755 --- a/setup.py +++ b/setup.py @@ -87,7 +87,7 @@ def read(*names, **kwargs): "atlite==0.2.11", "cdsapi", "click<8.1", - "entsoe-py >=0.5.5", + "entsoe-py >=0.6.2", "GeoAlchemy2", "geopandas>=0.10.0", "geopy", From e95acf9439d34371a85c43fe809351bb65b60af9 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 21:45:25 +0100 Subject: [PATCH 535/787] Extend entsoe-py API authorisation process --- README.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 38cb528af..7c5e4aa77 100644 --- a/README.rst +++ b/README.rst @@ -139,11 +139,14 @@ packages are required too. Right now these are: * To download generation and demand data from entsoe you need to register in the `entsoe platform `_. Once the user is - created, a personal token can be generated to access the available data. This - token must be saved in a text file called *.entsoe-token* in the home directory. + created, send an email to transparency@entsoe.eu with “Restful API access” in + the subject line. Indicate the email address you entered during registration + in the email body. After authorisation a personal token can be generated in + 'My Account Settings'to access the available data. This token must be saved + in a text file called *.entsoe-token* in the home directory. In Ubuntu you can go to the home directory by typing :code:`cd ~` in a terminal. To create the file execute :code:`nano ".entsoe-token"` and then - paste your personal token (36 characters). Finally press :code:`CRL + x` to + paste your personal token (36 characters). Finally press :code:`CRL + x` to save and exit. * Make sure you have enough free disk space (~350 GB) in your working From 8429620663eb35a350ab046db7fded98f943bee3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:04:40 +0100 Subject: [PATCH 536/787] Add changelog entry #184 --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7b685f99a..a64b39985 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,9 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Fix depricated python-operator import + `#184 `_ + .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 438b3f367f7cb63e9031db342c5d937df024eb0c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:14:26 +0100 Subject: [PATCH 537/787] Add changelog entry for #182 --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de4c74ee4..be465e9a4 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,8 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Add status2023 electrical neighbours + `#182 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 97ede21da41b9bd75107104a42d891dbe7e2b4fa Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:17:54 +0100 Subject: [PATCH 538/787] Add changelog entry for #169 --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7b685f99a..ac96a8cd6 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,10 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Update osm for status2023 + `#169 `_ + + .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 5daaa4abcc21e0d299e28b1751edfe7aae455a92 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:14:26 +0100 Subject: [PATCH 539/787] Add changelog entry for #182 --- CHANGELOG.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 92c5419fe..9646550b7 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -254,7 +254,8 @@ Added `#822 `_ * Fix depricated python-operator import `#184 `_ - +* Add status2023 electrical neighbours + `#182 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 @@ -732,8 +733,6 @@ Bug Fixes `#1098 `_ * Fix conversion factor for CH4 loads abroad in eGon2035 `#1104 `_ -* Fix CRS in ERA5 transformation - `#179 `_ * Fix URLs of MaStR datasets .. _PR #692: https://github.com/openego/eGon-data/pull/692 From 78e6dcac23ec99015a1e52d9b076fcc4dc961be3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:16:34 +0100 Subject: [PATCH 540/787] Add changelog entry for #168 --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9646550b7..2a343b1a8 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -256,6 +256,8 @@ Added `#184 `_ * Add status2023 electrical neighbours `#182 `_ +* Fix transformer s_nom + `#168 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 @@ -733,7 +735,6 @@ Bug Fixes `#1098 `_ * Fix conversion factor for CH4 loads abroad in eGon2035 `#1104 `_ -* Fix URLs of MaStR datasets .. _PR #692: https://github.com/openego/eGon-data/pull/692 .. _#343: https://github.com/openego/eGon-data/issues/343 From 762c70a5b1bc5587d32be070a24039dc2b13fd57 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 22:17:54 +0100 Subject: [PATCH 541/787] Add changelog entry for #169 --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2a343b1a8..20599a2e6 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -258,6 +258,10 @@ Added `#182 `_ * Fix transformer s_nom `#168 `_ +* Update osm for status2023 + `#169 `_ + + .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 2ae58bd31a52c5ba86d4214102ba2602f0e5e044 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 23:30:02 +0100 Subject: [PATCH 542/787] Add download function to get former cached DemandRegio tables As FFE open-data servers are currently not available, we use formerly cached tables. This is a temporary ad-hoc fix until servers are running again. --- src/egon/data/datasets.yml | 6 ++++++ src/egon/data/datasets/demandregio/__init__.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index dba2feb8d..7a7865d54 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -94,6 +94,12 @@ demandregio_installation: targets: path: 'demandregio-disaggregator' +demandregio_workaround: + source: + url: "https://wolke.rl-institut.de/s/FqzCXNnPgGeRykk/download/__cache__.zip" + targets: + path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' + demandregio_society: sources: disaggregator: diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index ef8b384d2..40c01009d 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -3,6 +3,8 @@ """ from pathlib import Path +import os +import zipfile from sqlalchemy import ARRAY, Column, Float, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base @@ -18,6 +20,7 @@ EgonScenario, get_sector_parameters, ) +from egon.data.datasets.zensus import download_and_check import egon.data.config import egon.data.datasets.scenario_parameters.parameters as scenario_parameters @@ -807,3 +810,14 @@ def timeseries_per_wz(): for year in years: for sector in ["CTS", "industry"]: insert_timeseries_per_wz(sector, int(year)) + + +def get_cached_tables(): + """Get cached demandregio tabel from former runs""" + data_config = egon.data.config.datasets() + cache_url = data_config["demandregio_workaround"]["source"]["url"] + target_path = data_config["demandregio_workaround"]["targets"]["path"] + cache_path = Path(".", target_path, "__cache__.zip").resolve() + download_and_check(cache_url, cache_path, max_iteration=5) + with zipfile.ZipFile(cache_path, "r") as zip_ref: + zip_ref.extractall(cache_path.parent) From 3b5d3bae71664599f095d72752b10e0b00bcd522 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 23:32:19 +0100 Subject: [PATCH 543/787] Add task to dataset --- src/egon/data/datasets/demandregio/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 40c01009d..b431536e5 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -42,6 +42,7 @@ def __init__(self, dependencies): dependencies=dependencies, tasks=( clone_and_install, + get_cached_tables, create_tables, { insert_household_demand, From 93124f2e0f00d157184c7a627303ade11b86716e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 23:32:36 +0100 Subject: [PATCH 544/787] Bump version number for DemandRegio --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index b431536e5..c48e2b948 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -38,7 +38,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( clone_and_install, From ca5fb0e3d0c6fa553b8d5f2d96ade452369b8193 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 23:36:16 +0100 Subject: [PATCH 545/787] Add changelog entry for #185 --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20599a2e6..5e664f17c 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -260,6 +260,8 @@ Added `#168 `_ * Update osm for status2023 `#169 `_ +* Use cached DemandRegio tables for status2023 + `#185 `_ From 3e64f38c554d08fe2a986aeac22278b68dccbdb5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:02:10 +0100 Subject: [PATCH 546/787] Get cached and db-backup tables --- src/egon/data/datasets.yml | 11 +++++++--- .../data/datasets/demandregio/__init__.py | 22 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 7a7865d54..5e9dcf486 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -96,10 +96,15 @@ demandregio_installation: demandregio_workaround: source: - url: "https://wolke.rl-institut.de/s/FqzCXNnPgGeRykk/download/__cache__.zip" + cache: + url: "https://wolke.rl-institut.de/s/FqzCXNnPgGeRykk/download/__cache__.zip" + dbdump: + url: "https://wolke.rl-institut.de/s/7Z9m9q7JiP6HC6k/download/status2019-egon_demandregio_cts_ind.zip" targets: - path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' - + cache: + path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' + dbdump: + path: "demandregio_dbdump" demandregio_society: sources: disaggregator: diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index c48e2b948..418e9bbf7 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -3,6 +3,7 @@ """ from pathlib import Path +import subprocess import os import zipfile @@ -12,7 +13,7 @@ import pandas as pd from egon.data import db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.demandregio.install_disaggregator import ( clone_and_install, ) @@ -814,11 +815,16 @@ def timeseries_per_wz(): def get_cached_tables(): - """Get cached demandregio tabel from former runs""" + """Get cached demandregio tables and db-dump from former runs""" + data_config = egon.data.config.datasets() + for s in ["cache", "dbdump"]: + url = data_config["demandregio_workaround"]["source"][s]["url"] + target_path = data_config["demandregio_workaround"]["targets"][s]["path"] + filename = os.path.basename(url) + file_path = Path(".", target_path, filename).resolve() + os.makedirs(file_path.parent, exist_ok=True) + download_and_check(url, file_path, max_iteration=5) + with zipfile.ZipFile(file_path, "r") as zip_ref: + zip_ref.extractall(file_path.parent) + data_config = egon.data.config.datasets() - cache_url = data_config["demandregio_workaround"]["source"]["url"] - target_path = data_config["demandregio_workaround"]["targets"]["path"] - cache_path = Path(".", target_path, "__cache__.zip").resolve() - download_and_check(cache_url, cache_path, max_iteration=5) - with zipfile.ZipFile(cache_path, "r") as zip_ref: - zip_ref.extractall(cache_path.parent) From d9de7a941edb94b77e9bd618008a823a9f49219c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:03:36 +0100 Subject: [PATCH 547/787] Restore backup tables into db --- .../data/datasets/demandregio/__init__.py | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 418e9bbf7..a47bf0210 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -12,7 +12,7 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import db, logger from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.demandregio.install_disaggregator import ( clone_and_install, @@ -827,4 +827,41 @@ def get_cached_tables(): with zipfile.ZipFile(file_path, "r") as zip_ref: zip_ref.extractall(file_path.parent) +def backup_tables_to_db(): + """Get demandregio tables from former db-backup""" + # Read database configuration from docker-compose.yml + docker_db_config = db.credentials() data_config = egon.data.config.datasets() + + # Specify the path to the pgAdmin 4 backup file + backup_path = data_config["demandregio_workaround"]["targets"]["dbdump"]["path"] + backup_files = [file for file in os.listdir(backup_path) if + file.endswith(".backup")] + + for file in backup_files: + + # Construct the pg_restore command + pg_restore_cmd = [ + "pg_restore", + "-h", f"{docker_db_config['HOST']}", + "-p", f"{docker_db_config['PORT']}", + "-d", f"{docker_db_config['POSTGRES_DB']}", + "-U", f"{docker_db_config['POSTGRES_USER']}", + "--no-owner", # Optional: Prevent restoring ownership information + "--no-comments", # Optional: Exclude comments during restore + "--clean", # Optional: Drop existing objects before restore + "--verbose", + Path(".", backup_path, file).resolve(), + ] + + # Execute the pg_restore command + try: + subprocess.run(pg_restore_cmd, env={ + "PGPASSWORD": docker_db_config["POSTGRES_PASSWORD"]}, check=True) + logger.info( + f"Table {file} restored successfully to " + f"{docker_db_config['POSTGRES_DB']}.") + except subprocess.CalledProcessError as e: + logger.warning(f"Restore failed for table: {file} with: {e}") + + From b7c237dc3a556270911758c16fceb0364987372e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:09:37 +0100 Subject: [PATCH 548/787] Add ind and cts demand scaling electricity --- .../data/datasets/demandregio/__init__.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index a47bf0210..5f2b782d9 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -865,3 +865,38 @@ def backup_tables_to_db(): logger.warning(f"Restore failed for table: {file} with: {e}") +def scale_sq19(annual_sum, sector, scn): + """Scales the annual demand of all nuts3 status2019 for selected sector + to the annual sum of the scenario. + """ + sql = f""" + DELETE FROM demand.egon_demandregio_cts_ind + WHERE scenario = {scn} + AND wz IN (SELECT wz + FROM demand.egon_demandregio_wz + WHERE sector = {sector}); + + """ + db.execute_sql(sql) + logger.info(f"Removed demand for {sector} in scenario {scn} .") + + sql = f""" + INSERT INTO demand.egon_demandregio_cts_ind (nuts3, wz, scenario, year, demand) + SELECT nuts3, wz, {scn}, year, demand * {annual_sum} / total_demand +-- SELECT nuts3, wz, {scn}, year, demand +-- FROM demand.egon_demandregio_cts_ind + FROM demand.egon_demandregio_cts_ind, + (SELECT SUM(demand) AS total_demand + FROM demand.egon_demandregio_cts_ind + WHERE scenario = 'status2019' + AND wz IN (SELECT wz + FROM demand.egon_demandregio_wz + WHERE sector = {sector}) + ) AS subquery + WHERE scenario = 'status2019' + AND wz IN (SELECT wz + FROM demand.egon_demandregio_wz + WHERE sector = {sector}) + """ + db.execute_sql(sql) + logger.info(f"Demand scaled successfully for {sector} in scenario {scn} .") From cf00c402c03620a78b03f3c0faee2e146b506449 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:16:52 +0100 Subject: [PATCH 549/787] Make scaling factor according to documentation --- src/egon/data/datasets/demandregio/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 5f2b782d9..b7618b94c 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -555,7 +555,7 @@ def insert_cts_ind(scenario, year, engine, target_values): # scale values according to target_values if sector in target_values[scenario].keys(): ec_cts_ind *= ( - target_values[scenario][sector] * 1e3 / ec_cts_ind.sum().sum() + target_values[scenario][sector] / ec_cts_ind.sum().sum() ) # include new largescale consumers according to NEP 2021 @@ -649,11 +649,16 @@ def insert_cts_ind_demands(): target_values = { # according to NEP 2021 # new consumers will be added seperatly - "eGon2035": {"CTS": 135300, "industry": 225400}, + "eGon2035": { + "CTS": 135300 * 1e3, + "industry": 225400 * 1e3 + }, # CTS: reduce overall demand from demandregio (without traffic) # by share of heat according to JRC IDEES, data from 2011 # industry: no specific heat demand, use data from demandregio - "eGon100RE": {"CTS": (1 - (5.96 + 6.13) / 154.64) * 125183.403}, + "eGon100RE": { + "CTS": ((1 - (5.96 + 6.13) / 154.64) * 125183.403) * 1e3 + }, # no adjustments for status quo "eGon2021": {}, "status2019": {}, From e366a8c24af6177e46f853c8796a0b4a5e75c674 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:17:45 +0100 Subject: [PATCH 550/787] Add status2023 tasks to DemandRegio dataset --- .../data/datasets/demandregio/__init__.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index b7618b94c..f1be4c3fc 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -37,19 +37,36 @@ class DemandRegio(Dataset): def __init__(self, dependencies): + scale_sq19_cts_status2023 = wrapped_partial( # adhoc workaround #180 + scale_sq19, + annual_sum=121160 * 1e3, # BDEW2023 Stromverbrauch vorläufig + sector="'CTS'", + scn="'status2023'", + postfix="_cts_status2023") + scale_sq19_ind_status2023 = wrapped_partial( + scale_sq19, + annual_sum=200380 * 1e3, + sector="'industry'", + scn="'status2023'", + postfix="_ind_status2023") + super().__init__( name="DemandRegio", version="0.0.7", dependencies=dependencies, tasks=( clone_and_install, - get_cached_tables, + get_cached_tables, # adhoc workaround #180 create_tables, { insert_household_demand, insert_society_data, - insert_cts_ind_demands, + # insert_cts_ind_demands, + (backup_tables_to_db, # adhoc workaround #180 + scale_sq19_cts_status2023, + scale_sq19_ind_status2023,) }, + ), ) From 85bd171092d6c8054954b33844deff82a97d80e7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 18:18:31 +0100 Subject: [PATCH 551/787] Add draft for status2023 scaling with original function --- src/egon/data/datasets/demandregio/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index f1be4c3fc..9bd87d86c 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -679,6 +679,10 @@ def insert_cts_ind_demands(): # no adjustments for status quo "eGon2021": {}, "status2019": {}, + # "status2023": { + # "CTS": 121160 * 1e3, + # "industry": 200380 * 1e3 + # }, # TODO status2023 } insert_cts_ind(scn, year, engine, target_values) From dd437dc81a4f327704d14bca5ab8ba1cec62e8ca Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:19:18 +0100 Subject: [PATCH 552/787] Update demandregio household demands per size --- .../data/datasets/demandregio/__init__.py | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index ef8b384d2..499e2d395 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -423,18 +423,38 @@ def disagg_households_power( pd.DataFrame or pd.Series """ # source: survey of energieAgenturNRW + # with/without direct water heating (DHW), and weighted average + # https://1-stromvergleich.com/wp-content/uploads/erhebung_wo_bleibt_der_strom.pdf demand_per_hh_size = pd.DataFrame( index=range(1, 7), data={ - "weighted DWH": [2290, 3202, 4193, 4955, 5928, 5928], - "without DHW": [1714, 2812, 3704, 4432, 5317, 5317], + # "weighted DWH": [2290, 3202, 4193, 4955, 5928, 5928], + # "without DHW": [1714, 2812, 3704, 4432, 5317, 5317], + "with_DHW": [2181, 3843, 5151, 6189, 7494, 8465], + "without_DHW": [1798, 2850, 3733, 4480, 5311, 5816], + "weighted": [2256, 3248, 4246, 5009, 5969, 6579], }, ) + if scenario == "eGon100RE": + # chose demand per household size from survey without DHW + power_per_HH = demand_per_hh_size["without_DHW"] / 1e3 # TODO why without? + + # calculate demand per nuts3 in 2011 + df_2011 = data.households_per_size(year=2011) * power_per_HH + + # scale demand per hh-size to meet demand without heat + # according to JRC in 2011 (136.6-(20.14+9.41) TWh) + # TODO check source and method + power_per_HH *= (136.6 - (20.14 + 9.41)) * 1e6 / df_2011.sum().sum() + + # calculate demand per nuts3 in 2050 + df = data.households_per_size(year=year) * power_per_HH + # Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario if scenario in ["status2019", "eGon2021", "eGon2035"]: # chose demand per household size from survey including weighted DHW - power_per_HH = demand_per_hh_size["weighted DWH"] / 1e3 + power_per_HH = demand_per_hh_size["weighted"] / 1e3 # calculate demand per nuts3 df = ( @@ -444,21 +464,10 @@ def disagg_households_power( if scenario == "eGon2035": # scale to fit demand of NEP 2021 scebario C 2035 (119TWh) - df *= 119000000 / df.sum().sum() + df *= 119 * 1e6 / df.sum().sum() - elif scenario == "eGon100RE": - # chose demand per household size from survey without DHW - power_per_HH = demand_per_hh_size["without DHW"] / 1e3 - # calculate demand per nuts3 in 2011 - df_2011 = data.households_per_size(year=2011) * power_per_HH - # scale demand per hh-size to meet demand without heat - # according to JRC in 2011 (136.6-(20.14+9.41) TWh) - power_per_HH *= (136.6 - (20.14 + 9.41)) * 1e6 / df_2011.sum().sum() - - # calculate demand per nuts3 in 2050 - df = data.households_per_size(year=year) * power_per_HH else: print( @@ -479,7 +488,7 @@ def insert_hh_demand(scenario, year, engine): Parameters ---------- scenario : str - Name of the corresponing scenario. + Name of the corresponding scenario. year : int The number of households per region is taken from this year. @@ -595,7 +604,7 @@ def insert_household_demand(): scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] - scenarios.append("eGon2021") + scenarios.append("eGon2021") # TODO why is this always appended? for t in targets: db.execute_sql( From f5240eba40d1c30202c373f2fb62efeb6d31a0fa Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:20:10 +0100 Subject: [PATCH 553/787] Add scenario status2023 of demandregio households --- .../data/datasets/demandregio/__init__.py | 9 +++++- .../scenario_parameters/parameters.py | 31 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 499e2d395..d7c5091f2 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -452,7 +452,7 @@ def disagg_households_power( df = data.households_per_size(year=year) * power_per_HH # Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario - if scenario in ["status2019", "eGon2021", "eGon2035"]: + elif scenario in ["status2019", "status2023", "eGon2021", "eGon2035"]: # chose demand per household size from survey including weighted DHW power_per_HH = demand_per_hh_size["weighted"] / 1e3 @@ -466,7 +466,14 @@ def disagg_households_power( # scale to fit demand of NEP 2021 scebario C 2035 (119TWh) df *= 119 * 1e6 / df.sum().sum() + if scenario == "status2023": + # scale to fit demand of BDEW 2023 (130.48 TWh) see issue #180 + df *= 130.48 * 1e6 / df.sum().sum() + # if scenario == "status2021": # TODO status2021 + # # scale to fit demand of AGEB 2021 (138.6 TWh) + # # https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf#page=10 + # df *= 138.6 * 1e6 / df.sum().sum() else: diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 91e7b6bc0..703e6070a 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -123,6 +123,35 @@ def global_settings(scenario): "weather_year": 2011, "population_year": 2021, } + elif scenario == "status2023": + parameters = { + "weather_year": 2021, # TODO check if possible for 2023 + "population_year": 2021, # TODO check maybe possible for 2023 if + # ffe.opendata is online + # "fuel_costs": { + # # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) + # "oil": 12.9 * 3.6, # [EUR/MWh] + # "gas": 5.6 * 3.6, # [EUR/MWh] + # "coal": 3.0 * 3.6, # [EUR/MWh] + # "lignite": 1.1 * 3.6, # [EUR/MWh] + # "nuclear": 0.47 * 3.6, # [EUR/MWh] + # "biomass": read_costs(read_csv(2020), "biomass", "fuel"), + # }, + # "co2_costs": 24.7, # [EUR/t_CO2], source: + # # https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ + # "co2_emissions": { + # # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 + # "waste": 0.165, # [t_CO2/MW_th] + # "lignite": 0.393, # [t_CO2/MW_th] + # "gas": 0.201, # [t_CO2/MW_th] + # "nuclear": 0.0, # [t_CO2/MW_th] + # "oil": 0.288, # [t_CO2/MW_th] + # "coal": 0.335, # [t_CO2/MW_th] + # "other_non_renewable": 0.268, # [t_CO2/MW_th] + # }, + # "interest_rate": 0.05, # [p.u.] + } + elif scenario == "status2019": parameters = { "weather_year": 2019, @@ -135,7 +164,7 @@ def global_settings(scenario): "nuclear": 0.47*3.6, # [EUR/MWh] "biomass": read_costs(read_csv(2020), "biomass", "fuel"), }, - "co2_costs": 24.7, # [EUR/t_CO2], source: + "co2_costs": 24.7, # [EUR/t_CO2], source: #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 "waste": 0.165, # [t_CO2/MW_th] From c0822d289ff3545872f1b0237619edd8b81652e1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:20:44 +0100 Subject: [PATCH 554/787] Bump version number for DemandRegio --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index d7c5091f2..21f4a3a13 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -35,7 +35,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( clone_and_install, From a3671994e4764a0dd0a4f82517c204ecb7d484c2 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:26:55 +0100 Subject: [PATCH 555/787] Add changelog entry for #186 --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20599a2e6..f3d442163 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -260,6 +260,8 @@ Added `#168 `_ * Update osm for status2023 `#169 `_ +* Add status2023 scenario of demandregio households + `#186 `_ From 74740f2923c8cdf45f07228af9f76d80696f29ce Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:27:22 +0100 Subject: [PATCH 556/787] Black&Isort --- src/egon/data/datasets/demandregio/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 21f4a3a13..63b6bfdc7 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -438,7 +438,9 @@ def disagg_households_power( if scenario == "eGon100RE": # chose demand per household size from survey without DHW - power_per_HH = demand_per_hh_size["without_DHW"] / 1e3 # TODO why without? + power_per_HH = ( + demand_per_hh_size["without_DHW"] / 1e3 + ) # TODO why without? # calculate demand per nuts3 in 2011 df_2011 = data.households_per_size(year=2011) * power_per_HH @@ -475,7 +477,6 @@ def disagg_households_power( # # https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf#page=10 # df *= 138.6 * 1e6 / df.sum().sum() - else: print( f"Electric demand per household size for scenario {scenario} " @@ -611,7 +612,7 @@ def insert_household_demand(): scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] - scenarios.append("eGon2021") # TODO why is this always appended? + scenarios.append("eGon2021") # TODO why is this always appended? for t in targets: db.execute_sql( From 8029d38176c3ae69b79d2c36e6550b2731c9510b Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 18 Jan 2024 22:28:45 +0100 Subject: [PATCH 557/787] Update changelog #185 --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5e664f17c..618291281 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -260,7 +260,7 @@ Added `#168 `_ * Update osm for status2023 `#169 `_ -* Use cached DemandRegio tables for status2023 +* Use cached DemandRegio tables and scale status2023 cts & ind `#185 `_ From b5b7a2d87f80529ffc3249e1bb7fcb5785072d49 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 11:26:15 +0100 Subject: [PATCH 558/787] Update url of cached file download Download server did not support underscores in filename. --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 5e9dcf486..6d736728e 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -97,7 +97,7 @@ demandregio_installation: demandregio_workaround: source: cache: - url: "https://wolke.rl-institut.de/s/FqzCXNnPgGeRykk/download/__cache__.zip" + url: "https://wolke.rl-institut.de/s/GXrKmTkFygJcsqt/download/cache.zip" dbdump: url: "https://wolke.rl-institut.de/s/7Z9m9q7JiP6HC6k/download/status2019-egon_demandregio_cts_ind.zip" targets: From a19326826c3a638ca7f34e040da2041c9ebaad08 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 11:28:47 +0100 Subject: [PATCH 559/787] Update url of cached file download 2 Download server did not support underscores in filename. --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 6d736728e..b9e6e99e4 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -99,7 +99,7 @@ demandregio_workaround: cache: url: "https://wolke.rl-institut.de/s/GXrKmTkFygJcsqt/download/cache.zip" dbdump: - url: "https://wolke.rl-institut.de/s/7Z9m9q7JiP6HC6k/download/status2019-egon_demandregio_cts_ind.zip" + url: "https://wolke.rl-institut.de/s/7Z9m9q7JiP6HC6k/download/status2019-egon-demandregio-cts-ind.zip" targets: cache: path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' From c724f9891fe51d391a1431fa71ad54b42e1e730e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 11:29:34 +0100 Subject: [PATCH 560/787] Remove ind/cts backup tass from parallelization in DR --- src/egon/data/datasets/demandregio/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index b04f14b2b..e3ef39072 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -62,11 +62,10 @@ def __init__(self, dependencies): insert_household_demand, insert_society_data, # insert_cts_ind_demands, - (backup_tables_to_db, # adhoc workaround #180 - scale_sq19_cts_status2023, - scale_sq19_ind_status2023,) }, - + backup_tables_to_db, # adhoc workaround #180 + scale_sq19_cts_status2023, + scale_sq19_ind_status2023 ), ) From feae4164af3d1e6ceeb3be8007e719f1cebc5217 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 11:43:51 +0100 Subject: [PATCH 561/787] Add filename logging for cached file download --- src/egon/data/datasets/demandregio/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index e3ef39072..32ae6dd26 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -865,6 +865,7 @@ def get_cached_tables(): filename = os.path.basename(url) file_path = Path(".", target_path, filename).resolve() os.makedirs(file_path.parent, exist_ok=True) + logger.info(f"Downloading: {filename} from {url}.") download_and_check(url, file_path, max_iteration=5) with zipfile.ZipFile(file_path, "r") as zip_ref: zip_ref.extractall(file_path.parent) From 8125c90dbf56decbab9454e273174ddf3add02c4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 13:23:47 +0100 Subject: [PATCH 562/787] Use population_year == 2019 for demandregio Temporary fix as long as ffe.opendata is down. We could only reproduced cached files for 2019. --- src/egon/data/datasets/scenario_parameters/parameters.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 703e6070a..d8eb8bd22 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -125,9 +125,8 @@ def global_settings(scenario): } elif scenario == "status2023": parameters = { - "weather_year": 2021, # TODO check if possible for 2023 - "population_year": 2021, # TODO check maybe possible for 2023 if - # ffe.opendata is online + "weather_year": 2019, # TODO fixed to 2019 as long as FFE is down + "population_year": 2019, # TODO check if possible for 2023 # "fuel_costs": { # # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) # "oil": 12.9 * 3.6, # [EUR/MWh] From dbcfa90b5b0e824b5d9fbbcb6fca68737282d117 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 22 Jan 2024 16:38:35 +0100 Subject: [PATCH 563/787] limit flask-session version --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index e4d4616e1..7956076fd 100755 --- a/setup.py +++ b/setup.py @@ -88,6 +88,7 @@ def read(*names, **kwargs): "cdsapi", "click<8.1", "entsoe-py >=0.5.5", + "Flask-Session<0.6.0", "GeoAlchemy2", "geopandas>=0.10.0", "geopy", From e45067dd27b7d450137bd78b210a839eeea77d6c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 18:41:13 +0100 Subject: [PATCH 564/787] Try except for demandregio cloning and install Check if repo is already cloned and installed. If not clone or install. If none, do both. --- .../demandregio/install_disaggregator.py | 75 ++++++++++++------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/src/egon/data/datasets/demandregio/install_disaggregator.py b/src/egon/data/datasets/demandregio/install_disaggregator.py index 552242628..fa80831f9 100644 --- a/src/egon/data/datasets/demandregio/install_disaggregator.py +++ b/src/egon/data/datasets/demandregio/install_disaggregator.py @@ -1,16 +1,18 @@ """This module downloads and installs demandregio's disaggregator from GitHub """ +from pathlib import Path +from subprocess import check_output +import importlib.util import os import shutil -from pathlib import Path +from egon.data import logger, subprocess import egon.data.config -from egon.data import subprocess def clone_and_install(): - """ Clone and install repository of demandregio's disaggregator + """Clone and install repository of demandregio's disaggregator Returns ------- @@ -26,27 +28,48 @@ def clone_and_install(): ] ) - # Delete repository if it already exists - if repo_path.exists() and repo_path.is_dir(): - shutil.rmtree(repo_path) - - # Create subfolder - os.mkdir(repo_path) - - # Clone from GitHub repository - subprocess.run( - [ - "git", - "clone", - "--single-branch", - "--branch", - source["branch"], - source["git-repository"], - ], - cwd=repo_path, - ) + try: + status = check_output( + ["git", "status"], cwd=(repo_path / "disaggregator").absolute() + ) + if status.startswith(b"Auf Branch features/pandas-update"): + logger.info("Demandregio cloned and right branch checked out.") + else: + raise ImportError( + "Demandregio cloned but wrong branch checked " + "out. Please checkout features/pandas-update" + ) + spec = importlib.util.find_spec("disaggregator") + if spec is not None: + logger.info("Demandregio is not installed. Installing now.") + # Install disaggregator from path + subprocess.run( + [ + "pip", + "install", + "-e", + (repo_path / "disaggregator").absolute(), + ] + ) - # Install disaggregator from path - subprocess.run( - ["pip", "install", "-e", (repo_path / "disaggregator").absolute()] - ) + except subprocess.CalledProcessError and FileNotFoundError: + # Create subfolder + os.makedirs(repo_path, exist_ok=True) + + # Clone from GitHub repository + subprocess.run( + [ + "git", + "clone", + "--single-branch", + "--branch", + source["branch"], + source["git-repository"], + ], + cwd=repo_path, + ) + + # Install disaggregator from path + subprocess.run( + ["pip", "install", "-e", (repo_path / "disaggregator").absolute()] + ) From 48d3d2d94fb9aba8f384420fb6f6a173bd226b05 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 18:49:23 +0100 Subject: [PATCH 565/787] Bump version number for DemandRegio --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index ef8b384d2..83dfc38e1 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -35,7 +35,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( clone_and_install, From 2f5d8cecbd251372822b7398db078715afb23b69 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 18:56:39 +0100 Subject: [PATCH 566/787] Add changelog entry for #195 --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7231c97a..b799cb5bd 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,10 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Try except for demandregio clone and install + `#195 `_ + + .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 4ca6fc2bd2d33ed0cb235358ae483bc9427331a4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 22 Jan 2024 18:58:52 +0100 Subject: [PATCH 567/787] Move changelog to changes --- CHANGELOG.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b799cb5bd..1119994ce 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,9 +252,6 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ -* Try except for demandregio clone and install - `#195 `_ - .. _PR #159: https://github.com/openego/eGon-data/pull/159 @@ -490,6 +487,9 @@ Changed `#1026 `_ * Change hgv data source to use database `#1086 `_ +* Try except for demandregio clone and install + `#195 `_ + .. _#799: https://github.com/openego/eGon-data/issues/799 From 22f952d0c309c86180a738f01d18bac69085fbf7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 13:48:14 +0100 Subject: [PATCH 568/787] Update demandregio workaround urls after nextcloud update --- src/egon/data/datasets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index b9e6e99e4..712801866 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -97,9 +97,9 @@ demandregio_installation: demandregio_workaround: source: cache: - url: "https://wolke.rl-institut.de/s/GXrKmTkFygJcsqt/download/cache.zip" + url: "https://wolke.rl-institut.de/s/BPMMCdKcjZGidrE/download/cache.zip" dbdump: - url: "https://wolke.rl-institut.de/s/7Z9m9q7JiP6HC6k/download/status2019-egon-demandregio-cts-ind.zip" + url: "https://wolke.rl-institut.de/s/NCyWssr2yRHYZsZ/download/status2019-egon-demandregio-cts-ind.zip" targets: cache: path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' From ac2d54635677b6578c1aa2d2c9b71c4ccd984b35 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 15:48:20 +0100 Subject: [PATCH 569/787] Add global parameters for 2023, fuel prices not uptodate --- .../scenario_parameters/parameters.py | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 91e7b6bc0..b3f418cf8 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -123,6 +123,37 @@ def global_settings(scenario): "weather_year": 2011, "population_year": 2021, } + + elif scenario == "status2023": + parameters = { + "weather_year": 2019, # TODO fixed to 2019 as long as FFE is down + "population_year": 2019, # TODO check if possible for 2023 + "fuel_costs": { + # TODO status2023 update values + # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) + "oil": 12.9 * 3.6, # [EUR/MWh] + "gas": 5.6 * 3.6, # [EUR/MWh] + "coal": 3.0 * 3.6, # [EUR/MWh] + "lignite": 1.1 * 3.6, # [EUR/MWh] + "nuclear": 0.47 * 3.6, # [EUR/MWh] + "biomass": read_costs(read_csv(2020), "biomass", "fuel"), + }, + "co2_costs": 83.66, # [EUR/t_CO2], source: + # https://www.iwr.de/news/co2-emissionshandel-deutschland-erzielt-2023-rekordeinnahmen-von-ueber-18-mrd-euro-news38528 + "co2_emissions": { + # Netzentwicklungsplan Strom 2037, Genehmigtr Scenariorahmen, p. 66, table 21 + # https://www.netzentwicklungsplan.de/sites/default/files/2023-01/Szenariorahmen_2037_Genehmigung.pdf + "waste": 0.165, # [t_CO2/MW_th] + "lignite": 0.393, # [t_CO2/MW_th] + "gas": 0.201, # [t_CO2/MW_th] + "nuclear": 0.0, # [t_CO2/MW_th] + "oil": 0.288, # [t_CO2/MW_th] + "coal": 0.337, # [t_CO2/MW_th] + "other_non_renewable": 0.268, # [t_CO2/MW_th] + }, + "interest_rate": 0.05, # [p.u.] + } + elif scenario == "status2019": parameters = { "weather_year": 2019, @@ -135,7 +166,7 @@ def global_settings(scenario): "nuclear": 0.47*3.6, # [EUR/MWh] "biomass": read_costs(read_csv(2020), "biomass", "fuel"), }, - "co2_costs": 24.7, # [EUR/t_CO2], source: + "co2_costs": 24.7, # [EUR/t_CO2], source: #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 "waste": 0.165, # [t_CO2/MW_th] From 4fa1bf40be7aaf5860c1c49b1a0e11d4c711b947 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 15:49:07 +0100 Subject: [PATCH 570/787] Add scenario status2023 to scenario parameters (only global+electricity) --- .../datasets/scenario_parameters/__init__.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 3133fc287..76e928491 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -146,6 +146,28 @@ def insert_scenarios(): session.commit() + # Scenario status2023 + status2023 = EgonScenario(name="status2023") + + status2023.description = """ + Status quo ante scenario for 2023. + """ + status2023.global_parameters = parameters.global_settings(status2019.name) + + status2023.electricity_parameters = parameters.electricity(status2019.name) + + # TODO status2023 which parameters are needed at all? + # status2023.gas_parameters = parameters.gas(status2019.name) + + # status2023.heat_parameters = parameters.heat(status2019.name) + + # status2023.mobility_parameters = parameters.mobility(status2019.name) + + session.add(status2023) + + session.commit() + + def get_sector_parameters(sector, scenario=None): """Returns parameters for each sector as dictionary. From ddae6b5b52c7c3d236b8e59da7a37c58b69cd892 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 16:05:02 +0100 Subject: [PATCH 571/787] Bump version number for ScenarioParameters --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 76e928491..f83df41bb 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -266,7 +266,7 @@ class ScenarioParameters(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioParameters", - version="0.0.15", + version="0.0.16", dependencies=dependencies, tasks=( create_table, From eaf775d59f8c5cbb652af65df27847cb24b1a402 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 17:56:46 +0100 Subject: [PATCH 572/787] Host files at TuBerlin --- src/egon/data/datasets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 712801866..fbe1c530b 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -97,9 +97,9 @@ demandregio_installation: demandregio_workaround: source: cache: - url: "https://wolke.rl-institut.de/s/BPMMCdKcjZGidrE/download/cache.zip" + url: "https://tubcloud.tu-berlin.de/s/dKqF6wKJnLRyDws/download/cache.zip" dbdump: - url: "https://wolke.rl-institut.de/s/NCyWssr2yRHYZsZ/download/status2019-egon-demandregio-cts-ind.zip" + url: "https://tubcloud.tu-berlin.de/s/ktaxyo8kSTK8w3f/download/status2019-egon_demandregio_cts_ind.zip" targets: cache: path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' From 7348096974d495b1d117bf363caf398ce9db2960 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 18:40:02 +0100 Subject: [PATCH 573/787] Fix url filename --- src/egon/data/datasets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index fbe1c530b..3c810a9e0 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -99,7 +99,7 @@ demandregio_workaround: cache: url: "https://tubcloud.tu-berlin.de/s/dKqF6wKJnLRyDws/download/cache.zip" dbdump: - url: "https://tubcloud.tu-berlin.de/s/ktaxyo8kSTK8w3f/download/status2019-egon_demandregio_cts_ind.zip" + url: "https://tubcloud.tu-berlin.de/s/ktaxyo8kSTK8w3f/download/status2019-egon-demandregio-cts-ind.zip" targets: cache: path: 'demandregio-disaggregator/disaggregator/disaggregator/data_in/' From 827862c4f1fd5d9c835427dc8f97cfece87270ef Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 15:28:37 +0100 Subject: [PATCH 574/787] Use all parameters from 2019 --- .../datasets/scenario_parameters/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index f83df41bb..6236eaf7c 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -123,9 +123,9 @@ def insert_scenarios(): eGon2021.mobility_parameters = parameters.mobility(eGon2021.name) session.add(eGon2021) - - session.commit() - + + session.commit() + # Scenario status2019 status2019 = EgonScenario(name="status2019") @@ -152,16 +152,16 @@ def insert_scenarios(): status2023.description = """ Status quo ante scenario for 2023. """ + # TODO status2023 all settings from 2019 are used status2023.global_parameters = parameters.global_settings(status2019.name) status2023.electricity_parameters = parameters.electricity(status2019.name) - # TODO status2023 which parameters are needed at all? - # status2023.gas_parameters = parameters.gas(status2019.name) + status2023.gas_parameters = parameters.gas(status2019.name) - # status2023.heat_parameters = parameters.heat(status2019.name) + status2023.heat_parameters = parameters.heat(status2019.name) - # status2023.mobility_parameters = parameters.mobility(status2019.name) + status2023.mobility_parameters = parameters.mobility(status2019.name) session.add(status2023) @@ -224,7 +224,7 @@ def get_sector_parameters(sector, scenario=None): ).val[0], index=["eGon100RE"], ), - + pd.DataFrame( db.select_dataframe( f""" @@ -235,7 +235,7 @@ def get_sector_parameters(sector, scenario=None): index=["eGon2021"], ) ], ignore_index=True) - + return values From c8214d223ca207ca611471f3ffb71076ddd8550c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 15:29:06 +0100 Subject: [PATCH 575/787] Black&isort --- .../datasets/scenario_parameters/__init__.py | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 6236eaf7c..e37c81b74 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -1,5 +1,6 @@ """The central module containing all code dealing with scenario table. """ + from pathlib import Path from urllib.request import urlretrieve import shutil @@ -168,7 +169,6 @@ def insert_scenarios(): session.commit() - def get_sector_parameters(sector, scenario=None): """Returns parameters for each sector as dictionary. @@ -206,36 +206,38 @@ def get_sector_parameters(sector, scenario=None): else: print(f"Scenario name {scenario} is not valid.") else: - values = pd.concat([ - pd.DataFrame( - db.select_dataframe( - f""" + values = pd.concat( + [ + pd.DataFrame( + db.select_dataframe( + f""" SELECT {sector}_parameters as val FROM scenario.egon_scenario_parameters WHERE name='eGon2035'""" - ).val[0], - index=["eGon2035"]), - pd.DataFrame( - db.select_dataframe( - f""" + ).val[0], + index=["eGon2035"], + ), + pd.DataFrame( + db.select_dataframe( + f""" SELECT {sector}_parameters as val FROM scenario.egon_scenario_parameters WHERE name='eGon100RE'""" - ).val[0], - index=["eGon100RE"], - ), - - pd.DataFrame( - db.select_dataframe( - f""" + ).val[0], + index=["eGon100RE"], + ), + pd.DataFrame( + db.select_dataframe( + f""" SELECT {sector}_parameters as val FROM scenario.egon_scenario_parameters WHERE name='eGon2021'""" - ).val[0], - index=["eGon2021"], - ) - ], ignore_index=True) - + ).val[0], + index=["eGon2021"], + ), + ], + ignore_index=True, + ) return values From 9a170399eab2a85e3c94547dabbf16109503fcdb Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 21:06:30 +0100 Subject: [PATCH 576/787] Add dynamic statusquo task generation for chp This is based on the wrapped_partial function introduced in features/status2023_electrical_neighbours. --- src/egon/data/datasets/chp/__init__.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 8f6929b97..350bf9144 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -16,7 +16,7 @@ import pypsa from egon.data import config, db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.chp.match_nep import insert_large_chp, map_carrier from egon.data.datasets.chp.small_chp import ( assign_use_case, @@ -314,7 +314,7 @@ def insert_biomass_chp(scenario): session.commit() -def insert_chp_statusquo(): +def insert_chp_statusquo(scn="status2019"): cfg = config.datasets()["chp_location"] # import data for MaStR @@ -343,13 +343,13 @@ def insert_chp_statusquo(): ) mastr = mastr.loc[ mastr.Inbetriebnahmedatum - <= config.datasets()["mastr_new"]["status2023_date_max"] + <= config.datasets()["mastr_new"][f"{scn}_date_max"] ] mastr = mastr.loc[ ( mastr.DatumEndgueltigeStilllegung - >= config.datasets()["mastr_new"]["status2023_date_max"] + >= config.datasets()["mastr_new"][f"{scn}_date_max"] ) | (mastr.DatumEndgueltigeStilllegung.isnull()) ] @@ -413,13 +413,13 @@ def insert_chp_statusquo(): mastr, cfg, WORKING_DIR_MASTR_NEW ) - gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus + gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus # fixed to status2019, no other data avail. mastr = assign_bus_id(mastr, cfg, drop_missing=True) mastr["gas_bus_id"] = gas_bus_id - mastr = assign_use_case(mastr, cfg["sources"], "status2019") + mastr = assign_use_case(mastr, cfg["sources"], "status2019") # fixed to status2019, no other data avail. # Insert entries with location session = sessionmaker(bind=db.engine())() @@ -435,7 +435,7 @@ def insert_chp_statusquo(): carrier=map_carrier().loc[row.Energietraeger], el_capacity=row.Nettonennleistung / 1000, th_capacity=row.ThermischeNutzleistung / 1000, - scenario="status2019", + scenario=scn, district_heating=row.district_heating, electrical_bus_id=row.bus_id, ch4_bus_id=row.gas_bus_id, @@ -642,7 +642,14 @@ def insert_chp_egon100re(): insert_per_scenario = set() if "status2019" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.add(insert_chp_statusquo) + insert_per_scenario.add( + wrapped_partial(insert_chp_statusquo, scn="status2019", postfix="_2019") + ) + +if "status2023" in config.settings()["egon-data"]["--scenarios"]: + insert_per_scenario.add( + wrapped_partial(insert_chp_statusquo, scn="status2023", postfix="_2023") + ) if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: insert_per_scenario.add(insert_chp_egon2035) From 2c56cd179ad56555b9bc5a36d2f7555d45785bc1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 21:48:48 +0100 Subject: [PATCH 577/787] Add draft for heat demand parameter update --- .../scenario_parameters/parameters.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 91e7b6bc0..27ffd3cc5 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -1155,6 +1155,44 @@ def heat(scenario): ), } + elif scenario == "status2023": + parameters = { + # source: AG Energiebilanzen 2022 https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf + "DE_demand_residential_TJ": 1754.2 * 1e3 + + 407.5 * 1e3, # [TJ], Endenergieverbrauch Haushalte 2.1 Raumwärme + Warmwasser + "DE_demand_service_TJ": 668.4 * 1e3 + + 44.3 * 1e3 , # [TJ], Endenergieverbrauch GHD 3.1 Raumwärme + Warmwasser + "DE_district_heating_share": (189760 + 38248) + / ( + 1658400 + 383300 + 567300 + 71500 + ), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) + } # TODO status2023 needs update + + costs = read_csv(2020) + + # Insert marginal_costs in EUR/MWh + # marginal cost can include fuel, C02 and operation and maintenance costs + parameters["marginal_cost"] = { + "central_heat_pump": read_costs( + costs, "central air-sourced heat pump", "VOM" + ), + "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"), + "central_gas_boiler": read_costs( + costs, "central gas boiler", "VOM" + ), + "central_resistive_heater": read_costs( + costs, "central resistive heater", "VOM" + ), + "rural_heat_pump": 0, # Danish Energy Agency, Technology Data for Individual Heating Plants + } + + # Insert efficiency in p.u. + parameters["efficiency"] = { + "central_gas_boiler": read_costs( + costs, "central gas boiler", "efficiency" + ), + } + else: print(f"Scenario name {scenario} is not valid.") From feb4f8a569d4ff60178ff1f60557affa22e1bf25 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 21:51:12 +0100 Subject: [PATCH 578/787] Add heat demand scenario --- src/egon/data/datasets/heat_demand/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index a346bf82e..1d0fd8117 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -357,6 +357,16 @@ def future_heat_demand_germany(scenario_name): ser_hd_reduction = ( heat_parameters["DE_demand_service_TJ"] / 3600 / 226.588158 ) + elif scenario_name == "status2023": + heat_parameters = get_sector_parameters("heat", scenario=scenario_name) + + # Calculate reduction share based on final energy demand and overall demand from Peta for 2015 + res_hd_reduction = ( + heat_parameters["DE_demand_residential_TJ"] / 3600 / 443.788483 # TODO status2023 can values stay same? + ) + ser_hd_reduction = ( + heat_parameters["DE_demand_service_TJ"] / 3600 / 226.588158 # TODO status2023 can values stay same? + ) else: heat_parameters = get_sector_parameters("heat", scenario=scenario_name) From 0431ccf1bc5a0511b50889a90f4a1bbd6d2666ce Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 29 Jan 2024 21:52:10 +0100 Subject: [PATCH 579/787] Bump version number of heat-demands --- src/egon/data/datasets/heat_demand/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index 1d0fd8117..cacce89db 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -47,7 +47,7 @@ def __init__(self, dependencies): super().__init__( name="heat-demands", # version=self.target_files + "_0.0", - version="0.0.3", # maybe rethink the naming + version="0.0.4", # maybe rethink the naming dependencies=dependencies, tasks=(scenario_data_import), ) From 25721b8b7d238a058a2ae634a72542bc9fde46ab Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:18:38 +0100 Subject: [PATCH 580/787] Map global paramaters status2023->2023 --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index e37c81b74..f1092e8ab 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -154,7 +154,7 @@ def insert_scenarios(): Status quo ante scenario for 2023. """ # TODO status2023 all settings from 2019 are used - status2023.global_parameters = parameters.global_settings(status2019.name) + status2023.global_parameters = parameters.global_settings(status2023.name) status2023.electricity_parameters = parameters.electricity(status2019.name) From 8ebd4c288d851671458cdc820cd7613b878faa63 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:29:17 +0100 Subject: [PATCH 581/787] Comment heat parameter for status2023 as status2019 is used --- .../scenario_parameters/parameters.py | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 27ffd3cc5..33708a36d 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -1155,43 +1155,43 @@ def heat(scenario): ), } - elif scenario == "status2023": - parameters = { - # source: AG Energiebilanzen 2022 https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf - "DE_demand_residential_TJ": 1754.2 * 1e3 - + 407.5 * 1e3, # [TJ], Endenergieverbrauch Haushalte 2.1 Raumwärme + Warmwasser - "DE_demand_service_TJ": 668.4 * 1e3 - + 44.3 * 1e3 , # [TJ], Endenergieverbrauch GHD 3.1 Raumwärme + Warmwasser - "DE_district_heating_share": (189760 + 38248) - / ( - 1658400 + 383300 + 567300 + 71500 - ), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) - } # TODO status2023 needs update - - costs = read_csv(2020) - - # Insert marginal_costs in EUR/MWh - # marginal cost can include fuel, C02 and operation and maintenance costs - parameters["marginal_cost"] = { - "central_heat_pump": read_costs( - costs, "central air-sourced heat pump", "VOM" - ), - "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"), - "central_gas_boiler": read_costs( - costs, "central gas boiler", "VOM" - ), - "central_resistive_heater": read_costs( - costs, "central resistive heater", "VOM" - ), - "rural_heat_pump": 0, # Danish Energy Agency, Technology Data for Individual Heating Plants - } - - # Insert efficiency in p.u. - parameters["efficiency"] = { - "central_gas_boiler": read_costs( - costs, "central gas boiler", "efficiency" - ), - } + # elif scenario == "status2023": + # parameters = { + # # source: AG Energiebilanzen 2022 https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf + # "DE_demand_residential_TJ": 1754.2 * 1e3 + # + 407.5 * 1e3, # [TJ], Endenergieverbrauch Haushalte 2.1 Raumwärme + Warmwasser + # "DE_demand_service_TJ": 668.4 * 1e3 + # + 44.3 * 1e3 , # [TJ], Endenergieverbrauch GHD 3.1 Raumwärme + Warmwasser + # "DE_district_heating_share": (189760 + 38248) + # / ( + # 1658400 + 383300 + 567300 + 71500 + # ), # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx) + # } # TODO status2023 needs update + # + # costs = read_csv(2020) + # + # # Insert marginal_costs in EUR/MWh + # # marginal cost can include fuel, C02 and operation and maintenance costs + # parameters["marginal_cost"] = { + # "central_heat_pump": read_costs( + # costs, "central air-sourced heat pump", "VOM" + # ), + # "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"), + # "central_gas_boiler": read_costs( + # costs, "central gas boiler", "VOM" + # ), + # "central_resistive_heater": read_costs( + # costs, "central resistive heater", "VOM" + # ), + # "rural_heat_pump": 0, # Danish Energy Agency, Technology Data for Individual Heating Plants + # } + # + # # Insert efficiency in p.u. + # parameters["efficiency"] = { + # "central_gas_boiler": read_costs( + # costs, "central gas boiler", "efficiency" + # ), + # } else: print(f"Scenario name {scenario} is not valid.") From 40aaf161927bedfc96a049e0f2235ba5f3e26757 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:31:40 +0100 Subject: [PATCH 582/787] Adjust minimum connection rate for all statusquo scenarios --- src/egon/data/datasets/district_heating_areas/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index ce906ba2c..02ff01192 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -521,9 +521,10 @@ def district_heating_areas(scenario_name, plotting=False): minimum_connection_rate = 0.3 - # Adjust minimum connection rate for status2019, + # Adjust minimum connection rate for status2019, and other statusquo scn # otherwise the existing district heating grids would have too much demand - if scenario_name == "status2019": + # if scenario_name == "status2019": + if "status" in scenario_name: minimum_connection_rate = 0.6 # heat_demand is scenario specific From b9a8da1f43dad09b9ae229f3a1e019ab8c043b31 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:33:53 +0100 Subject: [PATCH 583/787] Add remark --- src/egon/data/datasets/heat_demand/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand/__init__.py b/src/egon/data/datasets/heat_demand/__init__.py index cacce89db..31954d6a9 100644 --- a/src/egon/data/datasets/heat_demand/__init__.py +++ b/src/egon/data/datasets/heat_demand/__init__.py @@ -358,7 +358,8 @@ def future_heat_demand_germany(scenario_name): heat_parameters["DE_demand_service_TJ"] / 3600 / 226.588158 ) elif scenario_name == "status2023": - heat_parameters = get_sector_parameters("heat", scenario=scenario_name) + heat_parameters = get_sector_parameters("heat", scenario=scenario_name) # currently data for 2019 is used + # see scenario_paramters/__init__ for this. # Calculate reduction share based on final energy demand and overall demand from Peta for 2015 res_hd_reduction = ( From 471888847e799665ff2275d1dce4ce2f3aea15d4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:52:09 +0100 Subject: [PATCH 584/787] Add plotting color for status2023 district heating areas --- src/egon/data/datasets/district_heating_areas/plot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/district_heating_areas/plot.py b/src/egon/data/datasets/district_heating_areas/plot.py index c0c81f3e5..7310ed22f 100644 --- a/src/egon/data/datasets/district_heating_areas/plot.py +++ b/src/egon/data/datasets/district_heating_areas/plot.py @@ -62,6 +62,8 @@ def plot_heat_density_sorted(heat_denisty_per_scenario, scenario_name=None): colors["curve"]["eGon100RE"] = "orange" colors["share"]["status2019"] = "darkgreen" colors["curve"]["status2019"] = "green" + colors["share"]["status2023"] = "darkgrey" + colors["curve"]["status2023"] = "grey" for scenario in heat_denisty_per_scenario.keys(): From 4893b073af77ba65e85bf1896631bd809ea7d6e0 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:54:16 +0100 Subject: [PATCH 585/787] Add remark --- src/egon/data/datasets/district_heating_areas/plot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/district_heating_areas/plot.py b/src/egon/data/datasets/district_heating_areas/plot.py index 7310ed22f..dacb56971 100644 --- a/src/egon/data/datasets/district_heating_areas/plot.py +++ b/src/egon/data/datasets/district_heating_areas/plot.py @@ -64,6 +64,7 @@ def plot_heat_density_sorted(heat_denisty_per_scenario, scenario_name=None): colors["curve"]["status2019"] = "green" colors["share"]["status2023"] = "darkgrey" colors["curve"]["status2023"] = "grey" + # TODO status2023 set plotting=False? for scenario in heat_denisty_per_scenario.keys(): From 4dba767387a5db759b02ec705cda4b0acf822f85 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 14:55:05 +0100 Subject: [PATCH 586/787] Add status2023 to table --- src/egon/data/datasets/district_heating_areas/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/district_heating_areas/plot.py b/src/egon/data/datasets/district_heating_areas/plot.py index dacb56971..9cd3b2f58 100644 --- a/src/egon/data/datasets/district_heating_areas/plot.py +++ b/src/egon/data/datasets/district_heating_areas/plot.py @@ -53,7 +53,7 @@ def plot_heat_density_sorted(heat_denisty_per_scenario, scenario_name=None): fig, ax = plt.subplots(1, 1) colors = pd.DataFrame( - columns=["share", "curve"], index=["status2019", "eGon2035", "eGon100RE"] + columns=["share", "curve"], index=["status2019", "status2023", "eGon2035", "eGon100RE"] ) colors["share"]["eGon2035"] = "darkblue" From f07d5477eed0d852c0d3e162e853de96f509494e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 17:11:03 +0100 Subject: [PATCH 587/787] Add status2023 to hh_electricity --- .../electricity_demand_timeseries/hh_buildings.py | 3 +++ .../electricity_demand_timeseries/hh_profiles.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index e9ea3e770..edfb6ba88 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -642,6 +642,7 @@ def get_building_peak_loads(): HouseholdElectricityProfilesOfBuildings, HouseholdElectricityProfilesInCensusCells.nuts3, HouseholdElectricityProfilesInCensusCells.factor_2019, + HouseholdElectricityProfilesInCensusCells.factor_2023, HouseholdElectricityProfilesInCensusCells.factor_2035, HouseholdElectricityProfilesInCensusCells.factor_2050, ) @@ -692,11 +693,13 @@ def ve(s): df_building_peak_load_nuts3 = pd.DataFrame( [ df_building_peak_load_nuts3 * df["factor_2019"].unique(), + df_building_peak_load_nuts3 * df["factor_2023"].unique(), df_building_peak_load_nuts3 * df["factor_2035"].unique(), df_building_peak_load_nuts3 * df["factor_2050"].unique(), ], index=[ "status2019", + "status2023", "eGon2035", "eGon100RE", ], diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 67aa44014..a0cd633f6 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -165,6 +165,7 @@ class HouseholdElectricityProfilesInCensusCells(Base): nuts3 = Column(String) nuts1 = Column(String) factor_2019 = Column(Float) + factor_2023 = Column(Float) factor_2035 = Column(Float) factor_2050 = Column(Float) @@ -1377,6 +1378,18 @@ def adjust_to_demand_regio_nuts3_annual( / (nuts3_profiles_sum_annual / 1e3) ) + if ( + "status2023" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + df_hh_profiles_in_census_cells.loc[ + nuts3_cell_ids, "factor_2023" + ] = ( + df_demand_regio.loc[(2023, nuts3_id), "demand_mwha"] + * 1e3 + / (nuts3_profiles_sum_annual / 1e3) + ) + if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] From 7f28858a0d42066d1c7c87cb8b20a47f6e15bf64 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 17:28:03 +0100 Subject: [PATCH 588/787] Add mv_grid_district task for status2023 --- .../electricity_demand_timeseries/hh_profiles.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index a0cd633f6..8f91bf0d7 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -212,6 +212,19 @@ def __init__(self, dependencies): tasks = tasks + (mv_hh_electricity_load_2035,) + if ( + "status2023" + in egon.data.config.settings()["egon-data"]["--scenarios"] + ): + mv_hh_electricity_load_2035 = PythonOperator( + task_id="MV-hh-electricity-load-2023", + python_callable=mv_grid_district_HH_electricity_load, + op_args=["status2023", 2023], + op_kwargs={"drop_table": True}, + ) + + tasks = tasks + (mv_hh_electricity_load_2035,) + if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] From b5bd92d3c5666c0427c3d4f20f4834601b670773 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 17:29:06 +0100 Subject: [PATCH 589/787] Bump version number of Household Demands --- .../data/datasets/electricity_demand_timeseries/hh_profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 8f91bf0d7..d4286c9fd 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -251,7 +251,7 @@ def __init__(self, dependencies): super().__init__( name="Household Demands", - version="0.0.11", + version="0.0.12", dependencies=dependencies, tasks=tasks, ) From fa2d01410098155c8a63fca29ed983143263770e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 17:37:53 +0100 Subject: [PATCH 590/787] Adhoc fix demandregio_hh year column for status2023 to 2023 --- src/egon/data/datasets/demandregio/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index ef8b384d2..d72703bd5 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -500,7 +500,9 @@ def insert_hh_demand(scenario, year, engine): # insert into database for hh_size in ec_hh.columns: df = pd.DataFrame(ec_hh[hh_size]) - df["year"] = year + df["year"] = 2023 if scenario == "status2023" else year # TODO status2023 + # adhoc fix until ffeopendata servers are up and population_year can be set + df["scenario"] = scenario df["hh_size"] = hh_size df = df.rename({hh_size: "demand"}, axis="columns") From bc4994c3240cfc4f0802d79cac800034545d6af6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 30 Jan 2024 18:13:50 +0100 Subject: [PATCH 591/787] Add link to changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2477e403..b0d253205 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -489,6 +489,7 @@ Changed * Try except for demandregio clone and install `#195 `_ * Add new MaStR dataset for SQ2023 scenario + `#175 `_ .. _#799: https://github.com/openego/eGon-data/issues/799 From afca9aeefddc732c09daa575457b541de4df626c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:02:36 +0100 Subject: [PATCH 592/787] Bump version number of osmtgmod --- src/egon/data/datasets/osmtgmod/__init__.py | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index 21a84b73a..b1bb68528 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -521,7 +521,8 @@ def to_pypsa(): """ ) - for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: + # for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: + for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: capital_cost = get_sector_parameters( "electricity", scenario_name.replace("'", "") @@ -628,19 +629,19 @@ def to_pypsa(): WHERE a.line_id = result.line_id AND scn_name = {scenario_name}; - -- set capital costs for eHV-lines + -- set capital costs for eHV-lines UPDATE grid.egon_etrago_line SET capital_cost = {capital_cost['ac_ehv_overhead_line']} * length WHERE v_nom > 110 AND scn_name = {scenario_name}; - -- set capital costs for HV-lines + -- set capital costs for HV-lines UPDATE grid.egon_etrago_line SET capital_cost = {capital_cost['ac_hv_overhead_line']} * length WHERE v_nom = 110 AND scn_name = {scenario_name}; - - -- set capital costs for transformers + + -- set capital costs for transformers UPDATE grid.egon_etrago_transformer a SET capital_cost = {capital_cost['transformer_380_220']} WHERE (a.bus0 IN ( @@ -688,20 +689,20 @@ def to_pypsa(): SELECT bus_id FROM grid.egon_etrago_bus WHERE v_nom = 220)) AND scn_name = {scenario_name}; - - -- set lifetime for eHV-lines + + -- set lifetime for eHV-lines UPDATE grid.egon_etrago_line - SET lifetime = {lifetime['ac_ehv_overhead_line']} + SET lifetime = {lifetime['ac_ehv_overhead_line']} WHERE v_nom > 110 AND scn_name = {scenario_name}; - -- set capital costs for HV-lines + -- set capital costs for HV-lines UPDATE grid.egon_etrago_line SET lifetime = {lifetime['ac_hv_overhead_line']} WHERE v_nom = 110 AND scn_name = {scenario_name}; - - -- set capital costs for transformers + + -- set capital costs for transformers UPDATE grid.egon_etrago_transformer a SET lifetime = {lifetime['transformer_380_220']} WHERE (a.bus0 IN ( @@ -749,7 +750,7 @@ def to_pypsa(): SELECT bus_id FROM grid.egon_etrago_bus WHERE v_nom = 220)) AND scn_name = {scenario_name}; - + -- delete buses without connection to AC grid and generation or -- load assigned @@ -776,7 +777,7 @@ class Osmtgmod(Dataset): def __init__(self, dependencies): super().__init__( name="Osmtgmod", - version="0.0.5", + version="0.0.7", dependencies=dependencies, tasks=( import_osm_data, From 1174bccdcbdbfefb2b14e876feed1774febda743 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:10:33 +0100 Subject: [PATCH 593/787] Add remark --- src/egon/data/datasets/osmtgmod/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index b1bb68528..a7ccb7b0e 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -524,6 +524,7 @@ def to_pypsa(): # for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + # TODO maybe not needed anymore? capital_cost = get_sector_parameters( "electricity", scenario_name.replace("'", "") )["capital_cost"] From 122fee97f29bd412e1a6b06dac8b51661dba6f36 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:27:30 +0100 Subject: [PATCH 594/787] Fix er5 scenario to status2023 Its currently not possible to have multiple era5 weather years. --- src/egon/data/datasets/era5.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index 6b5624e21..ff1e8de1d 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -69,7 +69,8 @@ def import_cutout(boundary="Europe"): Weather data stored in cutout """ - weather_year = get_sector_parameters("global", "status2019")["weather_year"] + weather_year = get_sector_parameters("global", "status2023")["weather_year"] + # This is fixed to one scenario as its currently not possible to have multiple weather-years if boundary == "Europe": xs = slice(-12.0, 35.1) From afdf65e90ebc37eca7635f3785a8813998f56669 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:28:38 +0100 Subject: [PATCH 595/787] Bump version number of era5 --- src/egon/data/datasets/era5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/era5.py b/src/egon/data/datasets/era5.py index ff1e8de1d..0f6f11a52 100644 --- a/src/egon/data/datasets/era5.py +++ b/src/egon/data/datasets/era5.py @@ -23,7 +23,7 @@ class WeatherData(Dataset): def __init__(self, dependencies): super().__init__( name="Era5", - version="0.0.2", + version="0.0.3", dependencies=dependencies, tasks=({create_tables, download_era5}, insert_weather_cells), ) From a8b28c17be87c220e3050a86d22490273a20d601 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:29:48 +0100 Subject: [PATCH 596/787] Update weather year in scenario paramters to 2023 --- src/egon/data/datasets/scenario_parameters/parameters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index b3f418cf8..48948550c 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -126,8 +126,8 @@ def global_settings(scenario): elif scenario == "status2023": parameters = { - "weather_year": 2019, # TODO fixed to 2019 as long as FFE is down - "population_year": 2019, # TODO check if possible for 2023 + "weather_year": 20123, + "population_year": 2019, # TODO: check if possible for 2023 "fuel_costs": { # TODO status2023 update values # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) From 200ce6fc41ed3a8d383f3021d5e3cf003aca5c79 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 17:38:27 +0100 Subject: [PATCH 597/787] Update weather year in scenario paramters to 2023 --- src/egon/data/datasets/scenario_parameters/parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 48948550c..f70abcb48 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -126,7 +126,7 @@ def global_settings(scenario): elif scenario == "status2023": parameters = { - "weather_year": 20123, + "weather_year": 2023, "population_year": 2019, # TODO: check if possible for 2023 "fuel_costs": { # TODO status2023 update values From 5846d2c324334550e1df19b89f5ad1725be69b58 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 18:18:56 +0100 Subject: [PATCH 598/787] Add function to derive scenario year from name --- .../data/datasets/scenario_parameters/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 3133fc287..d38f5dbab 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -45,6 +45,19 @@ def create_table(): EgonScenario.__table__.create(bind=engine, checkfirst=True) +def get_scenario_year(scenario_name): + """Derives scenarios year from scenario name. Scenario + eGon100RE is an exception as year is not in the name.""" + try: + year = int(scenario_name[-4:]) + except ValueError as e: + if e.args[0] == "invalid literal for int() with base 10: '00RE'": + year = 2050 # eGon100RE + else: + raise ValueError("The names of the scenarios do not end with the year!") + return year + + def insert_scenarios(): """Insert scenarios and their parameters to scenario table From bc26416a35a8f32bd06d8044cf75e4fb40049ca4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 18:23:46 +0100 Subject: [PATCH 599/787] Make scenario generation more lean --- .../hh_profiles.py | 47 ++----------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index d4286c9fd..f661e6b65 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -135,6 +135,7 @@ from egon.data import db from egon.data.datasets import Dataset +from egon.data.datasets.scenario_parameters import get_scenario_year from egon.data.datasets.zensus_mv_grid_districts import MapZensusGridDistricts import egon.data.config @@ -1379,50 +1380,12 @@ def adjust_to_demand_regio_nuts3_annual( # demand regio in MWh # profiles in Wh - if ( - "status2019" - in egon.data.config.settings()["egon-data"]["--scenarios"] - ): - df_hh_profiles_in_census_cells.loc[ - nuts3_cell_ids, "factor_2019" - ] = ( - df_demand_regio.loc[(2019, nuts3_id), "demand_mwha"] - * 1e3 - / (nuts3_profiles_sum_annual / 1e3) - ) - - if ( - "status2023" - in egon.data.config.settings()["egon-data"]["--scenarios"] - ): - df_hh_profiles_in_census_cells.loc[ - nuts3_cell_ids, "factor_2023" - ] = ( - df_demand_regio.loc[(2023, nuts3_id), "demand_mwha"] - * 1e3 - / (nuts3_profiles_sum_annual / 1e3) - ) - - if ( - "eGon2035" - in egon.data.config.settings()["egon-data"]["--scenarios"] - ): - df_hh_profiles_in_census_cells.loc[ - nuts3_cell_ids, "factor_2035" - ] = ( - df_demand_regio.loc[(2035, nuts3_id), "demand_mwha"] - * 1e3 - / (nuts3_profiles_sum_annual / 1e3) - ) - - if ( - "eGon100RE" - in egon.data.config.settings()["egon-data"]["--scenarios"] - ): + for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: + year = get_scenario_year(scn) df_hh_profiles_in_census_cells.loc[ - nuts3_cell_ids, "factor_2050" + nuts3_cell_ids, f"factor_{year}" ] = ( - df_demand_regio.loc[(2050, nuts3_id), "demand_mwha"] + df_demand_regio.loc[(year, nuts3_id), "demand_mwha"] * 1e3 / (nuts3_profiles_sum_annual / 1e3) ) From 2b74904ff35ef3c148d4eccb9ebcd87b203b3f1d Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 18:45:57 +0100 Subject: [PATCH 600/787] Fill empty columns with np.nan to allow multiplication If values would be none, an error would be raised. In this case multiplication is possible but results in nan as well which is not a problem as this scenario is not selected in the run but due to the code needs to be calculated anyways. This is more an adhoc fix. A clean fix would replace the specifc factor_* columns and make them dynamic or organise in a different way. --- .../datasets/electricity_demand_timeseries/hh_buildings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index edfb6ba88..312099311 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -657,6 +657,9 @@ def get_building_peak_loads(): cells_query.statement, cells_query.session.bind, index_col="id" ) + # fill columns with None with np.nan to allow multiplication with emtpy columns + df_buildings_and_profiles = df_buildings_and_profiles.fillna(np.nan) + # Read demand profiles from egon-data-bundle df_profiles = get_iee_hh_demand_profiles_raw() From 9a6d7ab8524feab034cfb4ddb54bb93aa3e5104b Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 1 Feb 2024 12:34:00 +0100 Subject: [PATCH 601/787] Add single quotes around scenario for sql-strings SQL needs single quotes to be seen as strings. This is necessary to be seen as string in the sql script and not as variable. --- src/egon/data/datasets/osmtgmod/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index a7ccb7b0e..00b0c5fd1 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -522,7 +522,9 @@ def to_pypsa(): ) # for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: - for scenario_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + scenario_list = egon.data.config.settings()["egon-data"]["--scenarios"] + scenario_list = [f"'{scn}'" if not scn[1] == "'" else scn for scn in scenario_list] + for scenario_name in scenario_list: # TODO maybe not needed anymore? capital_cost = get_sector_parameters( From b59a387e52003194c5b905bd773bdcfc85ed1055 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 1 Feb 2024 13:47:14 +0100 Subject: [PATCH 602/787] Set weather year to 2017 for CTS gas timeseries To temporarily fix task heat_demand_timeseries.export-etrago-cts-heat-profiles --- src/egon/data/datasets/heat_demand_timeseries/service_sector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py index f16b37e6f..9cc04b2e9 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/service_sector.py +++ b/src/egon/data/datasets/heat_demand_timeseries/service_sector.py @@ -74,7 +74,7 @@ def cts_demand_per_aggregation_level(aggregation_level, scenario): df_CTS_gas_2011 = df_CTS_gas_2011.asfreq("H") else: df_CTS_gas_2011 = temporal.disagg_temporal_gas_CTS( - use_nuts3code=True, year=2019 + use_nuts3code=True, year=2017 ) df_CTS_gas_2011.to_csv("CTS_heat_demand_profile_nuts3.csv") From 05dcd79b03cbedf409b386d92106782c671e6ace Mon Sep 17 00:00:00 2001 From: nesnoj Date: Thu, 1 Feb 2024 18:03:28 +0100 Subject: [PATCH 603/787] Reactivate task insert_cts_ind_demands, remove temporary DB restore and scaling #180 --- .../data/datasets/demandregio/__init__.py | 99 +------------------ 1 file changed, 5 insertions(+), 94 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 32ae6dd26..32938d926 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -37,19 +37,6 @@ class DemandRegio(Dataset): def __init__(self, dependencies): - scale_sq19_cts_status2023 = wrapped_partial( # adhoc workaround #180 - scale_sq19, - annual_sum=121160 * 1e3, # BDEW2023 Stromverbrauch vorläufig - sector="'CTS'", - scn="'status2023'", - postfix="_cts_status2023") - scale_sq19_ind_status2023 = wrapped_partial( - scale_sq19, - annual_sum=200380 * 1e3, - sector="'industry'", - scn="'status2023'", - postfix="_ind_status2023") - super().__init__( name="DemandRegio", version="0.0.7", @@ -61,11 +48,8 @@ def __init__(self, dependencies): { insert_household_demand, insert_society_data, - # insert_cts_ind_demands, + insert_cts_ind_demands, }, - backup_tables_to_db, # adhoc workaround #180 - scale_sq19_cts_status2023, - scale_sq19_ind_status2023 ), ) @@ -695,10 +679,10 @@ def insert_cts_ind_demands(): # no adjustments for status quo "eGon2021": {}, "status2019": {}, - # "status2023": { - # "CTS": 121160 * 1e3, - # "industry": 200380 * 1e3 - # }, # TODO status2023 + "status2023": { + "CTS": 121160 * 1e3, + "industry": 200380 * 1e3 + }, } insert_cts_ind(scn, year, engine, target_values) @@ -870,76 +854,3 @@ def get_cached_tables(): with zipfile.ZipFile(file_path, "r") as zip_ref: zip_ref.extractall(file_path.parent) -def backup_tables_to_db(): - """Get demandregio tables from former db-backup""" - # Read database configuration from docker-compose.yml - docker_db_config = db.credentials() - data_config = egon.data.config.datasets() - - # Specify the path to the pgAdmin 4 backup file - backup_path = data_config["demandregio_workaround"]["targets"]["dbdump"]["path"] - backup_files = [file for file in os.listdir(backup_path) if - file.endswith(".backup")] - - for file in backup_files: - - # Construct the pg_restore command - pg_restore_cmd = [ - "pg_restore", - "-h", f"{docker_db_config['HOST']}", - "-p", f"{docker_db_config['PORT']}", - "-d", f"{docker_db_config['POSTGRES_DB']}", - "-U", f"{docker_db_config['POSTGRES_USER']}", - "--no-owner", # Optional: Prevent restoring ownership information - "--no-comments", # Optional: Exclude comments during restore - "--clean", # Optional: Drop existing objects before restore - "--verbose", - Path(".", backup_path, file).resolve(), - ] - - # Execute the pg_restore command - try: - subprocess.run(pg_restore_cmd, env={ - "PGPASSWORD": docker_db_config["POSTGRES_PASSWORD"]}, check=True) - logger.info( - f"Table {file} restored successfully to " - f"{docker_db_config['POSTGRES_DB']}.") - except subprocess.CalledProcessError as e: - logger.warning(f"Restore failed for table: {file} with: {e}") - - -def scale_sq19(annual_sum, sector, scn): - """Scales the annual demand of all nuts3 status2019 for selected sector - to the annual sum of the scenario. - """ - sql = f""" - DELETE FROM demand.egon_demandregio_cts_ind - WHERE scenario = {scn} - AND wz IN (SELECT wz - FROM demand.egon_demandregio_wz - WHERE sector = {sector}); - - """ - db.execute_sql(sql) - logger.info(f"Removed demand for {sector} in scenario {scn} .") - - sql = f""" - INSERT INTO demand.egon_demandregio_cts_ind (nuts3, wz, scenario, year, demand) - SELECT nuts3, wz, {scn}, year, demand * {annual_sum} / total_demand --- SELECT nuts3, wz, {scn}, year, demand --- FROM demand.egon_demandregio_cts_ind - FROM demand.egon_demandregio_cts_ind, - (SELECT SUM(demand) AS total_demand - FROM demand.egon_demandregio_cts_ind - WHERE scenario = 'status2019' - AND wz IN (SELECT wz - FROM demand.egon_demandregio_wz - WHERE sector = {sector}) - ) AS subquery - WHERE scenario = 'status2019' - AND wz IN (SELECT wz - FROM demand.egon_demandregio_wz - WHERE sector = {sector}) - """ - db.execute_sql(sql) - logger.info(f"Demand scaled successfully for {sector} in scenario {scn} .") From aacc88864475b8d7aa577dfe897c5cc89ff3359a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 2 Feb 2024 13:33:04 +0100 Subject: [PATCH 604/787] Clone osmtgmod only if not existing --- src/egon/data/datasets/osmtgmod/__init__.py | 55 ++++++++++++++++----- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index 00b0c5fd1..a2d12bf26 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -6,11 +6,12 @@ import logging import os import shutil +import subprocess import sys import psycopg2 -from egon.data import db +from egon.data import db, logger from egon.data.config import settings from egon.data.datasets import Dataset from egon.data.datasets.osmtgmod.substation import extract @@ -19,7 +20,6 @@ import egon.data.subprocess as subproc - def run(): sys.setrecursionlimit(5000) # execute osmTGmod @@ -52,18 +52,47 @@ def import_osm_data(): # Delete repository if it already exists if osmtgmod_repos.exists() and osmtgmod_repos.is_dir(): - shutil.rmtree(osmtgmod_repos) + try: + status = subprocess.check_output( + ["git", "status"], cwd=(osmtgmod_repos).absolute() + ) + if status.startswith( + b"Auf Branch features/egon" + ) or status.startswith(b"On branch features/egon"): + logger.info("OsmTGmod cloned and right branch checked out.") - subproc.run( - [ - "git", - "clone", - "--single-branch", - "--branch", - "features/egon", - "https://github.com/openego/osmTGmod.git", - ] - ) + else: + subproc.run( + [ + "git", + "checkout", + "features/egon", + ] + ) + except subprocess.CalledProcessError: + shutil.rmtree(osmtgmod_repos) + subproc.run( + [ + "git", + "clone", + "--single-branch", + "--branch", + "features/egon", + "https://github.com/openego/osmTGmod.git", + ] + ) + else: + + subproc.run( + [ + "git", + "clone", + "--single-branch", + "--branch", + "features/egon", + "https://github.com/openego/osmTGmod.git", + ] + ) data_config = egon.data.config.datasets() osm_config = data_config["openstreetmap"]["original_data"] From 9b721f74cefae6b5d3d34019092ca3b0170dcca5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 2 Feb 2024 13:33:25 +0100 Subject: [PATCH 605/787] Black&isort --- src/egon/data/datasets/osmtgmod/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/osmtgmod/__init__.py b/src/egon/data/datasets/osmtgmod/__init__.py index a2d12bf26..7d5d8075e 100644 --- a/src/egon/data/datasets/osmtgmod/__init__.py +++ b/src/egon/data/datasets/osmtgmod/__init__.py @@ -441,9 +441,11 @@ def osmtgmod( # beware: comments in C-like style (such as /* comment */) arn't parsed! sqlfile_without_comments = "".join( [ - line.lstrip().split("--")[0] + "\n" - if not line.lstrip().split("--")[0] == "" - else "" + ( + line.lstrip().split("--")[0] + "\n" + if not line.lstrip().split("--")[0] == "" + else "" + ) for line in sqlfile.split("\n") ] ) @@ -552,7 +554,9 @@ def to_pypsa(): # for scenario_name in ["'eGon2035'", "'eGon100RE'", "'status2019'"]: scenario_list = egon.data.config.settings()["egon-data"]["--scenarios"] - scenario_list = [f"'{scn}'" if not scn[1] == "'" else scn for scn in scenario_list] + scenario_list = [ + f"'{scn}'" if not scn[1] == "'" else scn for scn in scenario_list + ] for scenario_name in scenario_list: # TODO maybe not needed anymore? From 4c453afbe24bbb16865b0fe5a939bbe1330d4bde Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 5 Feb 2024 18:03:29 +0100 Subject: [PATCH 606/787] Add status2023 to hh_electricity_demand --- src/egon/data/datasets/electricity_demand/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index e0653663f..041f1d711 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -93,6 +93,7 @@ def get_annual_household_el_demand_cells(): HouseholdElectricityProfilesOfBuildings, HouseholdElectricityProfilesInCensusCells.nuts3, HouseholdElectricityProfilesInCensusCells.factor_2019, + HouseholdElectricityProfilesInCensusCells.factor_2023, HouseholdElectricityProfilesInCensusCells.factor_2035, HouseholdElectricityProfilesInCensusCells.factor_2050, ) @@ -148,6 +149,12 @@ def ve(s): df_profiles.loc[:, df["profile_id"]].sum(axis=0) * df["factor_2019"].values ) + + if "status2023" in scenarios: + df_annual_demand_iter["status2023"] = ( + df_profiles.loc[:, df["profile_id"]].sum(axis=0) + * df["factor_2023"].values + ) df_annual_demand_iter["zensus_population_id"] = df["cell_id"].values df_annual_demand = pd.concat([df_annual_demand, df_annual_demand_iter]) From 2b4b70a584a190ae678aaf842c3d5f447a86afdc Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 5 Feb 2024 18:04:04 +0100 Subject: [PATCH 607/787] Bump version number of HouseholdElectricityDemand --- src/egon/data/datasets/electricity_demand/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index 041f1d711..a412820ee 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -28,7 +28,7 @@ class HouseholdElectricityDemand(Dataset): def __init__(self, dependencies): super().__init__( name="HouseholdElectricityDemand", - version="0.0.4", + version="0.0.5", dependencies=dependencies, tasks=(create_tables, get_annual_household_el_demand_cells), ) From c2b6b3af37fce2dd07201f1fc1e88f6eb75a2c05 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 5 Feb 2024 18:33:00 +0100 Subject: [PATCH 608/787] Fix cts_buildings to status2023 --- .../electricity_demand_timeseries/cts_buildings.py | 11 ++++++----- .../electricity_demand_timeseries/hh_buildings.py | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index 21af89b8b..fae5eec54 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -260,7 +260,7 @@ def __init__(self, dependencies): version="0.0.4", dependencies=dependencies, tasks=( - cts_buildings, + cts_buildings, # TODO: status2023, currently fixed for only 2023 {cts_electricity, cts_heat}, get_cts_electricity_peak_load, map_all_used_buildings, @@ -442,6 +442,7 @@ def buildings_with_amenities(): Contains synthetic amenities in lost cells. Might be empty """ + from saio.boundaries import egon_map_zensus_buildings_filtered_all from saio.openstreetmap import osm_amenities_in_buildings_filtered @@ -461,7 +462,7 @@ def buildings_with_amenities(): ) .filter( EgonDemandRegioZensusElectricity.sector == "service", - EgonDemandRegioZensusElectricity.scenario == "status2019", + EgonDemandRegioZensusElectricity.scenario == "status2023", # TODO: status2023 ) ) df_amenities_in_buildings = pd.read_sql( @@ -1210,7 +1211,7 @@ def adapt_numpy_int64(numpy_int64): log.info("Start logging!") # Buildings with amenities - df_buildings_with_amenities, df_lost_cells = buildings_with_amenities() + df_buildings_with_amenities, df_lost_cells = buildings_with_amenities() # TODO: status2023 this is fixed to 2023 log.info("Buildings with amenities selected!") # Median number of amenities per cell @@ -1229,7 +1230,7 @@ def adapt_numpy_int64(numpy_int64): # Amenities not assigned to buildings df_amenities_without_buildings = amenities_without_buildings() - log.info("Amenities without buildlings selected!") + log.info("Amenities without buildings selected!") # Append lost cells due to duplicated ids, to cover all demand cells if not df_lost_cells.empty: @@ -1256,7 +1257,7 @@ def adapt_numpy_int64(numpy_int64): df_amenities_without_buildings, points="geom_amenity" ) log.info("Synthetic buildings created!") - + # df_synthetic_buildings_with_amenities["scn_name"] = scn_name # TODO: status 2023, add eventually # TODO remove renaming after #722 write_table_to_postgis( df_synthetic_buildings_with_amenities.rename( diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 312099311..08174a7b3 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -155,6 +155,7 @@ class OsmBuildingsSynthetic(Base): id = Column(String, primary_key=True) cell_id = Column(String, index=True) + # scn_name = Column(String, index=True) # TODO: status2023 currently fixed to 2023 geom_building = Column(Geometry("Polygon", 3035), index=True) geom_point = Column(Geometry("POINT", 3035)) n_amenities_inside = Column(Integer) From 2796d0212116e5bd3e128f3d0ddea7e87b360bc5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 7 Feb 2024 16:31:38 +0100 Subject: [PATCH 609/787] Remove hard-coded scneario 2021 This was needed in egon-datat to produce dingo grids, but is not obligatory anymore. --- src/egon/data/datasets/demandregio/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 63b6bfdc7..c184c725d 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -649,7 +649,6 @@ def insert_cts_ind_demands(): scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] - scenarios.append("eGon2021") for scn in scenarios: year = scenario_parameters.global_settings(scn)["population_year"] From 3cc1a12fb7393a60e96bcc40064603e3068120b6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 7 Feb 2024 16:39:06 +0100 Subject: [PATCH 610/787] Fix targets years in insert_society_data --- src/egon/data/datasets/demandregio/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index c184c725d..c96b14f74 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -693,9 +693,12 @@ def insert_society_data(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - target_years = np.append( - get_sector_parameters("global").population_year.values, 2018 - ) + target_years = [ + get_sector_parameters("global", scn)["population_year"] + for scn in egon.data.config.settings()["egon-data"]["--scenarios"] + ] + + target_years = np.unique(np.append(np.array(target_years), 2018)) for year in target_years: df_pop = pd.DataFrame(data.population(year=year)) From b2173b6b4ccf6aea974078e0ddd559cfc2de9eda Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 7 Feb 2024 17:26:02 +0100 Subject: [PATCH 611/787] Use capital costs of dynamic scenario --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 992ef31f5..f7ef30c91 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -587,7 +587,7 @@ def foreign_dc_lines(scenario, sources, targets, central_buses): AND country != 'DE') """ ) - capital_cost = get_sector_parameters("electricity", "eGon2035")[ + capital_cost = get_sector_parameters("electricity", scenario)[ "capital_cost" ] From 936793bf9145af6f171f3d51008929172baf28f4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 7 Feb 2024 17:45:23 +0100 Subject: [PATCH 612/787] Add central foreign buses for status2023 --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index f7ef30c91..f6f78f9e8 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -247,7 +247,7 @@ def buses(scenario, sources, targets): central_buses.scn_name = scenario # Insert all central buses for eGon2035 - if scenario in ["eGon2035", "status2019"]: + if scenario in ["eGon2035", "status2019", "status2023"]: # TODO: status2023 this is hardcoded shit central_buses.to_postgis( targets["buses"]["table"], schema=targets["buses"]["schema"], From 462dd48d448e5f17ee603a41b400312d219f421b Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 08:46:56 +0100 Subject: [PATCH 613/787] Pass scn_name to entsoe_to_bus_etrago function --- src/egon/data/datasets/electrical_neighbours.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index f6f78f9e8..dcb385db8 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1450,7 +1450,7 @@ def map_carriers_entsoe(): } -def entsoe_to_bus_etrago(): +def entsoe_to_bus_etrago(scn_name): map_entsoe = pd.Series( { "LU": "LU00", @@ -1469,7 +1469,7 @@ def entsoe_to_bus_etrago(): } ) - for_bus = get_foreign_bus_id(scenario="status2019") + for_bus = get_foreign_bus_id(scenario=scn_name) return map_entsoe.map(for_bus) @@ -1538,7 +1538,7 @@ def insert_generators_sq(scn_name="status2019"): AND scn_name = '{scn_name}' """ ) - entsoe_to_bus = entsoe_to_bus_etrago() + entsoe_to_bus = entsoe_to_bus_etrago(scn_name) carrier_entsoe = map_carriers_entsoe() gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() @@ -1715,7 +1715,7 @@ def insert_loads_sq(scn_name="status2019"): session = sessionmaker(bind=engine)() # get the corresponding bus per foreign country - entsoe_to_bus = entsoe_to_bus_etrago() + entsoe_to_bus = entsoe_to_bus_etrago(scn_name) # Calculate and insert demand timeseries per etrago bus_id for country in load_sq.columns: From f5b95278c836ac63e464f4aad1e1bd7cb97ec953 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 8 Feb 2024 10:34:27 +0100 Subject: [PATCH 614/787] fix that the population year can differ from scenario year --- .../hh_profiles.py | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index f661e6b65..dc12bd436 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -121,6 +121,7 @@ is made in ... the content of this module docstring needs to be moved to docs attribute of the respective dataset class. """ + from itertools import cycle, product from pathlib import Path import os @@ -135,7 +136,10 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.datasets.scenario_parameters import get_scenario_year +from egon.data.datasets.scenario_parameters import ( + get_scenario_year, + get_sector_parameters, +) from egon.data.datasets.zensus_mv_grid_districts import MapZensusGridDistricts import egon.data.config @@ -374,9 +378,11 @@ def ve(s): file_section = ( "path" if dataset == "Everything" - else "path_testmode" - if dataset == "Schleswig-Holstein" - else ve(f"'{dataset}' is not a valid dataset boundary.") + else ( + "path_testmode" + if dataset == "Schleswig-Holstein" + else ve(f"'{dataset}' is not a valid dataset boundary.") + ) ) file_path = pa_config["sources"]["household_electricity_demand_profiles"][ @@ -1198,15 +1204,15 @@ def refine_census_data_at_cell_level( right_on=["cell_id", "characteristics_code"], ) - df_census_households_grid_refined[ - "characteristics_code" - ] = df_census_households_grid_refined["characteristics_code"].astype(int) - df_census_households_grid_refined[ - "hh_5types" - ] = df_census_households_grid_refined["hh_5types"].astype(int) - df_census_households_grid_refined[ - "hh_10types" - ] = df_census_households_grid_refined["hh_10types"].astype(int) + df_census_households_grid_refined["characteristics_code"] = ( + df_census_households_grid_refined["characteristics_code"].astype(int) + ) + df_census_households_grid_refined["hh_5types"] = ( + df_census_households_grid_refined["hh_5types"].astype(int) + ) + df_census_households_grid_refined["hh_10types"] = ( + df_census_households_grid_refined["hh_10types"].astype(int) + ) return df_census_households_grid_refined @@ -1238,9 +1244,11 @@ def get_cell_demand_profile_ids(df_cell, pool_size): # instead of random.sample use random.choices() if with replacement # list of sample ids per hh_type in cell cell_profile_ids = [ - (hh_type, random.sample(range(pool_size[hh_type]), k=sq)) - if pool_size[hh_type] >= sq - else (hh_type, random.choices(range(pool_size[hh_type]), k=sq)) + ( + (hh_type, random.sample(range(pool_size[hh_type]), k=sq)) + if pool_size[hh_type] >= sq + else (hh_type, random.choices(range(pool_size[hh_type]), k=sq)) + ) for hh_type, sq in zip( df_cell["hh_type"], df_cell["hh_10types"], @@ -1319,9 +1327,9 @@ def assign_hh_demand_profiles_to_cells(df_zensus_cells, df_iee_profiles): df_hh_profiles_in_census_cells.at[grid_id, "cell_id"] = df_cell.loc[ :, "cell_id" ].unique()[0] - df_hh_profiles_in_census_cells.at[ - grid_id, "cell_profile_ids" - ] = cell_profile_ids + df_hh_profiles_in_census_cells.at[grid_id, "cell_profile_ids"] = ( + cell_profile_ids + ) df_hh_profiles_in_census_cells.at[grid_id, "nuts3"] = df_cell.loc[ :, "nuts3" ].unique()[0] @@ -1382,10 +1390,14 @@ def adjust_to_demand_regio_nuts3_annual( for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: year = get_scenario_year(scn) + population_year = get_sector_parameters("global", scn)[ + "population_year" + ] + df_hh_profiles_in_census_cells.loc[ nuts3_cell_ids, f"factor_{year}" ] = ( - df_demand_regio.loc[(year, nuts3_id), "demand_mwha"] + df_demand_regio.loc[(population_year, nuts3_id), "demand_mwha"] * 1e3 / (nuts3_profiles_sum_annual / 1e3) ) @@ -1587,10 +1599,10 @@ def gen_profile_names(n): ].astype(int) # Cast profile ids back to initial str format - df_hh_profiles_in_census_cells[ - "cell_profile_ids" - ] = df_hh_profiles_in_census_cells["cell_profile_ids"].apply( - lambda x: list(map(gen_profile_names, x)) + df_hh_profiles_in_census_cells["cell_profile_ids"] = ( + df_hh_profiles_in_census_cells["cell_profile_ids"].apply( + lambda x: list(map(gen_profile_names, x)) + ) ) # Write allocation table into database From 7e7c1ccc541c416aaa86f106f14e436f1afbc008 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 11:00:37 +0100 Subject: [PATCH 615/787] Revert "Fix targets years in insert_society_data" This reverts commit 3cc1a12fb7393a60e96bcc40064603e3068120b6. --- src/egon/data/datasets/demandregio/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index c96b14f74..c184c725d 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -693,12 +693,9 @@ def insert_society_data(): f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" ) - target_years = [ - get_sector_parameters("global", scn)["population_year"] - for scn in egon.data.config.settings()["egon-data"]["--scenarios"] - ] - - target_years = np.unique(np.append(np.array(target_years), 2018)) + target_years = np.append( + get_sector_parameters("global").population_year.values, 2018 + ) for year in target_years: df_pop = pd.DataFrame(data.population(year=year)) From 30b96191f6a485237477deeb12b8d352dd4d5da3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:09:13 +0100 Subject: [PATCH 616/787] Dynamise gaspipes status quo scenario generation --- src/egon/data/datasets/gas_grid.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 4c8b83d43..9daa39666 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -31,7 +31,7 @@ from egon.data import config, db from egon.data.config import settings -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.electrical_neighbours import central_buses_egon100 from egon.data.datasets.etrago_helpers import copy_and_modify_buses from egon.data.datasets.scenario_parameters import get_sector_parameters @@ -936,7 +936,7 @@ def insert_gas_data_eGon100RE(): ) -def insert_gas_data_status2019(): +def insert_gas_data_status(scn_name): """ Function to deal with the gas network for the status2019 scenario. For this scenario just one CH4 bus is consider in the center of Germany. @@ -951,7 +951,6 @@ def insert_gas_data_status2019(): None. """ - scn_name = "status2019" # delete old entries db.execute_sql( @@ -1021,7 +1020,14 @@ class GasNodesAndPipes(Dataset): #: version: str = "0.0.10" - tasks = (insert_gas_data_status2019,) + tasks = () + + for scn_name in config.settings()["egon-data"]["--scenarios"]: + if "status" in scn_name: + tasks += (wrapped_partial( + insert_gas_data_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" + )) + # tasks = (insert_gas_data_status,) if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: tasks = tasks + (insert_gas_data,) From 8ce62e824ca489afd9e51afecc6e65fd19c294e1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:09:35 +0100 Subject: [PATCH 617/787] Bump version number of GasNodesAndPipes --- src/egon/data/datasets/gas_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 9daa39666..c5e410d0b 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -1018,7 +1018,7 @@ class GasNodesAndPipes(Dataset): #: name: str = "GasNodesAndPipes" #: - version: str = "0.0.10" + version: str = "0.0.11" tasks = () From e62af4bf2a67e54e8549fc79b3188ef2e0963d59 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:16:54 +0100 Subject: [PATCH 618/787] Make it a tuple --- src/egon/data/datasets/gas_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index c5e410d0b..7ddbbe85f 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -1026,7 +1026,7 @@ class GasNodesAndPipes(Dataset): if "status" in scn_name: tasks += (wrapped_partial( insert_gas_data_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" - )) + ),) # tasks = (insert_gas_data_status,) if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: From 8eb9cc2472c93925110461aa9454483d4d2e0f52 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:42:49 +0100 Subject: [PATCH 619/787] Dynamise gas areas status quo tasks --- src/egon/data/datasets/gas_areas.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index e8d907ad7..bc566b17b 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -6,7 +6,7 @@ from sqlalchemy import BigInteger, Column, Text from sqlalchemy.ext.declarative import declarative_base -from egon.data import db +from egon.data import db, config from egon.data.datasets import Dataset from egon.data.datasets.generate_voronoi import get_voronoi_geodataframe @@ -69,7 +69,7 @@ def __init__(self, dependencies): ) -class GasAreasstatus2019(Dataset): +class GasAreasStatusQuo(Dataset): """Create the gas voronoi table and the gas voronoi areas for status2019 *Dependencies* @@ -83,16 +83,26 @@ class GasAreasstatus2019(Dataset): """ #: - name: str = "GasAreasstatus2019" + name: str = "GasAreasStatusQuo" #: version: str = "0.0.1" + tasks = () + + for scn_name in config.settings()["egon-data"]["--scenarios"]: + if "status" in scn_name: + tasks += (wrapped_partial( + voronoi_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" + ),) + + tasks += (create_gas_voronoi_table,) + def __init__(self, dependencies): super().__init__( name=self.name, version=self.version, dependencies=dependencies, - tasks=(create_gas_voronoi_table, voronoi_status2019), + tasks=tasks, ) @@ -142,12 +152,12 @@ def voronoi_egon100RE(): create_voronoi("eGon100RE", carrier) -def voronoi_status2019(): +def voronoi_status(scn_name): """ - Create voronoi polygons for all gas carriers in status2019 scenario + Create voronoi polygons for all gas carriers in status_x scenario """ for carrier in ["CH4"]: - create_voronoi("status2019", carrier) + create_voronoi(scn_name, carrier) def create_voronoi(scn_name, carrier): From 9c49330df7548aae04a5640df0d127c907a3f113 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:43:07 +0100 Subject: [PATCH 620/787] Bump version number of GasAreas --- src/egon/data/datasets/gas_areas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index bc566b17b..37caf1e8a 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -85,7 +85,7 @@ class GasAreasStatusQuo(Dataset): #: name: str = "GasAreasStatusQuo" #: - version: str = "0.0.1" + version: str = "0.0.2" tasks = () From e1ed031bcf809ff4826e18c51fb2b8489ec72328 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 8 Feb 2024 14:52:27 +0100 Subject: [PATCH 621/787] Revert "fix that the population year can differ from scenario year" This reverts commit f5b95278c836ac63e464f4aad1e1bd7cb97ec953. --- .../hh_profiles.py | 60 ++++++++----------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index dc12bd436..f661e6b65 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -121,7 +121,6 @@ is made in ... the content of this module docstring needs to be moved to docs attribute of the respective dataset class. """ - from itertools import cycle, product from pathlib import Path import os @@ -136,10 +135,7 @@ from egon.data import db from egon.data.datasets import Dataset -from egon.data.datasets.scenario_parameters import ( - get_scenario_year, - get_sector_parameters, -) +from egon.data.datasets.scenario_parameters import get_scenario_year from egon.data.datasets.zensus_mv_grid_districts import MapZensusGridDistricts import egon.data.config @@ -378,11 +374,9 @@ def ve(s): file_section = ( "path" if dataset == "Everything" - else ( - "path_testmode" - if dataset == "Schleswig-Holstein" - else ve(f"'{dataset}' is not a valid dataset boundary.") - ) + else "path_testmode" + if dataset == "Schleswig-Holstein" + else ve(f"'{dataset}' is not a valid dataset boundary.") ) file_path = pa_config["sources"]["household_electricity_demand_profiles"][ @@ -1204,15 +1198,15 @@ def refine_census_data_at_cell_level( right_on=["cell_id", "characteristics_code"], ) - df_census_households_grid_refined["characteristics_code"] = ( - df_census_households_grid_refined["characteristics_code"].astype(int) - ) - df_census_households_grid_refined["hh_5types"] = ( - df_census_households_grid_refined["hh_5types"].astype(int) - ) - df_census_households_grid_refined["hh_10types"] = ( - df_census_households_grid_refined["hh_10types"].astype(int) - ) + df_census_households_grid_refined[ + "characteristics_code" + ] = df_census_households_grid_refined["characteristics_code"].astype(int) + df_census_households_grid_refined[ + "hh_5types" + ] = df_census_households_grid_refined["hh_5types"].astype(int) + df_census_households_grid_refined[ + "hh_10types" + ] = df_census_households_grid_refined["hh_10types"].astype(int) return df_census_households_grid_refined @@ -1244,11 +1238,9 @@ def get_cell_demand_profile_ids(df_cell, pool_size): # instead of random.sample use random.choices() if with replacement # list of sample ids per hh_type in cell cell_profile_ids = [ - ( - (hh_type, random.sample(range(pool_size[hh_type]), k=sq)) - if pool_size[hh_type] >= sq - else (hh_type, random.choices(range(pool_size[hh_type]), k=sq)) - ) + (hh_type, random.sample(range(pool_size[hh_type]), k=sq)) + if pool_size[hh_type] >= sq + else (hh_type, random.choices(range(pool_size[hh_type]), k=sq)) for hh_type, sq in zip( df_cell["hh_type"], df_cell["hh_10types"], @@ -1327,9 +1319,9 @@ def assign_hh_demand_profiles_to_cells(df_zensus_cells, df_iee_profiles): df_hh_profiles_in_census_cells.at[grid_id, "cell_id"] = df_cell.loc[ :, "cell_id" ].unique()[0] - df_hh_profiles_in_census_cells.at[grid_id, "cell_profile_ids"] = ( - cell_profile_ids - ) + df_hh_profiles_in_census_cells.at[ + grid_id, "cell_profile_ids" + ] = cell_profile_ids df_hh_profiles_in_census_cells.at[grid_id, "nuts3"] = df_cell.loc[ :, "nuts3" ].unique()[0] @@ -1390,14 +1382,10 @@ def adjust_to_demand_regio_nuts3_annual( for scn in egon.data.config.settings()["egon-data"]["--scenarios"]: year = get_scenario_year(scn) - population_year = get_sector_parameters("global", scn)[ - "population_year" - ] - df_hh_profiles_in_census_cells.loc[ nuts3_cell_ids, f"factor_{year}" ] = ( - df_demand_regio.loc[(population_year, nuts3_id), "demand_mwha"] + df_demand_regio.loc[(year, nuts3_id), "demand_mwha"] * 1e3 / (nuts3_profiles_sum_annual / 1e3) ) @@ -1599,10 +1587,10 @@ def gen_profile_names(n): ].astype(int) # Cast profile ids back to initial str format - df_hh_profiles_in_census_cells["cell_profile_ids"] = ( - df_hh_profiles_in_census_cells["cell_profile_ids"].apply( - lambda x: list(map(gen_profile_names, x)) - ) + df_hh_profiles_in_census_cells[ + "cell_profile_ids" + ] = df_hh_profiles_in_census_cells["cell_profile_ids"].apply( + lambda x: list(map(gen_profile_names, x)) ) # Write allocation table into database From 4aba3ed0c39405a28d1dce14060dcb6f2e134354 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:52:54 +0100 Subject: [PATCH 622/787] Dynamise CH4 production --- src/egon/data/datasets/ch4_prod.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/ch4_prod.py b/src/egon/data/datasets/ch4_prod.py index f4f317a71..0ed951351 100755 --- a/src/egon/data/datasets/ch4_prod.py +++ b/src/egon/data/datasets/ch4_prod.py @@ -368,13 +368,13 @@ def import_gas_generators(): .reset_index(drop=False) ) - elif scn_name == "status2019": + elif "status" in scn_name: # Add one large CH4 generator at each CH4 bus CH4_generators_list = db.select_dataframe( - """ + f""" SELECT bus_id as bus, scn_name, carrier FROM grid.egon_gas_voronoi - WHERE scn_name = 'status2019' + WHERE scn_name = {scn_name} AND carrier = 'CH4' """ ) From be3c7c262652014c2034eb803ec3788b41902c1e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 14:53:23 +0100 Subject: [PATCH 623/787] Bump version number of CH4Production --- src/egon/data/datasets/ch4_prod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/ch4_prod.py b/src/egon/data/datasets/ch4_prod.py index 0ed951351..8d85d988f 100755 --- a/src/egon/data/datasets/ch4_prod.py +++ b/src/egon/data/datasets/ch4_prod.py @@ -45,7 +45,7 @@ class CH4Production(Dataset): name: str = "CH4Production" #: - version: str = "0.0.8" + version: str = "0.0.9" def __init__(self, dependencies): super().__init__( From e97f7256c16c5e427060ddc80948320a03b86318 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 15:05:09 +0100 Subject: [PATCH 624/787] Deactivate CH4 storages as not needed in StatusQuo The assumption is taken, that the gas grid is no bottelneck and therefore all gas in summed in one bus only, not needing any storages. A more sophisticated approach might be applied later in case sophistication will be financed in research. --- src/egon/data/datasets/ch4_storages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/ch4_storages.py b/src/egon/data/datasets/ch4_storages.py index ff84af686..e4c81c4fc 100755 --- a/src/egon/data/datasets/ch4_storages.py +++ b/src/egon/data/datasets/ch4_storages.py @@ -47,14 +47,14 @@ class CH4Storages(Dataset): #: name: str = "CH4Storages" #: - version: str = "0.0.2" + version: str = "0.0.3" def __init__(self, dependencies): super().__init__( name=self.name, version=self.version, dependencies=dependencies, - tasks=(insert_ch4_storages), + # tasks=(insert_ch4_storages), ) From d3ed1433f8c2ef9b8eaf0e1cf1df0a7af6a7ad9d Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 15:15:03 +0100 Subject: [PATCH 625/787] Deactivate GasNeighbours for same reasons --- src/egon/data/datasets/gas_neighbours/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/gas_neighbours/__init__.py b/src/egon/data/datasets/gas_neighbours/__init__.py index 7732553b1..974f3ae09 100755 --- a/src/egon/data/datasets/gas_neighbours/__init__.py +++ b/src/egon/data/datasets/gas_neighbours/__init__.py @@ -17,13 +17,13 @@ class GasNeighbours(Dataset): def __init__(self, dependencies): super().__init__( name="GasNeighbours", - version="0.0.4", + version="0.0.5", dependencies=dependencies, tasks=( - tyndp_gas_generation, - tyndp_gas_demand, - grid, - insert_ocgt_abroad, - insert_gas_neigbours_eGon100RE, + # tyndp_gas_generation, + # tyndp_gas_demand, + # grid, + # insert_ocgt_abroad, + # insert_gas_neigbours_eGon100RE, ), ) From d67f5f7ace9666848bb649a78a10a7e91745ebcb Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 15:19:07 +0100 Subject: [PATCH 626/787] Fix pipeline --- src/egon/data/datasets/gas_areas.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 37caf1e8a..5313926a6 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -7,7 +7,7 @@ from sqlalchemy.ext.declarative import declarative_base from egon.data import db, config -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.generate_voronoi import get_voronoi_geodataframe @@ -87,17 +87,17 @@ class GasAreasStatusQuo(Dataset): #: version: str = "0.0.2" - tasks = () + def __init__(self, dependencies): + tasks = () - for scn_name in config.settings()["egon-data"]["--scenarios"]: - if "status" in scn_name: - tasks += (wrapped_partial( - voronoi_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" - ),) + for scn_name in config.settings()["egon-data"]["--scenarios"]: + if "status" in scn_name: + tasks += (wrapped_partial( + voronoi_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" + ),) - tasks += (create_gas_voronoi_table,) + tasks += (create_gas_voronoi_table,) - def __init__(self, dependencies): super().__init__( name=self.name, version=self.version, From cca9931924de946a3e261f5022f1327c5a041d80 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 15:24:34 +0100 Subject: [PATCH 627/787] Add fake tasks Fake tasks are added to not have to remove the whole datasets from the pipeline. --- src/egon/data/datasets/ch4_storages.py | 5 +++++ src/egon/data/datasets/gas_neighbours/__init__.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/egon/data/datasets/ch4_storages.py b/src/egon/data/datasets/ch4_storages.py index e4c81c4fc..6f0843b0f 100755 --- a/src/egon/data/datasets/ch4_storages.py +++ b/src/egon/data/datasets/ch4_storages.py @@ -55,9 +55,14 @@ def __init__(self, dependencies): version=self.version, dependencies=dependencies, # tasks=(insert_ch4_storages), + tasks=(notasks), ) +def notasks(): + return None + + def import_installed_ch4_storages(scn_name): """ Define list of CH4 stores from the SciGRID_gas data diff --git a/src/egon/data/datasets/gas_neighbours/__init__.py b/src/egon/data/datasets/gas_neighbours/__init__.py index 974f3ae09..50195a517 100755 --- a/src/egon/data/datasets/gas_neighbours/__init__.py +++ b/src/egon/data/datasets/gas_neighbours/__init__.py @@ -25,5 +25,10 @@ def __init__(self, dependencies): # grid, # insert_ocgt_abroad, # insert_gas_neigbours_eGon100RE, + notasks, ), ) + + +def notasks(): + return None From 43df56660aa991e3e7ee5966f3fad6e4d38433f1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 15:31:32 +0100 Subject: [PATCH 628/787] Fix import --- src/egon/data/airflow/dags/pipeline_status_quo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index fd93b7399..79092b220 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -35,7 +35,7 @@ from egon.data.datasets.etrago_setup import EtragoSetup from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen from egon.data.datasets.fix_ehv_subnetworks import FixEhvSubnetworks -from egon.data.datasets.gas_areas import GasAreasstatus2019 +from egon.data.datasets.gas_areas import GasAreasStatusQuo from egon.data.datasets.gas_grid import GasNodesAndPipes from egon.data.datasets.gas_neighbours import GasNeighbours from egon.data.datasets.heat_demand import HeatDemandImport @@ -350,7 +350,7 @@ ] ) # Create gas voronoi status2019 - create_gas_polygons_status2019 = GasAreasstatus2019( + create_gas_polygons_status2019 = GasAreasStatusQuo( dependencies=[setup_etrago, vg250, gas_grid_insert_data, substation_voronoi] ) @@ -424,8 +424,8 @@ scenario_capacities, ] ) - - + + # Pumped hydro units pumped_hydro = Storages( dependencies=[ From 9e0e047319b677320ab37262324b29322a3f6525 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 16:12:27 +0100 Subject: [PATCH 629/787] Use status2023 --- src/egon/data/datasets/chp/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 350bf9144..a8cec22c0 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -413,13 +413,13 @@ def insert_chp_statusquo(scn="status2019"): mastr, cfg, WORKING_DIR_MASTR_NEW ) - gas_bus_id = db.assign_gas_bus_id(mastr, "status2019", "CH4").bus # fixed to status2019, no other data avail. + gas_bus_id = db.assign_gas_bus_id(mastr, scn, "CH4").bus mastr = assign_bus_id(mastr, cfg, drop_missing=True) mastr["gas_bus_id"] = gas_bus_id - mastr = assign_use_case(mastr, cfg["sources"], "status2019") # fixed to status2019, no other data avail. + mastr = assign_use_case(mastr, cfg["sources"], scn) # Insert entries with location session = sessionmaker(bind=db.engine())() From fa9640c7483c03111d308934e77477952509f328 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 16:26:48 +0100 Subject: [PATCH 630/787] Change order of gas voronoi tasks Tables were filled first and then deleted and recreated. Stupid me... --- src/egon/data/datasets/gas_areas.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egon/data/datasets/gas_areas.py b/src/egon/data/datasets/gas_areas.py index 5313926a6..ee9f3d557 100755 --- a/src/egon/data/datasets/gas_areas.py +++ b/src/egon/data/datasets/gas_areas.py @@ -88,7 +88,7 @@ class GasAreasStatusQuo(Dataset): version: str = "0.0.2" def __init__(self, dependencies): - tasks = () + tasks = (create_gas_voronoi_table,) for scn_name in config.settings()["egon-data"]["--scenarios"]: if "status" in scn_name: @@ -96,8 +96,6 @@ def __init__(self, dependencies): voronoi_status, scn_name=scn_name, postfix=f"_{scn_name[-4:]}" ),) - tasks += (create_gas_voronoi_table,) - super().__init__( name=self.name, version=self.version, From 3eb97577477393ec184395222b11a6356209b4b6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 8 Feb 2024 17:00:27 +0100 Subject: [PATCH 631/787] Make scn_name a sql string --- src/egon/data/datasets/ch4_prod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/ch4_prod.py b/src/egon/data/datasets/ch4_prod.py index 8d85d988f..71790dd89 100755 --- a/src/egon/data/datasets/ch4_prod.py +++ b/src/egon/data/datasets/ch4_prod.py @@ -374,7 +374,7 @@ def import_gas_generators(): f""" SELECT bus_id as bus, scn_name, carrier FROM grid.egon_gas_voronoi - WHERE scn_name = {scn_name} + WHERE scn_name = '{scn_name}' AND carrier = 'CH4' """ ) From 6aa7307a6e6f8232f5a0addc7ad36b8a521ecfe9 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 18:42:16 +0100 Subject: [PATCH 632/787] Add wrapped_partial function for dynamic tasks Partials need to be updated with further information like __module__, __name__. This info is copied from the actual function. --- src/egon/data/datasets/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index 256db5769..a45ea5a71 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -4,7 +4,7 @@ from collections import abc from dataclasses import dataclass -from functools import reduce +from functools import partial, reduce, update_wrapper from typing import Callable, Iterable, Set, Tuple, Union import re @@ -19,6 +19,13 @@ SCHEMA = "metadata" +def wrapped_partial(func, *args, **kwargs): + partial_func = partial(func, *args, **kwargs) + # update partial to look like func + update_wrapper(partial_func, func) + return partial_func + + def setup(): """Create the database structure for storing dataset information.""" # TODO: Move this into a task generating the initial database structure. From eadfc4ea797e398fe40b7bb896cf73706129bcd5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 17 Jan 2024 19:03:03 +0100 Subject: [PATCH 633/787] Add optional postfix for new partial function --- src/egon/data/datasets/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/__init__.py b/src/egon/data/datasets/__init__.py index a45ea5a71..34254bb38 100644 --- a/src/egon/data/datasets/__init__.py +++ b/src/egon/data/datasets/__init__.py @@ -20,9 +20,14 @@ def wrapped_partial(func, *args, **kwargs): + """Like :func:`functools.partial`, but preserves the original function's + name and docstring. Also allows to add a postfix to the function's name. + """ + postfix = kwargs.pop("postfix", None) partial_func = partial(func, *args, **kwargs) - # update partial to look like func update_wrapper(partial_func, func) + if postfix: + partial_func.__name__ = f"{func.__name__}{postfix}" return partial_func From bb77049f3212104348da7dea8a5b45753c451b85 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 09:44:19 +0100 Subject: [PATCH 634/787] Add changelog entry --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7231c97a..33d0a1ef4 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,9 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Add wrapped_partial to dynamise task generation + `#207 `_ + .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From dc857b78a9cd1a0339b826bd44aef28fc31cd346 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 9 Feb 2024 09:44:59 +0100 Subject: [PATCH 635/787] Add status2023 to scenario capacities and dynamize status quo generation --- src/egon/data/datasets/scenario_capacities.py | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index b46ac6e49..978b2addd 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -13,7 +13,7 @@ from egon.data import db from egon.data.config import settings -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial import egon.data.config # will be later imported from another file @@ -97,8 +97,8 @@ def nuts_mapping(): return nuts_mapping -def insert_capacities_status2019(): - """Insert capacity of rural heat pumps for status2019 +def insert_capacities_status_quo(scenario: str) -> None: + """Insert capacity of rural heat pumps for status quo Returns ------- @@ -114,19 +114,23 @@ def insert_capacities_status2019(): DELETE FROM {targets['scenario_capacities']['schema']}. {targets['scenario_capacities']['table']} - WHERE scenario_name = 'status2019' + WHERE scenario_name = '{scenario}' """ ) - # Rural heat capacity for 2019 according to NEP 2035, version 2021 - rural_heat_capacity = 1e6 * 5e-3 + rural_heat_capacity = { + # Rural heat capacity for 2019 according to NEP 2035, version 2021 + "status2019": 1e6 * 5e-3, + # TODO: Replace placeholder + "status2023": 1e6 * 5e-3, + }[scenario] if settings()["egon-data"]["--dataset-boundary"] != "Everything": rural_heat_capacity *= population_share() db.execute_sql( f""" - INSERT INTO + INSERT INTO {targets['scenario_capacities']['schema']}. {targets['scenario_capacities']['table']} (component, carrier, capacity, nuts, scenario_name) @@ -135,17 +139,22 @@ def insert_capacities_status2019(): 'residential_rural_heat_pump', {rural_heat_capacity}, 'DE', - 'status2019' + '{scenario}' ) """ ) # Include small storages for scenario2019 - small_storages = 600 # MW for Germany + small_storages = { + # MW for Germany + "status2019": 600, + # TODO: Replace placeholder + "status2023": 600, + }[scenario] db.execute_sql( f""" - INSERT INTO + INSERT INTO {targets['scenario_capacities']['schema']}. {targets['scenario_capacities']['table']} (component, carrier, capacity, nuts, scenario_name) @@ -154,7 +163,7 @@ def insert_capacities_status2019(): 'battery', {small_storages}, 'DE', - 'status2019' + '{scenario}' ) """ ) @@ -814,25 +823,32 @@ def eGon100_capacities(): tasks = (create_table,) -if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (insert_capacities_status2019, insert_data_nep) +scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] -if ( - "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] -) and not ( - "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"] -): - tasks = tasks + (insert_data_nep,) +status_quo = False -if "eGon100RE" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (eGon100_capacities,) +for scenario in scenarios: + if "status" in scenario: + tasks += ( + wrapped_partial( + insert_capacities_status_quo, scenario=scenario, + postfix=f"_{scenario[-2:]}" + ), + ) + status_quo = True + +if status_quo or ("eGon2035" in scenarios): + tasks += (insert_data_nep,) + +if "eGon100RE" in scenarios: + tasks += (eGon100_capacities,) class ScenarioCapacities(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioCapacities", - version="0.0.14", + version="0.0.15", dependencies=dependencies, tasks=tasks, ) From b54cc0fbf4670f10353ef72c8a85e48ae26cde09 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 9 Feb 2024 10:44:05 +0100 Subject: [PATCH 636/787] dynamize status quo checks --- src/egon/data/datasets/heat_supply/__init__.py | 4 ++-- src/egon/data/datasets/heat_supply/district_heating.py | 2 +- src/egon/data/datasets/scenario_capacities.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index b2c97a36c..129497ce4 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -95,7 +95,7 @@ def district_heating(): ) # Do not check data for status2019 as is it not listed in the table - if scenario != "status2019": + if "status" not in scenario: # Compare target value with sum of distributed heat supply df_check = db.select_dataframe( f""" @@ -129,7 +129,7 @@ def district_heating(): ) # Insert resistive heaters which are not available in status2019 - if scenario != "status2019": + if "status" not in scenario: backup_rh = backup_resistive_heaters(scenario) if not backup_rh.empty: diff --git a/src/egon/data/datasets/heat_supply/district_heating.py b/src/egon/data/datasets/heat_supply/district_heating.py index 3b62c87f6..15d0f3dfe 100644 --- a/src/egon/data/datasets/heat_supply/district_heating.py +++ b/src/egon/data/datasets/heat_supply/district_heating.py @@ -307,7 +307,7 @@ def cascade_heat_supply(scenario, plotting=True): district_heating_areas = select_district_heating_areas(scenario) # Select technolgies per district heating size - if scenario != "status2019": + if "status" not in scenario: map_dh_technologies = { "small": [ "CHP", diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 978b2addd..aab7643d3 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -848,7 +848,7 @@ class ScenarioCapacities(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioCapacities", - version="0.0.15", + version="0.0.16", dependencies=dependencies, tasks=tasks, ) From fb3c4d7804e76f438ba96352f010bf12bdd7bc25 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 9 Feb 2024 10:58:01 +0100 Subject: [PATCH 637/787] specify todo --- src/egon/data/datasets/scenario_capacities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index aab7643d3..828a66050 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -121,7 +121,7 @@ def insert_capacities_status_quo(scenario: str) -> None: rural_heat_capacity = { # Rural heat capacity for 2019 according to NEP 2035, version 2021 "status2019": 1e6 * 5e-3, - # TODO: Replace placeholder + # TODO: status2023 replace placeholder "status2023": 1e6 * 5e-3, }[scenario] @@ -148,7 +148,7 @@ def insert_capacities_status_quo(scenario: str) -> None: small_storages = { # MW for Germany "status2019": 600, - # TODO: Replace placeholder + # TODO: status2023 replace placeholder "status2023": 600, }[scenario] From e9977e69c238793d65dc759b3c1931ded4b28b6e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 11:00:05 +0100 Subject: [PATCH 638/787] Dynamise powerplants status quo --- src/egon/data/datasets/power_plants/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 801abb39f..7fa0f1d6e 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -13,7 +13,7 @@ import pandas as pd from egon.data import db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.mastr import ( WORKING_DIR_MASTR_NEW, WORKING_DIR_MASTR_OLD, @@ -1233,9 +1233,10 @@ def fill_missing_bus_and_geom(gens, carrier): create_tables, import_mastr, ) - -if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (power_plants_status_quo,) +for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + if "status" in scn_name: + tasks += (wrapped_partial( + power_plants_status_quo, scn_name=scn_name, postfix=f"_{scn_name[-4:]}"),) if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] From 34d748b878ea9a043461e3c48e4557f907f70ec5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 11:00:36 +0100 Subject: [PATCH 639/787] Bump version number for PowerPlants --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 7fa0f1d6e..f7aac40e9 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1265,7 +1265,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.22", + version="0.0.23", dependencies=dependencies, tasks=tasks, ) From 7eb3c54940feec84bf7405cbdae334a6f3e49b9d Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 11:53:52 +0100 Subject: [PATCH 640/787] Add changelog entry --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7231c97a..33f7efa70 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,8 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Add Status2023 update heat demand + `#199 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From c3d3167073a68ba6d6810a3ffd12f8c5bf8e3d1f Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 11:58:51 +0100 Subject: [PATCH 641/787] Add changelog entry --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7231c97a..11079f6c6 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -486,6 +486,8 @@ Changed `#1026 `_ * Change hgv data source to use database `#1086 `_ +* Skip osmTGmod repo cloning if existing + `#202 `_ .. _#799: https://github.com/openego/eGon-data/issues/799 From c8efafa1f2016d5ea3a92883570fdd182dfcc95a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 9 Feb 2024 12:32:01 +0100 Subject: [PATCH 642/787] Add changelog entry --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7231c97a..5cb9d7514 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -252,6 +252,8 @@ Added `PR #903 `_ * Add low flex scenario 'eGon2035_lowflex' `#822 `_ +* Add Status2023 to gas nodes + `#205 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 From 481ef448b206f10a1786cb8559c925f4b3ac43c4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 11:03:04 +0100 Subject: [PATCH 643/787] Add logging for select_bus_id --- src/egon/data/datasets/fix_ehv_subnetworks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/fix_ehv_subnetworks.py b/src/egon/data/datasets/fix_ehv_subnetworks.py index 16872ce3f..7226d7fa6 100644 --- a/src/egon/data/datasets/fix_ehv_subnetworks.py +++ b/src/egon/data/datasets/fix_ehv_subnetworks.py @@ -4,7 +4,7 @@ import numpy as np import pandas as pd -from egon.data import config, db +from egon.data import config, db, logger from egon.data.config import settings from egon.data.datasets import Dataset from egon.data.datasets.etrago_setup import link_geom_from_buses @@ -35,7 +35,9 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): ) if bus_id.empty: + logger.info("No bus found") if find_closest: + logger.info(f"Finding closest to x = {x}, y = {y}") bus_id = db.select_dataframe( f""" SELECT bus_id, st_distance(geom, 'SRID=4326;POINT({x} {y})'::geometry) @@ -47,10 +49,13 @@ def select_bus_id(x, y, v_nom, scn_name, carrier, find_closest=False): Limit 1 """ ) + logger.info(f"Bus ID = {bus_id.bus_id[0]} selected") return bus_id.bus_id[0] else: + logger.info("Find closest == False.") return None else: + logger.info(f"Exact match with bus ID = {bus_id.bus_id[0]} found.") return bus_id.bus_id[0] From fae03325855d3bf561a5b2e96bbc404b80acceac Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 13:13:54 +0100 Subject: [PATCH 644/787] Make entsoe-token function --- .../data/datasets/electrical_neighbours.py | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index dcb385db8..2f7f45327 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1,10 +1,11 @@ """The central module containing all code dealing with electrical neighbours """ - +import os.path from os import path import logging import zipfile +from pathlib import Path from shapely.geometry import LineString from sqlalchemy.orm import sessionmaker import entsoe @@ -12,7 +13,7 @@ import pandas as pd import requests -from egon.data import config, db +from egon.data import config, db, logger from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.fix_ehv_subnetworks import select_bus_id @@ -1299,12 +1300,26 @@ def tyndp_demand(): session.commit() +def get_entsoe_token(): + """Check for token in home dir. If not exists, check in working dir""" + token_path = path.join(path.expanduser("~"), ".entsoe-token") + if not os.path.isfile(token_path): + logger.info(f"Token file not found at {token_path}. Will check in working directory.") + token_path = Path(".entsoe-token") + if os.path.isfile(token_path): + logger.info(f"Token found at {token_path}") + else: + raise FileNotFoundError("No entsoe-token found.") + entsoe_token = open( + token_path.resolve(), "r" + ).read(36) + return entsoe_token + + def entsoe_historic_generation_capacities( year_start="20190101", year_end="20200101" ): - entsoe_token = open( - path.join(path.expanduser("~"), ".entsoe-token"), "r" - ).read(36) + entsoe_token = get_entsoe_token() client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") @@ -1357,9 +1372,7 @@ def entsoe_historic_generation_capacities( def entsoe_historic_demand(year_start="20190101", year_end="20200101"): - entsoe_token = open( - path.join(path.expanduser("~"), ".entsoe-token"), "r" - ).read(36) + entsoe_token = get_entsoe_token() client = entsoe.EntsoePandasClient(api_key=entsoe_token) start = pd.Timestamp(year_start, tz="Europe/Brussels") From 20231a72b12b2c1d6e370c803fa69146ada8bb0f Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 13:14:06 +0100 Subject: [PATCH 645/787] Append exception message --- src/egon/data/datasets/electrical_neighbours.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 2f7f45327..5fd28fd1e 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1514,10 +1514,10 @@ def insert_generators_sq(scn_name="status2019"): try: gen_sq = entsoe_historic_generation_capacities(**year_start_end) - except: + except Exception as e: logging.warning( - """Generation data from entsoe could not be retrieved. - Backup data is used instead""" + f"""Generation data from entsoe could not be retrieved. + Backup data is used instead \n {e}""" ) gen_sq = pd.read_csv( "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" From 3f090e1887b98d535062ba93e222dafe83996ff5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 13:21:16 +0100 Subject: [PATCH 646/787] Black&Isort --- .../data/datasets/electrical_neighbours.py | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 5fd28fd1e..62527fd05 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1,11 +1,12 @@ """The central module containing all code dealing with electrical neighbours """ -import os.path + from os import path +from pathlib import Path import logging +import os.path import zipfile -from pathlib import Path from shapely.geometry import LineString from sqlalchemy.orm import sessionmaker import entsoe @@ -248,7 +249,11 @@ def buses(scenario, sources, targets): central_buses.scn_name = scenario # Insert all central buses for eGon2035 - if scenario in ["eGon2035", "status2019", "status2023"]: # TODO: status2023 this is hardcoded shit + if scenario in [ + "eGon2035", + "status2019", + "status2023", + ]: # TODO: status2023 this is hardcoded shit central_buses.to_postgis( targets["buses"]["table"], schema=targets["buses"]["schema"], @@ -1108,9 +1113,9 @@ def insert_storage(capacities): for x in parameters: store.loc[store["carrier"] == "battery", x] = parameters_battery[x] - store.loc[ - store["carrier"] == "pumped_hydro", x - ] = parameters_pumped_hydro[x] + store.loc[store["carrier"] == "pumped_hydro", x] = ( + parameters_pumped_hydro[x] + ) # insert data session = sessionmaker(bind=db.engine())() @@ -1231,9 +1236,9 @@ def tyndp_demand(): ] # Assign etrago bus_id to TYNDP nodes buses = pd.DataFrame({"nodes": nodes}) - buses.loc[ - buses[buses.nodes.isin(map_buses.keys())].index, "nodes" - ] = buses[buses.nodes.isin(map_buses.keys())].nodes.map(map_buses) + buses.loc[buses[buses.nodes.isin(map_buses.keys())].index, "nodes"] = ( + buses[buses.nodes.isin(map_buses.keys())].nodes.map(map_buses) + ) buses.loc[:, "bus"] = ( get_foreign_bus_id(scenario="eGon2035") .loc[buses.loc[:, "nodes"]] From 578a195281c60eb07146cb7bdd708636ce4f9fd7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 13:22:04 +0100 Subject: [PATCH 647/787] Fix --- src/egon/data/datasets/electrical_neighbours.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 62527fd05..4bfa63100 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1309,15 +1309,15 @@ def get_entsoe_token(): """Check for token in home dir. If not exists, check in working dir""" token_path = path.join(path.expanduser("~"), ".entsoe-token") if not os.path.isfile(token_path): - logger.info(f"Token file not found at {token_path}. Will check in working directory.") + logger.info( + f"Token file not found at {token_path}. Will check in working directory." + ) token_path = Path(".entsoe-token") if os.path.isfile(token_path): logger.info(f"Token found at {token_path}") else: raise FileNotFoundError("No entsoe-token found.") - entsoe_token = open( - token_path.resolve(), "r" - ).read(36) + entsoe_token = open(token_path, "r").read(36) return entsoe_token From a321fbc14c11aab12775f1e700240aa99d0b8f22 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 13:23:37 +0100 Subject: [PATCH 648/787] Raise error if opene returns none --- src/egon/data/datasets/electrical_neighbours.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 4bfa63100..97db4f160 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1315,9 +1315,9 @@ def get_entsoe_token(): token_path = Path(".entsoe-token") if os.path.isfile(token_path): logger.info(f"Token found at {token_path}") - else: - raise FileNotFoundError("No entsoe-token found.") entsoe_token = open(token_path, "r").read(36) + if entsoe_token is None: + raise FileNotFoundError("No entsoe-token found.") return entsoe_token From a834e71f28d11ec596f41732d7be65f281ba7e7e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 16:22:32 +0100 Subject: [PATCH 649/787] Hardcode generation capacity for GB in 2023 --- .../data/datasets/electrical_neighbours.py | 24 ++++++++++++++++++- src/egon/data/datasets/fill_etrago_gen.py | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 97db4f160..67ca66f68 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1346,7 +1346,10 @@ def entsoe_historic_generation_capacities( "SE", "GB", ] - + # No GB data after Brexit + if int(year_start[:3]) > 2021: + logger.warning("No GB data after Brexit. GB is dropped from entsoe query!") + countries = [c for c in countries if c != "GB"] # todo: define wanted countries not_retrieved = [] @@ -1372,6 +1375,25 @@ def entsoe_historic_generation_capacities( df = pd.concat(dfs) df["country"] = countries df.set_index("country", inplace=True) + if int(year_start[:3]) == 2023: + # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated + # could probably somehow be automised + # https://www.elexonportal.co.uk/category/view/178 + # in MW + installed_capacity_gb = pd.Series({ + 'Biomass': 4438, + 'Fossil Gas': 37047, + 'Fossil Hard coal': 1491, + 'Hydro Pumped Storage': 5603, + 'Hydro Run-of-river and poundage': 2063, + 'Nuclear': 4950, + 'Other': 3313, + 'Other renewable': 1462, + 'Solar': 14518, + 'Wind Offshore': 13038, + 'Wind Onshore': 13907, + }, name="GB") + df = pd.concat([df.T, installed_capacity_gb], axis=1).T df.fillna(0, inplace=True) return df diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index 875bcff49..b59582538 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -112,7 +112,7 @@ def add_marginal_costs(power_plants): ) if warning: print( - f"""There are not marginal_cost values for: \n{warning} + f"""There are no marginal_cost values for: \n{warning} in the scenario {scenario}. Missing values set to 0""" ) pp = pd.concat( From 760df5dc46e89b5fd9410662a66227b89bb536e7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 16:48:28 +0100 Subject: [PATCH 650/787] Use replace get_terminal_size by shutil --- src/egon/data/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/__init__.py b/src/egon/data/__init__.py index 22de0bf2b..f0b261789 100644 --- a/src/egon/data/__init__.py +++ b/src/egon/data/__init__.py @@ -2,14 +2,14 @@ from loguru import logger import click - +import shutil __version__ = "0.0.0" def echo(message): prefix, message = message.split(" - ") lines = message.split("\n") - width = min(72, click.get_terminal_size()[0]) + width = min(72, shutil.get_terminal_size()[0]) wraps = ["\n".join(wrap(line, width)) for line in lines] message = "\n".join([prefix] + wraps) click.echo(message, err=True) From e596fe58ffe1c04a2f8732af56ebbd0db938b12d Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 16:56:10 +0100 Subject: [PATCH 651/787] Fix index --- src/egon/data/datasets/electrical_neighbours.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 67ca66f68..8332fbc88 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1347,7 +1347,7 @@ def entsoe_historic_generation_capacities( "GB", ] # No GB data after Brexit - if int(year_start[:3]) > 2021: + if int(year_start[:4]) > 2021: logger.warning("No GB data after Brexit. GB is dropped from entsoe query!") countries = [c for c in countries if c != "GB"] # todo: define wanted countries @@ -1375,7 +1375,7 @@ def entsoe_historic_generation_capacities( df = pd.concat(dfs) df["country"] = countries df.set_index("country", inplace=True) - if int(year_start[:3]) == 2023: + if int(year_start[:4]) == 2023: # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated # could probably somehow be automised # https://www.elexonportal.co.uk/category/view/178 From 4d3f48d1b5778b2e4eb4346a8af652dfc38e4674 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 17:01:13 +0100 Subject: [PATCH 652/787] Add logging message --- src/egon/data/datasets/electrical_neighbours.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 8332fbc88..2d8111f01 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1394,6 +1394,7 @@ def entsoe_historic_generation_capacities( 'Wind Onshore': 13907, }, name="GB") df = pd.concat([df.T, installed_capacity_gb], axis=1).T + logger.info("Manually added generation capacities for GB 2023.") df.fillna(0, inplace=True) return df From efaff8bbf427d27fb6db2f9080d2920b2262e5e7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 12 Feb 2024 18:00:51 +0100 Subject: [PATCH 653/787] Use backup 2019 if country is not available at entsoe --- .../data/datasets/electrical_neighbours.py | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 2d8111f01..0fe6b87c6 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1360,10 +1360,8 @@ def entsoe_historic_generation_capacities( else: kwargs = dict(start=start, end=end) try: - dfs.append( - client.query_installed_generation_capacity(country, **kwargs) - ) - + country_data = client.query_installed_generation_capacity(country, **kwargs) + dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) pass @@ -1395,8 +1393,9 @@ def entsoe_historic_generation_capacities( }, name="GB") df = pd.concat([df.T, installed_capacity_gb], axis=1).T logger.info("Manually added generation capacities for GB 2023.") + not_retrieved = [c for c in not_retrieved if c != "GB"] df.fillna(0, inplace=True) - return df + return df, not_retrieved def entsoe_historic_demand(year_start="20190101", year_end="20200101"): @@ -1449,15 +1448,15 @@ def entsoe_historic_demand(year_start="20190101", year_end="20200101"): not_retrieved.append(country) pass if not_retrieved: - logging.warning( + logger.warning( f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." ) df = pd.concat(dfs, axis=1) - df.columns = countries + df.columns = [c for c in countries if c not in not_retrieved] df.index = pd.date_range(year_start, periods=8760, freq="H") - return df + return df, not_retrieved def map_carriers_entsoe(): @@ -1540,17 +1539,18 @@ def insert_generators_sq(scn_name="status2019"): else: raise ValueError("No valid scenario name!") - try: - gen_sq = entsoe_historic_generation_capacities(**year_start_end) - except Exception as e: - logging.warning( - f"""Generation data from entsoe could not be retrieved. - Backup data is used instead \n {e}""" + gen_sq, not_retrieved = entsoe_historic_generation_capacities(**year_start_end) + if not_retrieved: + logger.warning( + "Generation data from entsoe could not be retrieved." + "Backup data from 2019 is used instead." ) - gen_sq = pd.read_csv( + gen_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" ) + gen_sq = pd.concat([gen_sq, gen_sq_backup.loc[not_retrieved]], axis=1) + targets = config.datasets()["electrical_neighbours"]["targets"] # Delete existing data db.execute_sql( @@ -1706,16 +1706,19 @@ def insert_loads_sq(scn_name="status2019"): else: raise ValueError("No valid scenario name!") - try: - load_sq = entsoe_historic_demand(**year_start_end) - except: - logging.warning( - """Demand data from entsoe could not be retrieved. - Backup data is used instead""" + load_sq, not_retrieved = entsoe_historic_demand(**year_start_end) + + if not_retrieved: + + logger.warning( + "Demand data from entsoe could not be retrieved." + f"Backup data of 2019 is used instead for {not_retrieved}""" ) - load_sq = pd.read_csv( + load_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" ) + load_sq_backup.index = load_sq.index + load_sq = pd.concat([load_sq, load_sq_backup.loc[:,not_retrieved]], axis=1) # Delete existing data db.execute_sql( From 9e0e8410778293b61979c790e4215b99c78331ea Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 13 Feb 2024 09:57:32 +0100 Subject: [PATCH 654/787] fix pv rooftop to work without any future scenario --- .../data/datasets/power_plants/__init__.py | 2 +- .../power_plants/pv_rooftop_buildings.py | 57 +++++++++++-------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f7aac40e9..582fbe99d 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1265,7 +1265,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.23", + version="0.0.24", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 53a7416b8..729318bd9 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -38,6 +38,7 @@ * Plant metadata (e.g. plant orientation) is also added random and weighted from MaStR data as basis. """ + from __future__ import annotations from collections import Counter @@ -161,6 +162,7 @@ SCENARIOS = config.settings()["egon-data"]["--scenarios"] SCENARIO_TIMESTAMP = { "status2019": pd.Timestamp("2020-01-01", tz="UTC"), + "status2023": pd.Timestamp("2024-01-01", tz="UTC"), "eGon2035": pd.Timestamp("2035-01-01", tz="UTC"), "eGon100RE": pd.Timestamp("2050-01-01", tz="UTC"), } @@ -1248,9 +1250,9 @@ def allocate_pv( assert len(assigned_buildings) == len(assigned_buildings.gens_id.unique()) - q_mastr_gdf.loc[ - assigned_buildings.gens_id, "building_id" - ] = assigned_buildings.index + q_mastr_gdf.loc[assigned_buildings.gens_id, "building_id"] = ( + assigned_buildings.index + ) assigned_gens = q_mastr_gdf.loc[~q_mastr_gdf.building_id.isna()] @@ -2768,6 +2770,7 @@ def add_bus_ids_sq( grid_districts_gdf = grid_districts(EPSG) mask = buildings_gdf.scenario == "status_quo" + buildings_gdf.loc[mask, "bus_id"] = ( buildings_gdf.loc[mask] .sjoin(grid_districts_gdf, how="left") @@ -2782,7 +2785,9 @@ def pv_rooftop_to_buildings(): mastr_gdf = load_mastr_data() - ts = pd.Timestamp(config.datasets()["mastr_new"]["status2019_date_max"]) + status_quo = "status2023" + + ts = pd.Timestamp(config.datasets()["mastr_new"][f"{status_quo}_date_max"]) mastr_gdf = mastr_gdf.loc[ pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts @@ -2795,9 +2800,10 @@ def pv_rooftop_to_buildings(): ) all_buildings_gdf = ( - desagg_mastr_gdf.assign(scenario="status_quo") + desagg_mastr_gdf.assign(scenario=status_quo) .reset_index() .rename(columns={"geometry": "geom", "EinheitMastrNummer": "gens_id"}) + .set_geometry("geom") ) scenario_buildings_gdf = all_buildings_gdf.copy() @@ -2805,25 +2811,34 @@ def pv_rooftop_to_buildings(): cap_per_bus_id_df = pd.DataFrame() for scenario in SCENARIOS: - if scenario == "status2019": - desagg_mastr_gdf = desagg_mastr_gdf.loc[ - pd.to_datetime(desagg_mastr_gdf.Inbetriebnahmedatum) <= ts - ] + if scenario == status_quo: + continue + elif "status" in scenario: + ts = pd.Timestamp( + config.datasets()["mastr_new"][f"{scenario}_date_max"] + ) + scenario_buildings_gdf = scenario_buildings_gdf.loc[ pd.to_datetime(scenario_buildings_gdf.Inbetriebnahmedatum) <= ts ] - logger.debug(f"Desaggregating scenario {scenario}.") - ( - scenario_buildings_gdf, - cap_per_bus_id_scenario_df, - ) = allocate_scenarios( # noqa: F841 - desagg_mastr_gdf, - desagg_buildings_gdf, - scenario_buildings_gdf, - scenario, - ) + else: + logger.debug(f"Desaggregating scenario {scenario}.") + + ( + scenario_buildings_gdf, + cap_per_bus_id_scenario_df, + ) = allocate_scenarios( # noqa: F841 + desagg_mastr_gdf, + desagg_buildings_gdf, + scenario_buildings_gdf, + scenario, + ) + + cap_per_bus_id_df = pd.concat( + [cap_per_bus_id_df, cap_per_bus_id_scenario_df] + ) all_buildings_gdf = gpd.GeoDataFrame( pd.concat( @@ -2833,10 +2848,6 @@ def pv_rooftop_to_buildings(): geometry="geom", ) - cap_per_bus_id_df = pd.concat( - [cap_per_bus_id_df, cap_per_bus_id_scenario_df] - ) - # add weather cell all_buildings_gdf = add_weather_cell_id(all_buildings_gdf) From 18f8faf68cb60891a244bfb4d9347a3176523b92 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 13 Feb 2024 13:37:43 +0100 Subject: [PATCH 655/787] Fix string --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 0fe6b87c6..e293f5220 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1712,7 +1712,7 @@ def insert_loads_sq(scn_name="status2019"): logger.warning( "Demand data from entsoe could not be retrieved." - f"Backup data of 2019 is used instead for {not_retrieved}""" + f"Backup data of 2019 is used instead for {not_retrieved}" ) load_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" From 655d9add9d933fe37e37ae7fb836b4c2b352b301 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 13 Feb 2024 13:47:32 +0100 Subject: [PATCH 656/787] update wind offshore --- .../data/datasets/power_plants/__init__.py | 2 +- .../datasets/power_plants/wind_offshore.py | 29 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 582fbe99d..e90130f5c 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1265,7 +1265,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.24", + version="0.0.25", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/power_plants/wind_offshore.py b/src/egon/data/datasets/power_plants/wind_offshore.py index 68cb09d59..85aa2083e 100644 --- a/src/egon/data/datasets/power_plants/wind_offshore.py +++ b/src/egon/data/datasets/power_plants/wind_offshore.py @@ -39,7 +39,9 @@ def map_id_bus(scenario): "inhausen": "29420322", "Cloppenburg": "50643382", } - elif scenario == "status2019": + elif "status" in scenario: + year = int(scenario[-4:]) + id_bus = { "UW Inhausen": "29420322", "UW Bentwisch": "32063539", @@ -52,6 +54,14 @@ def map_id_bus(scenario): "UW Diele": "177829920", "UW Lubmin": "460134233", } + + if year >= 2023: + # No update needed as no new stations used for offshore wind + # between 2019 and 2023 + pass + + # TODO: If necessary add new stations when generating status quo > 2023 + else: id_bus = {} @@ -59,7 +69,7 @@ def map_id_bus(scenario): def assign_ONEP_areas(): - assign_onep = { + return { "Büttel": "NOR-4-1", "Heide/West": "NOR-10-2", "Suchraum Gemeinden Ibbenbüren/Mettingen/Westerkappeln": "NOR-9-2", @@ -85,11 +95,10 @@ def assign_ONEP_areas(): "inhausen": "NOR-0-2", "Cloppenburg": "NOR-4-1", } - return assign_onep def map_ONEP_areas(): - onep = { + return { "NOR-0-1": Point(6.5, 53.6), "NOR-0-2": Point(8.07, 53.76), "NOR-1": Point(6.21, 54.06), @@ -121,7 +130,6 @@ def map_ONEP_areas(): "OST-3-2": Point(13.16, 54.98), "OST-7-1": Point(12.25, 54.5), } - return onep def insert(): @@ -187,7 +195,9 @@ def insert(): ) offshore.dropna(subset=["Netzverknuepfungspunkt"], inplace=True) - elif scenario == "status2019": + elif "status" in scenario: + year = int(scenario[-4:]) + offshore_path = ( Path(".") / "data_bundle_egon_data" @@ -214,7 +224,10 @@ def insert(): }, inplace=True, ) - offshore = offshore[offshore["Inbetriebnahme"] <= 2019] + offshore = offshore[offshore["Inbetriebnahme"] <= year] + + else: + raise ValueError(f"{scenario=} is not valid.") id_bus = map_id_bus(scenario) @@ -263,7 +276,7 @@ def insert(): offshore.drop(["Name ONEP/NEP"], axis=1, inplace=True) - if scenario == "status2019": + if "status" in scenario: offshore.drop(["Inbetriebnahme"], axis=1, inplace=True) # Scale capacities for eGon100RE From 482e065ec35cc5d4d503a8a2600e61b556fc315a Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 13 Feb 2024 15:39:18 +0100 Subject: [PATCH 657/787] update storages to status2023 --- .../scenario_parameters/parameters.py | 5 ++--- src/egon/data/datasets/storages/__init__.py | 19 +++++++++---------- .../data/datasets/storages/pumped_hydro.py | 8 +++++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index 91e7b6bc0..645b3d0fe 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -135,7 +135,7 @@ def global_settings(scenario): "nuclear": 0.47*3.6, # [EUR/MWh] "biomass": read_costs(read_csv(2020), "biomass", "fuel"), }, - "co2_costs": 24.7, # [EUR/t_CO2], source: + "co2_costs": 24.7, # [EUR/t_CO2], source: #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/ "co2_emissions": { # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8 "waste": 0.165, # [t_CO2/MW_th] @@ -499,8 +499,7 @@ def electricity(scenario): elif scenario == "eGon2021": parameters = {} - elif scenario == "status2019": - + elif (scenario == "status2019") or (scenario == "status2023"): costs = read_csv(2020) parameters = {"grid_topology": "Status Quo"} diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 63e8e81dc..c994b02d0 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -46,7 +46,7 @@ class Storages(Dataset): def __init__(self, dependencies): super().__init__( name="Storages", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( create_tables, @@ -403,7 +403,7 @@ def home_batteries_per_scenario(scenario): battery["carrier"] = "home_battery" battery["scenario"] = scenario - if (scenario == "eGon2035") | (scenario == "status2019"): + if (scenario == "eGon2035") | ("status" in scenario): source = "NEP" else: @@ -434,11 +434,10 @@ def allocate_pv_home_batteries_to_grids(): def allocate_pumped_hydro_scn(): - if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - allocate_pumped_hydro(scn="eGon2035") - - if "status2019" in config.settings()["egon-data"]["--scenarios"]: - allocate_pumped_hydro(scn="status2019") - - if "eGon100RE" in config.settings()["egon-data"]["--scenarios"]: - allocate_pumped_hydro_eGon100RE() + for scn in config.settings()["egon-data"]["--scenarios"]: + if scn == "eGon2035": + allocate_pumped_hydro(scn="eGon2035") + elif scn == "eGon100RE": + allocate_pumped_hydro_eGon100RE() + elif "status" in scn: + allocate_pumped_hydro(scn=scn) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 68e10b888..198df67a2 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -49,8 +49,10 @@ def select_nep_pumped_hydro(scn): nep_ph.rename( columns={"c2035_capacity": "elec_capacity"}, inplace=True ) - elif scn == "status2019": + elif "status" in scn: # Select plants with geolocation from list of conventional power plants + year = int(scn[-4:]) + nep_ph = db.select_dataframe( f""" SELECT bnetza_id, name, carrier, postcode, capacity, city, @@ -59,7 +61,7 @@ def select_nep_pumped_hydro(scn): WHERE carrier = '{carrier}' AND capacity > 0 AND postcode != 'None' - AND commissioned < '2020'; + AND commissioned < '{year+1}'; """ ) nep_ph["elec_capacity"] = nep_ph["capacity"] @@ -355,7 +357,7 @@ def apply_voltage_level_thresholds(power_plants): # account which were defined in the eGon project. Existing entries on voltage # will be overwritten - power_plants.loc[power_plants["el_capacity"] < 0.1, "voltage_level"] = 7 + power_plants.loc[power_plants["el_capacity"] <= 0.1, "voltage_level"] = 7 power_plants.loc[power_plants["el_capacity"] > 0.1, "voltage_level"] = 6 power_plants.loc[power_plants["el_capacity"] > 0.2, "voltage_level"] = 5 power_plants.loc[power_plants["el_capacity"] > 5.5, "voltage_level"] = 4 From 3653bce358f1b986100e9f26b045ae82fb78eb73 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 13 Feb 2024 17:29:14 +0100 Subject: [PATCH 658/787] fix wrong call to scenario_parameters --- src/egon/data/datasets/storages_etrago/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/egon/data/datasets/storages_etrago/__init__.py b/src/egon/data/datasets/storages_etrago/__init__.py index f4f8790cc..a2c5aad11 100644 --- a/src/egon/data/datasets/storages_etrago/__init__.py +++ b/src/egon/data/datasets/storages_etrago/__init__.py @@ -6,11 +6,9 @@ import geopandas as gpd import pandas as pd from egon.data import db, config -import egon.data.datasets.scenario_parameters.parameters as scenario_parameters from egon.data.datasets import Dataset from egon.data.datasets.scenario_parameters import ( get_sector_parameters, - EgonScenario, ) @@ -18,7 +16,7 @@ class StorageEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="StorageEtrago", - version="0.0.8", + version="0.0.9.dev", dependencies=dependencies, tasks=(insert_PHES, extendable_batteries), ) @@ -58,9 +56,9 @@ def insert_PHES(): next_bus_id = db.next_etrago_id("storage") # Add missing PHES specific information suitable for eTraGo selected from scenario_parameter table - parameters = scenario_parameters.electricity(scn)["efficiency"][ - "pumped_hydro" - ] + parameters = get_sector_parameters( + "electricity", scn + )["efficiency"]["pumped_hydro"] phes["storage_id"] = range(next_bus_id, next_bus_id + len(phes)) phes["max_hours"] = parameters["max_hours"] phes["efficiency_store"] = parameters["store"] From 7028bb0d20d7a8cd691f0c6a0a269746c078c889 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Tue, 13 Feb 2024 17:32:43 +0100 Subject: [PATCH 659/787] set dataset version number --- src/egon/data/datasets/storages_etrago/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/storages_etrago/__init__.py b/src/egon/data/datasets/storages_etrago/__init__.py index a2c5aad11..5f2793629 100644 --- a/src/egon/data/datasets/storages_etrago/__init__.py +++ b/src/egon/data/datasets/storages_etrago/__init__.py @@ -16,7 +16,7 @@ class StorageEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="StorageEtrago", - version="0.0.9.dev", + version="0.0.9", dependencies=dependencies, tasks=(insert_PHES, extendable_batteries), ) From 00716c103a0c188a512c0ed68bf13cddf226fb99 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 13 Feb 2024 18:27:48 +0100 Subject: [PATCH 660/787] Minors --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index e293f5220..1d3349ab3 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1542,7 +1542,7 @@ def insert_generators_sq(scn_name="status2019"): gen_sq, not_retrieved = entsoe_historic_generation_capacities(**year_start_end) if not_retrieved: logger.warning( - "Generation data from entsoe could not be retrieved." + "Generation data from entsoe could not be retrieved. " "Backup data from 2019 is used instead." ) gen_sq_backup = pd.read_csv( From d90c47b29a00c4b3df04a9d6b22fad7b420ced21 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 13 Feb 2024 18:38:06 +0100 Subject: [PATCH 661/787] Move warning into exception --- src/egon/data/datasets/electrical_neighbours.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 1d3349ab3..27cc50daf 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1363,13 +1363,10 @@ def entsoe_historic_generation_capacities( country_data = client.query_installed_generation_capacity(country, **kwargs) dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): + logger.warning(f"Data for country: {country} could not be retrieved.") not_retrieved.append(country) pass - if not_retrieved: - logging.warning( - f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." - ) df = pd.concat(dfs) df["country"] = countries df.set_index("country", inplace=True) @@ -1446,11 +1443,8 @@ def entsoe_historic_demand(year_start="20190101", year_end="20200101"): dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) + logger.warning(f"Data for country: {country} could not be retrieved.") pass - if not_retrieved: - logger.warning( - f"Data for country (-ies) {', '.join(not_retrieved)} could not be retrieved." - ) df = pd.concat(dfs, axis=1) df.columns = [c for c in countries if c not in not_retrieved] From cf5c29c6f7be4e247c7083e4296353541426556e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 14 Feb 2024 12:33:27 +0100 Subject: [PATCH 662/787] Create empty df, if no return from entsoe --- .../data/datasets/electrical_neighbours.py | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 27cc50daf..8e17b1842 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1367,31 +1367,34 @@ def entsoe_historic_generation_capacities( not_retrieved.append(country) pass - df = pd.concat(dfs) - df["country"] = countries - df.set_index("country", inplace=True) - if int(year_start[:4]) == 2023: - # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated - # could probably somehow be automised - # https://www.elexonportal.co.uk/category/view/178 - # in MW - installed_capacity_gb = pd.Series({ - 'Biomass': 4438, - 'Fossil Gas': 37047, - 'Fossil Hard coal': 1491, - 'Hydro Pumped Storage': 5603, - 'Hydro Run-of-river and poundage': 2063, - 'Nuclear': 4950, - 'Other': 3313, - 'Other renewable': 1462, - 'Solar': 14518, - 'Wind Offshore': 13038, - 'Wind Onshore': 13907, - }, name="GB") - df = pd.concat([df.T, installed_capacity_gb], axis=1).T - logger.info("Manually added generation capacities for GB 2023.") - not_retrieved = [c for c in not_retrieved if c != "GB"] - df.fillna(0, inplace=True) + if dfs: + df = pd.concat(dfs) + df["country"] = countries + df.set_index("country", inplace=True) + if int(year_start[:4]) == 2023: + # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated + # could probably somehow be automised + # https://www.elexonportal.co.uk/category/view/178 + # in MW + installed_capacity_gb = pd.Series({ + 'Biomass': 4438, + 'Fossil Gas': 37047, + 'Fossil Hard coal': 1491, + 'Hydro Pumped Storage': 5603, + 'Hydro Run-of-river and poundage': 2063, + 'Nuclear': 4950, + 'Other': 3313, + 'Other renewable': 1462, + 'Solar': 14518, + 'Wind Offshore': 13038, + 'Wind Onshore': 13907, + }, name="GB") + df = pd.concat([df.T, installed_capacity_gb], axis=1).T + logger.info("Manually added generation capacities for GB 2023.") + not_retrieved = [c for c in not_retrieved if c != "GB"] + df.fillna(0, inplace=True) + else: + df = pd.DataFrame() return df, not_retrieved @@ -1446,10 +1449,12 @@ def entsoe_historic_demand(year_start="20190101", year_end="20200101"): logger.warning(f"Data for country: {country} could not be retrieved.") pass - df = pd.concat(dfs, axis=1) - df.columns = [c for c in countries if c not in not_retrieved] - df.index = pd.date_range(year_start, periods=8760, freq="H") - + if dfs: + df = pd.concat(dfs, axis=1) + df.columns = [c for c in countries if c not in not_retrieved] + df.index = pd.date_range(year_start, periods=8760, freq="H") + else: + df = pd.DataFrame() return df, not_retrieved From 288ff727e6e709bd537d8f1fb9f1d035b8fb2728 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 14 Feb 2024 17:29:01 +0100 Subject: [PATCH 663/787] Save retrieved data in working-dir --- .../data/datasets/electrical_neighbours.py | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 8e17b1842..c3a16dcd0 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1,6 +1,6 @@ """The central module containing all code dealing with electrical neighbours """ - +import datetime from os import path from pathlib import Path import logging @@ -1513,6 +1513,14 @@ def entsoe_to_bus_etrago(scn_name): return map_entsoe.map(for_bus) +def save_entsoe_data(df: pd.DataFrame, file_path: Path): + os.makedirs(file_path.parent, exist_ok=True) + if not df.empty: + df.to_csv(file_path, index_label="Index") + logger.info(f"Saved entsoe data for {file_path.stem} " + f"to {file_path.parent} for countries: {df.index}") + + def insert_generators_sq(scn_name="status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1539,11 +1547,24 @@ def insert_generators_sq(scn_name="status2019"): raise ValueError("No valid scenario name!") gen_sq, not_retrieved = entsoe_historic_generation_capacities(**year_start_end) + if not_retrieved: - logger.warning( - "Generation data from entsoe could not be retrieved. " - "Backup data from 2019 is used instead." - ) + logger.warning("Generation data from entsoe could not be retrieved.") + # check for generation backup from former runs + file_path = Path("./", "entsoe_data", f"gen_entsoe_{scn_name}.csv").resolve() + if os.path.isfile(file_path): + gen_sq_backup = pd.read_csv(file_path, index_col="Index") + # check for missing columns in backup (former runs) + c_backup = [c for c in gen_sq_backup.columns if c in not_retrieved] + # remove columns, if found in backup + not_retrieved = [c for c in not_retrieved if c not in c_backup] + if c_backup: + gen_sq = pd.concat([gen_sq, gen_sq_backup.loc[:, c_backup]], axis=1) + logger.info(f"Appended data from former runs for {c_backup}") + save_entsoe_data(gen_sq, file_path=file_path) + + if not_retrieved: + logger.warning("Backup data from 2019 is used instead.") gen_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" ) @@ -1708,11 +1729,22 @@ def insert_loads_sq(scn_name="status2019"): load_sq, not_retrieved = entsoe_historic_demand(**year_start_end) if not_retrieved: + logger.warning("Demand data from entsoe could not be retrieved.") + # check for generation backup from former runs + file_path = Path("./", "entsoe_data", f"load_entsoe_{scn_name}.csv").resolve() + if os.path.isfile(file_path): + load_sq_backup = pd.read_csv(file_path, index_col="Index") + # check for missing columns in backup (former runs) + c_backup = [c for c in load_sq_backup.columns if c in not_retrieved] + # remove columns, if found in backup + not_retrieved = [c for c in not_retrieved if c not in c_backup] + if c_backup: + load_sq = pd.concat([load_sq, load_sq_backup.loc[:, c_backup]], axis=1) + logger.info(f"Appended data from former runs for {c_backup}") + save_entsoe_data(load_sq, file_path=file_path) - logger.warning( - "Demand data from entsoe could not be retrieved." - f"Backup data of 2019 is used instead for {not_retrieved}" - ) + if not_retrieved: + logger.warning(f"Backup data of 2019 is used instead for {not_retrieved}") load_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" ) From 0e2b124c72c3b27b7d2d39997ee9c217f53f04a3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 14 Feb 2024 17:29:39 +0100 Subject: [PATCH 664/787] Black&Isort --- .../data/datasets/electrical_neighbours.py | 88 +++++++++++++------ 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index c3a16dcd0..09273ed5c 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1,8 +1,9 @@ """The central module containing all code dealing with electrical neighbours """ -import datetime + from os import path from pathlib import Path +import datetime import logging import os.path import zipfile @@ -1317,7 +1318,7 @@ def get_entsoe_token(): logger.info(f"Token found at {token_path}") entsoe_token = open(token_path, "r").read(36) if entsoe_token is None: - raise FileNotFoundError("No entsoe-token found.") + raise FileNotFoundError("No entsoe-token found.") return entsoe_token @@ -1348,7 +1349,9 @@ def entsoe_historic_generation_capacities( ] # No GB data after Brexit if int(year_start[:4]) > 2021: - logger.warning("No GB data after Brexit. GB is dropped from entsoe query!") + logger.warning( + "No GB data after Brexit. GB is dropped from entsoe query!" + ) countries = [c for c in countries if c != "GB"] # todo: define wanted countries @@ -1360,10 +1363,14 @@ def entsoe_historic_generation_capacities( else: kwargs = dict(start=start, end=end) try: - country_data = client.query_installed_generation_capacity(country, **kwargs) + country_data = client.query_installed_generation_capacity( + country, **kwargs + ) dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): - logger.warning(f"Data for country: {country} could not be retrieved.") + logger.warning( + f"Data for country: {country} could not be retrieved." + ) not_retrieved.append(country) pass @@ -1376,19 +1383,22 @@ def entsoe_historic_generation_capacities( # could probably somehow be automised # https://www.elexonportal.co.uk/category/view/178 # in MW - installed_capacity_gb = pd.Series({ - 'Biomass': 4438, - 'Fossil Gas': 37047, - 'Fossil Hard coal': 1491, - 'Hydro Pumped Storage': 5603, - 'Hydro Run-of-river and poundage': 2063, - 'Nuclear': 4950, - 'Other': 3313, - 'Other renewable': 1462, - 'Solar': 14518, - 'Wind Offshore': 13038, - 'Wind Onshore': 13907, - }, name="GB") + installed_capacity_gb = pd.Series( + { + "Biomass": 4438, + "Fossil Gas": 37047, + "Fossil Hard coal": 1491, + "Hydro Pumped Storage": 5603, + "Hydro Run-of-river and poundage": 2063, + "Nuclear": 4950, + "Other": 3313, + "Other renewable": 1462, + "Solar": 14518, + "Wind Offshore": 13038, + "Wind Onshore": 13907, + }, + name="GB", + ) df = pd.concat([df.T, installed_capacity_gb], axis=1).T logger.info("Manually added generation capacities for GB 2023.") not_retrieved = [c for c in not_retrieved if c != "GB"] @@ -1446,7 +1456,9 @@ def entsoe_historic_demand(year_start="20190101", year_end="20200101"): dfs.append(country_data) except (entsoe.exceptions.NoMatchingDataError, requests.HTTPError): not_retrieved.append(country) - logger.warning(f"Data for country: {country} could not be retrieved.") + logger.warning( + f"Data for country: {country} could not be retrieved." + ) pass if dfs: @@ -1517,8 +1529,10 @@ def save_entsoe_data(df: pd.DataFrame, file_path: Path): os.makedirs(file_path.parent, exist_ok=True) if not df.empty: df.to_csv(file_path, index_label="Index") - logger.info(f"Saved entsoe data for {file_path.stem} " - f"to {file_path.parent} for countries: {df.index}") + logger.info( + f"Saved entsoe data for {file_path.stem} " + f"to {file_path.parent} for countries: {df.index}" + ) def insert_generators_sq(scn_name="status2019"): @@ -1546,12 +1560,16 @@ def insert_generators_sq(scn_name="status2019"): else: raise ValueError("No valid scenario name!") - gen_sq, not_retrieved = entsoe_historic_generation_capacities(**year_start_end) + gen_sq, not_retrieved = entsoe_historic_generation_capacities( + **year_start_end + ) if not_retrieved: logger.warning("Generation data from entsoe could not be retrieved.") # check for generation backup from former runs - file_path = Path("./", "entsoe_data", f"gen_entsoe_{scn_name}.csv").resolve() + file_path = Path( + "./", "entsoe_data", f"gen_entsoe_{scn_name}.csv" + ).resolve() if os.path.isfile(file_path): gen_sq_backup = pd.read_csv(file_path, index_col="Index") # check for missing columns in backup (former runs) @@ -1559,7 +1577,9 @@ def insert_generators_sq(scn_name="status2019"): # remove columns, if found in backup not_retrieved = [c for c in not_retrieved if c not in c_backup] if c_backup: - gen_sq = pd.concat([gen_sq, gen_sq_backup.loc[:, c_backup]], axis=1) + gen_sq = pd.concat( + [gen_sq, gen_sq_backup.loc[:, c_backup]], axis=1 + ) logger.info(f"Appended data from former runs for {c_backup}") save_entsoe_data(gen_sq, file_path=file_path) @@ -1731,25 +1751,35 @@ def insert_loads_sq(scn_name="status2019"): if not_retrieved: logger.warning("Demand data from entsoe could not be retrieved.") # check for generation backup from former runs - file_path = Path("./", "entsoe_data", f"load_entsoe_{scn_name}.csv").resolve() + file_path = Path( + "./", "entsoe_data", f"load_entsoe_{scn_name}.csv" + ).resolve() if os.path.isfile(file_path): load_sq_backup = pd.read_csv(file_path, index_col="Index") # check for missing columns in backup (former runs) - c_backup = [c for c in load_sq_backup.columns if c in not_retrieved] + c_backup = [ + c for c in load_sq_backup.columns if c in not_retrieved + ] # remove columns, if found in backup not_retrieved = [c for c in not_retrieved if c not in c_backup] if c_backup: - load_sq = pd.concat([load_sq, load_sq_backup.loc[:, c_backup]], axis=1) + load_sq = pd.concat( + [load_sq, load_sq_backup.loc[:, c_backup]], axis=1 + ) logger.info(f"Appended data from former runs for {c_backup}") save_entsoe_data(load_sq, file_path=file_path) if not_retrieved: - logger.warning(f"Backup data of 2019 is used instead for {not_retrieved}") + logger.warning( + f"Backup data of 2019 is used instead for {not_retrieved}" + ) load_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" ) load_sq_backup.index = load_sq.index - load_sq = pd.concat([load_sq, load_sq_backup.loc[:,not_retrieved]], axis=1) + load_sq = pd.concat( + [load_sq, load_sq_backup.loc[:, not_retrieved]], axis=1 + ) # Delete existing data db.execute_sql( From 64b24197210866570231310b0a4b4e80c83656b5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 15 Feb 2024 13:29:03 +0100 Subject: [PATCH 665/787] Only send unique cell_ids via sql query missing_buildins.index was not unique and therefore reaching the 1GB limit resulting in an error. Making the index unique reduces the data send via query without loosing any information as its only checked if data is in the list. --- .../data/datasets/electricity_demand_timeseries/hh_buildings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 08174a7b3..19029936b 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -343,7 +343,7 @@ def generate_synthetic_buildings(missing_buildings, edge_length): destatis_zensus_population_per_ha_inside_germany ).filter( destatis_zensus_population_per_ha_inside_germany.c.id.in_( - missing_buildings.index + missing_buildings.index.unique() ) ) From be9f9ecb9d051e9a9827cc37febefa87bfe54959 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 15 Feb 2024 16:30:25 +0100 Subject: [PATCH 666/787] Add countries only for retrieved data --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 09273ed5c..bd7693360 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1376,7 +1376,7 @@ def entsoe_historic_generation_capacities( if dfs: df = pd.concat(dfs) - df["country"] = countries + df["country"] = [c for c in countries if not in not_retrieved] df.set_index("country", inplace=True) if int(year_start[:4]) == 2023: # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated From 8b3bcb27ccbec3875a1d4cafb90d6ba06756130e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 15 Feb 2024 17:32:04 +0100 Subject: [PATCH 667/787] Fix list-comprehension --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index bd7693360..b7f11987c 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1376,7 +1376,7 @@ def entsoe_historic_generation_capacities( if dfs: df = pd.concat(dfs) - df["country"] = [c for c in countries if not in not_retrieved] + df["country"] = [c for c in countries if c not in not_retrieved] df.set_index("country", inplace=True) if int(year_start[:4]) == 2023: # https://www.bmreports.com/bmrs/?q=foregeneration/capacityaggregated From a6a18b4b360d51018e67eb9173c7ceeec2df2e76 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 16 Feb 2024 09:58:38 +0100 Subject: [PATCH 668/787] adapt heat tasks to work with any status quo scenario --- .../data/airflow/dags/pipeline_status_quo.py | 8 +- .../data/datasets/heat_etrago/__init__.py | 34 ++--- .../data/datasets/heat_supply/__init__.py | 10 +- .../heat_supply/individual_heating.py | 134 +++++++++++------- 4 files changed, 108 insertions(+), 78 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index fd93b7399..4e2e222d5 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -44,7 +44,7 @@ from egon.data.datasets.heat_etrago import HeatEtrago from egon.data.datasets.heat_etrago.hts_etrago import HtsEtragoTable from egon.data.datasets.heat_supply import HeatSupply -from egon.data.datasets.heat_supply.individual_heating import HeatPumps2019 +from egon.data.datasets.heat_supply.individual_heating import HeatPumpsStatusQuo from egon.data.datasets.industrial_sites import MergeIndustrialSites from egon.data.datasets.industry import IndustrialDemandCurves from egon.data.datasets.loadarea import LoadArea, OsmLanduse @@ -424,8 +424,8 @@ scenario_capacities, ] ) - - + + # Pumped hydro units pumped_hydro = Storages( dependencies=[ @@ -453,7 +453,7 @@ chp_etrago = ChpEtrago(dependencies=[chp, heat_etrago]) # Heat pump disaggregation for status2019 - heat_pumps_2019 = HeatPumps2019( + heat_pumps_2019 = HeatPumpsStatusQuo( dependencies=[ cts_demand_buildings, DistrictHeatingAreas, diff --git a/src/egon/data/datasets/heat_etrago/__init__.py b/src/egon/data/datasets/heat_etrago/__init__.py index 9b062b5eb..69c21e1b8 100644 --- a/src/egon/data/datasets/heat_etrago/__init__.py +++ b/src/egon/data/datasets/heat_etrago/__init__.py @@ -69,14 +69,14 @@ def insert_buses(carrier, scenario): SELECT ST_Centroid(geom) AS geom FROM {sources['mv_grids']['schema']}. {sources['mv_grids']['table']} - WHERE bus_id IN - (SELECT DISTINCT bus_id + WHERE bus_id IN + (SELECT DISTINCT bus_id FROM boundaries.egon_map_zensus_grid_districts a - JOIN demand.egon_peta_heat b + JOIN demand.egon_peta_heat b ON a.zensus_population_id = b.zensus_population_id WHERE b.scenario = '{scenario}' AND b.zensus_population_id NOT IN ( - SELECT zensus_population_id FROM + SELECT zensus_population_id FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' ) @@ -263,7 +263,7 @@ def insert_store(scenario, carrier): def store(): for scenario in config.settings()["egon-data"]["--scenarios"]: - if scenario != "status2019": + if "status" not in scenario: insert_store(scenario, "central_heat") insert_store(scenario, "rural_heat") @@ -290,8 +290,8 @@ def insert_central_direct_heat(scenario): {targets['heat_generators']['table']} WHERE carrier IN ('solar_thermal_collector', 'geo_thermal') AND scn_name = '{scenario}' - AND bus IN - (SELECT bus_id + AND bus IN + (SELECT bus_id FROM {targets['heat_buses']['schema']}. {targets['heat_buses']['table']} WHERE scn_name = '{scenario}' @@ -368,13 +368,15 @@ def insert_central_direct_heat(scenario): # Map solar thermal collectors to weather cells join = gpd.sjoin(weather_cells, solar_thermal)[["index_right"]] + weather_year = get_sector_parameters("global", scenario)["weather_year"] + feedin = db.select_dataframe( f""" SELECT w_id, feedin FROM {sources['feedin_timeseries']['schema']}. {sources['feedin_timeseries']['table']} WHERE carrier = 'solar_thermal' - AND weather_year = 2019 + AND weather_year = {weather_year} """, index_col="w_id", ) @@ -511,14 +513,14 @@ def insert_rural_gas_boilers(scenario): {targets['heat_links']['table']} WHERE carrier = 'rural_gas_boiler' AND scn_name = '{scenario}' - AND bus0 IN - (SELECT bus_id + AND bus0 IN + (SELECT bus_id FROM {targets['heat_buses']['schema']}. {targets['heat_buses']['table']} WHERE scn_name = '{scenario}' AND country = 'DE') - AND bus1 IN - (SELECT bus_id + AND bus1 IN + (SELECT bus_id FROM {targets['heat_buses']['schema']}. {targets['heat_buses']['table']} WHERE scn_name = '{scenario}' @@ -607,8 +609,8 @@ def supply(): """ for scenario in config.settings()["egon-data"]["--scenarios"]: - # There is no direct heat in status2019 scenario - if scenario != "status2019": + # There is no direct heat in status quo scenario + if "status" not in scenario: insert_central_direct_heat(scenario) insert_central_power_to_heat(scenario) insert_individual_power_to_heat(scenario) @@ -619,7 +621,7 @@ class HeatEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="HeatEtrago", - version="0.0.11", + version="0.0.12", dependencies=dependencies, tasks=(buses, supply, store), - ) \ No newline at end of file + ) diff --git a/src/egon/data/datasets/heat_supply/__init__.py b/src/egon/data/datasets/heat_supply/__init__.py index b2c97a36c..83ed5e7d5 100644 --- a/src/egon/data/datasets/heat_supply/__init__.py +++ b/src/egon/data/datasets/heat_supply/__init__.py @@ -94,8 +94,8 @@ def district_heating(): if_exists="append", ) - # Do not check data for status2019 as is it not listed in the table - if scenario != "status2019": + # Do not check data for status quo as is it not listed in the table + if "status" not in scenario: # Compare target value with sum of distributed heat supply df_check = db.select_dataframe( f""" @@ -128,8 +128,8 @@ def district_heating(): if_exists="append", ) - # Insert resistive heaters which are not available in status2019 - if scenario != "status2019": + # Insert resistive heaters which are not available in status quo + if "status" not in scenario: backup_rh = backup_resistive_heaters(scenario) if not backup_rh.empty: @@ -182,7 +182,7 @@ class HeatSupply(Dataset): def __init__(self, dependencies): super().__init__( name="HeatSupply", - version="0.0.9", + version="0.0.10", dependencies=dependencies, tasks=( create_tables, diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index f0d3d4092..f29d5a22a 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -184,7 +184,7 @@ import os import random -from airflow.operators.python_operator import PythonOperator +from airflow.operators.python import PythonOperator from psycopg2.extensions import AsIs, register_adapter from sqlalchemy import ARRAY, REAL, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base @@ -194,7 +194,7 @@ import saio from egon.data import config, db, logger -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.district_heating_areas import ( MapZensusDistrictHeatingAreas, ) @@ -264,6 +264,7 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ) tasks = set() + for i in range(parallel_tasks): tasks.add( PythonOperator( @@ -295,9 +296,9 @@ def dyn_parallel_tasks_pypsa_eur_sec(): ) -class HeatPumps2019(Dataset): +class HeatPumpsStatusQuo(Dataset): def __init__(self, dependencies): - def dyn_parallel_tasks_2019(): + def dyn_parallel_tasks_status_quo(scenario): """Dynamically generate tasks The goal is to speed up tasks by parallelising bulks of mvgds. @@ -310,40 +311,66 @@ def dyn_parallel_tasks_2019(): set of airflow.PythonOperators The tasks. Each element is of :func:`egon.data.datasets.heat_supply.individual_heating. - determine_hp_cap_peak_load_mvgd_ts_2019` + determine_hp_cap_peak_load_mvgd_ts_status_quo` """ parallel_tasks = config.datasets()["demand_timeseries_mvgd"].get( "parallel_tasks", 1 ) + tasks = set() + for i in range(parallel_tasks): tasks.add( PythonOperator( task_id=( "individual_heating." - f"determine-hp-capacity-2019-" + f"determine-hp-capacity-{scenario}-" f"mvgd-bulk{i}" ), python_callable=split_mvgds_into_bulks, op_kwargs={ "n": i, "max_n": parallel_tasks, - "func": determine_hp_cap_peak_load_mvgd_ts_2019, + "func": determine_hp_cap_peak_load_mvgd_ts_status_quo, }, ) ) return tasks + tasks = () + + for scenario in config.settings()["egon-data"]["--scenarios"]: + if "status" in scenario: + postfix = f"_{scenario[-4:]}" + + tasks += ( + wrapped_partial( + delete_heat_peak_loads_status_quo, + scenario=scenario, + postfix=postfix, + ), + wrapped_partial( + delete_hp_capacity_status_quo, + scenario=scenario, + postfix=postfix, + ), + wrapped_partial( + delete_mvgd_ts_status_quo, + scenario=scenario, + postfix=postfix, + ), + ) + + tasks += ( + {*dyn_parallel_tasks_status_quo(scenario)}, + ) + + super().__init__( - name="HeatPumps2019", - version="0.0.2", + name="HeatPumpsStatusQuo", + version="0.0.3", dependencies=dependencies, - tasks=( - delete_heat_peak_loads_2019, - delete_hp_capacity_2019, - delete_mvgd_ts_2019, - {*dyn_parallel_tasks_2019()}, - ), + tasks=tasks, ) @@ -367,7 +394,9 @@ def dyn_parallel_tasks_2035(): parallel_tasks = config.datasets()["demand_timeseries_mvgd"].get( "parallel_tasks", 1 ) + tasks = set() + for i in range(parallel_tasks): tasks.add( PythonOperator( @@ -612,12 +641,14 @@ def cascade_heat_supply_indiv(scenario, distribution_level, plotting=True): columns=["estimated_flh", "priority"], data={"estimated_flh": [4000, 8000], "priority": [2, 1]}, ) - elif scenario == "status2019": + elif "status" in scenario: technologies = pd.DataFrame( index=["heat_pump"], columns=["estimated_flh", "priority"], data={"estimated_flh": [4000], "priority": [2]}, ) + else: + raise ValueError(f"{scenario=} is not valid.") # In the beginning, the remaining demand equals demand heat_per_mv["remaining_demand"] = heat_per_mv["demand"] @@ -1882,9 +1913,9 @@ def determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids): ) -def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): +def determine_hp_cap_peak_load_mvgd_ts_status_quo(mvgd_ids, scenario): """ - Main function to determine HP capacity per building in status2019 scenario. + Main function to determine HP capacity per building in status quo scenario. Further, creates heat demand time series for all buildings with heat pumps in MV grid, as well as for all buildings with gas boilers, used in eTraGo. @@ -1901,7 +1932,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): # ===================================================== df_peak_loads_db = pd.DataFrame() - df_hp_cap_per_building_2019_db = pd.DataFrame() + df_hp_cap_per_building_status_quo_db = pd.DataFrame() df_heat_mvgd_ts_db = pd.DataFrame() for mvgd in mvgd_ids: @@ -1910,20 +1941,20 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): # ############# aggregate residential and CTS demand profiles ##### df_heat_ts = aggregate_residential_and_cts_profiles( - mvgd, scenario="status2019" + mvgd, scenario=scenario ) # ##################### determine peak loads ################### logger.info(f"MVGD={mvgd} | Determine peak loads.") - peak_load_2019 = df_heat_ts.max().rename("status2019") + peak_load_status_quo = df_heat_ts.max().rename(scenario) # ######## determine HP capacity per building ######### logger.info(f"MVGD={mvgd} | Determine HP capacities.") buildings_decentral_heating = ( get_buildings_with_decentral_heat_demand_in_mv_grid( - mvgd, scenario="status2019" + mvgd, scenario=scenario ) ) @@ -1931,33 +1962,30 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): # TODO maybe remove after succesfull DE run # Might be fixed in #990 buildings_decentral_heating = catch_missing_buidings( - buildings_decentral_heating, peak_load_2019 + buildings_decentral_heating, peak_load_status_quo ) - hp_cap_per_building_2019 = determine_hp_cap_buildings_pvbased_per_mvgd( - "status2019", + hp_cap_per_building_status_quo = determine_hp_cap_buildings_pvbased_per_mvgd( + scenario, mvgd, - peak_load_2019, + peak_load_status_quo, buildings_decentral_heating, ) - buildings_gas_2019 = pd.Index(buildings_decentral_heating).drop( - hp_cap_per_building_2019.index - ) # ################ aggregated heat profiles ################### logger.info(f"MVGD={mvgd} | Aggregate heat profiles.") - df_mvgd_ts_2019_hp = df_heat_ts.loc[ + df_mvgd_ts_status_quo_hp = df_heat_ts.loc[ :, - hp_cap_per_building_2019.index, + hp_cap_per_building_status_quo.index, ].sum(axis=1) df_heat_mvgd_ts = pd.DataFrame( data={ "carrier": "heat_pump", "bus_id": mvgd, - "scenario": "status2019", - "dist_aggregated_mw": [df_mvgd_ts_2019_hp.to_list()], + "scenario": scenario, + "dist_aggregated_mw": [df_mvgd_ts_status_quo_hp.to_list()], } ) @@ -1965,7 +1993,7 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): logger.info(f"MVGD={mvgd} | Collect results.") df_peak_loads_db = pd.concat( - [df_peak_loads_db, peak_load_2019.reset_index()], + [df_peak_loads_db, peak_load_status_quo.reset_index()], axis=0, ignore_index=True, ) @@ -1974,10 +2002,10 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): [df_heat_mvgd_ts_db, df_heat_mvgd_ts], axis=0, ignore_index=True ) - df_hp_cap_per_building_2019_db = pd.concat( + df_hp_cap_per_building_status_quo_db = pd.concat( [ - df_hp_cap_per_building_2019_db, - hp_cap_per_building_2019.reset_index(), + df_hp_cap_per_building_status_quo_db, + hp_cap_per_building_status_quo.reset_index(), ], axis=0, ) @@ -1987,11 +2015,11 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): export_to_db(df_peak_loads_db, df_heat_mvgd_ts_db, drop=False) - df_hp_cap_per_building_2019_db["scenario"] = "status2019" + df_hp_cap_per_building_status_quo_db["scenario"] = scenario # TODO debug duplicated building_ids - duplicates = df_hp_cap_per_building_2019_db.loc[ - df_hp_cap_per_building_2019_db.duplicated("building_id", keep=False) + duplicates = df_hp_cap_per_building_status_quo_db.loc[ + df_hp_cap_per_building_status_quo_db.duplicated("building_id", keep=False) ] if not duplicates.empty: @@ -2000,14 +2028,14 @@ def determine_hp_cap_peak_load_mvgd_ts_2019(mvgd_ids): f"{duplicates.loc[:,['building_id', 'hp_capacity']]}" ) - df_hp_cap_per_building_2019_db.drop_duplicates("building_id", inplace=True) + df_hp_cap_per_building_status_quo_db.drop_duplicates("building_id", inplace=True) - df_hp_cap_per_building_2019_db.building_id = ( - df_hp_cap_per_building_2019_db.building_id.astype(int) + df_hp_cap_per_building_status_quo_db.building_id = ( + df_hp_cap_per_building_status_quo_db.building_id.astype(int) ) write_table_to_postgres( - df_hp_cap_per_building_2019_db, + df_hp_cap_per_building_status_quo_db, EgonHpCapacityBuildings, drop=False, ) @@ -2199,10 +2227,10 @@ def delete_hp_capacity_100RE(): delete_hp_capacity(scenario="eGon100RE") -def delete_hp_capacity_2019(): - """Remove all hp capacities for the selected status2019""" +def delete_hp_capacity_status_quo(scenario): + """Remove all hp capacities for the selected status quo""" EgonHpCapacityBuildings.__table__.create(bind=engine, checkfirst=True) - delete_hp_capacity(scenario="status2019") + delete_hp_capacity(scenario=scenario) def delete_hp_capacity_2035(): @@ -2211,12 +2239,12 @@ def delete_hp_capacity_2035(): delete_hp_capacity(scenario="eGon2035") -def delete_mvgd_ts_2019(): - """Remove all mvgd ts for the selected status2019""" +def delete_mvgd_ts_status_quo(scenario): + """Remove all mvgd ts for the selected status quo""" EgonEtragoTimeseriesIndividualHeating.__table__.create( bind=engine, checkfirst=True ) - delete_mvgd_ts(scenario="status2019") + delete_mvgd_ts(scenario=scenario) def delete_mvgd_ts_2035(): @@ -2235,13 +2263,13 @@ def delete_mvgd_ts_100RE(): delete_mvgd_ts(scenario="eGon100RE") -def delete_heat_peak_loads_2019(): - """Remove all heat peak loads for status2019.""" +def delete_heat_peak_loads_status_quo(scenario): + """Remove all heat peak loads for status quo.""" BuildingHeatPeakLoads.__table__.create(bind=engine, checkfirst=True) with db.session_scope() as session: # Buses session.query(BuildingHeatPeakLoads).filter( - BuildingHeatPeakLoads.scenario == "status2019" + BuildingHeatPeakLoads.scenario == scenario ).delete(synchronize_session=False) From 4e5023ea7637e450932ca635399dafd9409c0715 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 16 Feb 2024 11:09:16 +0100 Subject: [PATCH 669/787] fix status quo bulk heat pump generation --- .../data/datasets/heat_supply/individual_heating.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index f29d5a22a..ea1148f57 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -331,6 +331,7 @@ def dyn_parallel_tasks_status_quo(scenario): op_kwargs={ "n": i, "max_n": parallel_tasks, + "scenario": scenario, "func": determine_hp_cap_peak_load_mvgd_ts_status_quo, }, ) @@ -368,7 +369,7 @@ def dyn_parallel_tasks_status_quo(scenario): super().__init__( name="HeatPumpsStatusQuo", - version="0.0.3", + version="0.0.4", dependencies=dependencies, tasks=tasks, ) @@ -2146,7 +2147,7 @@ def determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids): export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec) -def split_mvgds_into_bulks(n, max_n, func): +def split_mvgds_into_bulks(n, max_n, func, scenario=None): """ Generic function to split task into multiple parallel tasks, dividing the number of MVGDs into even bulks. @@ -2184,7 +2185,11 @@ def split_mvgds_into_bulks(n, max_n, func): mvgd_ids = mvgd_ids[n] logger.info(f"Bulk takes care of MVGD: {min(mvgd_ids)} : {max(mvgd_ids)}") - func(mvgd_ids) + + if scenario is not None: + func(mvgd_ids, scenario=scenario) + else: + func(mvgd_ids) def delete_hp_capacity(scenario): From a8f2aefb33f1aee29d70f44e6ea513eda6350da1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 12:42:00 +0100 Subject: [PATCH 670/787] Add casting to integer --- .../datasets/electricity_demand_timeseries/cts_buildings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index fae5eec54..1195abee3 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -168,7 +168,7 @@ from geoalchemy2 import Geometry from geoalchemy2.shape import to_shape from psycopg2.extensions import AsIs, register_adapter -from sqlalchemy import REAL, Column, Integer, String, func +from sqlalchemy import REAL, Column, Integer, String, func, cast from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd import numpy as np @@ -400,7 +400,7 @@ def create_synthetic_buildings(df, points=None, crs="EPSG:3035"): # get max number of building ids from synthetic residential table with db.session_scope() as session: max_synth_residential_id = session.execute( - func.max(OsmBuildingsSynthetic.id) + func.max(cast(OsmBuildingsSynthetic.id, Integer)) ).scalar() max_synth_residential_id = int(max_synth_residential_id) From f52ce9b88b11a7ef8925af08d49aa25e758d6221 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 12:43:15 +0100 Subject: [PATCH 671/787] Rename variable Rename to more generatl max_synth_building_id as this function is used twice and only in the first run, only residential buildings exist in the table. In the second run, also cts buildings exist. --- .../electricity_demand_timeseries/cts_buildings.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index 1195abee3..e9db069fb 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -397,17 +397,17 @@ def create_synthetic_buildings(df, points=None, crs="EPSG:3035"): # TODO remove after #772 implementation of egon_building_id df.rename(columns={"id": "egon_building_id"}, inplace=True) - # get max number of building ids from synthetic residential table + # get max number of building ids from synthetic table with db.session_scope() as session: - max_synth_residential_id = session.execute( + max_synth_building_id = session.execute( func.max(cast(OsmBuildingsSynthetic.id, Integer)) ).scalar() - max_synth_residential_id = int(max_synth_residential_id) + max_synth_building_id = int(max_synth_building_id) # create sequential ids df["egon_building_id"] = range( - max_synth_residential_id + 1, - max_synth_residential_id + df.shape[0] + 1, + max_synth_building_id + 1, + max_synth_building_id + df.shape[0] + 1, ) df["area"] = df["geom_building"].area From b3f6690e93100a19398718621542abaab84bd6b1 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 13:12:22 +0100 Subject: [PATCH 672/787] Use session_scope() --- .../heat_demand_timeseries/__init__.py | 192 +++++++++--------- 1 file changed, 95 insertions(+), 97 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index ed9f1811e..cf3e5668a 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -299,117 +299,115 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): aggregation_level="district" ) - # TODO: use session_scope! - from sqlalchemy.orm import sessionmaker - - session = sessionmaker(bind=db.engine())() - print(datetime.now() - start_time) start_time = datetime.now() for area in district_heating_grids.area_id.unique(): - selected_profiles = db.select_dataframe( - f""" - SELECT a.zensus_population_id, building_id, c.climate_zone, - selected_idp, ordinality as day, b.area_id - FROM demand.egon_heat_timeseries_selected_profiles a - INNER JOIN boundaries.egon_map_zensus_climate_zones c - ON a.zensus_population_id = c.zensus_population_id - INNER JOIN ( - SELECT * FROM demand.egon_map_zensus_district_heating_areas - WHERE scenario = '{scenario}' - AND area_id = '{area}' - ) b ON a.zensus_population_id = b.zensus_population_id , - - UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp - - """ - ) - if not selected_profiles.empty: - df = pd.merge( - selected_profiles, - daily_demand_shares, - on=["day", "climate_zone"], - ) + with db.session_scope() as session: + + selected_profiles = db.select_dataframe( + f""" + SELECT a.zensus_population_id, building_id, c.climate_zone, + selected_idp, ordinality as day, b.area_id + FROM demand.egon_heat_timeseries_selected_profiles a + INNER JOIN boundaries.egon_map_zensus_climate_zones c + ON a.zensus_population_id = c.zensus_population_id + INNER JOIN ( + SELECT * FROM demand.egon_map_zensus_district_heating_areas + WHERE scenario = '{scenario}' + AND area_id = '{area}' + ) b ON a.zensus_population_id = b.zensus_population_id , + + UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp - slice_df = pd.merge( - df[df.area_id == area], - idp_df, - left_on="selected_idp", - right_on="index", + """ ) - for hour in range(24): - slice_df[hour] = ( - slice_df.idp.str[hour] - .mul(slice_df.daily_demand_share) - .mul( - annual_demand.loc[ - slice_df.zensus_population_id.values, - "per_building", - ].values - ) + if not selected_profiles.empty: + df = pd.merge( + selected_profiles, + daily_demand_shares, + on=["day", "climate_zone"], ) - diff = ( - slice_df[range(24)].sum().sum() - - annual_demand[ - annual_demand.area_id == area - ].demand_total.sum() - ) / ( - annual_demand[annual_demand.area_id == area].demand_total.sum() - ) + slice_df = pd.merge( + df[df.area_id == area], + idp_df, + left_on="selected_idp", + right_on="index", + ) + + for hour in range(24): + slice_df[hour] = ( + slice_df.idp.str[hour] + .mul(slice_df.daily_demand_share) + .mul( + annual_demand.loc[ + slice_df.zensus_population_id.values, + "per_building", + ].values + ) + ) - assert ( - abs(diff) < 0.03 - ), f"""Deviation of residential heat demand time - series for district heating grid {str(area)} is {diff}""" - - hh = np.concatenate( - slice_df.drop( - [ - "zensus_population_id", - "building_id", - "climate_zone", - "selected_idp", - "area_id", - "daily_demand_share", - "idp", - ], - axis="columns", + diff = ( + slice_df[range(24)].sum().sum() + - annual_demand[ + annual_demand.area_id == area + ].demand_total.sum() + ) / ( + annual_demand[annual_demand.area_id == area].demand_total.sum() ) - .groupby("day") - .sum()[range(24)] - .values - ).ravel() - - cts = CTS_demand_dist[ - (CTS_demand_dist.scenario == scenario) - & (CTS_demand_dist.index == area) - ].drop("scenario", axis="columns") - if (not selected_profiles.empty) and not cts.empty: - entry = EgonTimeseriesDistrictHeating( - area_id=int(area), - scenario=scenario, - dist_aggregated_mw=(hh + cts.values[0]).tolist(), - ) - elif (not selected_profiles.empty) and cts.empty: - entry = EgonTimeseriesDistrictHeating( - area_id=int(area), - scenario=scenario, - dist_aggregated_mw=(hh).tolist(), - ) - elif not cts.empty: - entry = EgonTimeseriesDistrictHeating( - area_id=int(area), - scenario=scenario, - dist_aggregated_mw=(cts.values[0]).tolist(), - ) + assert ( + abs(diff) < 0.03 + ), f"""Deviation of residential heat demand time + series for district heating grid {str(area)} is {diff}""" + + hh = np.concatenate( + slice_df.drop( + [ + "zensus_population_id", + "building_id", + "climate_zone", + "selected_idp", + "area_id", + "daily_demand_share", + "idp", + ], + axis="columns", + ) + .groupby("day") + .sum()[range(24)] + .values + ).ravel() + + cts = CTS_demand_dist[ + (CTS_demand_dist.scenario == scenario) + & (CTS_demand_dist.index == area) + ].drop("scenario", axis="columns") + + if (not selected_profiles.empty) and not cts.empty: + entry = EgonTimeseriesDistrictHeating( + area_id=int(area), + scenario=scenario, + dist_aggregated_mw=(hh + cts.values[0]).tolist(), + ) + elif (not selected_profiles.empty) and cts.empty: + entry = EgonTimeseriesDistrictHeating( + area_id=int(area), + scenario=scenario, + dist_aggregated_mw=(hh).tolist(), + ) + elif not cts.empty: + entry = EgonTimeseriesDistrictHeating( + area_id=int(area), + scenario=scenario, + dist_aggregated_mw=(cts.values[0]).tolist(), + ) - session.add(entry) - session.commit() + session.add(entry) + session.commit() print( f"Time to create time series for district heating scenario {scenario}" From 25c1b01538fa076cb6d446a002acbdcd202670f4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 15:26:24 +0100 Subject: [PATCH 673/787] Only call temperatue_profile_extract() once --- .../datasets/heat_demand_timeseries/daily.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/daily.py b/src/egon/data/datasets/heat_demand_timeseries/daily.py index 95da233e0..edd3f4f98 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/daily.py +++ b/src/egon/data/datasets/heat_demand_timeseries/daily.py @@ -155,7 +155,7 @@ def map_climate_zones_to_zensus(): def daily_demand_shares_per_climate_zone(): - """Calculates shares of heat demand per day for each cliamte zone + """Calculates shares of heat demand per day for each climate zone Returns ------- @@ -171,14 +171,17 @@ def daily_demand_shares_per_climate_zone(): bind=engine, checkfirst=True ) + # Get temperature profiles of all TRY Climate Zones 2011 + temp_profile = temperature_profile_extract() + # Calulate daily demand shares - h = h_value() + h = h_value(temp_profile) # Normalize data to sum()=1 daily_demand_shares = h.resample("d").sum() / h.sum() # Extract temperature class for each day and climate zone - temperature_classes = temp_interval().resample("D").max() + temperature_classes = temp_interval(temp_profile).resample("D").max() # Initilize dataframe df = pd.DataFrame( @@ -317,9 +320,12 @@ def temperature_profile_extract(): return temperature_profile -def temp_interval(): +def temp_interval(temp_profile): """ Description: Create Dataframe with temperature data for TRY Climate Zones + + temp_profile: pandas.DataFrame + temperature profiles of all TRY Climate Zones 2011 Returns ------- temperature_interval : pandas.DataFrame @@ -328,7 +334,6 @@ def temp_interval(): """ index = pd.date_range(datetime(2019, 1, 1, 0), periods=8760, freq="H") temperature_interval = pd.DataFrame() - temp_profile = temperature_profile_extract() for x in range(len(temp_profile.columns)): name_station = temp_profile.columns[x] @@ -342,10 +347,12 @@ def temp_interval(): return temperature_interval -def h_value(): +def h_value(temp_profile): """ Description: Assignment of daily demand scaling factor to each day of all TRY Climate Zones + temp_profile: pandas.DataFrame + temperature profiles of all TRY Climate Zones 2011 Returns ------- h : pandas.DataFrame @@ -363,7 +370,6 @@ def h_value(): d = 0.1163157 - temp_profile = temperature_profile_extract() temperature_profile_res = ( temp_profile.resample("D") .mean() From 35655b4185688a0a71a1a5958cdd2f57d9fe593e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 15:43:58 +0100 Subject: [PATCH 674/787] Define sql query in variable --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index cf3e5668a..11954c746 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -306,8 +306,7 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): with db.session_scope() as session: - selected_profiles = db.select_dataframe( - f""" + sql = f""" SELECT a.zensus_population_id, building_id, c.climate_zone, selected_idp, ordinality as day, b.area_id FROM demand.egon_heat_timeseries_selected_profiles a @@ -322,7 +321,7 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp """ - ) + selected_profiles = db.select_dataframe(sql) if not selected_profiles.empty: df = pd.merge( From 949660b1b4ec1c3a3d94545e65a7fdea5bf7e739 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 16:11:46 +0100 Subject: [PATCH 675/787] Clean sql query --- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 11954c746..a23eaee8b 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -316,11 +316,10 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): SELECT * FROM demand.egon_map_zensus_district_heating_areas WHERE scenario = '{scenario}' AND area_id = '{area}' - ) b ON a.zensus_population_id = b.zensus_population_id , - + ) b ON a.zensus_population_id = b.zensus_population_id, UNNEST (selected_idp_profiles) WITH ORDINALITY as selected_idp - """ + selected_profiles = db.select_dataframe(sql) if not selected_profiles.empty: From 6e87a80618ea1f7a902689cdda232ccc6d067347 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 17:20:00 +0100 Subject: [PATCH 676/787] Get h_values for 2023 --- src/egon/data/datasets/heat_demand_timeseries/daily.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/daily.py b/src/egon/data/datasets/heat_demand_timeseries/daily.py index edd3f4f98..4162db5b7 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/daily.py +++ b/src/egon/data/datasets/heat_demand_timeseries/daily.py @@ -9,6 +9,7 @@ from egon.data import db import egon.data.datasets.era5 as era +from egon.data.datasets.scenario_parameters import get_sector_parameters from math import ceil @@ -360,7 +361,10 @@ def h_value(temp_profile): Extracted from demandlib. """ - index = pd.date_range(datetime(2019, 1, 1, 0), periods=8760, freq="H") + + weather_year = get_sector_parameters("global", "status2023")["weather_year"] + # TODO status2023: this is fixed to 2023 as only one weather year is currently possible + index = pd.date_range(datetime(weather_year, 1, 1, 0), periods=8760, freq="H") a = 3.0469695 From 08005ca6933fb56e4af11e530a9b0eca65b407a6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 16 Feb 2024 17:25:42 +0100 Subject: [PATCH 677/787] Fix weather year for temp interval to 2023 --- src/egon/data/datasets/heat_demand_timeseries/daily.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_demand_timeseries/daily.py b/src/egon/data/datasets/heat_demand_timeseries/daily.py index 4162db5b7..d98211cd0 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/daily.py +++ b/src/egon/data/datasets/heat_demand_timeseries/daily.py @@ -333,7 +333,9 @@ def temp_interval(temp_profile): Hourly temperature intrerval of all 15 TRY Climate station#s temperature profile """ - index = pd.date_range(datetime(2019, 1, 1, 0), periods=8760, freq="H") + weather_year = get_sector_parameters("global", "status2023")["weather_year"] + # TODO" status2023 this is currenlty fixed to one scenario possible as only one weather year is possible + index = pd.date_range(datetime(weather_year, 1, 1, 0), periods=8760, freq="H") temperature_interval = pd.DataFrame() for x in range(len(temp_profile.columns)): From 84f67536f6509ee9f422788a214163a9ae4916bc Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 19 Feb 2024 12:36:50 +0100 Subject: [PATCH 678/787] update scenario capacities for status2023 for small_storages and rural_heat_capacity --- src/egon/data/datasets/scenario_capacities.py | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 828a66050..c85d0942a 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -121,8 +121,17 @@ def insert_capacities_status_quo(scenario: str) -> None: rural_heat_capacity = { # Rural heat capacity for 2019 according to NEP 2035, version 2021 "status2019": 1e6 * 5e-3, - # TODO: status2023 replace placeholder - "status2023": 1e6 * 5e-3, + # Rural heat capacity for 2023 according to NEP 2037, version 2023 + # 1.2 Mio. for 2020 + # https://www.netzentwicklungsplan.de/sites/default/files/2023-07/ + # NEP_2037_2045_V2023_2_Entwurf_Teil1_1.pdf#page=25 + # and 3 kW per heat pump + # https://www.netzentwicklungsplan.de/sites/default/files/2022-11/ + # NEP_2035_V2021_2_Entwurf_Teil1.pdf#page=33 + # plus 0.15 Mio. 2021 and 0.24 Mio. in 2022 + # https://www.enercity.de/magazin/unsere-welt/waermepumpen-boom + # Assumption: 0.3 Mio. in 2023 + "status2023": (1.2 + 0.15 + 0.24 + 0.3) * 1e6 * 3e-3, }[scenario] if settings()["egon-data"]["--dataset-boundary"] != "Everything": @@ -148,8 +157,14 @@ def insert_capacities_status_quo(scenario: str) -> None: small_storages = { # MW for Germany "status2019": 600, - # TODO: status2023 replace placeholder - "status2023": 600, + # 1.3 GW in 2020 + # https://www.netzentwicklungsplan.de/sites/default/files/2023-07/ + # NEP_2037_2045_V2023_2_Entwurf_Teil1_1.pdf#page=25 + # Installed quantity 2020: 272,000 + # Installed quantity 2023: 1,197,000 + # https://www.photovoltaik.eu/solarspeicher/ + # bsw-speicherkapazitaet-von-heimspeichern-2023-verdoppelt + "status2023": 1300 * 1197 / 272, }[scenario] db.execute_sql( From 9cc692598b576ed395d97e8ee86ec20f1d9921ae Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 19 Feb 2024 12:41:19 +0100 Subject: [PATCH 679/787] update scenario capacities for status2023 for small_storages and rural_heat_capacity --- src/egon/data/datasets/scenario_capacities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index c85d0942a..64b7af9af 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -130,8 +130,8 @@ def insert_capacities_status_quo(scenario: str) -> None: # NEP_2035_V2021_2_Entwurf_Teil1.pdf#page=33 # plus 0.15 Mio. 2021 and 0.24 Mio. in 2022 # https://www.enercity.de/magazin/unsere-welt/waermepumpen-boom - # Assumption: 0.3 Mio. in 2023 - "status2023": (1.2 + 0.15 + 0.24 + 0.3) * 1e6 * 3e-3, + # plus 0.2 Mio. in H1 2023 -> Assumption 2023: 2 * 0.2 Mio = 0.4 Mio. + "status2023": (1.2 + 0.15 + 0.24 + 0.4) * 1e6 * 3e-3, }[scenario] if settings()["egon-data"]["--dataset-boundary"] != "Everything": From 785cb8bdf8f799b50bebffa7edca6dba5ee77ed3 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 19 Feb 2024 12:46:24 +0100 Subject: [PATCH 680/787] update dataset version --- src/egon/data/datasets/scenario_capacities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index 64b7af9af..95e296069 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -157,7 +157,7 @@ def insert_capacities_status_quo(scenario: str) -> None: small_storages = { # MW for Germany "status2019": 600, - # 1.3 GW in 2020 + # 1.3 GW in 2020/2021 # https://www.netzentwicklungsplan.de/sites/default/files/2023-07/ # NEP_2037_2045_V2023_2_Entwurf_Teil1_1.pdf#page=25 # Installed quantity 2020: 272,000 @@ -863,7 +863,7 @@ class ScenarioCapacities(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioCapacities", - version="0.0.16", + version="0.0.17", dependencies=dependencies, tasks=tasks, ) From 35a8fc28edcdc0d2a4ac1f613b8a65488b3dd7a5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 19 Feb 2024 17:08:28 +0100 Subject: [PATCH 681/787] Add status2023 to heat-etrago --- src/egon/data/datasets/heat_etrago/hts_etrago.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/heat_etrago/hts_etrago.py b/src/egon/data/datasets/heat_etrago/hts_etrago.py index d19357cc0..aaee6187e 100644 --- a/src/egon/data/datasets/heat_etrago/hts_etrago.py +++ b/src/egon/data/datasets/heat_etrago/hts_etrago.py @@ -12,7 +12,7 @@ def hts_to_etrago(scenario): targets = config.datasets()["etrago_heat"]["targets"] carriers = ["central_heat", "rural_heat", "rural_gas_boiler"] - if scenario == "status2019": + if "status" in scenario: carriers = ["central_heat", "rural_heat"] for carrier in carriers: From 47d1e3c53bbfafce38e429f5d1f125b74aab84e5 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 19 Feb 2024 23:33:56 +0100 Subject: [PATCH 682/787] Set drop in qcut --- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 729318bd9..31cbac9da 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -1117,6 +1117,10 @@ def sort_and_qcut_df( """ Determine the quantile of a given attribute in a (Geo)DataFrame. Sort the (Geo)DataFrame in ascending order for the given attribute. + If edges of quantiles are same, edges are droped. Which would result + in less bins than specified, and some larger (with more elements) + than others. + Parameters ----------- df : pandas.DataFrame or geopandas.GeoDataFrame @@ -1137,6 +1141,7 @@ def sort_and_qcut_df( df[col], q=q, labels=range(q), + duplicates="drop" ) ) From de4a24b17d66099e1c4d88ca1c59160c5e8522a0 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 11:30:54 +0100 Subject: [PATCH 683/787] Update fuel prices to 2023 forecast of tyndp 2020 --- src/egon/data/datasets/scenario_parameters/parameters.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/scenario_parameters/parameters.py b/src/egon/data/datasets/scenario_parameters/parameters.py index b3f418cf8..c227e8c48 100755 --- a/src/egon/data/datasets/scenario_parameters/parameters.py +++ b/src/egon/data/datasets/scenario_parameters/parameters.py @@ -129,11 +129,10 @@ def global_settings(scenario): "weather_year": 2019, # TODO fixed to 2019 as long as FFE is down "population_year": 2019, # TODO check if possible for 2023 "fuel_costs": { - # TODO status2023 update values - # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) - "oil": 12.9 * 3.6, # [EUR/MWh] - "gas": 5.6 * 3.6, # [EUR/MWh] - "coal": 3.0 * 3.6, # [EUR/MWh] + # TYNDP 2020, data for 2023 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/) + "oil": 16.4 * 3.6, # [EUR/MWh] + "gas": 6.1 * 3.6, # [EUR/MWh] + "coal": 3.4 * 3.6, # [EUR/MWh] "lignite": 1.1 * 3.6, # [EUR/MWh] "nuclear": 0.47 * 3.6, # [EUR/MWh] "biomass": read_costs(read_csv(2020), "biomass", "fuel"), From df57df0b624fd241f14cd3d5f969ba9f250cadee Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 11:38:41 +0100 Subject: [PATCH 684/787] Add logging for osm dataset choice --- src/egon/data/datasets/osm/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/osm/__init__.py b/src/egon/data/datasets/osm/__init__.py index 1fbbc3223..b86ef189a 100644 --- a/src/egon/data/datasets/osm/__init__.py +++ b/src/egon/data/datasets/osm/__init__.py @@ -20,7 +20,7 @@ import importlib_resources as resources -from egon.data import db +from egon.data import db, logger from egon.data.config import settings from egon.data.datasets import Dataset from egon.data.metadata import ( @@ -77,8 +77,10 @@ def to_postgres(cache_size=4096): if settings()["egon-data"]["--dataset-boundary"] == "Everything": input_filename = osm_config["target"]["file"] + logger.info("Using Everything DE dataset.") else: input_filename = osm_config["target"]["file_testmode"] + logger.info("Using testmode SH dataset.") input_file = Path(".") / "openstreetmap" / input_filename style_file = ( From 200ac5858e6c633349fba1da5940f7571c8ad786 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 11:42:58 +0100 Subject: [PATCH 685/787] Revert "Set drop in qcut" This reverts commit 47d1e3c53bbfafce38e429f5d1f125b74aab84e5. --- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 31cbac9da..729318bd9 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -1117,10 +1117,6 @@ def sort_and_qcut_df( """ Determine the quantile of a given attribute in a (Geo)DataFrame. Sort the (Geo)DataFrame in ascending order for the given attribute. - If edges of quantiles are same, edges are droped. Which would result - in less bins than specified, and some larger (with more elements) - than others. - Parameters ----------- df : pandas.DataFrame or geopandas.GeoDataFrame @@ -1141,7 +1137,6 @@ def sort_and_qcut_df( df[col], q=q, labels=range(q), - duplicates="drop" ) ) From 0c201feaad64d817bc9d6288cfca07c99f6349be Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 17:53:32 +0100 Subject: [PATCH 686/787] Rename datasetvariable in pipeline --- src/egon/data/airflow/dags/pipeline_status_quo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 79092b220..bb307b72f 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -349,8 +349,8 @@ tasks["etrago_setup.create-tables"], ] ) - # Create gas voronoi status2019 - create_gas_polygons_status2019 = GasAreasStatusQuo( + # Create gas voronoi status quo + create_gas_polygons_statusquo = GasAreasStatusQuo( dependencies=[setup_etrago, vg250, gas_grid_insert_data, substation_voronoi] ) @@ -360,24 +360,24 @@ gas_grid_insert_data, run_pypsaeursec, foreign_lines, - create_gas_polygons_status2019, + create_gas_polygons_statusquo, ] ) # Import gas production gas_production_insert_data = CH4Production( - dependencies=[create_gas_polygons_status2019] + dependencies=[create_gas_polygons_statusquo] ) # Import CH4 storages insert_data_ch4_storages = CH4Storages( - dependencies=[create_gas_polygons_status2019] + dependencies=[create_gas_polygons_statusquo] ) # CHP locations chp = Chp( dependencies=[ - create_gas_polygons_status2019, + create_gas_polygons_statusquo, demand_curves_industry, district_heating_areas, industrial_sites, @@ -406,7 +406,7 @@ ) create_ocgt = OpenCycleGasTurbineEtrago( - dependencies=[create_gas_polygons_status2019, power_plants] + dependencies=[create_gas_polygons_statusquo, power_plants] ) # Fill eTraGo generators tables From de020d6b950f58ac43d4c1d46fc4ceae2efa6f98 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 17:55:28 +0100 Subject: [PATCH 687/787] Rename dataset variable for heat pumps in pipeline --- src/egon/data/airflow/dags/pipeline_status_quo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index 4e2e222d5..b9cd2002a 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -452,8 +452,8 @@ # CHP to eTraGo chp_etrago = ChpEtrago(dependencies=[chp, heat_etrago]) - # Heat pump disaggregation for status2019 - heat_pumps_2019 = HeatPumpsStatusQuo( + # Heat pump disaggregation for status quo + heat_pumps_sq = HeatPumpsStatusQuo( dependencies=[ cts_demand_buildings, DistrictHeatingAreas, @@ -470,7 +470,7 @@ heat_etrago, heat_time_series, mv_grid_districts, - heat_pumps_2019, + heat_pumps_sq, ] ) From a79b15721b6177b76ddcdd4f068d613cfbd80027 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 17:58:59 +0100 Subject: [PATCH 688/787] Only give status2023 as default scenario --- src/egon/data/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index ba66f006a..1f3fa7dfb 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -166,7 +166,7 @@ @click.option( "--scenarios", - default=["status2019", "eGon2035"], + default=["status2023"], metavar="SCENARIOS", help=( "List of scenario names for which a data model shall be created." From 6bb4c6f48a078dec80dbef3dfb850a9ebf39dfaa Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 17:59:38 +0100 Subject: [PATCH 689/787] Only give status2023 as default scenario --- src/egon/data/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/config.py b/src/egon/data/config.py index 5dad8693f..e26e87f41 100644 --- a/src/egon/data/config.py +++ b/src/egon/data/config.py @@ -73,7 +73,7 @@ def settings() -> dict[str, dict[str, str]]: "--jobs": 1, "--random-seed": 42, "--processes-per-task": 1, - "--scenarios": ["status2019", "eGon2035"], + "--scenarios": "status2023", } } with open(files[0]) as f: From ed0f0512a5382a58fc9e8cc38aad4bfe678ce028 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 20 Feb 2024 18:41:08 +0100 Subject: [PATCH 690/787] Add comment --- src/egon/data/datasets/storages/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index c994b02d0..6491e58fb 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -312,6 +312,7 @@ def allocate_pumped_hydro_eGon100RE(): # Get allocation of pumped_hydro plants in eGon2035 scenario as the # reference for the distribution in eGon100RE scenario allocation = allocate_pumped_hydro(scn="status2019", export=False) + # TODO status2023 leave same as status2019 scaling_factor = capacity_phes / allocation.el_capacity.sum() From 4f734b66aeaa3e4f01e852f60ed8cce8bbfa5c96 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 12 Feb 2024 16:17:52 +0100 Subject: [PATCH 691/787] fix behaviour share ctd demands --- src/egon/data/datasets/electricity_demand/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/__init__.py b/src/egon/data/datasets/electricity_demand/__init__.py index e0653663f..267756437 100644 --- a/src/egon/data/datasets/electricity_demand/__init__.py +++ b/src/egon/data/datasets/electricity_demand/__init__.py @@ -227,11 +227,10 @@ def distribute_cts_demands(): peta["nuts3"] = map_nuts3.nuts3 # Calculate share of nuts3 heat demand per zensus cell - peta["share"] = ( - peta.heat_demand.groupby(peta.nuts3) - .apply(lambda grp: grp / grp.sum()) - .values - ) + for nuts3, df in peta.groupby("nuts3"): + peta.loc[df.index, "share"] = ( + df["heat_demand"] / df["heat_demand"].sum() + ) # Select forecasted electrical demands from demandregio table demand_nuts3 = db.select_dataframe( From cf2e28593bf8d1fc3d15ea54892ef4a449611602 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 1 Feb 2024 15:11:57 +0100 Subject: [PATCH 692/787] apply changes due to deprecated functions --- src/egon/data/datasets/fill_etrago_gen.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index 875bcff49..0375f78d5 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -104,12 +104,7 @@ def add_marginal_costs(power_plants): for carrier in pp_scn.carrier.unique(): if carrier not in (marginal_costs.index): warning.append(carrier) - marginal_costs = pd.concat( - [ - marginal_costs, - pd.Series(name=carrier, data={"marginal_cost": 0}), - ] - ) + marginal_costs.at[carrier, "marginal_cost"] = 0 if warning: print( f"""There are not marginal_cost values for: \n{warning} @@ -240,10 +235,10 @@ def numpy_nan(data): def power_timeser(weather_data): - if len(set(weather_data)) <= 1: - return weather_data.iloc[0] - else: + if weather_data.isna().any(): return -1 + else: + return weather_data.iloc[0] def adjust_renew_feedin_table(renew_feedin, cfg): From cdf347e4618facc266f106a06127524aaab1c483 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 15 Feb 2024 16:58:16 +0100 Subject: [PATCH 693/787] fix concat fill etrago loads --- src/egon/data/datasets/electricity_demand_etrago.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_etrago.py b/src/egon/data/datasets/electricity_demand_etrago.py index a52f521ad..caec72cd4 100644 --- a/src/egon/data/datasets/electricity_demand_etrago.py +++ b/src/egon/data/datasets/electricity_demand_etrago.py @@ -31,16 +31,12 @@ def demands_per_bus(scenario): # Select data on CTS electricity demands per bus cts_curves = db.select_dataframe( - f"""SELECT bus_id, p_set FROM + f"""SELECT bus_id AS bus, p_set FROM {sources['cts_curves']['schema']}. {sources['cts_curves']['table']} WHERE scn_name = '{scenario}'""", - index_col="bus_id", ) - # Rename index - cts_curves.index.rename("bus", inplace=True) - # Select data on industrial demands assigned to osm landuse areas ind_curves_osm = db.select_dataframe( @@ -48,7 +44,6 @@ def demands_per_bus(scenario): {sources['osm_curves']['schema']}. {sources['osm_curves']['table']} WHERE scn_name = '{scenario}'""", - index_col="bus", ) # Select data on industrial demands assigned to industrial sites @@ -58,17 +53,15 @@ def demands_per_bus(scenario): {sources['sites_curves']['schema']}. {sources['sites_curves']['table']} WHERE scn_name = '{scenario}'""", - index_col="bus", ) # Select data on household electricity demands per bus hh_curves = db.select_dataframe( - f"""SELECT bus_id, p_set FROM + f"""SELECT bus_id AS bus, p_set FROM {sources['household_curves']['schema']}. {sources['household_curves']['table']} WHERE scn_name = '{scenario}'""", - index_col="bus_id", ) # Create one df by appending all imported dataframes @@ -76,7 +69,7 @@ def demands_per_bus(scenario): demand_curves = pd.concat( [cts_curves, ind_curves_osm, ind_curves_sites, hh_curves], ignore_index=True, - ) + ).set_index("bus") # Split array to single columns in the dataframe demand_curves_split = demand_curves From 427c892159b8f71c437f8c69ac7ddcbd4169ecbd Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 15 Feb 2024 16:19:04 +0100 Subject: [PATCH 694/787] include biomass into carrier dic --- src/egon/data/datasets/scenario_capacities.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/scenario_capacities.py b/src/egon/data/datasets/scenario_capacities.py index b46ac6e49..2e9b02153 100755 --- a/src/egon/data/datasets/scenario_capacities.py +++ b/src/egon/data/datasets/scenario_capacities.py @@ -442,6 +442,7 @@ def map_carrier(): "Kernenergie": "nuclear", "Pumpspeicher": "pumped_hydro", "Mineralöl-\nProdukte": "oil", + "Biomasse": "biomass", } ) From 8ecc530c4272a90bda7e431954a04cbe9093fbfe Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 15 Feb 2024 14:01:43 +0100 Subject: [PATCH 695/787] include biomass CHP generators --- src/egon/data/datasets/chp/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 1a5329717..bf2d0f59b 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -322,6 +322,12 @@ def insert_chp_statusquo(): WORKING_DIR_MASTR_NEW / "bnetza_mastr_combustion_cleaned.csv" ) + mastr_biomass = pd.read_csv( + WORKING_DIR_MASTR_NEW / "bnetza_mastr_biomass_cleaned.csv" + ) + + mastr = pd.concat([mastr, mastr_biomass]).reset_index(drop=True) + mastr = mastr.loc[mastr.ThermischeNutzleistung > 0] mastr = mastr.loc[ @@ -333,6 +339,7 @@ def insert_chp_statusquo(): "nicht biogener Abfall", "Braunkohle", "Steinkohle", + "Biomasse", ] ) ] From 611a3f35a755ebb8c833e37f615102e28d701818 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 15 Feb 2024 13:33:08 +0100 Subject: [PATCH 696/787] add new dependency to etrago_loads task --- src/egon/data/airflow/dags/pipeline_status_quo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index fd93b7399..488d0b38d 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -284,6 +284,7 @@ cts_electricity_demand_annual, demand_curves_industry, hh_demand_buildings_setup, + household_electricity_demand_annual, ] ) From c1df65cf336511e98610ab91b2ed7712788c8c4e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 21 Feb 2024 17:54:10 +0100 Subject: [PATCH 697/787] Bump version number of ElectricalLoadEtrago --- src/egon/data/datasets/electricity_demand_etrago.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand_etrago.py b/src/egon/data/datasets/electricity_demand_etrago.py index caec72cd4..5c21efde5 100644 --- a/src/egon/data/datasets/electricity_demand_etrago.py +++ b/src/egon/data/datasets/electricity_demand_etrago.py @@ -264,7 +264,7 @@ class ElectricalLoadEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="Electrical_load_etrago", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=(export_to_db,), ) From 61bd008ef8b293567d9647b7820e46de51f6f995 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 13 Feb 2024 09:35:43 +0100 Subject: [PATCH 698/787] bump demandregio version --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index ef8b384d2..83dfc38e1 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -35,7 +35,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=( clone_and_install, From e7377b17bded78a272feb46c29186be7ff3962d3 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Mon, 15 Jan 2024 15:10:06 -0500 Subject: [PATCH 699/787] add parameter ousehold-demand-source to cli --- src/egon/data/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/egon/data/cli.py b/src/egon/data/cli.py index ba66f006a..065739596 100644 --- a/src/egon/data/cli.py +++ b/src/egon/data/cli.py @@ -99,6 +99,15 @@ ), show_default=True, ) +@click.option( + "--household-demand-source", + type=click.Choice(["IEE", "demand-regio"]), + default="demand-regio", + help=( + "Choose the source to calculate and allocate household demands." + ), + show_default=True, +) @click.option( "--jobs", default=1, From 5ad85c112b8a79d9a7428c1761d373c66f0f83f0 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 23 Jan 2024 15:46:36 +0100 Subject: [PATCH 700/787] download and import HH timeseries demand data --- .../data/datasets/demandregio/__init__.py | 80 ++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 83dfc38e1..351bc67b1 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -22,7 +22,7 @@ import egon.data.datasets.scenario_parameters.parameters as scenario_parameters try: - from disaggregator import config, data, spatial + from disaggregator import config, data, spatial, temporal except ImportError as e: pass @@ -48,6 +48,14 @@ def __init__(self, dependencies): ), ) +class DemandRegioLoadProfiles(Base): + __tablename__ = "demandregio_household_load_profiles" + __table_args__ = {"schema": "demand"} + + id = Column(Integer, primary_key=True) + year = Column(Integer) + nuts3 = Column(String) + load_in_mwh = Column(ARRAY(Float())) class EgonDemandRegioHH(Base): __tablename__ = "egon_demandregio_hh" @@ -471,6 +479,56 @@ def disagg_households_power( return df +def write_demandregio_hh_profiles_to_db(hh_profiles): + """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 + + Returns + ------- + """ + years = hh_profiles.index.year.unique().values + df_to_db = pd.DataFrame(columns=["id", "year", "nuts3", "load_in_mwh"]).set_index("id") + dataset = egon.data.config.settings()["egon-data"]["--dataset-boundary"] + + if dataset == "Schleswig-Holstein": + hh_profiles = hh_profiles.loc[ + :, hh_profiles.columns.str.contains("DEF0")] + + id = 0 + for year in years: + df = hh_profiles[hh_profiles.index.year == year] + for nuts3 in hh_profiles.columns: + id+=1 + df_to_db.at[id, "year"] = year + df_to_db.at[id, "nuts3"] = nuts3 + df_to_db.at[id, "load_in_mwh"] = df[nuts3].to_list() + + df_to_db["year"] = df_to_db["year"].apply(int) + df_to_db["nuts3"] = df_to_db["nuts3"].astype(str) + df_to_db["load_in_mwh"] = df_to_db["load_in_mwh"].apply(list) + df_to_db = df_to_db.reset_index() + + DemandRegioLoadProfiles.__table__.drop(bind=db.engine(), checkfirst=True) + DemandRegioLoadProfiles.__table__.create(bind=db.engine()) + + df_to_db.to_sql( + name=DemandRegioLoadProfiles.__table__.name, + schema=DemandRegioLoadProfiles.__table__.schema, + con=db.engine(), + if_exists="append", + index=-False, + ) + + return def insert_hh_demand(scenario, year, engine): """Calculates electrical demands of private households using demandregio's @@ -511,6 +569,26 @@ def insert_hh_demand(scenario, year, engine): if_exists="append", ) + # insert housholds demand timeseries + try: + hh_load_timeseries = ( + temporal.disagg_temporal_power_housholds_slp( + use_nuts3code=True, + by="households", + weight_by_income=False, + year=year, + ) + .resample("h") + .sum() + ) + except: + logger.info("HH demand timeseries could not be imported. Using BK") + hh_load_timeseries = pd.read_pickle( + "demandregio_dbdump/df_load_profiles.pkl" + ) + + write_demandregio_hh_profiles_to_db(hh_load_timeseries) + def insert_cts_ind(scenario, year, engine, target_values): """Calculates electrical demands of CTS and industry using demandregio's From 2b713a0382ef58d510d5224d76b0969bafa79e12 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 21 Feb 2024 18:04:45 +0100 Subject: [PATCH 701/787] Import logger --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 351bc67b1..cc6caa965 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -9,7 +9,7 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import db, logger from egon.data.datasets import Dataset from egon.data.datasets.demandregio.install_disaggregator import ( clone_and_install, From 76ce6ea43bb7c68f8ee563c1cf9b579251fe1195 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 21 Feb 2024 18:05:00 +0100 Subject: [PATCH 702/787] Remove try/except and pickle alternative --- .../data/datasets/demandregio/__init__.py | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index cc6caa965..f07149969 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -570,22 +570,16 @@ def insert_hh_demand(scenario, year, engine): ) # insert housholds demand timeseries - try: - hh_load_timeseries = ( - temporal.disagg_temporal_power_housholds_slp( - use_nuts3code=True, - by="households", - weight_by_income=False, - year=year, - ) - .resample("h") - .sum() - ) - except: - logger.info("HH demand timeseries could not be imported. Using BK") - hh_load_timeseries = pd.read_pickle( - "demandregio_dbdump/df_load_profiles.pkl" + hh_load_timeseries = ( + temporal.disagg_temporal_power_housholds_slp( + use_nuts3code=True, + by="households", + weight_by_income=False, + year=year, ) + .resample("h") + .sum() + ) write_demandregio_hh_profiles_to_db(hh_load_timeseries) From 3f84c04b7eb8d095528e38109ec48776bbc334bf Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Thu, 25 Jan 2024 15:49:44 +0100 Subject: [PATCH 703/787] adjust mv_grid_district_HH_electricity_load --- .../hh_profiles.py | 121 ++++++++++++++---- 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 67aa44014..1f3b3937c 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -1759,16 +1759,39 @@ def get_hh_profiles_from_db(profile_ids): return df_profile_loads +def get_demand_regio_hh_profiles_from_db(year): + """ + Retrieve demand regio household electricity demand profiles in nuts3 level + + Parameters + ---------- + year: int + To which year belong the required demand profile + + Returns + ------- + pd.DataFrame + Selection of household demand profiles + """ + + query = """Select * from demand.demandregio_household_load_profiles + Where year = year""" + + df_profile_loads = pd.read_sql( + query, db.engine(), index_col="id" + ) + + return df_profile_loads def mv_grid_district_HH_electricity_load( - scenario_name, scenario_year, drop_table=False + scenario_name, scenario_year, drop_table ): """ Aggregated household demand time series at HV/MV substation level Calculate the aggregated demand time series based on the demand profiles of each zensus cell inside each MV grid district. Profiles are read from - local hdf5-file. + local hdf5-file or demand timeseries per nuts3 in db. Parameters ---------- @@ -1807,33 +1830,82 @@ def tuple_format(x): cells_query.statement, cells_query.session.bind, index_col="cell_id" ) - # convert profile ids to tuple (type, id) format - cells["cell_profile_ids"] = cells["cell_profile_ids"].apply( - lambda x: list(map(tuple_format, x)) - ) + method = egon.data.config.settings()["egon-data"][ + "--household-demand-source" + ] - # Read demand profiles from egon-data-bundle - df_iee_profiles = get_iee_hh_demand_profiles_raw() + if method == "demand_regio": + #Import demand regio timeseries demand per nuts3 area + dr_series = pd.read_sql_query(""" + SELECT year, nuts3, load_in_mwh FROM demand.demandregio_household_load_profiles + """, + con = engine + ) + dr_series = dr_series[dr_series["year"] == scenario_year] + dr_series.drop(columns=["year"], inplace=True) + dr_series.set_index("nuts3", inplace=True) + dr_series = dr_series.squeeze() + + #Population data per cell_id is used to scale the demand per nuts3 + population = pd.read_sql_query(""" + SELECT grid_id, population FROM society.destatis_zensus_population_per_ha + """, + con = engine + ) + population.set_index("grid_id", inplace=True) + population = population.squeeze() + population.loc[population==-1] = 0 - # Process profiles for further use - df_iee_profiles = set_multiindex_to_profiles(df_iee_profiles) + cells["population"] = cells["grid_id"].map(population) + + factor_column = f"""factor_{scenario_year}""" - # Create aggregated load profile for each MV grid district - mvgd_profiles_dict = {} - for grid_district, data in cells.groupby("bus_id"): - mvgd_profile = get_load_timeseries( - df_iee_profiles=df_iee_profiles, - df_hh_profiles_in_census_cells=data, - cell_ids=data.index, - year=scenario_year, - peak_load_only=False, + mvgd_profiles = pd.DataFrame( + columns=["p_set", "q_set"], index=cells.bus_id.unique() ) - mvgd_profiles_dict[grid_district] = [mvgd_profile.round(3).to_list()] - mvgd_profiles = pd.DataFrame.from_dict(mvgd_profiles_dict, orient="index") + mvgd_profiles.index.name = "bus_id" - # Reshape data: put MV grid ids in columns to a single index column - mvgd_profiles = mvgd_profiles.reset_index() - mvgd_profiles.columns = ["bus_id", "p_set"] + for nuts3, df in cells.groupby("nuts3"): + cells.loc[df.index, factor_column] = df["population"] / df["population"].sum() + + for bus, df_bus in cells.groupby("bus_id"): + load_nuts = [0] * 8760 + for nuts3, df_nuts in df_bus.groupby("nuts3"): + factor_nuts = df_nuts[factor_column].sum() + total_load = [x * factor_nuts for x in dr_series[nuts3]] + load_nuts = [sum(x) for x in zip(load_nuts, total_load)] + mvgd_profiles.at[bus, "p_set"] = load_nuts + + mvgd_profiles.reset_index(inplace=True) + + elif method == "IEE": + # convert profile ids to tuple (type, id) format + cells["cell_profile_ids"] = cells["cell_profile_ids"].apply( + lambda x: list(map(tuple_format, x)) + ) + + # Read demand profiles from egon-data-bundle + df_iee_profiles = get_iee_hh_demand_profiles_raw() + + # Process profiles for further use + df_iee_profiles = set_multiindex_to_profiles(df_iee_profiles) + + # Create aggregated load profile for each MV grid district + mvgd_profiles_dict = {} + for grid_district, data in cells.groupby("bus_id"): + mvgd_profile = get_load_timeseries( + df_iee_profiles=df_iee_profiles, + df_hh_profiles_in_census_cells=data, + cell_ids=data.index, + year=scenario_year, + peak_load_only=False, + ) + mvgd_profiles_dict[grid_district] = [mvgd_profile.round(3).to_list()] + mvgd_profiles = pd.DataFrame.from_dict(mvgd_profiles_dict, orient="index") + + # Reshape data: put MV grid ids in columns to a single index column + mvgd_profiles = mvgd_profiles.reset_index() + mvgd_profiles.columns = ["bus_id", "p_set"] # Add remaining columns mvgd_profiles["scn_name"] = scenario_name @@ -1856,7 +1928,6 @@ def tuple_format(x): index=False, ) - def get_scaled_profiles_from_db( attribute, list_of_identifiers, year, aggregate=True, peak_load_only=False ): From e171760e9e9b39a31b96e5164fb3cf4aa62051a4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 22 Feb 2024 00:06:02 +0100 Subject: [PATCH 704/787] Fix method name --- .../data/datasets/electricity_demand_timeseries/hh_profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 1f3b3937c..54c25957a 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -1834,7 +1834,7 @@ def tuple_format(x): "--household-demand-source" ] - if method == "demand_regio": + if method == "demand-regio": #Import demand regio timeseries demand per nuts3 area dr_series = pd.read_sql_query(""" SELECT year, nuts3, load_in_mwh FROM demand.demandregio_household_load_profiles From d0568667dc1f019d7039fb55f0aa6baff2410982 Mon Sep 17 00:00:00 2001 From: CarlosEpia Date: Tue, 30 Jan 2024 22:11:25 +0100 Subject: [PATCH 705/787] Remap nuts3 codes --- src/egon/data/datasets/demandregio/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index f07149969..969195148 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -580,6 +580,8 @@ def insert_hh_demand(scenario, year, engine): .resample("h") .sum() ) + hh_load_timeseries.rename( + columns={"DEB16": "DEB1C", "DEB19": "DEB1D"}, inplace=True) write_demandregio_hh_profiles_to_db(hh_load_timeseries) From 9439875b0cfd5335217fc67ba8b055111f70c158 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 22 Feb 2024 00:12:34 +0100 Subject: [PATCH 706/787] Remove hardcoded status2021 demandregio demand timeseries --- src/egon/data/datasets/demandregio/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 969195148..2a0b03878 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -669,8 +669,6 @@ def insert_household_demand(): scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] - scenarios.append("eGon2021") - for t in targets: db.execute_sql( f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};" From bdd2f910c5ebd89b96c93be162173b87672f99f6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 22 Feb 2024 00:51:55 +0100 Subject: [PATCH 707/787] Remove gitmerge relict --- src/egon/data/datasets/chp/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/egon/data/datasets/chp/__init__.py b/src/egon/data/datasets/chp/__init__.py index 43e50f7d2..a5f5ada80 100644 --- a/src/egon/data/datasets/chp/__init__.py +++ b/src/egon/data/datasets/chp/__init__.py @@ -1,4 +1,3 @@ -<<<<<<< HEAD """ The central module containing all code dealing with combined heat and power (CHP) plants. From 5c634d973ab865427f67ee5977d97afb2fbe8d2a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 23 Feb 2024 13:58:43 +0100 Subject: [PATCH 708/787] Use pickled profiles if FFE doesnt work --- .../data/datasets/demandregio/__init__.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 8637de033..4b05f7a9e 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -594,18 +594,26 @@ def insert_hh_demand(scenario, year, engine): ) # insert housholds demand timeseries - hh_load_timeseries = ( - temporal.disagg_temporal_power_housholds_slp( - use_nuts3code=True, - by="households", - weight_by_income=False, - year=year, + try: + hh_load_timeseries = ( + temporal.disagg_temporal_power_housholds_slp( + use_nuts3code=True, + by="households", + weight_by_income=False, + year=year, + ) + .resample("h") + .sum() ) - .resample("h") - .sum() - ) - hh_load_timeseries.rename( - columns={"DEB16": "DEB1C", "DEB19": "DEB1D"}, inplace=True) + hh_load_timeseries.rename( + columns={"DEB16": "DEB1C", "DEB19": "DEB1D"}, inplace=True) + except Exception as e: + logger.warning(f"Couldnt get profiles from FFE, will use pickeld fallback! \n {e}") + hh_load_timeseries = pd.read_pickle(Path(".", "df_load_profiles.pkl").resolve()) + + def change_year(dt, year): + return dt.replace(year=year) + hh_load_timeseries.index = hh_load_timeseries.index.map(lambda dt: change_year(dt, year)) write_demandregio_hh_profiles_to_db(hh_load_timeseries) From f0b2de0d99bed451b57a7291ffc21f5351d094f3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 23 Feb 2024 15:29:32 +0100 Subject: [PATCH 709/787] Adhoc fix year for status2023 --- src/egon/data/datasets/demandregio/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 4b05f7a9e..1c7766dd3 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -613,6 +613,8 @@ def insert_hh_demand(scenario, year, engine): def change_year(dt, year): return dt.replace(year=year) + + year = 2023 if scenario == "status2023" else year # TODO status2023 hh_load_timeseries.index = hh_load_timeseries.index.map(lambda dt: change_year(dt, year)) write_demandregio_hh_profiles_to_db(hh_load_timeseries) From 5857364185c72ab1ec34c1f0d35ffc95eac70488 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:15:00 +0100 Subject: [PATCH 710/787] Remove slow functions --- .../power_plants/assign_weather_data.py | 160 ------------------ 1 file changed, 160 deletions(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 8e0fd352a..265fc85f1 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -1,11 +1,6 @@ -import json - import geopandas as gpd -import pandas as pd -from shapely.geometry import Polygon from egon.data import db -import egon.data.config def assign_bus_id(power_plants, cfg): @@ -73,160 +68,5 @@ def assign_bus_id(power_plants, cfg): return power_plants -def weatherId_and_busId(): - power_plants, cfg, con = find_weather_id() - power_plants = find_bus_id(power_plants, cfg) - write_power_plants_table(power_plants, cfg, con) - - -def find_bus_id(power_plants, cfg): - # Define bus_id for power plants without it - power_plants_no_busId = power_plants[power_plants.bus_id.isna()] - power_plants = power_plants[~power_plants.bus_id.isna()] - - power_plants_no_busId = power_plants_no_busId.drop(columns="bus_id") - - if len(power_plants_no_busId) > 0: - power_plants_no_busId = assign_bus_id(power_plants_no_busId, cfg) - - power_plants = pd.concat([power_plants, power_plants_no_busId]) - - return power_plants - - -def find_weather_id(): - """ - Assign weather data to the weather dependant generators (wind and solar) - - Parameters - ---------- - *No parameters required - """ - - # Connect to the data base - con = db.engine() - - cfg = egon.data.config.datasets()["weather_BusID"] - - # Import table with power plants - sql = f""" - SELECT * FROM - {cfg['sources']['power_plants']['schema']}. - {cfg['sources']['power_plants']['table']} - """ - power_plants = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="geom" - ) - - # select the power_plants that are weather dependant (wind offshore is - # not included here, because it alredy has weather_id assigned) - power_plants = power_plants[ - (power_plants["carrier"] == "solar") - | (power_plants["carrier"] == "wind_onshore") - | (power_plants["carrier"] == "solar_rooftop") - | (power_plants["carrier"] == "wind_offshore") - ] - power_plants.set_index("id", inplace=True) - - # Import table with weather data for each technology - sql = f""" - SELECT * FROM - {cfg['sources']['renewable_feedin']['schema']}. - {cfg['sources']['renewable_feedin']['table']} - """ - weather_data = pd.read_sql_query(sql, con) - weather_data.set_index("w_id", inplace=True) - - # Import weather cells with Id to match with the weather data - sql = f""" - SELECT * FROM - {cfg['sources']['weather_cells']['schema']}. - {cfg['sources']['weather_cells']['table']} - """ - weather_cells = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="geom" - ) - - # import Germany borders to speed up the matching process - sql = "SELECT * FROM boundaries.vg250_sta" - sql = f""" - SELECT * FROM - {cfg['sources']['boundaries']['schema']}. - {cfg['sources']['boundaries']['table']} - """ - boundaries = gpd.GeoDataFrame.from_postgis( - sql, con, crs="EPSG:4326", geom_col="geometry" - ) - - baltic_sea = Polygon([(11, 56), (11, 53), (15, 53), (15, 56)]) - north_sea = Polygon([(5, 56), (5, 53), (9, 53), (9, 56)]) - - boundaries.loc["baltic_sea", "geometry"] = baltic_sea - boundaries.loc["north_sea", "geometry"] = north_sea - - # Clip weater data cells using the German boundaries - weather_cells = gpd.clip(weather_cells, boundaries) - - for weather_id in weather_cells["w_id"]: - df = gpd.clip( - power_plants, weather_cells[weather_cells["w_id"] == weather_id] - ) - power_plant_list = df.index.to_list() - power_plants.loc[power_plant_list, "weather_cell_id"] = weather_id - - return (power_plants, cfg, con) - -def write_power_plants_table(power_plants, cfg, con): - # delete weather dependent power_plants from supply.egon_power_plants - db.execute_sql( - f""" - DELETE FROM {cfg['sources']['power_plants']['schema']}. - {cfg['sources']['power_plants']['table']} - WHERE carrier IN ('wind_onshore', 'solar', 'solar_rooftop', 'wind_offshore') - """ - ) - - # assert that the column "bus_id" is set as integer - power_plants["bus_id"] = power_plants["bus_id"].apply( - lambda x: pd.NA if pd.isna(x) else int(x) - ) - - # assert that the column "weather_cell_id" is set as integer - power_plants["weather_cell_id"] = power_plants["weather_cell_id"].apply( - lambda x: pd.NA if pd.isna(x) else int(x) - ) - - # Look for the maximum id in the table egon_power_plants sql = f""" - SELECT MAX(id) FROM - {cfg['sources']['power_plants']['schema']}. - {cfg['sources']['power_plants']['table']} - """ - max_id = pd.read_sql(sql, con) - max_id = max_id["max"].iat[0] - if max_id is None: - ini_id = 1 - else: - ini_id = int(max_id + 1) - - # write_table in egon-data database: - # Reset index - power_plants.index = pd.RangeIndex( - start=ini_id, stop=ini_id + len(power_plants), name="id" - ) - - # Set json format - for i in power_plants.index: - power_plants.sources[i] = json.dumps(power_plants.sources[i]) - power_plants.source_id[i] = json.dumps(power_plants.source_id[i]) - - # Insert into database - power_plants.reset_index().to_postgis( - name=f"{cfg['sources']['power_plants']['table']}", - schema=f"{cfg['sources']['power_plants']['schema']}", - con=con, - if_exists="append", - ) - - return "Bus_id and Weather_id were updated succesfully" From ab99a66e5fde8cafd01479f02e9e02c6e48d2734 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:16:01 +0100 Subject: [PATCH 711/787] Add function to assign missing buses --- .../power_plants/assign_weather_data.py | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index 265fc85f1..fbe3c9edc 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -68,5 +68,46 @@ def assign_bus_id(power_plants, cfg): return power_plants +def add_missing_bus_ids(scn_name): + """Assign busses by spatal intersection of mvgrid districts or ehv voronois.""" sql = f""" + -- Assign missing buses to mv grid district buses for HV and below + UPDATE supply.egon_power_plants AS epp + SET bus_id = ( + SELECT emgd.bus_id + FROM grid.egon_mv_grid_district AS emgd + WHERE ST_Intersects(epp.geom, emgd.geom) + ORDER BY emgd.geom <-> epp.geom + LIMIT 1 + ) + WHERE (epp.carrier = 'solar' + OR epp.carrier = 'wind_onshore' + OR epp.carrier = 'solar_rooftop' + OR epp.carrier = 'wind_offshore') + AND epp.scenario = '{scn_name}' + AND epp.bus_id is null + AND epp.voltage_level >= 3; -- HV and below + + + -- Assign missing buses to EHV buses for EHV + UPDATE supply.egon_power_plants AS epp + SET bus_id2 = ( + SELECT eesv.bus_id + FROM grid.egon_ehv_substation_voronoi AS eesv + WHERE ST_Intersects(epp.geom, eesv.geom) + ORDER BY eesv.geom <-> epp.geom + LIMIT 1 + ) + WHERE (epp.carrier = 'solar' + OR epp.carrier = 'wind_onshore' + OR epp.carrier = 'solar_rooftop' + OR epp.carrier = 'wind_offshore') + AND epp.scenario = '{scn_name}' + AND epp.bus_id is null + AND epp.voltage_level < 3; --EHV + + + """ + + db.execute_sql(sql) From a42c002d1f812f477533722868d77b8c8ee098c8 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:16:31 +0100 Subject: [PATCH 712/787] Add function to assign weather id --- .../power_plants/assign_weather_data.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index fbe3c9edc..ad80ad73e 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -111,3 +111,25 @@ def add_missing_bus_ids(scn_name): """ db.execute_sql(sql) + + +def find_weather_id(scn_name): + + sql = f"""UPDATE supply.egon_power_plants AS epp + SET weather_cell_id = ( + SELECT eewc.w_id + FROM supply.egon_era5_weather_cells AS eewc + WHERE ST_Intersects(epp.geom, eewc.geom) + ORDER BY eewc.geom <-> epp.geom + LIMIT 1 + ) + WHERE (epp.carrier = 'solar' + OR epp.carrier = 'solar_rooftop' + OR epp.carrier = 'wind_onshore' + OR epp.carrier = 'wind_offshore') + AND epp.scenario = '{scn_name}'; + """ + + db.execute_sql(sql) + + From 747b59a7c3c1c72a97a95c0f968e336f9c8afab7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:17:07 +0100 Subject: [PATCH 713/787] Add function to combine both --- src/egon/data/datasets/power_plants/assign_weather_data.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index ad80ad73e..d95f3b46d 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -133,3 +133,6 @@ def find_weather_id(scn_name): db.execute_sql(sql) +def weatherId_and_busId(scn_name): + find_weather_id(scn_name) + add_missing_bus_ids(scn_name) From 6ffcdd717ddf0be2c74ea79cd5c13c05d6e9b3a0 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:17:30 +0100 Subject: [PATCH 714/787] Integrate task --- src/egon/data/datasets/power_plants/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 801abb39f..37b6370ba 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -13,7 +13,7 @@ import pandas as pd from egon.data import db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.mastr import ( WORKING_DIR_MASTR_NEW, WORKING_DIR_MASTR_OLD, @@ -1256,9 +1256,13 @@ def fill_missing_bus_and_geom(gens, carrier): geocode_mastr_data, pv_rooftop_to_buildings, wind_offshore.insert, - assign_weather_data.weatherId_and_busId, ) +for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks += (wrapped_partial(assign_weather_data.weatherId_and_busId, + scn_name=scn_name, + postfix=f"_{scn_name}"),) + class PowerPlants(Dataset): def __init__(self, dependencies): From 77d9e4ac66b0e88c0ce09dd9a86ba90c3dc463c4 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:17:49 +0100 Subject: [PATCH 715/787] Bump version of PowerPlants to 0.0.23 --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 37b6370ba..09b54acce 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1268,7 +1268,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.22", + version="0.0.23", dependencies=dependencies, tasks=tasks, ) From 09e63a50418d30fe2c299c58f1a5f001cb76c195 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:21:08 +0100 Subject: [PATCH 716/787] Add timer to functions --- src/egon/data/datasets/power_plants/assign_weather_data.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index d95f3b46d..b3a8270f1 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -1,6 +1,7 @@ import geopandas as gpd from egon.data import db +from egon.data.datasets.power_plants.pv_rooftop_buildings import timer_func def assign_bus_id(power_plants, cfg): @@ -68,6 +69,7 @@ def assign_bus_id(power_plants, cfg): return power_plants +@timer_func def add_missing_bus_ids(scn_name): """Assign busses by spatal intersection of mvgrid districts or ehv voronois.""" @@ -113,6 +115,7 @@ def add_missing_bus_ids(scn_name): db.execute_sql(sql) +@timer_func def find_weather_id(scn_name): sql = f"""UPDATE supply.egon_power_plants AS epp From 040d6cb63eac0129cfec537a8b177a62f025a6c8 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:28:44 +0100 Subject: [PATCH 717/787] Adhoc remove postfix --- src/egon/data/datasets/power_plants/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 09b54acce..5bd19b268 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1261,7 +1261,8 @@ def fill_missing_bus_and_geom(gens, carrier): for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: tasks += (wrapped_partial(assign_weather_data.weatherId_and_busId, scn_name=scn_name, - postfix=f"_{scn_name}"),) + # postfix=f"_{scn_name}" + ),) class PowerPlants(Dataset): From 756dc9561b571b458cf734d1b523b4b909fc10f6 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 29 Feb 2024 17:36:11 +0100 Subject: [PATCH 718/787] Fix bug bus_id2 --- src/egon/data/datasets/power_plants/assign_weather_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/assign_weather_data.py b/src/egon/data/datasets/power_plants/assign_weather_data.py index b3a8270f1..38e3f80ae 100644 --- a/src/egon/data/datasets/power_plants/assign_weather_data.py +++ b/src/egon/data/datasets/power_plants/assign_weather_data.py @@ -94,7 +94,7 @@ def add_missing_bus_ids(scn_name): -- Assign missing buses to EHV buses for EHV UPDATE supply.egon_power_plants AS epp - SET bus_id2 = ( + SET bus_id = ( SELECT eesv.bus_id FROM grid.egon_ehv_substation_voronoi AS eesv WHERE ST_Intersects(epp.geom, eesv.geom) From 5dcd280b82be47ee8db15ea0c2e6b7e7ec72395e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 1 Mar 2024 11:11:56 +0100 Subject: [PATCH 719/787] Fix marginal costs 0 assignement --- src/egon/data/datasets/fill_etrago_gen.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index 875bcff49..e1065f6f3 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -104,12 +104,7 @@ def add_marginal_costs(power_plants): for carrier in pp_scn.carrier.unique(): if carrier not in (marginal_costs.index): warning.append(carrier) - marginal_costs = pd.concat( - [ - marginal_costs, - pd.Series(name=carrier, data={"marginal_cost": 0}), - ] - ) + marginal_costs.at[carrier, "marginal_cost"] = 0 if warning: print( f"""There are not marginal_cost values for: \n{warning} From f7b5bca8485916bf05a30f8f3ca7cab6206a9685 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 1 Mar 2024 11:12:31 +0100 Subject: [PATCH 720/787] Bump version of Egon_etrago_gen to 0.0.10 --- src/egon/data/datasets/fill_etrago_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index e1065f6f3..920454f5b 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -12,7 +12,7 @@ class Egon_etrago_gen(Dataset): def __init__(self, dependencies): super().__init__( name="etrago_generators", - version="0.0.9", + version="0.0.10", dependencies=dependencies, tasks=(fill_etrago_generators,), ) From 3b5e22086e33843a637e6a6375fec5eefd2644ca Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 31 Jan 2024 18:18:56 +0100 Subject: [PATCH 721/787] Add function to derive scenario year from name --- .../data/datasets/scenario_parameters/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 3133fc287..d38f5dbab 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -45,6 +45,19 @@ def create_table(): EgonScenario.__table__.create(bind=engine, checkfirst=True) +def get_scenario_year(scenario_name): + """Derives scenarios year from scenario name. Scenario + eGon100RE is an exception as year is not in the name.""" + try: + year = int(scenario_name[-4:]) + except ValueError as e: + if e.args[0] == "invalid literal for int() with base 10: '00RE'": + year = 2050 # eGon100RE + else: + raise ValueError("The names of the scenarios do not end with the year!") + return year + + def insert_scenarios(): """Insert scenarios and their parameters to scenario table From 66443a77153b9fe532ceb9a110d7fb5e80094688 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 1 Mar 2024 17:52:12 +0100 Subject: [PATCH 722/787] Fix peak_load retrival --- .../data/datasets/power_plants/pv_rooftop_buildings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 729318bd9..aadd3f654 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -67,6 +67,7 @@ from egon.data.datasets.mastr import WORKING_DIR_MASTR_NEW from egon.data.datasets.power_plants.mastr import EgonPowerPlantsPv from egon.data.datasets.scenario_capacities import EgonScenarioCapacities +from egon.data.datasets.scenario_parameters import get_scenario_year from egon.data.datasets.zensus_vg250 import Vg250Gem engine = db.engine() @@ -980,10 +981,14 @@ def drop_buildings_outside_muns( def egon_building_peak_loads(): - sql = """ + + # use active scenario wich is closest to today + scenario = sorted(SCENARIOS, key=get_scenario_year)[0] + + sql = f""" SELECT building_id FROM demand.egon_building_electricity_peak_loads - WHERE scenario = 'eGon2035' + WHERE scenario = '{scenario}' """ return ( From 7af46e6e770ffec08ea3b23363b693a589beca4b Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Sun, 3 Mar 2024 23:00:53 +0100 Subject: [PATCH 723/787] Fast fix with dropna This might lead to further problems but will be tested anyways. Further three windparks are without geoms. --- src/egon/data/datasets/fill_etrago_gen.py | 56 +++++++++++++++++------ 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index 875bcff49..c7be82fe8 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -292,30 +292,56 @@ def delete_previuos_gen(cfg, con, etrago_gen_orig, power_plants): def set_timeseries(power_plants, renew_feedin): + """ + Create a function to calculate the feed-in timeseries for power plants. + + Parameters + ---------- + power_plants : DataFrame + A DataFrame containing information about power plants, including their bus IDs, + carriers, weather cell IDs, and electrical capacities. + renew_feedin : DataFrame + A DataFrame containing feed-in values for different carriers and weather cell IDs. + + Returns + ------- + function + A function that takes a power plant object and returns its feed-in value based on + either its direct weather cell ID or the aggregated feed-in of all power plants + connected to the same bus and having the same carrier. + """ + def timeseries(pp): + """Calculate the feed-in for a given power plant based on weather cell ID or aggregation.""" if pp.weather_cell_id != -1: - feedin_time = renew_feedin[ + # Directly fetch feed-in value for power plants with an associated weather cell ID + return renew_feedin.loc[ (renew_feedin["w_id"] == pp.weather_cell_id) - & (renew_feedin["carrier"] == pp.carrier) - ].feedin.iloc[0] - return feedin_time + & (renew_feedin["carrier"] == pp.carrier), + "feedin", + ].iat[0] else: - df = power_plants[ + # Aggregate feed-in for power plants without a direct weather cell association + df = power_plants.loc[ (power_plants["bus_id"] == pp.bus_id) & (power_plants["carrier"] == pp.carrier) - ] - total_int_cap = df.el_capacity.sum() - df["feedin"] = 0 + ].dropna(subset=["weather_cell_id"]) + + total_int_cap = df["el_capacity"].sum() + + # Fetch and calculate proportional feed-in for each power plant df["feedin"] = df.apply( - lambda x: renew_feedin[ + lambda x: renew_feedin.loc[ (renew_feedin["w_id"] == x.weather_cell_id) - & (renew_feedin["carrier"] == x.carrier) - ].feedin.iloc[0], + & (renew_feedin["carrier"] == x.carrier), + "feedin", + ].iat[0], axis=1, ) - df["feedin"] = df.apply( - lambda x: x.el_capacity / total_int_cap * x.feedin, axis=1 - ) - return df.feedin.sum() + + # Calculate and return aggregated feed-in based on electrical capacity + return df.apply( + lambda x: x["el_capacity"] / total_int_cap * x["feedin"], axis=1 + ).sum() return timeseries From 91829acb475c31a2f107793dbe5a88285e03bd61 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Sun, 3 Mar 2024 23:03:51 +0100 Subject: [PATCH 724/787] Bump version of egon_etrago_gen to 0.0.10 --- src/egon/data/datasets/fill_etrago_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index c7be82fe8..98f8bc5c1 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -12,7 +12,7 @@ class Egon_etrago_gen(Dataset): def __init__(self, dependencies): super().__init__( name="etrago_generators", - version="0.0.9", + version="0.0.10", dependencies=dependencies, tasks=(fill_etrago_generators,), ) From a0c0a5ac2259fb6fb40700fc5c9ee7519ea1eafd Mon Sep 17 00:00:00 2001 From: nesnoj Date: Mon, 4 Mar 2024 10:16:00 +0100 Subject: [PATCH 725/787] Use KBA 2021 dataset The 2023's version is incompatible with VG250/RS7 data, previous change: df511e862b5af6747f319eb706b79054d6955233 --- src/egon/data/datasets.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 3f34bf26c..5e6f74133 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -1118,9 +1118,9 @@ emobility_mit: file_processed: "regiostar-referenzdateien_preprocessed.csv" sheet: "ReferenzGebietsstand2020" KBA: - url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2023.xlsx?__blob=publicationFile&v=2" - file: "fz1_2023.xlsx" - file_processed: "fz1_2023_preprocessed.csv" + url: "https://www.kba.de/SharedDocs/Downloads/DE/Statistik/Fahrzeuge/FZ1/fz1_2021.xlsx?__blob=publicationFile&v=2" + file: "fz1_2021.xlsx" + file_processed: "fz1_2021_preprocessed.csv" sheet: "FZ1.1" columns: "D, J:N" skiprows: 8 From c8ec34ecbe4b12cc1f4147372c0197039680e342 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Mon, 4 Mar 2024 11:57:57 +0100 Subject: [PATCH 726/787] Bugfix: use 2023's emob params Without these params wrong scenario variation name and values are used and therefore not found when model timeseries are generated with 2023 variation (resulting in 0 EVs without throwing an error). --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 41d508314..86b86ec83 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -175,7 +175,7 @@ def insert_scenarios(): status2023.heat_parameters = parameters.heat(status2019.name) - status2023.mobility_parameters = parameters.mobility(status2019.name) + status2023.mobility_parameters = parameters.mobility(status2023.name) session.add(status2023) From d8c6c1166c008e92c13c1eb03c3088b1bd0d85fa Mon Sep 17 00:00:00 2001 From: nesnoj Date: Mon, 4 Mar 2024 12:21:12 +0100 Subject: [PATCH 727/787] Apply stricter tolerances for EV count tests. 0.1% instead of 5.0% --- .../emobility/motorized_individual_travel/ev_allocation.py | 2 +- .../datasets/emobility/motorized_individual_travel/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py index f4a6c93fc..3a2bea57b 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/ev_allocation.py @@ -631,7 +631,7 @@ def get_random_evs(row): np.testing.assert_allclose( int(ev_actual), ev_target, - rtol=0.05, + rtol=0.001, err_msg=f"Dataset on EV numbers allocated to MVGDs " f"seems to be flawed. " f"Scenario: [{scn}], " diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py b/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py index a992cdcf9..649aeaeda 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/tests.py @@ -30,6 +30,6 @@ def validate_electric_vehicles_numbers(dataset_name, ev_data, ev_target): assert_allclose( ev_data[[_ for _ in CONFIG_EV.keys()]].sum().sum(), ev_target, - rtol=0.05, + rtol=0.001, err_msg=f"Dataset on EV numbers [{dataset_name}] seems to be flawed.", ) From 7584e6f98d329aac9e302e3736d2c76d478095ca Mon Sep 17 00:00:00 2001 From: nesnoj Date: Mon, 4 Mar 2024 12:22:32 +0100 Subject: [PATCH 728/787] Bump emob dataset version to 0.0.10 --- .../datasets/emobility/motorized_individual_travel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index 8071fedf4..132aa104e 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -485,7 +485,7 @@ def generate_model_data_tasks(scenario_name): super().__init__( name="MotorizedIndividualTravel", - version="0.0.9", + version="0.0.10", dependencies=dependencies, tasks=tasks, ) From b18a352e83a9f4dc21edb063e1dc8d45577279e9 Mon Sep 17 00:00:00 2001 From: nesnoj Date: Mon, 4 Mar 2024 12:23:13 +0100 Subject: [PATCH 729/787] Bump scenario_parameters dataset version to 0.0.17 --- src/egon/data/datasets/scenario_parameters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/scenario_parameters/__init__.py b/src/egon/data/datasets/scenario_parameters/__init__.py index 86b86ec83..0c4b2b24e 100755 --- a/src/egon/data/datasets/scenario_parameters/__init__.py +++ b/src/egon/data/datasets/scenario_parameters/__init__.py @@ -281,7 +281,7 @@ class ScenarioParameters(Dataset): def __init__(self, dependencies): super().__init__( name="ScenarioParameters", - version="0.0.16", + version="0.0.17", dependencies=dependencies, tasks=( create_table, From c9f72023671f919dda3cc8122cd0681ab44452fd Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 09:57:46 +0100 Subject: [PATCH 730/787] Improve task generation --- .../data/datasets/electrical_neighbours.py | 42 ++++++++----------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b7f11987c..d86e78756 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1849,31 +1849,23 @@ def insert_loads_sq(scn_name="status2019"): insert_per_scenario = set() -if "eGon2035" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update([tyndp_generation, tyndp_demand]) - -if "status2019" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update( - [ - wrapped_partial( - insert_generators_sq, scn_name="status2019", postfix="_19" - ), - wrapped_partial( - insert_loads_sq, scn_name="status2019", postfix="_19" - ), - ] - ) -if "status2023" in config.settings()["egon-data"]["--scenarios"]: - insert_per_scenario.update( - [ - wrapped_partial( - insert_generators_sq, scn_name="status2023", postfix="_23" - ), - wrapped_partial( - insert_loads_sq, scn_name="status2023", postfix="_23" - ), - ] - ) +for scn_name in config.settings()["egon-data"]["--scenarios"]: + + if scn_name == "eGon2035": + insert_per_scenario.update([tyndp_generation, tyndp_demand]) + + if "status" in scn_name: + postfix = f"_{scn_name.split('status')[-1]}" + insert_per_scenario.update( + [ + wrapped_partial( + insert_generators_sq, scn_name=scn_name, postfix=postfix + ), + wrapped_partial( + insert_loads_sq, scn_name=scn_name, postfix=postfix + ), + ] + ) tasks = tasks + (insert_per_scenario,) From 8bd47f48aa9e92e4422f8623cd73fe8de6da1966 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:02:53 +0100 Subject: [PATCH 731/787] Improve data period detection --- src/egon/data/datasets/electrical_neighbours.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index d86e78756..74856bb36 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1552,11 +1552,9 @@ def insert_generators_sq(scn_name="status2019"): None. """ - - if scn_name == "status2019": - year_start_end = {"year_start": "20190101", "year_end": "20200101"} - elif scn_name == "status2023": - year_start_end = {"year_start": "20230101", "year_end": "20240101"} + if "status" in scn_name: + year = int(scn_name.split('status')[-1]) + year_start_end = {"year_start": f"{year}0101", "year_end": f"{year+1}0101"} else: raise ValueError("No valid scenario name!") From 21f2fc0a0c4374adcc3e8217aec3a2e23bb0e810 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:25:16 +0100 Subject: [PATCH 732/787] Improve code --- .../data/datasets/electrical_neighbours.py | 88 +++++++++---------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 74856bb36..d96b32f3e 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1558,7 +1558,7 @@ def insert_generators_sq(scn_name="status2019"): else: raise ValueError("No valid scenario name!") - gen_sq, not_retrieved = entsoe_historic_generation_capacities( + df_gen_sq, not_retrieved = entsoe_historic_generation_capacities( **year_start_end ) @@ -1569,25 +1569,20 @@ def insert_generators_sq(scn_name="status2019"): "./", "entsoe_data", f"gen_entsoe_{scn_name}.csv" ).resolve() if os.path.isfile(file_path): - gen_sq_backup = pd.read_csv(file_path, index_col="Index") - # check for missing columns in backup (former runs) - c_backup = [c for c in gen_sq_backup.columns if c in not_retrieved] - # remove columns, if found in backup - not_retrieved = [c for c in not_retrieved if c not in c_backup] - if c_backup: - gen_sq = pd.concat( - [gen_sq, gen_sq_backup.loc[:, c_backup]], axis=1 - ) - logger.info(f"Appended data from former runs for {c_backup}") - save_entsoe_data(gen_sq, file_path=file_path) + df_gen_sq, not_retrieved = fill_by_backup_data_from_former_runs( + df_gen_sq, file_path, not_retrieved) + save_entsoe_data(df_gen_sq, file_path=file_path) if not_retrieved: - logger.warning("Backup data from 2019 is used instead.") - gen_sq_backup = pd.read_csv( + logger.warning( + f"Backup data of 2019 is used instead for {not_retrieved}" + ) + df_gen_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" ) - - gen_sq = pd.concat([gen_sq, gen_sq_backup.loc[not_retrieved]], axis=1) + df_gen_sq = pd.concat( + [df_gen_sq, df_gen_sq_backup.loc[not_retrieved]], axis=1 + ) targets = config.datasets()["electrical_neighbours"]["targets"] # Delete existing data @@ -1619,18 +1614,18 @@ def insert_generators_sq(scn_name="status2019"): ) entsoe_to_bus = entsoe_to_bus_etrago(scn_name) carrier_entsoe = map_carriers_entsoe() - gen_sq = gen_sq.groupby(axis=1, by=carrier_entsoe).sum() + df_gen_sq = df_gen_sq.groupby(axis=1, by=carrier_entsoe).sum() # Filter generators modeled as storage and geothermal - gen_sq = gen_sq.loc[ - :, ~gen_sq.columns.isin(["Hydro Pumped Storage", "geo_thermal"]) + df_gen_sq = df_gen_sq.loc[ + :, ~df_gen_sq.columns.isin(["Hydro Pumped Storage", "geo_thermal"]) ] list_gen_sq = pd.DataFrame( dtype=int, columns=["carrier", "country", "capacity"] ) - for carrier in gen_sq.columns: - gen_carry = gen_sq[carrier] + for carrier in df_gen_sq.columns: + gen_carry = df_gen_sq[carrier] for country, cap in gen_carry.items(): gen = pd.DataFrame( {"carrier": carrier, "country": country, "capacity": cap}, @@ -1682,8 +1677,8 @@ def insert_generators_sq(scn_name="status2019"): AND scn_name = '{scn_name}') AND scn_name = '{scn_name}' """ - gen_sq = pd.read_sql_query(sql, db.engine()) - gen_sq = gen_sq[gen_sq.carrier.isin(renew_carriers_sq)] + df_gen_sq = pd.read_sql_query(sql, db.engine()) + df_gen_sq = df_gen_sq[df_gen_sq.carrier.isin(renew_carriers_sq)] sql = f""" SELECT * FROM {targets['generators']['schema']}.{targets['generators']['table']} @@ -1700,7 +1695,7 @@ def insert_generators_sq(scn_name="status2019"): # egon_sq_to_100 map the timeseries used in the scenario eGon100RE # to the same bus and carrier for the status quo scenario egon_sq_to_100 = {} - for i, gen in gen_sq.iterrows(): + for i, gen in df_gen_sq.iterrows(): gen_id_100 = gen_100[ (gen_100["bus"] == gen["bus"]) & (gen_100["carrier"] == gen["carrier"]) @@ -1711,7 +1706,7 @@ def insert_generators_sq(scn_name="status2019"): # insert generators_timeseries data session = sessionmaker(bind=db.engine())() - for gen_id in gen_sq.generator_id: + for gen_id in df_gen_sq.generator_id: serie = series_egon100[ series_egon100.generator_id == egon_sq_to_100[gen_id] ]["p_max_pu"].values[0] @@ -1724,6 +1719,19 @@ def insert_generators_sq(scn_name="status2019"): return +def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): + sq_backup = pd.read_csv(file_path, index_col="Index") + # check for missing columns in backup (former runs) + c_backup = [c for c in sq_backup.columns if c in not_retrieved] + # remove columns, if found in backup + not_retrieved = [c for c in not_retrieved if c not in c_backup] + if c_backup: + df_sq = pd.concat( + [df_sq, sq_backup.loc[:, c_backup]], axis=1 + ) + logger.info(f"Appended data from former runs for {c_backup}") + return df_sq, not_retrieved + def insert_loads_sq(scn_name="status2019"): """ @@ -1744,7 +1752,7 @@ def insert_loads_sq(scn_name="status2019"): else: raise ValueError("No valid scenario name!") - load_sq, not_retrieved = entsoe_historic_demand(**year_start_end) + df_load_sq, not_retrieved = entsoe_historic_demand(**year_start_end) if not_retrieved: logger.warning("Demand data from entsoe could not be retrieved.") @@ -1753,30 +1761,20 @@ def insert_loads_sq(scn_name="status2019"): "./", "entsoe_data", f"load_entsoe_{scn_name}.csv" ).resolve() if os.path.isfile(file_path): - load_sq_backup = pd.read_csv(file_path, index_col="Index") - # check for missing columns in backup (former runs) - c_backup = [ - c for c in load_sq_backup.columns if c in not_retrieved - ] - # remove columns, if found in backup - not_retrieved = [c for c in not_retrieved if c not in c_backup] - if c_backup: - load_sq = pd.concat( - [load_sq, load_sq_backup.loc[:, c_backup]], axis=1 - ) - logger.info(f"Appended data from former runs for {c_backup}") - save_entsoe_data(load_sq, file_path=file_path) + df_load_sq, not_retrieved = fill_by_backup_data_from_former_runs( + df_load_sq, file_path, not_retrieved) + save_entsoe_data(df_load_sq, file_path=file_path) if not_retrieved: logger.warning( f"Backup data of 2019 is used instead for {not_retrieved}" ) - load_sq_backup = pd.read_csv( + df_load_sq_backup = pd.read_csv( "data_bundle_egon_data/entsoe/load_entsoe.csv", index_col="Index" ) - load_sq_backup.index = load_sq.index - load_sq = pd.concat( - [load_sq, load_sq_backup.loc[:, not_retrieved]], axis=1 + df_load_sq_backup.index = df_load_sq.index + df_load_sq = pd.concat( + [df_load_sq, df_load_sq_backup.loc[:, not_retrieved]], axis=1 ) # Delete existing data @@ -1821,7 +1819,7 @@ def insert_loads_sq(scn_name="status2019"): entsoe_to_bus = entsoe_to_bus_etrago(scn_name) # Calculate and insert demand timeseries per etrago bus_id - for country in load_sq.columns: + for country in df_load_sq.columns: load_id = db.next_etrago_id("load") entry = etrago.EgonPfHvLoad( @@ -1835,7 +1833,7 @@ def insert_loads_sq(scn_name="status2019"): scn_name=scn_name, load_id=int(load_id), temp_id=1, - p_set=list(load_sq[country]), + p_set=list(df_load_sq[country]), ) session.add(entry) From 06348faacdc566e97ef023943c02480b9bec5a30 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:32:02 +0100 Subject: [PATCH 733/787] Black&Isort --- .../data/datasets/electrical_neighbours.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index d96b32f3e..7f44c47b2 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1553,8 +1553,11 @@ def insert_generators_sq(scn_name="status2019"): """ if "status" in scn_name: - year = int(scn_name.split('status')[-1]) - year_start_end = {"year_start": f"{year}0101", "year_end": f"{year+1}0101"} + year = int(scn_name.split("status")[-1]) + year_start_end = { + "year_start": f"{year}0101", + "year_end": f"{year+1}0101", + } else: raise ValueError("No valid scenario name!") @@ -1570,7 +1573,8 @@ def insert_generators_sq(scn_name="status2019"): ).resolve() if os.path.isfile(file_path): df_gen_sq, not_retrieved = fill_by_backup_data_from_former_runs( - df_gen_sq, file_path, not_retrieved) + df_gen_sq, file_path, not_retrieved + ) save_entsoe_data(df_gen_sq, file_path=file_path) if not_retrieved: @@ -1719,6 +1723,7 @@ def insert_generators_sq(scn_name="status2019"): return + def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): sq_backup = pd.read_csv(file_path, index_col="Index") # check for missing columns in backup (former runs) @@ -1726,9 +1731,7 @@ def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): # remove columns, if found in backup not_retrieved = [c for c in not_retrieved if c not in c_backup] if c_backup: - df_sq = pd.concat( - [df_sq, sq_backup.loc[:, c_backup]], axis=1 - ) + df_sq = pd.concat([df_sq, sq_backup.loc[:, c_backup]], axis=1) logger.info(f"Appended data from former runs for {c_backup}") return df_sq, not_retrieved @@ -1762,7 +1765,8 @@ def insert_loads_sq(scn_name="status2019"): ).resolve() if os.path.isfile(file_path): df_load_sq, not_retrieved = fill_by_backup_data_from_former_runs( - df_load_sq, file_path, not_retrieved) + df_load_sq, file_path, not_retrieved + ) save_entsoe_data(df_load_sq, file_path=file_path) if not_retrieved: From 84a2a9fe06fabe0baca460a77ab839ad4a66f20e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:34:20 +0100 Subject: [PATCH 734/787] Rename functions Make function name more specific by adding tyndp to declare data base used. --- src/egon/data/datasets/electrical_neighbours.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 7f44c47b2..b9076268a 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -885,7 +885,7 @@ def calc_capacities(): ] -def insert_generators(capacities): +def insert_generators_tyndp(capacities): """Insert generators for foreign countries based on TYNDP-data Parameters @@ -1043,7 +1043,7 @@ def insert_generators(capacities): session.commit() -def insert_storage(capacities): +def insert_storage_tyndp(capacities): """Insert storage units for foreign countries based on TYNDP-data Parameters @@ -1174,9 +1174,9 @@ def tyndp_generation(): capacities = calc_capacities() - insert_generators(capacities) + insert_generators_tyndp(capacities) - insert_storage(capacities) + insert_storage_tyndp(capacities) def tyndp_demand(): From 12785663918806e46b8bef37a599252292efbf18 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:41:16 +0100 Subject: [PATCH 735/787] Move function --- .../data/datasets/electrical_neighbours.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index b9076268a..1d8dee6ac 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1535,6 +1535,18 @@ def save_entsoe_data(df: pd.DataFrame, file_path: Path): ) +def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): + sq_backup = pd.read_csv(file_path, index_col="Index") + # check for missing columns in backup (former runs) + c_backup = [c for c in sq_backup.columns if c in not_retrieved] + # remove columns, if found in backup + not_retrieved = [c for c in not_retrieved if c not in c_backup] + if c_backup: + df_sq = pd.concat([df_sq, sq_backup.loc[:, c_backup]], axis=1) + logger.info(f"Appended data from former runs for {c_backup}") + return df_sq, not_retrieved + + def insert_generators_sq(scn_name="status2019"): """ Insert generators for foreign countries based on ENTSO-E data @@ -1724,16 +1736,6 @@ def insert_generators_sq(scn_name="status2019"): return -def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): - sq_backup = pd.read_csv(file_path, index_col="Index") - # check for missing columns in backup (former runs) - c_backup = [c for c in sq_backup.columns if c in not_retrieved] - # remove columns, if found in backup - not_retrieved = [c for c in not_retrieved if c not in c_backup] - if c_backup: - df_sq = pd.concat([df_sq, sq_backup.loc[:, c_backup]], axis=1) - logger.info(f"Appended data from former runs for {c_backup}") - return df_sq, not_retrieved def insert_loads_sq(scn_name="status2019"): From 7fafe1e64a315bbf0b1a045696e9bdbcfc5053a3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 10:47:20 +0100 Subject: [PATCH 736/787] Add minimal docstring --- src/egon/data/datasets/electrical_neighbours.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 1d8dee6ac..7678e2ce8 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1536,6 +1536,19 @@ def save_entsoe_data(df: pd.DataFrame, file_path: Path): def fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved): + """ + Fills missing data from former runs + Parameters + ---------- + df_sq: pd.DataFrame + file_path: str, Path + not_retrieved: list + + Returns + ------- + df_sq, not_retrieved + + """ sq_backup = pd.read_csv(file_path, index_col="Index") # check for missing columns in backup (former runs) c_backup = [c for c in sq_backup.columns if c in not_retrieved] From 5d55e17f8e198456fd8500edcb4d509ae368d03c Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 12:00:43 +0100 Subject: [PATCH 737/787] Add pumped hydro storage to electrical_neighbours --- .../data/datasets/electrical_neighbours.py | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 7678e2ce8..6923579e2 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -16,6 +16,7 @@ import requests from egon.data import config, db, logger +from egon.data.db import session_scope from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.fill_etrago_gen import add_marginal_costs from egon.data.datasets.fix_ehv_subnetworks import select_bus_id @@ -1749,6 +1750,110 @@ def insert_generators_sq(scn_name="status2019"): return +def insert_storage_units_sq(scn_name="status2019"): + """ + Insert storage_units for foreign countries based on ENTSO-E data + + Parameters + ---------- + scn_name : str + Scenario to which the foreign storage units will be assigned. + The default is "status2019". + + Returns + ------- + None. + + """ + if "status" in scn_name: + year = int(scn_name.split("status")[-1]) + year_start_end = { + "year_start": f"{year}0101", + "year_end": f"{year+1}0101", + } + else: + raise ValueError("No valid scenario name!") + + df_gen_sq, not_retrieved = entsoe_historic_generation_capacities( + **year_start_end + ) + + if not_retrieved: + logger.warning("Generation data from entsoe could not be retrieved.") + # check for generation backup from former runs + file_path = Path( + "./", "entsoe_data", f"gen_entsoe_{scn_name}.csv" + ).resolve() + if os.path.isfile(file_path): + df_gen_sq, not_retrieved = fill_by_backup_data_from_former_runs( + df_gen_sq, file_path, not_retrieved + ) + save_entsoe_data(df_gen_sq, file_path=file_path) + + if not_retrieved: + logger.warning( + f"Backup data of 2019 is used instead for {not_retrieved}" + ) + df_gen_sq_backup = pd.read_csv( + "data_bundle_egon_data/entsoe/gen_entsoe.csv", index_col="Index" + ) + df_gen_sq = pd.concat( + [df_gen_sq, df_gen_sq_backup.loc[not_retrieved]], axis=1 + ) + + sto_sq = df_gen_sq.loc[:, df_gen_sq.columns == "Hydro Pumped Storage"] + sto_sq.rename(columns={"Hydro Pumped Storage": "p_nom"}, inplace=True) + + targets = config.datasets()["electrical_neighbours"]["targets"] + + # Delete existing data + db.execute_sql( + f""" + DELETE FROM {targets['storage']['schema']}.{targets['storage']['table']} + WHERE bus IN ( + SELECT bus_id FROM + {targets['buses']['schema']}.{targets['buses']['table']} + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + """ + ) + + # Add missing information suitable for eTraGo selected from scenario_parameter table + parameters_pumped_hydro = get_sector_parameters(sector="electricity", scenario=scn_name)["efficiency"]["pumped_hydro"] + + # Set bus_id + entsoe_to_bus = entsoe_to_bus_etrago() + sto_sq["bus"] = sto_sq.index.map(entsoe_to_bus) + + # Insert carrier specific parameters + sto_sq["carrier"] = "pumped_hydro" + sto_sq["scn_name"] = scn_name + sto_sq["dispatch"] = parameters_pumped_hydro["dispatch"] + sto_sq["store"] = parameters_pumped_hydro["store"] + sto_sq["standing_loss"] = parameters_pumped_hydro["standing_loss"] + sto_sq["max_hours"] = parameters_pumped_hydro["max_hours"] + + # Delete entrances without any installed capacity + sto_sq = sto_sq[sto_sq["p_nom"] > 0] + + # insert data pumped_hydro storage + + with session_scope() as session: + for i, row in sto_sq.iterrows(): + entry = etrago.EgonPfHvStorage( + scn_name=scn_name, + storage_id=int(db.next_etrago_id("storage")), + bus=row.bus, + max_hours=row.max_hours, + efficiency_store=row.store, + efficiency_dispatch=row.dispatch, + standing_loss=row.standing_loss, + carrier=row.carrier, + p_nom=row.p_nom, + ) + + session.add(entry) def insert_loads_sq(scn_name="status2019"): @@ -1879,6 +1984,9 @@ def insert_loads_sq(scn_name="status2019"): wrapped_partial( insert_loads_sq, scn_name=scn_name, postfix=postfix ), + wrapped_partial( + insert_storage_units_sq, scn_name=scn_name, postfix=postfix + ), ] ) From 9b0d9138dbfcf2bf56ad9d5e72364e50ac090adf Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 12:03:34 +0100 Subject: [PATCH 738/787] Use session_scope() --- .../data/datasets/electrical_neighbours.py | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 6923579e2..dd0048345 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1734,18 +1734,16 @@ def insert_generators_sq(scn_name="status2019"): egon_sq_to_100[gen["generator_id"]] = gen_id_100 # insert generators_timeseries data - session = sessionmaker(bind=db.engine())() - for gen_id in df_gen_sq.generator_id: - serie = series_egon100[ - series_egon100.generator_id == egon_sq_to_100[gen_id] - ]["p_max_pu"].values[0] - entry = etrago.EgonPfHvGeneratorTimeseries( - scn_name=scn_name, generator_id=gen_id, temp_id=1, p_max_pu=serie - ) + with session_scope() as session: + serie = series_egon100[ + series_egon100.generator_id == egon_sq_to_100[gen_id] + ]["p_max_pu"].values[0] + entry = etrago.EgonPfHvGeneratorTimeseries( + scn_name=scn_name, generator_id=gen_id, temp_id=1, p_max_pu=serie + ) - session.add(entry) - session.commit() + session.add(entry) return @@ -1935,34 +1933,30 @@ def insert_loads_sq(scn_name="status2019"): """ ) - # Connect to database - engine = db.engine() - session = sessionmaker(bind=engine)() - # get the corresponding bus per foreign country entsoe_to_bus = entsoe_to_bus_etrago(scn_name) # Calculate and insert demand timeseries per etrago bus_id for country in df_load_sq.columns: - load_id = db.next_etrago_id("load") + with session_scope() as session: + load_id = db.next_etrago_id("load") - entry = etrago.EgonPfHvLoad( - scn_name=scn_name, - load_id=int(load_id), - carrier="AC", - bus=int(entsoe_to_bus[country]), - ) + entry = etrago.EgonPfHvLoad( + scn_name=scn_name, + load_id=int(load_id), + carrier="AC", + bus=int(entsoe_to_bus[country]), + ) - entry_ts = etrago.EgonPfHvLoadTimeseries( - scn_name=scn_name, - load_id=int(load_id), - temp_id=1, - p_set=list(df_load_sq[country]), - ) + entry_ts = etrago.EgonPfHvLoadTimeseries( + scn_name=scn_name, + load_id=int(load_id), + temp_id=1, + p_set=list(df_load_sq[country]), + ) - session.add(entry) - session.add(entry_ts) - session.commit() + session.add(entry) + session.add(entry_ts) tasks = (grid,) From 4f5f25f84bdbafe529c5f2550cbdac272e86523d Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 12:09:06 +0100 Subject: [PATCH 739/787] Pass scn_name to function --- src/egon/data/datasets/electrical_neighbours.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index dd0048345..168e0cac6 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1821,7 +1821,7 @@ def insert_storage_units_sq(scn_name="status2019"): parameters_pumped_hydro = get_sector_parameters(sector="electricity", scenario=scn_name)["efficiency"]["pumped_hydro"] # Set bus_id - entsoe_to_bus = entsoe_to_bus_etrago() + entsoe_to_bus = entsoe_to_bus_etrago(scn_name=scn_name) sto_sq["bus"] = sto_sq.index.map(entsoe_to_bus) # Insert carrier specific parameters From ac7c488cd72850f34a877edd8c48608791b45e29 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 12:21:16 +0100 Subject: [PATCH 740/787] Add commit for each line entry Otherwise function, get next etrago-id will not work. Using bulk insert would probably be much faster but needs to change some more code. --- src/egon/data/datasets/electrical_neighbours.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/electrical_neighbours.py b/src/egon/data/datasets/electrical_neighbours.py index 168e0cac6..90b4a678c 100644 --- a/src/egon/data/datasets/electrical_neighbours.py +++ b/src/egon/data/datasets/electrical_neighbours.py @@ -1734,8 +1734,8 @@ def insert_generators_sq(scn_name="status2019"): egon_sq_to_100[gen["generator_id"]] = gen_id_100 # insert generators_timeseries data - for gen_id in df_gen_sq.generator_id: - with session_scope() as session: + with session_scope() as session: + for gen_id in df_gen_sq.generator_id: serie = series_egon100[ series_egon100.generator_id == egon_sq_to_100[gen_id] ]["p_max_pu"].values[0] @@ -1744,6 +1744,7 @@ def insert_generators_sq(scn_name="status2019"): ) session.add(entry) + session.commit() return @@ -1852,6 +1853,7 @@ def insert_storage_units_sq(scn_name="status2019"): ) session.add(entry) + session.commit() def insert_loads_sq(scn_name="status2019"): @@ -1937,8 +1939,8 @@ def insert_loads_sq(scn_name="status2019"): entsoe_to_bus = entsoe_to_bus_etrago(scn_name) # Calculate and insert demand timeseries per etrago bus_id - for country in df_load_sq.columns: - with session_scope() as session: + with session_scope() as session: + for country in df_load_sq.columns: load_id = db.next_etrago_id("load") entry = etrago.EgonPfHvLoad( @@ -1957,6 +1959,7 @@ def insert_loads_sq(scn_name="status2019"): session.add(entry) session.add(entry_ts) + session.commit() tasks = (grid,) From d5bffdaf1c83b25bfb7ea154425c69558b370423 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 13:24:10 +0100 Subject: [PATCH 741/787] Filter_mastr_geoometry only for SH --- src/egon/data/datasets/storages/pumped_hydro.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 198df67a2..3d541b74e 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -146,10 +146,15 @@ def select_mastr_pumped_hydro(): mastr_ph = mastr_ph.set_crs(4326) - mastr_ph = mastr_ph[~(mastr_ph["federal_state"].isnull())] + if ( + config.settings()["egon-data"]["--dataset-boundary"] + == "Schleswig-Holstein" + ): - # Drop CHP outside of Germany/ outside the test mode area - mastr_ph = filter_mastr_geometry(mastr_ph, federal_state=None) + mastr_ph = mastr_ph[~(mastr_ph["federal_state"].isnull())] + + # Drop hydropower outside of Germany/ outside the test mode area + mastr_ph = filter_mastr_geometry(mastr_ph, federal_state=None) return mastr_ph From a71a117c60033218e6089bf070fd4e58caf7e125 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 13:47:35 +0100 Subject: [PATCH 742/787] Add session_scope() --- src/egon/data/datasets/storages/__init__.py | 28 +++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index c994b02d0..e9866db5e 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -11,6 +11,7 @@ import pandas as pd from egon.data import config, db +from egon.data.db import session_scope from egon.data.datasets import Dataset from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD from egon.data.datasets.power_plants import assign_voltage_level @@ -251,19 +252,20 @@ def allocate_pumped_hydro(scn, export=True): if export: # Insert into target table session = sessionmaker(bind=db.engine())() - for i, row in power_plants.iterrows(): - entry = EgonStorages( - sources={"el_capacity": row.source}, - source_id={"MastrNummer": row.MaStRNummer}, - carrier=row.carrier, - el_capacity=row.el_capacity, - voltage_level=row.voltage_level, - bus_id=row.bus_id, - scenario=row.scenario, - geom=f"SRID=4326;POINT({row.geometry.x} {row.geometry.y})", - ) - session.add(entry) - session.commit() + with session_scope() as session: + for i, row in power_plants.iterrows(): + entry = EgonStorages( + sources={"el_capacity": row.source}, + source_id={"MastrNummer": row.MaStRNummer}, + carrier=row.carrier, + el_capacity=row.el_capacity, + voltage_level=row.voltage_level, + bus_id=row.bus_id, + scenario=row.scenario, + geom=f"SRID=4326;POINT({row.geometry.x} {row.geometry.y})", + ) + session.add(entry) + session.commit() else: return power_plants From cb629068cc0f6f94e25d74bf7cf8a960fc774292 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 7 Mar 2024 14:00:40 +0100 Subject: [PATCH 743/787] Drop hydro_power without federal_states --- src/egon/data/datasets/storages/pumped_hydro.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 3d541b74e..8c748ac45 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -146,14 +146,16 @@ def select_mastr_pumped_hydro(): mastr_ph = mastr_ph.set_crs(4326) + # drop hydropower without federal state + # Obervermunterwerk II in Austria + mastr_ph = mastr_ph[~(mastr_ph["federal_state"].isnull())] + if ( config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein" ): - mastr_ph = mastr_ph[~(mastr_ph["federal_state"].isnull())] - - # Drop hydropower outside of Germany/ outside the test mode area + # Drop hydropower outside the test mode area mastr_ph = filter_mastr_geometry(mastr_ph, federal_state=None) return mastr_ph From 8183ecc7fd1e1db089e9e4cd7f29c877a1b4a9d9 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 11 Mar 2024 16:26:58 +0100 Subject: [PATCH 744/787] drop conventional plants that were decommissioned --- .../data/datasets/power_plants/__init__.py | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index e90130f5c..5cd3537b4 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -988,6 +988,8 @@ def fill_missing_bus_and_geom(gens, carrier): "Breitengrad", "Gemeinde", "Inbetriebnahmedatum", + "EinheitBetriebsstatus", + "DatumEndgueltigeStilllegung", ] # import nuclear power plants nuclear = pd.read_csv( @@ -1014,6 +1016,24 @@ def fill_missing_bus_and_geom(gens, carrier): ) ] + # drop plants that are decommissioned + conv["DatumEndgueltigeStilllegung"] = pd.to_datetime( + conv["DatumEndgueltigeStilllegung"] + ) + + # keep plants that were decommissioned after the max date + conv.loc[ + ( + conv.DatumEndgueltigeStilllegung > + egon.data.config.datasets()["mastr_new"]["status2023_date_max"] + ), + "EinheitBetriebsstatus", + ] = "InBetrieb" + + conv = conv.loc[conv.EinheitBetriebsstatus == "InBetrieb"] + + conv = conv.drop(columns=["EinheitBetriebsstatus", "DatumEndgueltigeStilllegung"]) + # convert from KW to MW conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 # drop generators installed after 2019 @@ -1265,7 +1285,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.25", + version="0.0.26", dependencies=dependencies, tasks=tasks, ) From 10f60f11020e4cae167bbd56b3e59e1b0be363a3 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 11 Mar 2024 17:20:48 +0100 Subject: [PATCH 745/787] Update folder name mastr dump 2024 New dump was already downloaded before but saved in old folder name. --- src/egon/data/datasets.yml | 4 ++-- src/egon/data/datasets/mastr.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index e4b6e99c9..b851e01ed 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -377,8 +377,8 @@ power_plants: mastr_hydro: "bnetza_mastr_hydro_cleaned.csv" mastr_location: "location_elec_generation_raw.csv" mastr_combustion_without_chp: "supply.egon_mastr_conventional_without_chp" - mastr_combustion: "bnetza_mastr/dump_2022-11-17/bnetza_mastr_combustion_cleaned.csv" - mastr_nuclear: "bnetza_mastr/dump_2022-11-17/bnetza_mastr_nuclear_cleaned.csv" + mastr_combustion: "bnetza_mastr/dump_2024-01-08/bnetza_mastr_combustion_cleaned.csv" + mastr_nuclear: "bnetza_mastr/dump_2024-01-08/bnetza_mastr_nuclear_cleaned.csv" mastr_storage: "bnetza_mastr_storage_cleaned.csv" mastr_gsgk: "bnetza_mastr_gsgk_cleaned.csv" capacities: "supply.egon_scenario_capacities" diff --git a/src/egon/data/datasets/mastr.py b/src/egon/data/datasets/mastr.py index 8f46fbf77..27f244705 100644 --- a/src/egon/data/datasets/mastr.py +++ b/src/egon/data/datasets/mastr.py @@ -28,7 +28,7 @@ import egon.data.config WORKING_DIR_MASTR_OLD = Path(".", "bnetza_mastr", "dump_2021-05-03") -WORKING_DIR_MASTR_NEW = Path(".", "bnetza_mastr", "dump_2022-11-17") +WORKING_DIR_MASTR_NEW = Path(".", "bnetza_mastr", "dump_2024-01-08") def download_mastr_data(): From 209d2eb410182b5d8d4091f535e4690a6b8ae221 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 11 Mar 2024 17:27:11 +0100 Subject: [PATCH 746/787] Use 2024 mastr dump for hydro power Old dumps were missing about 1.8 GW hydropower capacity due to late correction of operator in mastr. --- src/egon/data/datasets/storages/pumped_hydro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index 8c748ac45..c40538250 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -11,7 +11,7 @@ from egon.data import config, db from egon.data.datasets.chp.match_nep import match_nep_chp from egon.data.datasets.chp.small_chp import assign_use_case -from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD +from egon.data.datasets.mastr import WORKING_DIR_MASTR_NEW from egon.data.datasets.power_plants import ( assign_bus_id, assign_voltage_level, @@ -93,7 +93,7 @@ def select_mastr_pumped_hydro(): # Read-in data from MaStR mastr_ph = pd.read_csv( - WORKING_DIR_MASTR_OLD / sources["mastr_storage"], + WORKING_DIR_MASTR_NEW / sources["mastr_storage"], delimiter=",", usecols=[ "Nettonennleistung", From 58329fa3e126a85a84528f8ba1288987aa330ce9 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 11 Mar 2024 17:31:10 +0100 Subject: [PATCH 747/787] Download pumped hydro csv from openmastr --- src/egon/data/datasets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 7f6a584a7..aa2c68bfc 100644 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -305,6 +305,7 @@ mastr_new: - "biomass" - "combustion" - "nuclear" + - "storage" file_basename: "bnetza_mastr" deposit_id: 10480958 egon2021_date_max: "2021-12-31 23:59:00" From 3360a73d632b0db59635e52f7a42600f058ff3d2 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 11 Mar 2024 17:46:14 +0100 Subject: [PATCH 748/787] Remove hydro power outside of germany Hydro power storages in austria which is operated by germany will be added in later commits. --- src/egon/data/datasets/storages/pumped_hydro.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index c40538250..abc31cba4 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -154,8 +154,10 @@ def select_mastr_pumped_hydro(): config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein" ): - # Drop hydropower outside the test mode area + mastr_ph = filter_mastr_geometry(mastr_ph, federal_state="Schleswig-Holstein") + else: + # Drop hydropower outside of germany mastr_ph = filter_mastr_geometry(mastr_ph, federal_state=None) return mastr_ph From e460c128bb96a05aa83553665e508ec3a07b5a30 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Mon, 11 Mar 2024 17:59:46 +0100 Subject: [PATCH 749/787] Move code to remove foreign entries --- src/egon/data/datasets/storages/pumped_hydro.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/egon/data/datasets/storages/pumped_hydro.py b/src/egon/data/datasets/storages/pumped_hydro.py index abc31cba4..c9f2bace3 100755 --- a/src/egon/data/datasets/storages/pumped_hydro.py +++ b/src/egon/data/datasets/storages/pumped_hydro.py @@ -137,13 +137,6 @@ def select_mastr_pumped_hydro(): ), ) - # Drop rows without post code and update datatype of postcode - mastr_ph = mastr_ph[~mastr_ph["plz"].isnull()] - mastr_ph["plz"] = mastr_ph["plz"].astype(int) - - # Calculate power in MW - mastr_ph.loc[:, "el_capacity"] *= 1e-3 - mastr_ph = mastr_ph.set_crs(4326) # drop hydropower without federal state @@ -160,6 +153,14 @@ def select_mastr_pumped_hydro(): # Drop hydropower outside of germany mastr_ph = filter_mastr_geometry(mastr_ph, federal_state=None) + # Drop rows without post code and update datatype of postcode + mastr_ph = mastr_ph[~mastr_ph["plz"].isnull()] + mastr_ph["plz"] = mastr_ph["plz"].astype(int) + + # Calculate power in MW + mastr_ph.loc[:, "el_capacity"] *= 1e-3 + + return mastr_ph From 6985efbebd824c6c92d2a0e0cf8c24a967b8d260 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 12 Mar 2024 21:53:01 +0100 Subject: [PATCH 750/787] Add new function to get pumped hydro --- src/egon/data/datasets/storages/__init__.py | 218 +++++++++++++++++++- 1 file changed, 215 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index e9866db5e..25d3d44a7 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -1,5 +1,6 @@ """The central module containing all code dealing with power plant data. """ + from pathlib import Path from geoalchemy2 import Geometry @@ -11,10 +12,13 @@ import pandas as pd from egon.data import config, db -from egon.data.db import session_scope from egon.data.datasets import Dataset -from egon.data.datasets.mastr import WORKING_DIR_MASTR_OLD -from egon.data.datasets.power_plants import assign_voltage_level +from egon.data.datasets.mastr import ( + WORKING_DIR_MASTR_NEW, + WORKING_DIR_MASTR_OLD, +) +from egon.data.datasets.mv_grid_districts import Vg250GemClean +from egon.data.datasets.power_plants import assign_bus_id, assign_voltage_level from egon.data.datasets.storages.home_batteries import ( allocate_home_batteries_to_buildings, ) @@ -25,6 +29,7 @@ select_mastr_pumped_hydro, select_nep_pumped_hydro, ) +from egon.data.db import session_scope Base = declarative_base() @@ -271,6 +276,213 @@ def allocate_pumped_hydro(scn, export=True): return power_plants +def allocate_pumped_hydro_sq(scn_name): + """ + Allocate pumped hydro by mastr data only. Capacities outside + germany are assigned to foreign buses. Mastr dump 2024 is used. + No filter for commissioning is applied. + Parameters + ---------- + scn_name + + Returns + ------- + + """ + sources = config.datasets()["power_plants"]["sources"] + + # Read-in data from MaStR + mastr_ph = pd.read_csv( + WORKING_DIR_MASTR_NEW / sources["mastr_storage"], + delimiter=",", + usecols=[ + "Nettonennleistung", + "EinheitMastrNummer", + "Kraftwerksnummer", + "Technologie", + "Postleitzahl", + "Laengengrad", + "Breitengrad", + "EinheitBetriebsstatus", + "LokationMastrNummer", + "Ort", + "Bundesland", + ], + dtype={"Postleitzahl": str}, + ) + + # Rename columns + mastr_ph = mastr_ph.rename( + columns={ + "Kraftwerksnummer": "bnetza_id", + "Technologie": "carrier", + "Postleitzahl": "plz", + "Ort": "city", + "Bundesland": "federal_state", + "Nettonennleistung": "el_capacity", + } + ) + + # Select only pumped hydro units + mastr_ph = mastr_ph.loc[mastr_ph.carrier == "Pumpspeicher"] + + # Select only pumped hydro units which are in operation + mastr_ph = mastr_ph.loc[mastr_ph.EinheitBetriebsstatus == "InBetrieb"] + + # Calculate power in MW + mastr_ph.loc[:, "el_capacity"] *= 1e-3 + + # Create geodataframe from long, lat + mastr_ph = gpd.GeoDataFrame( + mastr_ph, + geometry=gpd.points_from_xy( + mastr_ph["Laengengrad"], mastr_ph["Breitengrad"] + ), + crs="4326", + ) + + # Identify pp without geocord + mastr_ph_nogeo = mastr_ph.loc[mastr_ph["Laengengrad"].isna()] + + # Remove all PP without geocord (PP<= 30kW) + mastr_ph = mastr_ph.dropna(subset="Laengengrad") + + # Get geometry of villages/cities with same name of pp with missing geocord + with session_scope() as session: + query = session.query( + Vg250GemClean.gen, Vg250GemClean.geometry + ).filter(Vg250GemClean.gen.in_(mastr_ph_nogeo.loc[:, "city"].unique())) + df_cities = gpd.read_postgis( + query.statement, + query.session.bind, + geom_col="geometry", + crs="4326", + ) + + # Just take the first entry, inaccuracy is negligible as centroid is taken afterwards + df_cities = df_cities.drop_duplicates("gen", keep="first") + + # Use the centroid instead of polygon of region + df_cities.loc[:, "geometry"] = df_cities["geometry"].centroid + + # Add centroid geometry to pp without geometry + mastr_ph_nogeo = pd.merge( + left=df_cities, + right=mastr_ph_nogeo, + right_on="city", + left_on="gen", + how="inner", + ).drop("gen", axis=1) + + mastr_ph = pd.concat([mastr_ph, mastr_ph_nogeo], axis=0) + + # aggregate capacity per location + agg_cap = mastr_ph.groupby("geometry")["el_capacity"].sum() + + # list mastr number by location + agg_mastr = mastr_ph.groupby("geometry")["EinheitMastrNummer"].apply(list) + + # remove duplicates by location + mastr_ph = mastr_ph.drop_duplicates(subset="geometry", keep="first").drop( + ["el_capacity", "EinheitMastrNummer"], axis=1 + ) + + # Adjust capacity + mastr_ph = pd.merge( + left=mastr_ph, right=agg_cap, left_on="geometry", right_on="geometry" + ) + + # Adjust capacity + mastr_ph = pd.merge( + left=mastr_ph, right=agg_mastr, left_on="geometry", right_on="geometry" + ) + + # Drop small pp <= 03 kW + mastr_ph = mastr_ph.loc[mastr_ph["el_capacity"] > 30] + + # Apply voltage level by capacity + mastr_ph = apply_voltage_level_thresholds(mastr_ph) + mastr_ph["voltage_level"] = mastr_ph["voltage_level"].astype(int) + + # Capacity located outside germany -> will be assigned to foreign buses + mastr_ph_foreign = mastr_ph.loc[mastr_ph["federal_state"].isna()] + + # Keep only capacities within germany + mastr_ph = mastr_ph.dropna(subset="federal_state") + + # Asign buses within germany + mastr_ph = assign_bus_id(mastr_ph, cfg=config.datasets()["power_plants"]) + mastr_ph["bus_id"] = mastr_ph["bus_id"].astype(int) + + # Get foreign buses + sql = f""" + SELECT * FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' + and country != 'DE' + """ + df_foreign_buses = db.select_geodataframe( + sql, geom_col="geom", epsg="4326" + ) + + # Assign closest bus at voltage level to foreign pp + nearest_neighbors = [] + for vl, v_nom in {1: 380, 2: 220, 3: 110}.items(): + ph = mastr_ph_foreign.loc[mastr_ph_foreign["voltage_level"] == vl] + if ph.empty: + continue + bus = df_foreign_buses.loc[ + df_foreign_buses["v_nom"] == v_nom, + ["v_nom", "country", "bus_id", "geom"], + ] + results = gpd.sjoin_nearest( + left_df=ph, right_df=bus, how="left", distance_col="distance" + ) + nearest_neighbors.append(results) + mastr_ph_foreign = pd.concat(nearest_neighbors) + + # Merge foreign pp + mastr_ph = pd.concat([mastr_ph, mastr_ph_foreign]) + + # Reduce to necessary columns + mastr_ph = mastr_ph[ + [ + "el_capacity", + "voltage_level", + "bus_id", + "geometry", + "EinheitMastrNummer", + ] + ] + + # Rename and format columns + mastr_ph["carrier"] = "pumped_hydro" + mastr_ph = mastr_ph.rename( + columns={"EinheitMastrNummer": "source_id", "geometry": "geom"} + ) + mastr_ph["source_id"] = mastr_ph["source_id"].apply( + lambda x: {"MastrNummer": ", ".join(x)} + ) + mastr_ph = mastr_ph.set_geometry("geom") + mastr_ph["geom"] = mastr_ph["geom"].apply(lambda x: x.wkb_hex) + mastr_ph["scenario"] = "status2023" + mastr_ph["sources"] = [ + {"el_capacity": "MaStR aggregated by location"} + ] * mastr_ph.shape[0] + + # Delete existing units in the target table + db.execute_sql( + f""" DELETE FROM supply.egon_storages + WHERE carrier = 'pumped_hydro' + AND scenario= '{scn_name}';""" + ) + + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonStorages, + mastr_ph.to_dict(orient="records"), + ) + + def allocate_pumped_hydro_eGon100RE(): """Allocates pumped_hydro plants for eGon100RE scenario based on a prox-to-now method applied on allocated pumped-hydro plants in the eGon2035 From 4225e3cc87177fddcea0edb146ef363a8e301bec Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 12 Mar 2024 21:53:19 +0100 Subject: [PATCH 751/787] Use new function for statusquo scenarios --- src/egon/data/datasets/storages/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 25d3d44a7..019ff518d 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -654,4 +654,4 @@ def allocate_pumped_hydro_scn(): elif scn == "eGon100RE": allocate_pumped_hydro_eGon100RE() elif "status" in scn: - allocate_pumped_hydro(scn=scn) + allocate_pumped_hydro_sq(scn_name=scn) From 20703abc51f3e3b89aa20c2a24884c6eaf6bed08 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 12 Mar 2024 21:54:56 +0100 Subject: [PATCH 752/787] Bump version of Storages to 0.0.8 --- src/egon/data/datasets/storages/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 019ff518d..f471c6cee 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -52,7 +52,7 @@ class Storages(Dataset): def __init__(self, dependencies): super().__init__( name="Storages", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=( create_tables, From f213fe7422891533afd7adfb1edf01f313b8dd4f Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Sun, 17 Mar 2024 19:03:26 +0100 Subject: [PATCH 753/787] Adhoc direct fix, merge hell Somehow code just got lost. Missing parts (task integration) are directly comitted. Hopefully not more is missing... --- src/egon/data/datasets/power_plants/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index c565502ef..d40f9a3da 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -13,7 +13,7 @@ import pandas as pd from egon.data import db -from egon.data.datasets import Dataset +from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.mastr import ( WORKING_DIR_MASTR_NEW, WORKING_DIR_MASTR_OLD, @@ -1234,8 +1234,10 @@ def fill_missing_bus_and_geom(gens, carrier): import_mastr, ) -if "status2019" in egon.data.config.settings()["egon-data"]["--scenarios"]: - tasks = tasks + (power_plants_status_quo,) +for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + if "status" in scn_name: + tasks += (wrapped_partial( + power_plants_status_quo, scn_name=scn_name, postfix=f"_{scn_name[-4:]}"),) if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] @@ -1256,9 +1258,14 @@ def fill_missing_bus_and_geom(gens, carrier): geocode_mastr_data, pv_rooftop_to_buildings, wind_offshore.insert, - assign_weather_data.weatherId_and_busId, ) +for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: + tasks += (wrapped_partial(assign_weather_data.weatherId_and_busId, + scn_name=scn_name, + # postfix=f"_{scn_name}" + ),) + class PowerPlants(Dataset): def __init__(self, dependencies): From ec8d8c1efe05dc17a0e39b4ab6f855d27b4a69db Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Sun, 17 Mar 2024 19:21:27 +0100 Subject: [PATCH 754/787] Recommit decommisiong Somehow changes got lost during merge. This is commit 8183ecc7fd1e1db089e9e4cd7f29c877a1b4a9d9 reapplied. --- .../data/datasets/power_plants/__init__.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index d40f9a3da..097576d67 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -988,6 +988,8 @@ def fill_missing_bus_and_geom(gens, carrier): "Breitengrad", "Gemeinde", "Inbetriebnahmedatum", + "EinheitBetriebsstatus", + "DatumEndgueltigeStilllegung", ] # import nuclear power plants nuclear = pd.read_csv( @@ -1014,6 +1016,24 @@ def fill_missing_bus_and_geom(gens, carrier): ) ] + # drop plants that are decommissioned + conv["DatumEndgueltigeStilllegung"] = pd.to_datetime( + conv["DatumEndgueltigeStilllegung"] + ) + + # keep plants that were decommissioned after the max date + conv.loc[ + ( + conv.DatumEndgueltigeStilllegung > + egon.data.config.datasets()["mastr_new"]["status2023_date_max"] + ), + "EinheitBetriebsstatus", + ] = "InBetrieb" + + conv = conv.loc[conv.EinheitBetriebsstatus == "InBetrieb"] + + conv = conv.drop(columns=["EinheitBetriebsstatus", "DatumEndgueltigeStilllegung"]) + # convert from KW to MW conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 # drop generators installed after 2019 From 3ac6bdcd26750d41b7dd1a7ca38dd08b84ba6b71 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 23:54:10 +0100 Subject: [PATCH 755/787] Improve comments --- src/egon/data/datasets/storages/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index f471c6cee..069935f70 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -382,17 +382,17 @@ def allocate_pumped_hydro_sq(scn_name): # list mastr number by location agg_mastr = mastr_ph.groupby("geometry")["EinheitMastrNummer"].apply(list) - # remove duplicates by location + # remove duplicates by location and keep only first mastr_ph = mastr_ph.drop_duplicates(subset="geometry", keep="first").drop( ["el_capacity", "EinheitMastrNummer"], axis=1 ) - # Adjust capacity + # Add aggregated capacity by location mastr_ph = pd.merge( left=mastr_ph, right=agg_cap, left_on="geometry", right_on="geometry" ) - # Adjust capacity + # Add list of mastr nr by location mastr_ph = pd.merge( left=mastr_ph, right=agg_mastr, left_on="geometry", right_on="geometry" ) @@ -410,7 +410,7 @@ def allocate_pumped_hydro_sq(scn_name): # Keep only capacities within germany mastr_ph = mastr_ph.dropna(subset="federal_state") - # Asign buses within germany + # Assign buses within germany mastr_ph = assign_bus_id(mastr_ph, cfg=config.datasets()["power_plants"]) mastr_ph["bus_id"] = mastr_ph["bus_id"].astype(int) @@ -424,7 +424,7 @@ def allocate_pumped_hydro_sq(scn_name): sql, geom_col="geom", epsg="4326" ) - # Assign closest bus at voltage level to foreign pp + # Assign closest foreign bus at voltage level to foreign pp nearest_neighbors = [] for vl, v_nom in {1: 380, 2: 220, 3: 110}.items(): ph = mastr_ph_foreign.loc[mastr_ph_foreign["voltage_level"] == vl] From 2f16d80dab9239ba88ece9a9d11f4c21beacd794 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Thu, 21 Mar 2024 15:57:24 +0100 Subject: [PATCH 756/787] Add missing_dependencies --- src/egon/data/airflow/dags/pipeline_status_quo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egon/data/airflow/dags/pipeline_status_quo.py b/src/egon/data/airflow/dags/pipeline_status_quo.py index fd93b7399..5e3250812 100755 --- a/src/egon/data/airflow/dags/pipeline_status_quo.py +++ b/src/egon/data/airflow/dags/pipeline_status_quo.py @@ -425,9 +425,8 @@ ] ) - - # Pumped hydro units - pumped_hydro = Storages( + # Pumped hydro and home storage units + storage_units = Storages( dependencies=[ mastr_data, mv_grid_districts, @@ -435,6 +434,7 @@ scenario_parameters, setup, vg250_mv_grid_districts, + fill_etrago_generators, ] ) @@ -476,7 +476,7 @@ # Storages to eTraGo storage_etrago = StorageEtrago( - dependencies=[pumped_hydro, scenario_parameters, setup_etrago] + dependencies=[storage_units, scenario_parameters, setup_etrago] ) # eMobility: motorized individual travel TODO: adjust for SQ From a9b6e253389273e29dde76d04363e7516e2d44bd Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 23 May 2024 16:46:42 +0200 Subject: [PATCH 757/787] adapt weather year for aggregated load curve for service sector --- src/egon/data/datasets/electricity_demand/temporal.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/electricity_demand/temporal.py b/src/egon/data/datasets/electricity_demand/temporal.py index f0943d58a..6e59e9607 100644 --- a/src/egon/data/datasets/electricity_demand/temporal.py +++ b/src/egon/data/datasets/electricity_demand/temporal.py @@ -10,6 +10,8 @@ from sqlalchemy import ARRAY, Column, Float, Integer, String from sqlalchemy.ext.declarative import declarative_base +import egon.data.datasets.scenario_parameters.parameters as scenario_parameters + Base = declarative_base() @@ -35,13 +37,15 @@ def create_table(): EgonEtragoElectricityCts.__table__.create(bind=engine, checkfirst=True) -def calc_load_curve(share_wz, annual_demand=1): +def calc_load_curve(share_wz, scn, annual_demand=1): """Create aggregated demand curve for service sector Parameters ---------- share_wz : pandas.Series or pandas.DataFrame Share of annual demand per cts branch + scn : str + Scenario name annual_demand : float or pandas.Series, optional Annual demand in MWh. The default is 1. @@ -51,7 +55,7 @@ def calc_load_curve(share_wz, annual_demand=1): Annual load curve of combindes cts branches """ - year = 2011 + year = int(scenario_parameters.global_settings(scn)["weather_year"]) sources = egon.data.config.datasets()["electrical_load_curves_cts"][ "sources" @@ -198,7 +202,7 @@ def calc_load_curves_cts(scenario): annual_demand_subst = demands_zensus.groupby("bus_id").demand.sum() # Return electrical load curves per hvmv substation - return calc_load_curve(share_subst, annual_demand_subst) + return calc_load_curve(share_subst, scenario, annual_demand_subst) def insert_cts_load(): From 05e23d7a51c5b8eee6b481f25dc2902494481556 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 19:23:01 +0100 Subject: [PATCH 758/787] Replace logging by logger --- src/egon/data/datasets/power_plants/__init__.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 097576d67..97979878c 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -9,10 +9,9 @@ from sqlalchemy.orm import sessionmaker import geopandas as gpd import numpy as np -import logging import pandas as pd -from egon.data import db +from egon.data import db, logger from egon.data.datasets import Dataset, wrapped_partial from egon.data.datasets.mastr import ( WORKING_DIR_MASTR_NEW, @@ -949,12 +948,12 @@ def fill_missing_bus_and_geom(gens, carrier): (gens.geom.is_empty) & (gens.location.isin(geom_municipalities.index)) ] - logging.info( + logger.info( f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] .sum()}MW) were drop""" ) - logging.info( + logger.info( f"""{len(new_geom)} {carrier} generator(s) ({new_geom .sum()}MW) received a geom based on location """ @@ -1099,7 +1098,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - logging.info( + logger.info( f""" {len(conv)} conventional generators with a total installed capacity of {conv.capacity.sum()}MW were inserted into the db @@ -1135,7 +1134,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - logging.info( + logger.info( f""" {len(hydro)} hydro generators with a total installed capacity of {hydro.capacity.sum()}MW were inserted into the db @@ -1169,7 +1168,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - logging.info( + logger.info( f""" {len(biomass)} biomass generators with a total installed capacity of {biomass.capacity.sum()}MW were inserted into the db @@ -1207,7 +1206,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - logging.info( + logger.info( f""" {len(solar)} solar generators with a total installed capacity of {solar.capacity.sum()}MW were inserted into the db @@ -1239,7 +1238,7 @@ def fill_missing_bus_and_geom(gens, carrier): session.add(entry) session.commit() - logging.info( + logger.info( f""" {len(wind_onshore)} wind_onshore generators with a total installed capacity of {wind_onshore.capacity.sum()}MW were inserted into the db From 232cc5eae60e97b1b5d054adeb37ea0942641ed7 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 19:28:34 +0100 Subject: [PATCH 759/787] Add logging about droped CHP capacities --- src/egon/data/datasets/power_plants/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 97979878c..eea4614d0 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1042,9 +1042,14 @@ def fill_missing_bus_and_geom(gens, carrier): < egon.data.config.datasets()["mastr_new"]["status2019_date_max"] ] + conv_cap_chp = conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 # drop chp generators conv["ThermischeNutzleistung"] = conv["ThermischeNutzleistung"].fillna(0) conv = conv[conv.ThermischeNutzleistung == 0] + conv_cap_no_chp = conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 + + logger.info("Dropped CHP generators in GW") + logger.info(conv_cap_chp-conv_cap_no_chp) # rename carriers conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" From 7724352eee9d19607839d3a25b293994fbf4bb33 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 19:29:05 +0100 Subject: [PATCH 760/787] Make commisssioning and decomissioning date check dynamic --- src/egon/data/datasets/power_plants/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index eea4614d0..51dcc2d70 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1024,7 +1024,7 @@ def fill_missing_bus_and_geom(gens, carrier): conv.loc[ ( conv.DatumEndgueltigeStilllegung > - egon.data.config.datasets()["mastr_new"]["status2023_date_max"] + egon.data.config.datasets()["mastr_new"][f"{scn_name}_date_max"] ), "EinheitBetriebsstatus", ] = "InBetrieb" @@ -1035,11 +1035,12 @@ def fill_missing_bus_and_geom(gens, carrier): # convert from KW to MW conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 + # drop generators installed after 2019 conv["Inbetriebnahmedatum"] = pd.to_datetime(conv["Inbetriebnahmedatum"]) conv = conv[ conv["Inbetriebnahmedatum"] - < egon.data.config.datasets()["mastr_new"]["status2019_date_max"] + < egon.data.config.datasets()["mastr_new"][f"{scn_name}_date_max"] ] conv_cap_chp = conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 From 6756fbf96235e0d33085e5e5e17e3c7998cda025 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 20:29:03 +0100 Subject: [PATCH 761/787] Rework script --- .../data/datasets/power_plants/__init__.py | 323 +++++++++--------- 1 file changed, 163 insertions(+), 160 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 51dcc2d70..e3810b752 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -903,81 +903,9 @@ def allocate_other_power_plants(): session.commit() -def power_plants_status_quo(scn_name="status2019"): - con = db.engine() - session = sessionmaker(bind=db.engine())() - cfg = egon.data.config.datasets()["power_plants"] - db.execute_sql( - f""" - DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} - WHERE carrier IN ('wind_onshore', 'solar', 'biomass', - 'run_of_river', 'reservoir', 'solar_rooftop', - 'wind_offshore', 'nuclear', 'coal', 'lignite', 'oil', - 'gas') - AND scenario = '{scn_name}' - """ - ) - - # import municipalities to assign missing geom and bus_id - geom_municipalities = gpd.GeoDataFrame.from_postgis( - """ - SELECT gen, ST_UNION(geometry) as geom - FROM boundaries.vg250_gem - GROUP BY gen - """, - con, - geom_col="geom", - ).set_index("gen") - geom_municipalities["geom"] = geom_municipalities["geom"].centroid - - mv_grid_districts = gpd.GeoDataFrame.from_postgis( - f""" - SELECT * FROM {cfg['sources']['egon_mv_grid_district']} - """, - con, - ) - mv_grid_districts.geom = mv_grid_districts.geom.to_crs(4326) - - def fill_missing_bus_and_geom(gens, carrier): - # drop generators without data to get geometry. - drop_id = gens[ - (gens.geom.is_empty) - & ~(gens.location.isin(geom_municipalities.index)) - ].index - new_geom = gens["capacity"][ - (gens.geom.is_empty) - & (gens.location.isin(geom_municipalities.index)) - ] - logger.info( - f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] - .sum()}MW) were drop""" - ) - - logger.info( - f"""{len(new_geom)} {carrier} generator(s) ({new_geom - .sum()}MW) received a geom based on location - """ - ) - gens.drop(index=drop_id, inplace=True) - - # assign missing geometries based on location and buses based on geom - - gens["geom"] = gens.apply( - lambda x: geom_municipalities.at[x["location"], "geom"] - if x["geom"].is_empty - else x["geom"], - axis=1, - ) - gens["bus_id"] = gens.sjoin( - mv_grid_districts[["bus_id", "geom"]], how="left" - ).bus_id_right.values - - gens = gens.dropna(subset=["bus_id"]) - # convert geom to WKB - gens["geom"] = gens["geom"].to_wkt() - - return gens +def get_conventional_power_plants_non_chp(scn_name): + cfg = egon.data.config.datasets()["power_plants"] # Write conventional power plants in supply.egon_power_plants common_columns = [ "EinheitMastrNummer", @@ -1053,15 +981,14 @@ def fill_missing_bus_and_geom(gens, carrier): logger.info(conv_cap_chp-conv_cap_no_chp) # rename carriers - conv.loc[conv.Energietraeger == "Braunkohle", "Energietraeger"] = "lignite" - conv.loc[conv.Energietraeger == "Steinkohle", "Energietraeger"] = "coal" - conv.loc[conv.Energietraeger == "Erdgas", "Energietraeger"] = "gas" - conv.loc[ - conv.Energietraeger == "Mineralölprodukte", "Energietraeger" - ] = "oil" - conv.loc[ - conv.Energietraeger == "Kernenergie", "Energietraeger" - ] = "nuclear" + # rename carriers + conv["Energietraeger"] = conv["Energietraeger"].replace( + to_replace={"Braunkohle": "lignite", + "Steinkohle": "coal", + "Erdgas": "gas", + "Mineralölprodukte": "oil", + "Kernenergie": "nuclear" + }) # rename columns conv.rename( @@ -1074,7 +1001,6 @@ def fill_missing_bus_and_geom(gens, carrier): inplace=True, ) conv["bus_id"] = np.nan - conv["geom"] = gpd.points_from_xy( conv.Laengengrad, conv.Breitengrad, crs=4326 ) @@ -1083,40 +1009,123 @@ def fill_missing_bus_and_geom(gens, carrier): ] = Point() conv = gpd.GeoDataFrame(conv, geometry="geom") - conv = fill_missing_bus_and_geom(conv, carrier="conventional") + # assign voltage level by capacity conv["voltage_level"] = np.nan - conv["voltage_level"] = assign_voltage_level_by_capacity( conv.rename(columns={"capacity": "Nettonennleistung"}) ) + # Add further information + conv["sources"] = [{"el_capacity": "MaStR"}] * conv.shape[0] + conv["source_id"] = conv["gens_id"].apply( + lambda x: {"MastrNummer": x} + ) + conv["scenario"] = scn_name - for i, row in conv.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier=row.carrier, - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=row.geom, + return conv + +def power_plants_status_quo(scn_name="status2019"): + def fill_missing_bus_and_geom(gens, carrier): + # drop generators without data to get geometry. + drop_id = gens[ + (gens.geom.is_empty) + & ~(gens.location.isin(geom_municipalities.index)) + ].index + new_geom = gens["capacity"][ + (gens.geom.is_empty) + & (gens.location.isin(geom_municipalities.index)) + ] + logger.info( + f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] + .sum()}MW) were drop""" + ) + + logger.info( + f"""{len(new_geom)} {carrier} generator(s) ({new_geom + .sum()}MW) received a geom based on location + """ + ) + gens.drop(index=drop_id, inplace=True) + + # assign missing geometries based on location and buses based on geom + + gens["geom"] = gens.apply( + lambda x: geom_municipalities.at[x["location"], "geom"] + if x["geom"].is_empty + else x["geom"], + axis=1, + ) + gens["bus_id"] = gens.sjoin( + mv_grid_districts[["bus_id", "geom"]], how="left" + ).bus_id_right.values + + gens = gens.dropna(subset=["bus_id"]) + # convert geom to WKB + gens["geom"] = gens["geom"].to_wkt() + + return gens + + def convert_master_info(df): + # Add further information + df["sources"] = [{"el_capacity": "MaStR"}] * df.shape[0] + df["source_id"] = df["gens_id"].apply( + lambda x: {"MastrNummer": x} + ) + return df + + con = db.engine() + cfg = egon.data.config.datasets()["power_plants"] + + db.execute_sql( + f""" + DELETE FROM {cfg['target']['schema']}.{cfg['target']['table']} + WHERE carrier IN ('wind_onshore', 'solar', 'biomass', + 'run_of_river', 'reservoir', 'solar_rooftop', + 'wind_offshore', 'nuclear', 'coal', 'lignite', 'oil', + 'gas') + AND scenario = '{scn_name}' + """ + ) + + # import municipalities to assign missing geom and bus_id + geom_municipalities = gpd.GeoDataFrame.from_postgis( + """ + SELECT gen, ST_UNION(geometry) as geom + FROM boundaries.vg250_gem + GROUP BY gen + """, + con, + geom_col="geom", + ).set_index("gen") + geom_municipalities["geom"] = geom_municipalities["geom"].centroid + + mv_grid_districts = gpd.GeoDataFrame.from_postgis( + f""" + SELECT * FROM {cfg['sources']['egon_mv_grid_district']} + """, + con, + ) + mv_grid_districts.geom = mv_grid_districts.geom.to_crs(4326) + + # get con + conv = get_conventional_power_plants_non_chp(scn_name) + conv = fill_missing_bus_and_geom(conv, carrier="conventional") + + # Write into DB + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonPowerPlants, + conv.to_dict(orient="records"), ) - session.add(entry) - session.commit() logger.info( f""" {len(conv)} conventional generators with a total installed capacity of - {conv.capacity.sum()}MW were inserted into the db + {int(conv.capacity.sum())} MW were inserted into the db """ ) - # Write hydro power plants in supply.egon_power_plants - map_hydro = { - "Laufwasseranlage": "run_of_river", - "Speicherwasseranlage": "reservoir", - } - + # Hydro Power Plants + # ################### hydro = gpd.GeoDataFrame.from_postgis( f"""SELECT *, city AS location FROM {cfg['sources']['hydro']} WHERE plant_type IN ('Laufwasseranlage', 'Speicherwasseranlage')""", @@ -1126,19 +1135,19 @@ def fill_missing_bus_and_geom(gens, carrier): hydro = fill_missing_bus_and_geom(hydro, carrier="hydro") - for i, row in hydro.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier=map_hydro[row.plant_type], - el_capacity=row.capacity, - voltage_level=row.voltage_level, - bus_id=row.bus_id, - scenario=scn_name, - geom=row.geom, + hydro = convert_master_info(hydro) + hydro["carrier"] = hydro["plant_type"].replace( + to_replace={ + "Laufwasseranlage": "run_of_river", + "Speicherwasseranlage": "reservoir", + }) + + # Write into DB + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonPowerPlants, + hydro.to_dict(orient="records"), ) - session.add(entry) - session.commit() logger.info( f""" @@ -1147,7 +1156,8 @@ def fill_missing_bus_and_geom(gens, carrier): """ ) - # Write biomass power plants in supply.egon_power_plants + # Biomass + # ################### biomass = gpd.GeoDataFrame.from_postgis( f"""SELECT *, city AS location FROM {cfg['sources']['biomass']}""", con, @@ -1160,19 +1170,17 @@ def fill_missing_bus_and_geom(gens, carrier): biomass = fill_missing_bus_and_geom(biomass, carrier="biomass") - for i, row in biomass.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier="biomass", - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=row.geom, + biomass = convert_master_info(biomass) + biomass["scenario"] = scn_name + biomass["carrier"] = "biomass" + biomass= biomass.rename(columns={"capacity": "el_capacity"}) + + # Write into DB + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonPowerPlants, + biomass.to_dict(orient="records"), ) - session.add(entry) - session.commit() logger.info( f""" @@ -1181,7 +1189,8 @@ def fill_missing_bus_and_geom(gens, carrier): """ ) - # Write solar power plants in supply.egon_power_plants + # Solar + # ################### solar = gpd.GeoDataFrame.from_postgis( f"""SELECT *, city AS location FROM {cfg['sources']['pv']} WHERE site_type IN ('Freifläche', @@ -1193,24 +1202,20 @@ def fill_missing_bus_and_geom(gens, carrier): "Freifläche": "solar", "Bauliche Anlagen (Hausdach, Gebäude und Fassade)": "solar_rooftop", } - solar["site_type"] = solar["site_type"].map(map_solar) + solar["carrier"] = solar["site_type"].replace( + to_replace=map_solar) solar = fill_missing_bus_and_geom(solar, carrier="solar") - - solar = pd.DataFrame(solar, index=solar.index) - for i, row in solar.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier=row.site_type, - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=row.geom, + solar = convert_master_info(solar) + solar["scenario"] = scn_name + solar = solar.rename(columns={"capacity": "el_capacity"}) + + # Write into DB + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonPowerPlants, + solar.to_dict(orient="records"), ) - session.add(entry) - session.commit() logger.info( f""" @@ -1219,7 +1224,8 @@ def fill_missing_bus_and_geom(gens, carrier): """ ) - # Write wind_onshore power plants in supply.egon_power_plants + # Wind + # ################### wind_onshore = gpd.GeoDataFrame.from_postgis( f"""SELECT *, city AS location FROM {cfg['sources']['wind']}""", con, @@ -1229,20 +1235,17 @@ def fill_missing_bus_and_geom(gens, carrier): wind_onshore = fill_missing_bus_and_geom( wind_onshore, carrier="wind_onshore" ) - - for i, row in wind_onshore.iterrows(): - entry = EgonPowerPlants( - sources={"el_capacity": "MaStR"}, - source_id={"MastrNummer": row.gens_id}, - carrier="wind_onshore", - el_capacity=row.capacity, - scenario=scn_name, - bus_id=row.bus_id, - voltage_level=row.voltage_level, - geom=row.geom, + wind_onshore = convert_master_info(wind_onshore) + wind_onshore["scenario"] = scn_name + wind_onshore = wind_onshore.rename(columns={"capacity": "el_capacity"}) + wind_onshore["carrier"] = ("wind_onshore") + + # Write into DB + with db.session_scope() as session: + session.bulk_insert_mappings( + EgonPowerPlants, + wind_onshore.to_dict(orient="records"), ) - session.add(entry) - session.commit() logger.info( f""" From 9e1ce6203776c05a3b85a9d24acd5000ae0a535e Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 20:29:50 +0100 Subject: [PATCH 762/787] Black&Isort --- .../data/datasets/power_plants/__init__.py | 86 +++++++++++-------- 1 file changed, 50 insertions(+), 36 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index e3810b752..523e8479d 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1,7 +1,9 @@ """The central module containing all code dealing with power plant data. """ -from geoalchemy2 import Geometry + from pathlib import Path + +from geoalchemy2 import Geometry from shapely.geometry import Point from sqlalchemy import BigInteger, Column, Float, Integer, Sequence, String from sqlalchemy.dialects.postgresql import JSONB @@ -951,15 +953,17 @@ def get_conventional_power_plants_non_chp(scn_name): # keep plants that were decommissioned after the max date conv.loc[ ( - conv.DatumEndgueltigeStilllegung > - egon.data.config.datasets()["mastr_new"][f"{scn_name}_date_max"] + conv.DatumEndgueltigeStilllegung + > egon.data.config.datasets()["mastr_new"][f"{scn_name}_date_max"] ), "EinheitBetriebsstatus", ] = "InBetrieb" conv = conv.loc[conv.EinheitBetriebsstatus == "InBetrieb"] - conv = conv.drop(columns=["EinheitBetriebsstatus", "DatumEndgueltigeStilllegung"]) + conv = conv.drop( + columns=["EinheitBetriebsstatus", "DatumEndgueltigeStilllegung"] + ) # convert from KW to MW conv["Nettonennleistung"] = conv["Nettonennleistung"] / 1000 @@ -971,24 +975,30 @@ def get_conventional_power_plants_non_chp(scn_name): < egon.data.config.datasets()["mastr_new"][f"{scn_name}_date_max"] ] - conv_cap_chp = conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 + conv_cap_chp = ( + conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 + ) # drop chp generators conv["ThermischeNutzleistung"] = conv["ThermischeNutzleistung"].fillna(0) conv = conv[conv.ThermischeNutzleistung == 0] - conv_cap_no_chp = conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 + conv_cap_no_chp = ( + conv.groupby("Energietraeger")["Nettonennleistung"].sum() / 1e3 + ) logger.info("Dropped CHP generators in GW") - logger.info(conv_cap_chp-conv_cap_no_chp) + logger.info(conv_cap_chp - conv_cap_no_chp) # rename carriers # rename carriers conv["Energietraeger"] = conv["Energietraeger"].replace( - to_replace={"Braunkohle": "lignite", - "Steinkohle": "coal", - "Erdgas": "gas", - "Mineralölprodukte": "oil", - "Kernenergie": "nuclear" - }) + to_replace={ + "Braunkohle": "lignite", + "Steinkohle": "coal", + "Erdgas": "gas", + "Mineralölprodukte": "oil", + "Kernenergie": "nuclear", + } + ) # rename columns conv.rename( @@ -1004,9 +1014,9 @@ def get_conventional_power_plants_non_chp(scn_name): conv["geom"] = gpd.points_from_xy( conv.Laengengrad, conv.Breitengrad, crs=4326 ) - conv.loc[ - (conv.Laengengrad.isna() | conv.Breitengrad.isna()), "geom" - ] = Point() + conv.loc[(conv.Laengengrad.isna() | conv.Breitengrad.isna()), "geom"] = ( + Point() + ) conv = gpd.GeoDataFrame(conv, geometry="geom") # assign voltage level by capacity @@ -1016,24 +1026,23 @@ def get_conventional_power_plants_non_chp(scn_name): ) # Add further information conv["sources"] = [{"el_capacity": "MaStR"}] * conv.shape[0] - conv["source_id"] = conv["gens_id"].apply( - lambda x: {"MastrNummer": x} - ) + conv["source_id"] = conv["gens_id"].apply(lambda x: {"MastrNummer": x}) conv["scenario"] = scn_name return conv + def power_plants_status_quo(scn_name="status2019"): def fill_missing_bus_and_geom(gens, carrier): # drop generators without data to get geometry. drop_id = gens[ (gens.geom.is_empty) & ~(gens.location.isin(geom_municipalities.index)) - ].index + ].index new_geom = gens["capacity"][ (gens.geom.is_empty) & (gens.location.isin(geom_municipalities.index)) - ] + ] logger.info( f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] .sum()}MW) were drop""" @@ -1049,9 +1058,11 @@ def fill_missing_bus_and_geom(gens, carrier): # assign missing geometries based on location and buses based on geom gens["geom"] = gens.apply( - lambda x: geom_municipalities.at[x["location"], "geom"] - if x["geom"].is_empty - else x["geom"], + lambda x: ( + geom_municipalities.at[x["location"], "geom"] + if x["geom"].is_empty + else x["geom"] + ), axis=1, ) gens["bus_id"] = gens.sjoin( @@ -1067,9 +1078,7 @@ def fill_missing_bus_and_geom(gens, carrier): def convert_master_info(df): # Add further information df["sources"] = [{"el_capacity": "MaStR"}] * df.shape[0] - df["source_id"] = df["gens_id"].apply( - lambda x: {"MastrNummer": x} - ) + df["source_id"] = df["gens_id"].apply(lambda x: {"MastrNummer": x}) return df con = db.engine() @@ -1138,9 +1147,10 @@ def convert_master_info(df): hydro = convert_master_info(hydro) hydro["carrier"] = hydro["plant_type"].replace( to_replace={ - "Laufwasseranlage": "run_of_river", - "Speicherwasseranlage": "reservoir", - }) + "Laufwasseranlage": "run_of_river", + "Speicherwasseranlage": "reservoir", + } + ) # Write into DB with db.session_scope() as session: @@ -1173,7 +1183,7 @@ def convert_master_info(df): biomass = convert_master_info(biomass) biomass["scenario"] = scn_name biomass["carrier"] = "biomass" - biomass= biomass.rename(columns={"capacity": "el_capacity"}) + biomass = biomass.rename(columns={"capacity": "el_capacity"}) # Write into DB with db.session_scope() as session: @@ -1202,8 +1212,7 @@ def convert_master_info(df): "Freifläche": "solar", "Bauliche Anlagen (Hausdach, Gebäude und Fassade)": "solar_rooftop", } - solar["carrier"] = solar["site_type"].replace( - to_replace=map_solar) + solar["carrier"] = solar["site_type"].replace(to_replace=map_solar) solar = fill_missing_bus_and_geom(solar, carrier="solar") solar = convert_master_info(solar) @@ -1238,7 +1247,7 @@ def convert_master_info(df): wind_onshore = convert_master_info(wind_onshore) wind_onshore["scenario"] = scn_name wind_onshore = wind_onshore.rename(columns={"capacity": "el_capacity"}) - wind_onshore["carrier"] = ("wind_onshore") + wind_onshore["carrier"] = "wind_onshore" # Write into DB with db.session_scope() as session: @@ -1264,8 +1273,13 @@ def convert_master_info(df): for scn_name in egon.data.config.settings()["egon-data"]["--scenarios"]: if "status" in scn_name: - tasks += (wrapped_partial( - power_plants_status_quo, scn_name=scn_name, postfix=f"_{scn_name[-4:]}"),) + tasks += ( + wrapped_partial( + power_plants_status_quo, + scn_name=scn_name, + postfix=f"_{scn_name[-4:]}", + ), + ) if ( "eGon2035" in egon.data.config.settings()["egon-data"]["--scenarios"] From 6396e0cc4833d139374c27e2b63b81fd4fc2337b Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 20:30:48 +0100 Subject: [PATCH 763/787] Minors --- src/egon/data/datasets/power_plants/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 523e8479d..f6d790b24 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1115,7 +1115,8 @@ def convert_master_info(df): ) mv_grid_districts.geom = mv_grid_districts.geom.to_crs(4326) - # get con + # Conventional non CHP + # ################### conv = get_conventional_power_plants_non_chp(scn_name) conv = fill_missing_bus_and_geom(conv, carrier="conventional") From b156a20b49da55ee06fb28f2b21b99bd301f8051 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 20:53:55 +0100 Subject: [PATCH 764/787] Improve logging --- .../data/datasets/power_plants/__init__.py | 53 +++++++------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index f6d790b24..de3647dfd 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1044,13 +1044,13 @@ def fill_missing_bus_and_geom(gens, carrier): & (gens.location.isin(geom_municipalities.index)) ] logger.info( - f"""{len(drop_id)} {carrier} generator(s) ({gens.loc[drop_id, 'capacity'] - .sum()}MW) were drop""" + f"""{len(drop_id)} {carrier} generator(s) ({int(gens.loc[drop_id, 'capacity'] + .sum())}MW) were drop""" ) logger.info( - f"""{len(new_geom)} {carrier} generator(s) ({new_geom - .sum()}MW) received a geom based on location + f"""{len(new_geom)} {carrier} generator(s) ({int(new_geom + .sum())}MW) received a geom based on location """ ) gens.drop(index=drop_id, inplace=True) @@ -1081,6 +1081,15 @@ def convert_master_info(df): df["source_id"] = df["gens_id"].apply(lambda x: {"MastrNummer": x}) return df + def log_insert_capacity(df, tech): + logger.info( + f""" + {len(df)} {tech} generators with a total installed capacity of + {int(df.capacity.sum())}MW were inserted into the db + """ + ) + + con = db.engine() cfg = egon.data.config.datasets()["power_plants"] @@ -1127,12 +1136,7 @@ def convert_master_info(df): conv.to_dict(orient="records"), ) - logger.info( - f""" - {len(conv)} conventional generators with a total installed capacity of - {int(conv.capacity.sum())} MW were inserted into the db - """ - ) + log_insert_capacity(conv, tech="conventional non chp") # Hydro Power Plants # ################### @@ -1160,12 +1164,7 @@ def convert_master_info(df): hydro.to_dict(orient="records"), ) - logger.info( - f""" - {len(hydro)} hydro generators with a total installed capacity of - {hydro.capacity.sum()}MW were inserted into the db - """ - ) + log_insert_capacity(hydro, tech="hydro") # Biomass # ################### @@ -1193,12 +1192,7 @@ def convert_master_info(df): biomass.to_dict(orient="records"), ) - logger.info( - f""" - {len(biomass)} biomass generators with a total installed capacity of - {biomass.capacity.sum()}MW were inserted into the db - """ - ) + log_insert_capacity(biomass, tech="biomass") # Solar # ################### @@ -1227,12 +1221,7 @@ def convert_master_info(df): solar.to_dict(orient="records"), ) - logger.info( - f""" - {len(solar)} solar generators with a total installed capacity of - {solar.capacity.sum()}MW were inserted into the db - """ - ) + log_insert_capacity(solar, tech="solar") # Wind # ################### @@ -1257,14 +1246,8 @@ def convert_master_info(df): wind_onshore.to_dict(orient="records"), ) - logger.info( - f""" - {len(wind_onshore)} wind_onshore generators with a total installed capacity of - {wind_onshore.capacity.sum()}MW were inserted into the db - """ - ) + log_insert_capacity(wind_onshore, tech="wind_onshore") - return tasks = ( From da69403482748868d46d575132842660e9d5ce3f Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 21:01:55 +0100 Subject: [PATCH 765/787] Improve logging --- src/egon/data/datasets/power_plants/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index de3647dfd..7b266ccb5 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1084,8 +1084,8 @@ def convert_master_info(df): def log_insert_capacity(df, tech): logger.info( f""" - {len(df)} {tech} generators with a total installed capacity of - {int(df.capacity.sum())}MW were inserted into the db + {len(df)} {tech} generators with a total installed capacity of + {int(df.capacity.sum())} MW were inserted into the db """ ) From b597d136f8ebb8b7d25b04dcfdf5e98d55e60618 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 21:23:01 +0100 Subject: [PATCH 766/787] Add missing scenario --- src/egon/data/datasets/power_plants/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 7b266ccb5..edb2d5042 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1156,6 +1156,7 @@ def log_insert_capacity(df, tech): "Speicherwasseranlage": "reservoir", } ) + hydro["scenario"] = scn_name # Write into DB with db.session_scope() as session: From 08de63709b03d3e1a439d7ff160f605f94dec140 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 21:40:45 +0100 Subject: [PATCH 767/787] Fix minors --- src/egon/data/datasets/power_plants/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index edb2d5042..1e0f52ced 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1005,7 +1005,7 @@ def get_conventional_power_plants_non_chp(scn_name): columns={ "EinheitMastrNummer": "gens_id", "Energietraeger": "carrier", - "Nettonennleistung": "capacity", + "Nettonennleistung": "el_capacity", "Gemeinde": "location", }, inplace=True, @@ -1022,7 +1022,7 @@ def get_conventional_power_plants_non_chp(scn_name): # assign voltage level by capacity conv["voltage_level"] = np.nan conv["voltage_level"] = assign_voltage_level_by_capacity( - conv.rename(columns={"capacity": "Nettonennleistung"}) + conv.rename(columns={"el_capacity": "Nettonennleistung"}) ) # Add further information conv["sources"] = [{"el_capacity": "MaStR"}] * conv.shape[0] @@ -1085,11 +1085,10 @@ def log_insert_capacity(df, tech): logger.info( f""" {len(df)} {tech} generators with a total installed capacity of - {int(df.capacity.sum())} MW were inserted into the db + {int(df["el_capacity"].sum())} MW were inserted into the db """ ) - con = db.engine() cfg = egon.data.config.datasets()["power_plants"] @@ -1157,6 +1156,7 @@ def log_insert_capacity(df, tech): } ) hydro["scenario"] = scn_name + hydro = hydro.rename(columns={"capacity": "el_capacity"}) # Write into DB with db.session_scope() as session: @@ -1185,6 +1185,7 @@ def log_insert_capacity(df, tech): biomass["scenario"] = scn_name biomass["carrier"] = "biomass" biomass = biomass.rename(columns={"capacity": "el_capacity"}) + biomass = biomass.drop(columns="id") # Write into DB with db.session_scope() as session: From 09fecacf2cdcdb761324e32c9e953ab2173061b9 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 21:45:05 +0100 Subject: [PATCH 768/787] Fix minors --- src/egon/data/datasets/power_plants/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 1e0f52ced..0b5ca728c 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1005,7 +1005,7 @@ def get_conventional_power_plants_non_chp(scn_name): columns={ "EinheitMastrNummer": "gens_id", "Energietraeger": "carrier", - "Nettonennleistung": "el_capacity", + "Nettonennleistung": "capacity", "Gemeinde": "location", }, inplace=True, @@ -1022,7 +1022,7 @@ def get_conventional_power_plants_non_chp(scn_name): # assign voltage level by capacity conv["voltage_level"] = np.nan conv["voltage_level"] = assign_voltage_level_by_capacity( - conv.rename(columns={"el_capacity": "Nettonennleistung"}) + conv.rename(columns={"capacity": "Nettonennleistung"}) ) # Add further information conv["sources"] = [{"el_capacity": "MaStR"}] * conv.shape[0] @@ -1127,6 +1127,7 @@ def log_insert_capacity(df, tech): # ################### conv = get_conventional_power_plants_non_chp(scn_name) conv = fill_missing_bus_and_geom(conv, carrier="conventional") + conv= conv.rename(columns={"capacity": "el_capacity"}) # Write into DB with db.session_scope() as session: From baeec25ba523f53931cb2ec10150ad51acdc5878 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Tue, 19 Mar 2024 21:57:59 +0100 Subject: [PATCH 769/787] Drop ids --- src/egon/data/datasets/power_plants/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 0b5ca728c..3aec2c22c 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1216,6 +1216,7 @@ def log_insert_capacity(df, tech): solar = convert_master_info(solar) solar["scenario"] = scn_name solar = solar.rename(columns={"capacity": "el_capacity"}) + solar = solar.drop(columns="id") # Write into DB with db.session_scope() as session: @@ -1241,6 +1242,7 @@ def log_insert_capacity(df, tech): wind_onshore["scenario"] = scn_name wind_onshore = wind_onshore.rename(columns={"capacity": "el_capacity"}) wind_onshore["carrier"] = "wind_onshore" + wind_onshore = wind_onshore.drop(columns="id") # Write into DB with db.session_scope() as session: From 337b38729837da6d5328603e81d08d0f49a7ba77 Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Wed, 20 Mar 2024 11:20:40 +0100 Subject: [PATCH 770/787] Drop id hydro --- src/egon/data/datasets/power_plants/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 3aec2c22c..830cf3eb0 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1158,6 +1158,7 @@ def log_insert_capacity(df, tech): ) hydro["scenario"] = scn_name hydro = hydro.rename(columns={"capacity": "el_capacity"}) + hydro = hydro.drop(columns="id") # Write into DB with db.session_scope() as session: From cabf9dcfb0948a0c788f2d5e135850eb08c0a20a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 16:56:58 +0100 Subject: [PATCH 771/787] Skip download if data-bundle.zip exists --- src/egon/data/datasets/data_bundle/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index ce16f3fdc..4df5c9c06 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -1,4 +1,4 @@ -"""The central module containing all code dealing with small scale inpu-data +"""The central module containing all code dealing with small scale input-data """ @@ -13,7 +13,7 @@ def download(): """ - Download small scale imput data from Zenodo + Download small scale input data from Zenodo Parameters ---------- @@ -27,8 +27,10 @@ def download(): url = f"""https://zenodo.org/record/{sources['deposit_id']}/files/data_bundle_egon_data.zip""" target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file"] - # Retrieve files - urlretrieve(url, target_file) + # check if file exists + if not Path(target_file).exists(): + # Retrieve files + urlretrieve(url, target_file) with zipfile.ZipFile(target_file, "r") as zip_ref: zip_ref.extractall(".") From a1b745a37ff39c172347b2ad91385403b4070c8a Mon Sep 17 00:00:00 2001 From: "Julian.Endres" Date: Fri, 26 Jan 2024 17:08:34 +0100 Subject: [PATCH 772/787] Bump version number for DataBundle --- src/egon/data/datasets/data_bundle/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/data_bundle/__init__.py b/src/egon/data/datasets/data_bundle/__init__.py index 4df5c9c06..b49f64327 100644 --- a/src/egon/data/datasets/data_bundle/__init__.py +++ b/src/egon/data/datasets/data_bundle/__init__.py @@ -43,7 +43,7 @@ def __init__(self, dependencies): ]["deposit_id"] super().__init__( name="DataBundle", - version=str(deposit_id) + "-0.0.2", + version=str(deposit_id) + "-0.0.3", dependencies=dependencies, tasks=(download), ) From ab204b9b1c8cab519b2ac28a3495ab91b2db2a28 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 5 Jun 2024 09:44:18 +0200 Subject: [PATCH 773/787] update timeseries_per_wz to be run for each weather year of each scenario of the run --- src/egon/data/datasets/demandregio/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 1c7766dd3..8da3be8ac 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -39,7 +39,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.7", + version="0.0.8.dev", dependencies=dependencies, tasks=( clone_and_install, @@ -916,9 +916,11 @@ def timeseries_per_wz(): """ - years = get_sector_parameters("global").weather_year.unique() + scenarios = egon.data.config.settings()["egon-data"]["--scenarios"] + + for scn in scenarios: + year = int(scenario_parameters.global_settings(scn)["weather_year"]) - for year in years: for sector in ["CTS", "industry"]: insert_timeseries_per_wz(sector, int(year)) From 48ff5d67150ebb4520dfba46fe4379724dd090a0 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 19 Jun 2024 14:18:30 +0200 Subject: [PATCH 774/787] hand over scenario information to adapted function calc_load_curve --- src/egon/data/datasets/industry/temporal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egon/data/datasets/industry/temporal.py b/src/egon/data/datasets/industry/temporal.py index b1fb05900..523d2a1d3 100644 --- a/src/egon/data/datasets/industry/temporal.py +++ b/src/egon/data/datasets/industry/temporal.py @@ -212,7 +212,7 @@ def calc_load_curves_ind_osm(scenario): annual_demand_osm = demands_osm_area.groupby("osm_id").demand.sum() # Return electrical load curves per osm industrial landuse area - load_curves = calc_load_curve(share_wz_transpose, annual_demand_osm) + load_curves = calc_load_curve(share_wz_transpose, scenario, annual_demand_osm) curves_da = identify_bus(load_curves, demand_area) @@ -373,7 +373,7 @@ def calc_load_curves_ind_sites(scenario): .demand ) - load_curves = calc_load_curve(share_transpose, demands_ind_sites["demand"]) + load_curves = calc_load_curve(share_transpose, scenario, demands_ind_sites["demand"]) curves_da = identify_bus(load_curves, demand_area) From c4d19d232b0497d880ecaec24427784f2d477bf9 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Wed, 19 Jun 2024 14:28:47 +0200 Subject: [PATCH 775/787] update dataset version --- src/egon/data/datasets/demandregio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 8da3be8ac..64e25ddcb 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -39,7 +39,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.8.dev", + version="0.0.8", dependencies=dependencies, tasks=( clone_and_install, From a421b7a3e6d304a425d7902b97f4d1d2c50bc179 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 21 Jun 2024 14:06:37 +0200 Subject: [PATCH 776/787] add SH filter to storages in SH run --- src/egon/data/datasets/storages/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 069935f70..56d5724cf 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -311,6 +311,10 @@ def allocate_pumped_hydro_sq(scn_name): dtype={"Postleitzahl": str}, ) + if egon.data.config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein": + # Filter for Schleswig-Holstein + mastr_ph = mastr_ph.loc[mastr_ph.Bundesland == "SchleswigHolstein"] + # Rename columns mastr_ph = mastr_ph.rename( columns={ From 103732396441c6c020568b6ee37d77e24b9c89f3 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 21 Jun 2024 14:09:55 +0200 Subject: [PATCH 777/787] correct call to config --- src/egon/data/datasets/storages/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index 56d5724cf..f220fb2bc 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -311,7 +311,7 @@ def allocate_pumped_hydro_sq(scn_name): dtype={"Postleitzahl": str}, ) - if egon.data.config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein": + if config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein": # Filter for Schleswig-Holstein mastr_ph = mastr_ph.loc[mastr_ph.Bundesland == "SchleswigHolstein"] From 4600871ebb6b3133e0a72d8e1431350f29846910 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Fri, 21 Jun 2024 14:21:04 +0200 Subject: [PATCH 778/787] do not use foreig storages in SH run --- src/egon/data/datasets/storages/__init__.py | 58 +++++++++++---------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/egon/data/datasets/storages/__init__.py b/src/egon/data/datasets/storages/__init__.py index f220fb2bc..a1b222446 100755 --- a/src/egon/data/datasets/storages/__init__.py +++ b/src/egon/data/datasets/storages/__init__.py @@ -411,6 +411,33 @@ def allocate_pumped_hydro_sq(scn_name): # Capacity located outside germany -> will be assigned to foreign buses mastr_ph_foreign = mastr_ph.loc[mastr_ph["federal_state"].isna()] + if not mastr_ph_foreign.empty: + # Get foreign buses + sql = f""" + SELECT * FROM grid.egon_etrago_bus + WHERE scn_name = '{scn_name}' + and country != 'DE' + """ + df_foreign_buses = db.select_geodataframe( + sql, geom_col="geom", epsg="4326" + ) + + # Assign closest foreign bus at voltage level to foreign pp + nearest_neighbors = [] + for vl, v_nom in {1: 380, 2: 220, 3: 110}.items(): + ph = mastr_ph_foreign.loc[mastr_ph_foreign["voltage_level"] == vl] + if ph.empty: + continue + bus = df_foreign_buses.loc[ + df_foreign_buses["v_nom"] == v_nom, + ["v_nom", "country", "bus_id", "geom"], + ] + results = gpd.sjoin_nearest( + left_df=ph, right_df=bus, how="left", distance_col="distance" + ) + nearest_neighbors.append(results) + mastr_ph_foreign = pd.concat(nearest_neighbors) + # Keep only capacities within germany mastr_ph = mastr_ph.dropna(subset="federal_state") @@ -418,34 +445,9 @@ def allocate_pumped_hydro_sq(scn_name): mastr_ph = assign_bus_id(mastr_ph, cfg=config.datasets()["power_plants"]) mastr_ph["bus_id"] = mastr_ph["bus_id"].astype(int) - # Get foreign buses - sql = f""" - SELECT * FROM grid.egon_etrago_bus - WHERE scn_name = '{scn_name}' - and country != 'DE' - """ - df_foreign_buses = db.select_geodataframe( - sql, geom_col="geom", epsg="4326" - ) - - # Assign closest foreign bus at voltage level to foreign pp - nearest_neighbors = [] - for vl, v_nom in {1: 380, 2: 220, 3: 110}.items(): - ph = mastr_ph_foreign.loc[mastr_ph_foreign["voltage_level"] == vl] - if ph.empty: - continue - bus = df_foreign_buses.loc[ - df_foreign_buses["v_nom"] == v_nom, - ["v_nom", "country", "bus_id", "geom"], - ] - results = gpd.sjoin_nearest( - left_df=ph, right_df=bus, how="left", distance_col="distance" - ) - nearest_neighbors.append(results) - mastr_ph_foreign = pd.concat(nearest_neighbors) - - # Merge foreign pp - mastr_ph = pd.concat([mastr_ph, mastr_ph_foreign]) + if not mastr_ph_foreign.empty: + # Merge foreign pp + mastr_ph = pd.concat([mastr_ph, mastr_ph_foreign]) # Reduce to necessary columns mastr_ph = mastr_ph[ From e5b09b82b7a400d12b3b6ee7bc067b459f8a9bcf Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 29 Jul 2024 15:33:22 +0200 Subject: [PATCH 779/787] shift slp time series to fit year 2023 --- src/egon/data/datasets/demandregio/__init__.py | 7 ++++++- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egon/data/datasets/demandregio/__init__.py b/src/egon/data/datasets/demandregio/__init__.py index 64e25ddcb..a2a837ddc 100644 --- a/src/egon/data/datasets/demandregio/__init__.py +++ b/src/egon/data/datasets/demandregio/__init__.py @@ -39,7 +39,7 @@ class DemandRegio(Dataset): def __init__(self, dependencies): super().__init__( name="DemandRegio", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=( clone_and_install, @@ -617,6 +617,11 @@ def change_year(dt, year): year = 2023 if scenario == "status2023" else year # TODO status2023 hh_load_timeseries.index = hh_load_timeseries.index.map(lambda dt: change_year(dt, year)) + if scenario == "status2023": + hh_load_timeseries = hh_load_timeseries.shift(24 * 2) + + hh_load_timeseries.iloc[:24 * 7] = hh_load_timeseries.iloc[24 * 7:24 * 7 * 2].values + write_demandregio_hh_profiles_to_db(hh_load_timeseries) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index a23eaee8b..3345a011b 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -358,7 +358,7 @@ def create_district_heating_profile_python_like(scenario="eGon2035"): ) assert ( - abs(diff) < 0.03 + abs(diff) < 0.04 ), f"""Deviation of residential heat demand time series for district heating grid {str(area)} is {diff}""" @@ -744,7 +744,7 @@ def create_individual_heating_profile_python_like(scenario="eGon2035"): assert ( abs(diff) < 0.03 - ), f"""Deviation of residential heat demand time + ), f"""Deviation of residential heat demand time series for mv grid {str(grid)} is {diff}""" if not (slice_df[hour].empty or cts.empty): From 0d33a930a75236889228252b6d0a70f49542edc9 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 22 Aug 2024 10:29:10 +0200 Subject: [PATCH 780/787] renamed metadata.py --- src/egon/data/{metadata.py => metadata/__init__.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/egon/data/{metadata.py => metadata/__init__.py} (100%) diff --git a/src/egon/data/metadata.py b/src/egon/data/metadata/__init__.py similarity index 100% rename from src/egon/data/metadata.py rename to src/egon/data/metadata/__init__.py From 39327eabaad4dede923be38b74251568b0270b44 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 22 Aug 2024 11:00:59 +0200 Subject: [PATCH 781/787] replace oep_metadata_version function --- src/egon/data/datasets/DSM_cts_ind.py | 4 ++-- .../emobility/motorized_individual_travel/db_classes.py | 8 ++++---- .../db_classes.py | 4 ++-- src/egon/data/datasets/power_plants/mastr_db_classes.py | 4 ++-- .../data/datasets/power_plants/pv_rooftop_buildings.py | 4 ++-- src/egon/data/datasets/storages/home_batteries.py | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 52d871766..7b21acbdb 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -28,7 +28,7 @@ generate_resource_fields_from_db_table, license_odbl, meta_metadata, - oep_metadata_version, + meta_metadata, sources, ) @@ -396,7 +396,7 @@ def add_metadata_individual(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 889f2271c..42396f538 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -32,7 +32,7 @@ license_ccby, license_odbl, meta_metadata, - oep_metadata_version, + meta_metadata, sources, ) @@ -410,7 +410,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) @@ -532,7 +532,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) @@ -654,7 +654,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index 5699627a6..0a4502019 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -17,7 +17,7 @@ generate_resource_fields_from_db_table, license_odbl, meta_metadata, - oep_metadata_version, + meta_metadata, ) Base = declarative_base() @@ -152,7 +152,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index 38872b6ed..3d912eed2 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -21,7 +21,7 @@ generate_resource_fields_from_db_table, license_dedl, meta_metadata, - oep_metadata_version, + meta_metadata, sources, ) @@ -437,7 +437,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 5843d8007..4fb9f8fbe 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -39,7 +39,7 @@ license_dedl, license_odbl, meta_metadata, - oep_metadata_version, + meta_metadata, sources, ) @@ -2216,7 +2216,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata()["metadataVersion"])() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 087a7f94f..78800946c 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -51,7 +51,7 @@ license_dedl, license_odbl, meta_metadata, - oep_metadata_version, + meta_metadata, sources, ) @@ -329,7 +329,7 @@ def add_metadata(): }, } - dialect = get_dialect(oep_metadata_version())() + dialect = get_dialect(meta_metadata())() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) From cfe1b138be2e8d9a3c5c70616f57b0412e5ef00a Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 22 Aug 2024 11:29:03 +0200 Subject: [PATCH 782/787] remove zenodo sandbox from metadata strings --- src/egon/data/datasets/power_plants/mastr_db_classes.py | 4 ++-- src/egon/data/datasets/power_plants/metadata.py | 4 ++-- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 4 ++-- src/egon/data/datasets/storages/home_batteries.py | 4 ++-- src/egon/data/metadata/__init__.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index 3d912eed2..f95c6d1fd 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -365,7 +365,7 @@ def add_metadata(): "system modeling" ), "path": ( - "https://sandbox.zenodo.org/record/" + "https://zenodo.org/record/" f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" ), "licenses": [license_dedl(attribution="© Cußmann, Ilka")], @@ -379,7 +379,7 @@ def add_metadata(): "the data dump from 2022-11-17 for eGon-data." ), "path": ( - f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + f"https://zenodo.org/record/{deposit_id_mastr}" ), "licenses": [license_dedl(attribution="© Amme, Jonathan")], }, diff --git a/src/egon/data/datasets/power_plants/metadata.py b/src/egon/data/datasets/power_plants/metadata.py index 91fe353e6..703fd3f33 100644 --- a/src/egon/data/datasets/power_plants/metadata.py +++ b/src/egon/data/datasets/power_plants/metadata.py @@ -42,7 +42,7 @@ def metadata(): { "title": '"open-MaStR power unit registry"', "description": "Raw data download Marktstammdatenregister (MaStR) data using the webservice. All data from the Marktstammdatenregister is included. There are duplicates included. For further information read in the documentationg of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html", - "path": "https://sandbox.zenodo.org/record/808086", + "path": "https://zenodo.org/record/10480958", "licenses": [ { "name": licenses_datenlizenz_deutschland( @@ -121,7 +121,7 @@ def metadata(): { "title": '"Data bundle for egon-data"', "description": "Zenodo repository to provide several different input data sets for eGon-data", - "path": "https://sandbox.zenodo.org/record/1167119", + "path": "https://zenodo.org/record/10226009", "licenses": [license_ccby("© eGon development team")], }, ], diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 4fb9f8fbe..51858a59f 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2147,7 +2147,7 @@ def add_metadata(): "system modeling" ), "path": ( - "https://sandbox.zenodo.org/record/" + "https://zenodo.org/record/" f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" ), "licenses": [license_dedl(attribution="© Cußmann, Ilka")], @@ -2159,7 +2159,7 @@ def add_metadata(): "the data dump from 2022-11-17 for eGon-data." ), "path": ( - f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + f"https://zenodo.org/record/{deposit_id_mastr}" ), "licenses": [license_dedl(attribution="© Amme, Jonathan")], }, diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 78800946c..fbd631bd8 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -254,7 +254,7 @@ def add_metadata(): "system modeling" ), "path": ( - "https://sandbox.zenodo.org/record/" + "https://zenodo.org/record/" f"{deposit_id_data_bundle}#.Y_dWM4CZMVM" ), "licenses": [license_dedl(attribution="© Cußmann, Ilka")], @@ -266,7 +266,7 @@ def add_metadata(): "the data dump from 2022-11-17 for eGon-data." ), "path": ( - f"https://sandbox.zenodo.org/record/{deposit_id_mastr}" + f"https://zenodo.org/record/{deposit_id_mastr}" ), "licenses": [license_dedl(attribution="© Amme, Jonathan")], }, diff --git a/src/egon/data/metadata/__init__.py b/src/egon/data/metadata/__init__.py index a15b0ecb1..c6868c098 100755 --- a/src/egon/data/metadata/__init__.py +++ b/src/egon/data/metadata/__init__.py @@ -509,7 +509,7 @@ def sources(): "Zenodo repository to provide several different input" " data sets for eGon-data" ), - "path": "https://sandbox.zenodo.org/record/1167119", + "path": "https://zenodo.org/record/10226009", "licenses": [license_ccby("© eGon development team")], }, "Einspeiseatlas": { @@ -640,7 +640,7 @@ def sources(): " https://www.marktstammdatenregister.de/MaStRHilfe" "/subpages/statistik.html" ), - "path": "https://sandbox.zenodo.org/record/808086", + "path": "https://zenodo.org/record/10480930", "licenses": [ licenses_datenlizenz_deutschland( "© 2021 Bundesnetzagentur für Elektrizität, Gas," From 2486137d41e77ddc3dd0045a92a972d6ee0ee301 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 29 Aug 2024 14:07:20 +0200 Subject: [PATCH 783/787] fix wrong oep version string for omi --- src/egon/data/datasets/DSM_cts_ind.py | 2 +- .../emobility/motorized_individual_travel/db_classes.py | 6 +++--- .../db_classes.py | 2 +- src/egon/data/datasets/heat_demand_timeseries/__init__.py | 4 ++-- src/egon/data/datasets/power_plants/__init__.py | 1 - src/egon/data/datasets/power_plants/mastr_db_classes.py | 2 +- src/egon/data/datasets/power_plants/pv_rooftop_buildings.py | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index 7b21acbdb..49d8807e6 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -396,7 +396,7 @@ def add_metadata_individual(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 42396f538..4fe967239 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -410,7 +410,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) @@ -532,7 +532,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) @@ -654,7 +654,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py index 0a4502019..860f1a513 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel_charging_infrastructure/db_classes.py @@ -152,7 +152,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 7e8c5d4f9..c0f6b4e28 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -10,7 +10,7 @@ import numpy as np import pandas as pd -from egon.data import db +from egon.data import config, db import egon.data.datasets.era5 as era try: @@ -817,7 +817,7 @@ def district_heating(method="python"): ) if method == "python": - for scenario in egon.data.config.settings()["egon-data"][ + for scenario in config.settings()["egon-data"][ "--scenarios" ]: create_district_heating_profile_python_like(scenario) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 1a6c5bf23..77aa1d1cb 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -1357,7 +1357,6 @@ def log_insert_capacity(df, tech): ) tasks = tasks + ( - geocode_mastr_data, pv_rooftop_to_buildings, wind_offshore.insert, ) diff --git a/src/egon/data/datasets/power_plants/mastr_db_classes.py b/src/egon/data/datasets/power_plants/mastr_db_classes.py index f95c6d1fd..43a2af6d2 100644 --- a/src/egon/data/datasets/power_plants/mastr_db_classes.py +++ b/src/egon/data/datasets/power_plants/mastr_db_classes.py @@ -437,7 +437,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 983003e96..7a83b5f07 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -2222,7 +2222,7 @@ def add_metadata(): }, } - dialect = get_dialect(meta_metadata()["metadataVersion"])() + dialect = get_dialect(f"oep-v{meta_metadata()['metadataVersion'][4:7]}")() meta = dialect.compile_and_render(dialect.parse(json.dumps(meta))) From 173b574d595d8fa8fe2630616d4acf061ce5ec37 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 14 Oct 2024 14:22:36 +0200 Subject: [PATCH 784/787] add call to metadata function for mastr --- src/egon/data/datasets/power_plants/mastr.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/egon/data/datasets/power_plants/mastr.py b/src/egon/data/datasets/power_plants/mastr.py index 225c7c685..dabb20008 100644 --- a/src/egon/data/datasets/power_plants/mastr.py +++ b/src/egon/data/datasets/power_plants/mastr.py @@ -33,6 +33,7 @@ from egon.data import config, db from egon.data.datasets.mastr import WORKING_DIR_MASTR_NEW from egon.data.datasets.power_plants.mastr_db_classes import ( + add_metadata, EgonMastrGeocoded, EgonPowerPlantsBiomass, EgonPowerPlantsCombustion, @@ -528,3 +529,5 @@ def import_mastr() -> None: if_exists="append", schema=target_tables[tech].__table_args__["schema"], ) + + add_metadata() From 6122eea4004b92b239e45c04aa3ee9e6367e30de Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 14 Oct 2024 14:25:16 +0200 Subject: [PATCH 785/787] update dataset version --- src/egon/data/datasets/power_plants/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 8a293a678..c9645c201 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -95,7 +95,7 @@ class PowerPlants(Dataset): #: name: str = "PowerPlants" #: - version: str = "0.0.18" + version: str = "0.0.19" def __init__(self, dependencies): super().__init__( From 8b890bfd84eb3c40a31aeb90122b3cd1a552690d Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 14 Oct 2024 14:26:24 +0200 Subject: [PATCH 786/787] fixing some merge errors --- src/egon/data/datasets/power_plants/__init__.py | 4 ++-- src/egon/data/datasets/power_plants/mastr.py | 2 +- .../datasets/power_plants/pv_rooftop_buildings.py | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 77aa1d1cb..96d7b0993 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -992,12 +992,12 @@ def get_conventional_power_plants_non_chp(scn_name): ] # import nuclear power plants nuclear = pd.read_csv( - cfg["sources"]["mastr_nuclear"], + WORKING_DIR_MASTR_OLD / cfg["sources"]["mastr_nuclear"], usecols=common_columns, ) # import combustion power plants comb = pd.read_csv( - cfg["sources"]["mastr_combustion"], + WORKING_DIR_MASTR_OLD / cfg["sources"]["mastr_combustion"], usecols=common_columns + ["ThermischeNutzleistung"], ) diff --git a/src/egon/data/datasets/power_plants/mastr.py b/src/egon/data/datasets/power_plants/mastr.py index e8fb71653..0359421a8 100644 --- a/src/egon/data/datasets/power_plants/mastr.py +++ b/src/egon/data/datasets/power_plants/mastr.py @@ -350,7 +350,7 @@ def import_mastr() -> None: # (eGon2021 scenario) len_old = len(units) ts = pd.Timestamp( - egon.data.config.datasets()["mastr_new"]["status2023_date_max"] + config.datasets()["mastr_new"]["status2023_date_max"] ) units = units.loc[pd.to_datetime(units.Inbetriebnahmedatum) <= ts] logger.debug( diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 7a83b5f07..9faa2fdf7 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -31,6 +31,7 @@ ) from egon.data.datasets.power_plants.mastr_db_classes import EgonPowerPlantsPv from egon.data.datasets.scenario_capacities import EgonScenarioCapacities +from egon.data.datasets.scenario_parameters import get_scenario_year from egon.data.datasets.zensus_vg250 import Vg250Gem from egon.data.metadata import ( context, @@ -2362,10 +2363,12 @@ def pv_rooftop_to_buildings(): status_quo = "status2023" - ts = pd.Timestamp(config.datasets()["mastr_new"][f"{status_quo}_date_max"]) + ts = pd.Timestamp( + config.datasets()["mastr_new"][f"{status_quo}_date_max"], tz="UTC" + ) mastr_gdf = mastr_gdf.loc[ - pd.to_datetime(mastr_gdf.Inbetriebnahmedatum) <= ts + mastr_gdf.commissioning_date <= ts ] buildings_gdf = load_building_data() @@ -2390,12 +2393,11 @@ def pv_rooftop_to_buildings(): continue elif "status" in scenario: ts = pd.Timestamp( - config.datasets()["mastr_new"][f"{scenario}_date_max"] + config.datasets()["mastr_new"][f"{scenario}_date_max"], tz="UTC" ) scenario_buildings_gdf = scenario_buildings_gdf.loc[ - pd.to_datetime(scenario_buildings_gdf.Inbetriebnahmedatum) - <= ts + scenario_buildings_gdf.commissioning_date <= ts ] else: From 224aa7a29db170347fcd3f5bb5c4c4d824837a20 Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Mon, 14 Oct 2024 15:05:24 +0200 Subject: [PATCH 787/787] correct use of ' token in metadata --- src/egon/data/metadata/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egon/data/metadata/__init__.py b/src/egon/data/metadata/__init__.py index c6868c098..25e267217 100755 --- a/src/egon/data/metadata/__init__.py +++ b/src/egon/data/metadata/__init__.py @@ -236,7 +236,7 @@ def license_dedl(attribution=EGON_ATTRIBUTION): "path": "https://www.govdata.de/dl-de/by-2-0", "instruction": ( "Any use will be permitted provided it fulfils the requirements of" - " this 'Data licence Germany – attribution – Version 2.0'. The " + ' this "Data licence Germany – attribution – Version 2.0". The ' "data and meta-data provided may, for commercial and " "non-commercial use, in particular be copied, printed, presented, " "altered, processed and transmitted to third parties; be merged " @@ -245,8 +245,8 @@ def license_dedl(attribution=EGON_ATTRIBUTION): "external business processes, products and applications in public " "and non-public electronic networks. The user must ensure that the" " source note contains the following information: the name of the " - "provider, the annotation 'Data licence Germany – attribution – " - "Version 2.0' or 'dl-de/by-2-0' referring to the licence text " + 'provider, the annotation "Data licence Germany – attribution – ' + 'Version 2.0" or "dl-de/by-2-0" referring to the licence text ' "available at www.govdata.de/dl-de/by-2-0, and a reference to the " "dataset (URI). This applies only if the entity keeping the data " "provides the pieces of information 1-3 for the source note. " @@ -415,7 +415,7 @@ def sources(): " developed requirements and criteria for the" " assessment of suitable sites even if their" " exploration is still at an early stage and there is" - " little knowledge of the salinaries' structures." + ' little knowledge of the salinaries structures.' " Scientists at DEEP.KBB GmbH in Hanover, worked" " together with their project partners at the Federal" " Institute for Geosciences and Natural Resources and" @@ -691,7 +691,7 @@ def sources(): "title": "OpenStreetMap Data Extracts (Geofabrik)", "description": ( "Full data extract of OpenStreetMap data for defined" - " spatial extent at ''referenceDate''" + ' spatial extent at "referenceDate"' ), "path": ( "https://download.geofabrik.de/europe/germany-210101.osm.pbf"