Passed
Pull Request — dev (#1226)
by Patrik
01:50
created

shared.download_input_data()   A

Complexity

Conditions 3

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 21
rs 9.75
c 0
b 0
f 0
cc 3
nop 0
1
"""
2
SPDX-FileCopyrightText: Patrik Schönfeldt
3
SPDX-FileCopyrightText: DLR e.V.
4
5
SPDX-License-Identifier: MIT
6
"""
7
8
from pathlib import Path
9
10
from urllib.request import urlretrieve
11
12
13
def download_input_data():
14
    url_temperature = (
15
        "https://oemof.org/wp-content/uploads/2025/12/temperature.csv"
16
    )
17
    url_energy = "https://oemof.org/wp-content/uploads/2025/12/energy.csv"
18
19
    print(
20
        "Data is licensed from M. Schlemminger, T. Ohrdes, E. Schneider,"
21
        " and M. Knoop. Under Creative Commons Attribution 4.0 International"
22
        " License It is also available at doi: 10.5281/zenodo.5642902."
23
    )
24
25
    file_path = Path(__file__).parent
26
27
    temperature_file = Path(file_path, "temperature.csv")
28
    if not temperature_file.exists():
29
        urlretrieve(url_temperature, temperature_file)
30
31
    energy_file = Path(file_path, "energy.csv")
32
    if not energy_file.exists():
33
        urlretrieve(url_energy, energy_file)
34
35
36
if __name__ == "__main__":
37
    download_input_data()
38