Passed
Pull Request — dev (#568)
by
unknown
02:18
created

data.metadata.license_geonutzv()   A

Complexity

Conditions 1

Size

Total Lines 28
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nop 1
dl 0
loc 28
rs 10
c 0
b 0
f 0
1
from pathlib import Path
2
from urllib.request import urlretrieve
3
from zipfile import ZipFile
4
import os
5
6
from geoalchemy2 import Geometry
7
from omi.dialects import get_dialect
8
from sqlalchemy import MetaData, Table
9
from sqlalchemy.dialects.postgresql.base import ischema_names
10
11
from egon.data import db, logger
12
from egon.data.datasets import Dataset
13
from egon.data.db import engine
14
from egon.data import __path__ as data_path
15
16
def context():
17
    """
18
    Project context information for metadata
19
20
    Returns
21
    -------
22
    dict
23
        OEP metadata conform data license information
24
    """
25
26
    return {
27
        "homepage": "https://ego-n.org/",
28
        "documentation": "https://egon-data.readthedocs.io/en/latest/",
29
        "sourceCode": "https://github.com/openego/eGon-data",
30
        "contact": "https://ego-n.org/partners/",
31
        "grantNo": "03EI1002",
32
        "fundingAgency": "Bundesministerium für Wirtschaft und Energie",
33
        "fundingAgencyLogo": "https://www.innovation-beratung-"
34
        "foerderung.de/INNO/Redaktion/DE/Bilder/"
35
        "Titelbilder/titel_foerderlogo_bmwi.jpg?"
36
        "__blob=normal&v=3",
37
        "publisherLogo": "https://ego-n.org/images/eGon_logo_"
38
        "noborder_transbg.svg",
39
    }
40
41
42
def meta_metadata():
43
    """
44
    Meta data on metadata
45
46
    Returns
47
    -------
48
    dict
49
        OEP metadata conform metadata on metadata
50
    """
51
52
    return {
53
        "metadataVersion": "OEP-1.4.1",
54
        "metadataLicense": {
55
            "name": "CC0-1.0",
56
            "title": "Creative Commons Zero v1.0 Universal",
57
            "path": ("https://creativecommons.org/publicdomain/zero/1.0/"),
58
        },
59
    }
60
61
62
def licenses_datenlizenz_deutschland(attribution):
63
    """
64
    License information for Datenlizenz Deutschland
65
66
    Parameters
67
    ----------
68
    attribution : str
69
        Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG'
70
71
    Returns
72
    -------
73
    dict
74
        OEP metadata conform data license information
75
    """
76
77
    return {
78
        "name": "dl-by-de/2.0",
79
        "title": "Datenlizenz Deutschland – Namensnennung – Version 2.0",
80
        "path": "www.govdata.de/dl-de/by-2-0",
81
        "instruction": (
82
            "Jede Nutzung ist unter den Bedingungen dieser „Datenlizenz "
83
            "Deutschland - Namensnennung - Version 2.0 zulässig.\nDie "
84
            "bereitgestellten Daten und Metadaten dürfen für die "
85
            "kommerzielle und nicht kommerzielle Nutzung insbesondere:"
86
            "(1) vervielfältigt, ausgedruckt, präsentiert, verändert, "
87
            "bearbeitet sowie an Dritte übermittelt werden;\n "
88
            "(2) mit eigenen Daten und Daten Anderer zusammengeführt und "
89
            "zu selbständigen neuen Datensätzen verbunden werden;\n "
90
            "(3) in interne und externe Geschäftsprozesse, Produkte und "
91
            "Anwendungen in öffentlichen und nicht öffentlichen "
92
            "elektronischen Netzwerken eingebunden werden.\n"
93
            "Bei der Nutzung ist sicherzustellen, dass folgende Angaben "
94
            "als Quellenvermerk enthalten sind:\n"
95
            "(1) Bezeichnung des Bereitstellers nach dessen Maßgabe,\n"
96
            "(2) der Vermerk Datenlizenz Deutschland – Namensnennung – "
97
            "Version 2.0 oder dl-de/by-2-0 mit Verweis auf den Lizenztext "
98
            "unter www.govdata.de/dl-de/by-2-0 sowie\n"
99
            "(3) einen Verweis auf den Datensatz (URI)."
100
            "Dies gilt nur soweit die datenhaltende Stelle die Angaben"
101
            "(1) bis (3) zum Quellenvermerk bereitstellt.\n"
102
            "Veränderungen, Bearbeitungen, neue Gestaltungen oder "
103
            "sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis "
104
            "zu versehen, dass die Daten geändert wurden."
105
        ),
106
        "attribution": attribution,
107
    }
108
109
110
def license_odbl(attribution):
111
    """
112
    License information for Open Data Commons Open Database License (ODbL-1.0)
113
114
    Parameters
115
    ----------
116
    attribution : str
117
        Attribution for the dataset incl. © symbol, e.g.
118
        '© OpenStreetMap contributors'
119
120
    Returns
121
    -------
122
    dict
123
        OEP metadata conform data license information
124
    """
125
    return {
126
        "name": "ODbL-1.0",
127
        "title": "Open Data Commons Open Database License 1.0",
128
        "path": "https://opendatacommons.org/licenses/odbl/1.0/index.html",
129
        "instruction": "You are free: To Share, To Create, To Adapt; "
130
        "As long as you: Attribute, Share-Alike, Keep open!",
131
        "attribution": attribution,
132
    }
133
134
135
def license_ccby(attribution):
136
    """
137
    License information for Creative Commons Attribution 4.0 International
138
    (CC-BY-4.0)
139
140
    Parameters
141
    ----------
142
    attribution : str
143
        Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG'
144
145
    Returns
146
    -------
147
    dict
148
        OEP metadata conform data license information
149
    """
150
    return {
151
        "name": "CC-BY-4.0",
152
        "title": "Creative Commons Attribution 4.0 International",
153
        "path": "https://creativecommons.org/licenses/by/4.0/legalcode",
154
        "instruction": "You are free: To Share, To Create, To Adapt; "
155
        "As long as you: Attribute.",
156
        "attribution": attribution,
157
    }
158
159
160
def license_geonutzv(attribution):
161
    """
162
    License information for GeoNutzV
163
164
    Parameters
165
    ----------
166
    attribution : str
167
        Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG'
168
169
    Returns
170
    -------
171
    dict
172
        OEP metadata conform data license information
173
    """
174
    return {
175
        "name": "geonutzv-de-2013-03-19",
176
        "title": "Verordnung zur Festlegung der Nutzungsbestimmungen für die "
177
        "Bereitstellung von Geodaten des Bundes",
178
        "path": "https://www.gesetze-im-internet.de/geonutzv/",
179
        "instruction": "Geodaten und Geodatendienste, einschließlich "
180
        "zugehöriger Metadaten, werden für alle derzeit "
181
        "bekannten sowie für alle zukünftig bekannten Zwecke "
182
        "kommerzieller und nicht kommerzieller Nutzung "
183
        "geldleistungsfrei zur Verfügung gestellt, soweit "
184
        "durch besondere Rechtsvorschrift nichts anderes "
185
        "bestimmt ist oder vertragliche oder gesetzliche "
186
        "Rechte Dritter dem nicht entgegenstehen.",
187
        "attribution": attribution,
188
    }
189
190
191
def license_agpl(attribution):
192
    """
193
    License information for GNU Affero General Public License v3.0
194
195
    Parameters
196
    ----------
197
    attribution : str
198
        Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG'
199
200
    Returns
201
    -------
202
    dict
203
        OEP metadata conform data license information
204
    """
205
    return {
206
        "name": "AGPL-3.0 License",
207
        "title": "GNU Affero General Public License v3.0",
208
        "path": "https://www.gnu.org/licenses/agpl-3.0.de.html",
209
        "instruction": "Permissions of this strongest copyleft license are"
210
        "conditioned on making available complete source code of licensed "
211
        "works and modifications, which include larger works using a licensed"
212
        "work, under the same license. Copyright and license notices must be"
213
        "preserved. Contributors provide an express grant of patent rights."
214
        "When a modified version is used to provide a service over a network,"
215
        "the complete source code of the modified version must be made "
216
        "available.",
217
        "attribution": attribution,
218
    }
219
220
221
def license_dedl(attribution):
222
    """
223
    License information for Data licence Germany – attribution – version 2.0
224
225
    Parameters
226
    ----------
227
    attribution : str
228
        Attribution for the dataset incl. © symbol, e.g. '© GeoBasis-DE / BKG'
229
230
    Returns
231
    -------
232
    dict
233
        OEP metadata conform data license information
234
    """
235
    return {
236
        "name": "DL-DE-BY-2.0",
237
        "title": "Data licence Germany – attribution – version 2.0",
238
        "path": "https://www.govdata.de/dl-de/by-2-0",
239
        "instruction": (
240
            "Any use will be permitted provided it fulfils the requirements of"
241
            " this 'Data licence Germany – attribution – Version 2.0'. The "
242
            "data and meta-data provided may, for commercial and "
243
            "non-commercial use, in particular be copied, printed, presented, "
244
            "altered, processed and transmitted to third parties; be merged "
245
            "with own data and with the data of others and be combined to form"
246
            " new and independent datasets; be integrated in internal and "
247
            "external business processes, products and applications in public "
248
            "and non-public electronic networks. The user must ensure that the"
249
            " source note contains the following information: the name of the "
250
            "provider, the annotation 'Data licence Germany – attribution – "
251
            "Version 2.0' or 'dl-de/by-2-0' referring to the licence text "
252
            "available at www.govdata.de/dl-de/by-2-0, and a reference to the "
253
            "dataset (URI). This applies only if the entity keeping the data "
254
            "provides the pieces of information 1-3 for the source note. "
255
            "Changes, editing, new designs or other amendments must be marked "
256
            "as such in the source note."
257
        ),
258
        "attribution": attribution,
259
    }
260
261
262
def license_egon_data_odbl():
263
    """
264
    ODbL license with eGon data attribution
265
266
    Returns
267
    -------
268
    dict
269
        OEP metadata conform data license information for eGon tables
270
    """
271
    return license_odbl("© eGon development team")
272
273
274
def generate_resource_fields_from_sqla_model(model):
275
    """Generate a template for the resource fields for metadata from a SQL
276
    Alchemy model.
277
278
    For details on the fields see field 14.6.1 of `Open Energy Metadata
279
    <https://github.com/OpenEnergyPlatform/ oemetadata/blob/develop/metadata/
280
    v141/metadata_key_description.md>`_ standard.
281
    The fields `name` and `type` are automatically filled, the `description`
282
    and `unit` must be filled manually.
283
284
    Examples
285
    --------
286
    >>> from egon.data.metadata import generate_resource_fields_from_sqla_model
287
    >>> from egon.data.datasets.zensus_vg250 import Vg250Sta
288
    >>> resources = generate_resource_fields_from_sqla_model(Vg250Sta)
289
290
    Parameters
291
    ----------
292
    model : sqlalchemy.ext.declarative.declarative_base()
293
        SQLA model
294
295
    Returns
296
    -------
297
    list of dict
298
        Resource fields
299
    """
300
301
    return [
302
        {
303
            "name": col.name,
304
            "description": "",
305
            "type": str(col.type).lower(),
306
            "unit": "none",
307
        }
308
        for col in model.__table__.columns
309
    ]
310
311
312
def generate_resource_fields_from_db_table(schema, table, geom_columns=None):
313
    """Generate a template for the resource fields for metadata from a
314
    database table.
315
316
    For details on the fields see field 14.6.1 of `Open Energy Metadata
317
    <https://github.com/OpenEnergyPlatform/ oemetadata/blob/develop/metadata/
318
    v141/metadata_key_description.md>`_ standard.
319
    The fields `name` and `type` are automatically filled, the `description`
320
    and `unit` must be filled manually.
321
322
    Examples
323
    --------
324
    >>> from egon.data.metadata import generate_resource_fields_from_db_table
325
    >>> resources = generate_resource_fields_from_db_table(
326
    ...     'openstreetmap', 'osm_point', ['geom', 'geom_centroid']
327
    ... )  # doctest: +SKIP
328
329
    Parameters
330
    ----------
331
    schema : str
332
        The target table's database schema
333
    table : str
334
        Database table on which to put the given comment
335
    geom_columns : list of str
336
        Names of all geometry columns in the table. This is required to return
337
        Geometry data type for those columns as SQL Alchemy does not recognize
338
        them correctly. Defaults to ['geom'].
339
340
    Returns
341
    -------
342
    list of dict
343
        Resource fields
344
    """
345
346
    # handle geometry columns
347
    if geom_columns is None:
348
        geom_columns = ["geom"]
349
    for col in geom_columns:
350
        ischema_names[col] = Geometry
351
352
    table = Table(
353
        table, MetaData(), schema=schema, autoload=True, autoload_with=engine()
354
    )
355
356
    return [
357
        {
358
            "name": col.name,
359
            "description": "",
360
            "type": str(col.type).lower(),
361
            "unit": "none",
362
        }
363
        for col in table.c
364
    ]
365
366
367
def sources():
368
    return {
369
        "bgr_inspee": {
370
            "title": "Salt structures in Northern Germany",
371
            "description": 'The application "Information System Salt Structures" provides information about the '
372
            "areal distribution of salt structures (stocks and pillows) in Northern Germany. With general structural "
373
            "describing information, such as depth, secondary thickness, types of use or state of exploration, queries "
374
            "can be conducted. Contours of the salt structures can be displayed at horizontal cross-sections at four "
375
            "different depths up to a maximum depth of 2000 m below NN. A data sheet with information and further "
376
            "reading is provided for every single salt structure. Taking into account the fact that this work was "
377
            "undertaken at a scale for providing an overview and not for investigation of single structures, the scale "
378
            "of display is limited to a minimum of 1:300.000. This web application is the product of a BMWi-funded "
379
            'research project "InSpEE" running from the year 2012 to 2015. The acronym stands for "Information system '
380
            "salt structures: planning basis, selection criteria and estimation of the potential for the construction "
381
            'of salt caverns for the storage of renewable energies (hydrogen and compressed air)".',
382
            "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=338136ea-261a-4569-a2bf-92999d09bad2",
383
            "licenses": [license_geonutzv("© BGR, Hannover, 2015")],
384
        },
385
        "bgr_inspeeds": {
386
            "title": "Flat layered salts in Germany",
387
            "description": "Which salt formations are suitable for storing hydrogen or compressed air? "
388
            "In the InSpEE-DS research project, scientists developed requirements and criteria for the assessment "
389
            "of suitable sites even if their exploration is still at an early stage and there is little knowledge of "
390
            "the salinaries' structures. Scientists at DEEP.KBB GmbH in Hanover, worked together with their project "
391
            "partners at the Federal Institute for Geosciences and Natural Resources and the Leibniz University "
392
            "Hanover, Institute for Geotechnics Hanover, to develop the planning basis for the site selection and for "
393
            "the construction of storage caverns in flat layered salt and multiple or double saliniferous formations. "
394
            "Such caverns could store renewable energy in the form of hydrogen or compressed air. While the previous "
395
            "project InSpEE was limited to salt formations of great thickness in Northern Germany, salt horizons of "
396
            "different ages have now been examined all over Germany. To estimate the potential, depth contour maps of "
397
            "the top and the base as well as thickness maps of the respective stratigraphic units and reference "
398
            "profiles were developed. Information on compressed air and hydrogen storage potential were given for the "
399
            "identified areas and for the individual federal states. The web service "
400
            '"Information system for flat layered salt" gives access to this data. The scale of display is limited '
401
            "to a minimum of 1:300.000. This geographic information is product of a BMWi-funded research project "
402
            '"InSpEE-DS" running from the year 2015 to 2019. The acronym stands for "Information system salt: '
403
            "planning basis, selection criteria and estimation of the potential for the construction of salt caverns "
404
            'for the storage of renewable energies (hydrogen and compressed air) - double saline and flat salt layers".',
405
            "path": "https://produktcenter.bgr.de/terraCatalog/DetailResult.do?fileIdentifier=630430b8-4025-4d6f-9a62-025b53bc8b3d",
406
            "licenses": [license_geonutzv("© BGR, Hannover, 2021")],
407
        },
408
        "bgr_inspeeds_data_bundle": {
409
            "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die "
410
            "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – "
411
            "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung",
412
            "description": "Shapefiles corresponding to the data provided in figure 7-1 "
413
            "(Donadei, S., et al., 2020, p. 7-5). The energy storage potential data are provided per federal state "
414
            " in table 7-1 (Donadei, S., et al., 2020, p. 7-4). Note: Please include all bgr data sources when using "
415
            "the data.",
416
            "path": "https://dx.doi.org/10.5281/zenodo.4896526",
417
            "licenses": [license_geonutzv("© BGR, Hannover, 2021")],
418
        },
419
        "bgr_inspeeds_report": {
420
            "title": "Informationssystem Salz: Planungsgrundlagen, Auswahlkriterien und Potenzialabschätzung für die "
421
            "Errichtung von Salzkavernen zur Speicherung von Erneuerbaren Energien (Wasserstoff und Druckluft) – "
422
            "Doppelsalinare und flach lagernde Salzschichten. Teilprojekt Bewertungskriterien und Potenzialabschätzung",
423
            "description": "The report includes availability of saltstructures for energy storage and energy "
424
            "storage potential accumulated per federal state in Germany.",
425
            "path": "https://www.bgr.bund.de/DE/Themen/Nutzung_tieferer_Untergrund_CO2Speicherung/Downloads/InSpeeDS_TP_Bewertungskriterien.pdf?__blob=publicationFile&v=3",
426
            "licenses": [license_geonutzv("© BGR, Hannover, 2021")],
427
        },
428
        "demandregio": {
429
            "title": "DemandRegio",
430
            "description": "Harmonisierung und Entwicklung von Verfahren zur regionalen und "
431
            "zeitlichen Auflösung von Energienachfragen",
432
            "path": "https://doi.org/10.34805/ffe-119-20",
433
            "licenses": [license_ccby("© FZJ, TUB, FfE")],
434
        },
435
        "egon-data": {
436
            "title": "eGon-data",
437
            "description": "Workflow to download, process and generate data sets"
438
            "suitable for the further research conducted in the project eGon (https://ego-n.org/)",
439
            "path": "https://github.com/openego/eGon-data",
440
            "licenses": [license_agpl("© eGon development team")],
441
        },
442
        "egon-data_bundle": {
443
            "title": "Data bundle for egon-data",
444
            "description": "Zenodo repository to provide several different input data sets for eGon-data",
445
            "path": "https://sandbox.zenodo.org/record/1167119",
446
            "licenses": [license_ccby("© eGon development team")],
447
        },
448
        "Einspeiseatlas": {
449
            "title": "Einspeiseatlas",
450
            "description": "Im Einspeiseatlas finden sie sich die Informationen "
451
            "zu realisierten und geplanten Biomethanaufbereitungsanlagen - mit "
452
            "und ohne Einspeisung ins Gasnetz - in Deutschland und weltweit.",
453
            "path": "https://www.biogaspartner.de/einspeiseatlas/",
454
            "licenses": [
455
                license_ccby("Deutsche Energie-Agentur (dena, 2021)")
456
            ],
457
        },
458
        "era5": {
459
            "title": "ERA5 global reanalysis",
460
            "description": "ERA5 is the fifth generation ECMWF reanalysis for the global climate "
461
            "and weather for the past 4 to 7 decades. Currently data is available from 1950, "
462
            "split into Climate Data Store entries for 1950-1978 (preliminary back extension) and f"
463
            "rom 1979 onwards (final release plus timely updates, this page). ERA5 replaces the ERA-Interim reanalysis. "
464
            "See the online ERA5 documentation "
465
            "(https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency) "
466
            "for more information.",
467
            "path": "https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Dataupdatefrequency",
468
            "licenses": [
469
                {
470
                    "name": "Licence to use Copernicus Products",
471
                    "title": "Licence to use Copernicus Products",
472
                    "path": "https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf",
473
                    "instruction": "This Licence is free of charge, worldwide, non-exclusive, royalty free and perpetual. "
474
                    "Access to Copernicus Products is given for any purpose in so far as it is lawful, whereas use "
475
                    "may include, but is not limited to: reproduction; distribution; communication to the public; "
476
                    "adaptation, modification and combination with other data and information; or any "
477
                    "combination of the foregoing",
478
                    "attribution": "Copernicus Climate Change Service (C3S) Climate Data Store",
479
                },
480
            ],
481
        },
482
        "dsm-heitkoetter": {
483
            "title": "Assessment of the regionalised demand response potential "
484
            "in Germany using an open source tool and dataset",
485
            "description": "With the expansion of renewable energies in Germany, "
486
            "imminent grid congestion events occur more often. One approach for "
487
            "avoiding curtailment of renewable energies is to cover excess feed-in "
488
            "by demand response. As curtailment is often a local phenomenon, in "
489
            "this work we determine the regional demand response potential for "
490
            "the 401 German administrative districts with a temporal resolution "
491
            "of 15 min, including technical, socio-technical and economic "
492
            "restrictions.",
493
            "path": "https://doi.org/10.1016/j.adapen.2020.100001",
494
            "licenses": [
495
                license_ccby(
496
                    "© 2020 German Aerospace Center (DLR), "
497
                    "Institute of Networked Energy Systems."
498
                )
499
            ],
500
        },
501
        "hotmaps_industrial_sites": {
502
            "titel": "industrial_sites_Industrial_Database",
503
            "description": "Georeferenced industrial sites of energy-intensive industry sectors in EU28",
504
            "path": "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database",
505
            "licenses": [
506
                license_ccby("© 2016-2018: Pia Manz, Tobias Fleiter")
507
            ],
508
        },
509
        "hotmaps_scen_buildings": {
510
            "titel": "scen_current_building_demand",
511
            "description": "Energy demand scenarios in buidlings until the year 2050 - current policy scenario",
512
            "path": "https://gitlab.com/hotmaps/scen_current_building_demand",
513
            "licenses": [
514
                license_ccby(
515
                    "© 2016-2018: Michael Hartner, Lukas Kranzl, Sebastian Forthuber, Sara Fritz, Andreas Müller"
516
                )
517
            ],
518
        },
519
        "mastr": {
520
            "title": "open-MaStR power unit registry",
521
            "description": "Raw data download Marktstammdatenregister (MaStR) data "
522
            "using the webservice. All data from the Marktstammdatenregister is included."
523
            "There are duplicates included. For further information read in the documentation"
524
            "of the original data source: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/statistik.html",
525
            "path": "https://sandbox.zenodo.org/record/808086",
526
            "licenses": [
527
                licenses_datenlizenz_deutschland(
528
                    "© 2021 Bundesnetzagentur für Elektrizität, Gas, Telekommunikation, Post und Eisenbahnen"
529
                )
530
            ],
531
        },
532
        "nep2021": {
533
            "title": "Netzentwicklungsplan Strom 2035, Version 2021, erster Entwurf",
534
            "description": "Die vier deutschen Übertragungsnetzbetreiber zeigen mit "
535
            "diesem ersten Entwurf des Netzentwicklungsplans 2035, Version 2021, den "
536
            "benötigten Netzausbau für die nächsten Jahre auf. Der NEP-Bericht beschreibt "
537
            "keine konkreten Trassenverläufe von Übertragungsleitungen, sondern er "
538
            "dokumentiert den notwendigen Übertragungsbedarf zwischen Netzknoten. "
539
            "Das heißt, es werden Anfangs- und Endpunkte von zukünftigen Leitungsverbindungen "
540
            "definiert sowie konkrete Empfehlungen für den Aus- und Neubau der Übertragungsnetze "
541
            "an Land und auf See in Deutschland gemäß den Detailanforderungen im § 12 EnWG gegeben.",
542
            "path": "https://zenodo.org/record/5743452#.YbCoz7so8go",
543
            "licenses": [license_ccby("© Übertragungsnetzbetreiber")],
544
        },
545
        "openffe_gas": {
546
            "title": "Load Curves of the Industry Sector – eXtremOS solidEU Scenario (Europe NUTS-3)",
547
            "description": "Load Curves of the Industry Sector for the eXtremOS solidEU Scenario Scenario at NUTS-3-Level. "
548
            "More information at https://extremos.ffe.de/.",
549
            "path": "http://opendata.ffe.de/dataset/load-curves-of-the-industry-sector-extremos-solideu-scenario-europe-nuts-3/",
550
            "licenses": [license_ccby("© FfE, eXtremOS Project")],
551
        },
552
        "openstreetmap": {
553
            "title": "OpenStreetMap Data Extracts (Geofabrik)",
554
            "description": "Full data extract of OpenStreetMap data for defined"
555
            "spatial extent at ''referenceDate''",
556
            "path": "https://download.geofabrik.de/europe/germany-210101.osm.pbf",
557
            "licenses": [license_odbl("© OpenStreetMap contributors")],
558
        },
559
        "peta": {
560
            "title": "Pan-European Thermal Atlas, Peta version 5.0.1",
561
            "description": "Modelled Heat Demand distribution (in GJ per hectare grid cell) for residential and service "
562
            "heat demands for space heating and hot water for the year 2015 using HRE4 data and the combined "
563
            "top-down bottom-up approach of HRE4. "
564
            "National sector-specific heat demand data, derived by the FORECAST model in HRE4 for residential "
565
            "(delivered energy, for space heating and hot water) and service-sector (delivered energy, for space heating, hot "
566
            "water and process heat) buildings for the year 2015, were distributed using modelled, spatial "
567
            "statistics based floor areas in 100x100m grids and a population grid. "
568
            "For further information please see the documentation available on the Heat Roadmap Europe website, "
569
            "in particular D2.3 report: Methodologies and assumptions used in the mapping.",
570
            "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/search",
571
            "licenses": [
572
                license_ccby(
573
                    "© Europa-Universität Flensburg, Halmstad University and Aalborg University"
574
                )
575
            ],
576
        },
577
        "pipeline_classification": {
578
            "title": "Technical pipeline characteristics for high pressure pipelines",
579
            "description": "Parameters for the classification of gas pipelines, "
580
            "the whole documentation could is available at: "
581
            "https://www.econstor.eu/bitstream/10419/173388/1/1011162628.pdf",
582
            "path": "https://zenodo.org/record/5743452",
583
            "licenses": [license_ccby("© DIW Berlin, 2017")],
584
        },
585
        "schmidt": {
586
            "title": "Supplementary material to the masters thesis: "
587
            "NUTS-3 Regionalization of Industrial Load Shifting Potential in Germany using a Time-Resolved Model",
588
            "description": "Supplementary material to the named masters thesis, containing data on industrial processes"
589
            "for the estimation of NUTS-3 load shifting potential of suitable electrically powered industrial processes"
590
            "(cement milling, mechanical pulping, paper production, air separation).",
591
            "path": "https://zenodo.org/record/3613767",
592
            "licenses": [license_ccby("© 2019 Danielle Schmidt")],
593
        },
594
        "SciGRID_gas": {
595
            "title": "SciGRID_gas IGGIELGN",
596
            "description": "The SciGRID_gas dataset represents the European "
597
            "gas transport network (pressure levels of 20 bars and higher) "
598
            "including the geo-referenced transport pipelines,  compressor "
599
            "stations, LNG terminals, storage, production sites, gas power "
600
            "plants, border points, and demand time series. ",
601
            "path": "https://dx.doi.org/10.5281/zenodo.4896526",
602
            "licenses": [
603
                license_ccby(
604
                    "Jan Diettrich; Adam Pluta; Wided Medjroubi (DLR-VE)"
605
                ),
606
            ],
607
        },
608
        "seenergies": {
609
            "title": "D5 1 Industry Dataset With Demand Data",
610
            "description": "Georeferenced EU28 industrial sites with quantified annual excess heat volumes and demand data"
611
            "within main sectors: Chemical industry, Iron and steel, Non-ferrous metals, Non-metallic minerals, Paper and printing, and Refineries.",
612
            "path": "https://s-eenergies-open-data-euf.hub.arcgis.com/datasets/5e36c0af918040ed936b4e4c101f611d_0/about",
613
            "licenses": [license_ccby("© Europa-Universität Flensburg")],
614
        },
615
        "technology-data": {
616
            "titel": "Energy System Technology Data v0.3.0",
617
            "description": "This script compiles assumptions on energy system "
618
            "technologies (such as costs, efficiencies, lifetimes, etc.) for "
619
            "chosen years (e.g. [2020, 2030, 2050]) from a variety of sources "
620
            "into CSV files to be read by energy system modelling software. "
621
            "The merged outputs have standardized cost years, technology names, "
622
            "units and source information.",
623
            "path": "https://github.com/PyPSA/technology-data/tree/v0.3.0",
624
            "licenses": [
625
                license_agpl(
626
                    "© Marta Victoria (Aarhus University), Kun Zhu (Aarhus University), Elisabeth Zeyen (TUB), Tom Brown (TUB)"
627
                )
628
            ],
629
        },
630
        "tyndp": {
631
            "title": "Ten-Year Network Development Plan (TYNDP) 2020 Scenarios",
632
            "description": "ENTSOs’ TYNDP 2020 Scenario Report describes possible European energy futures up to 2050. "
633
            "Scenarios are not forecasts; they set out a range of possible futures used by the ENTSOs to test future "
634
            "electricity and gas infrastructure needs and projects. The scenarios are ambitious as they deliver "
635
            "a low carbon energy system for Europe by 2050. The ENTSOs have developed credible scenarios that are "
636
            "guided by technically sound pathways, while reflecting country by country specifics, so that a pan-European "
637
            "low carbon future is achieved.",
638
            "path": "https://tyndp.entsoe.eu/maps-data",
639
            "licenses": [license_ccby("© ENTSO-E and ENTSOG")],
640
        },
641
        "vg250": {
642
            "title": "Verwaltungsgebiete 1:250 000 (Ebenen)",
643
            "description": "Der Datenbestand umfasst sämtliche Verwaltungseinheiten der "
644
            "hierarchischen Verwaltungsebenen vom Staat bis zu den Gemeinden "
645
            "mit ihren Grenzen, statistischen Schlüsselzahlen, Namen der "
646
            "Verwaltungseinheit sowie die spezifische Bezeichnung der "
647
            "Verwaltungsebene des jeweiligen Landes.",
648
            "path": "https://daten.gdz.bkg.bund.de/produkte/vg/vg250_ebenen_0101/2020/vg250_01-01.geo84.shape.ebenen.zip",
649
            "licenses": [
650
                licenses_datenlizenz_deutschland(
651
                    "© Bundesamt für Kartographie und Geodäsie "
652
                    "2020 (Daten verändert)"
653
                )
654
            ],
655
        },
656
        "zensus": {
657
            "title": "Statistisches Bundesamt (Destatis) - Ergebnisse des Zensus 2011 zum Download",
658
            "description": "Als Download bieten wir Ihnen auf dieser Seite zusätzlich zur "
659
            "Zensusdatenbank CSV- und teilweise Excel-Tabellen mit umfassenden Personen-, Haushalts- "
660
            "und Familien- sowie Gebäude- und Wohnungs­merkmalen. Die Ergebnisse liegen auf Bundes-, "
661
            "Länder-, Kreis- und Gemeinde­ebene vor. Außerdem sind einzelne Ergebnisse für Gitterzellen verfügbar.",
662
            "path": "https://www.zensus2011.de/SharedDocs/Aktuelles/Ergebnisse/DemografischeGrunddaten.html;jsessionid=E0A2B4F894B258A3B22D20448F2E4A91.2_cid380?nn=3065474",
663
            "licenses": [
664
                licenses_datenlizenz_deutschland(
665
                    "© Statistische Ämter des Bundes und der Länder 2014"
666
                )
667
            ],
668
        },
669
    }
670
671
672
def contributors(authorlist):
673
    contributors_dict = {
674
        "am": {
675
            "title": "Aadit Malla",
676
            "email": "https://github.com/aadit879",
677
        },
678
        "an": {
679
            "title": "Amélia Nadal",
680
            "email": "https://github.com/AmeliaNadal",
681
        },
682
        "cb": {
683
            "title": "Clara Büttner",
684
            "email": "https://github.com/ClaraBuettner",
685
        },
686
        "ce": {
687
            "title": "Carlos Epia",
688
            "email": "https://github.com/CarlosEpia",
689
        },
690
        "fw": {
691
            "title": "Francesco Witte",
692
            "email": "https://github.com/fwitte",
693
        },
694
        "gp": {
695
            "title": "Guido Pleßmann",
696
            "email": "https://github.com/gplssm",
697
        },
698
        "ic": {
699
            "title": "Ilka Cußmann",
700
            "email": "https://github.com/IlkaCu",
701
        },
702
        "ja": {
703
            "title": "Jonathan Amme",
704
            "email": "https://github.com/nesnoj",
705
        },
706
        "je": {
707
            "title": "Jane Doe",
708
            "email": "https://github.com/JaneDoe",
709
        },
710
        "ke": {
711
            "title": "Katharina Esterl",
712
            "email": "https://github.com/KathiEsterl",
713
        },
714
        "kh": {
715
            "title": "Kilian Helfenbein",
716
            "email": "https://github.com/khelfen",
717
        },
718
        "sg": {
719
            "title": "Stephan Günther",
720
            "email": "https://github.com/gnn",
721
        },
722
        "um": {
723
            "title": "Ulf Müller",
724
            "email": "https://github.com/ulfmueller",
725
        },
726
    }
727
    return [
728
        {key: value for key, value in contributors_dict[author].items()}
729
        for author in authorlist
730
    ]
731
732
733
def upload_json_metadata():
734
    """Upload json metadata into db from zenodo"""
735
    path = Path(data_path[0]) / "json_metdata"
736
737
    v = "oep-v1.4"
738
739
    for file in os.listdir(path=str(path)):
740
741
        if file.endswith(".json"):
742
            split = file.split(".")
743
            if len(split) != 3:
744
                continue
745
            schema = split[0]
746
            table = split[1]
747
748
            dialect = get_dialect(v)()
749
750
            with open(file, "r") as infile:
751
                obj = dialect.parse(infile.read())
752
753
            meta_data_string = dialect.compile_and_render(obj)
754
            meta_json = "'" + meta_data_string + "'"
755
            db.submit_comment(meta_json, schema, table)
756
            logger.info(f"{schema}.{table} uploaded!")
757
758
759
class Json_Metadata(Dataset):
760
    def __init__(self, dependencies):
761
        super().__init__(
762
            name="JsonMetadata",
763
            version="0.0.0",
764
            dependencies=dependencies,
765
            tasks={upload_json_metadata},
766
        )
767