Passed
Pull Request — dev (#568)
by
unknown
01:43
created

data.metadata.license_egon_data_odbl()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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