-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (48 loc) · 1.29 KB
/
main.py
File metadata and controls
60 lines (48 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
open-MaStR - Main file
Bulk: Download XML-Dump and fill in local SQLite database.
SPDX-License-Identifier: AGPL-3.0-or-later
"""
from open_mastr import Mastr
import os
## specify download parameter
# set custom output path for: csv-export, database, xml-export.
# os.environ['OUTPUT_PATH'] = r"/your/custom/output_path"
# optimize bulk downloads and use the recommended number of processes
# os.environ['USE_RECOMMENDED_NUMBER_OF_PROCESSES'] = "True"
# set up your own number of processes for bulk download
# os.environ['NUMBER_OF_PROCESSES'] = "your_number"
# bulk download
bulk_date = "today"
bulk_cleansing = True
data_bulk = [
"biomass",
"combustion",
"gsgk",
"hydro",
"nuclear",
"solar",
"storage",
"wind",
"balancing_area",
"electricity_consumer",
"gas",
"grid",
"location",
"market",
"permit",
]
if __name__ == "__main__":
# instantiate Mastr class
db = Mastr()
## download Markstammdatenregister
# bulk download
db.download(method="bulk", data=data_bulk, date=bulk_date, bulk_cleansing=True)
## export to csv
"""
Technology-related tables are exported as joined, whereas additional tables
are duplicated as they are in the database.
"""
db.to_csv()