Passed
Push — dev ( 7cf077...0e9721 )
by
unknown
07:11 queued 04:45
created

data.metadata   A

Complexity

Total Complexity 20

Size/Duplication

Total Lines 966
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 20
eloc 355
dl 0
loc 966
rs 10
c 0
b 0
f 0

14 Functions

Rating   Name   Duplication   Size   Complexity  
A licenses_datenlizenz_deutschland() 0 45 1
B contributors() 0 58 1
A context() 0 22 1
A license_odbl() 0 22 1
A meta_metadata() 0 16 1
A license_agpl() 0 27 1
A license_ccby() 0 22 1
A license_dedl() 0 38 1
A upload_json_metadata() 0 17 4
A generate_resource_fields_from_sqla_model() 0 35 1
A license_geonutzv() 0 28 1
B sources() 0 508 1
A generate_resource_fields_from_db_table() 0 52 3
A license_egon_data_odbl() 0 10 1

1 Method

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