-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_data.py
More file actions
26 lines (21 loc) · 737 Bytes
/
get_data.py
File metadata and controls
26 lines (21 loc) · 737 Bytes
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
def download_data(force=False):
"""Download and extract course data from Zenodo."""
import urllib.request
import zipfile
import os
zip_path = 'data.zip'
data_dir = 'data'
if not os.path.exists(zip_path) or force:
print("Downloading course data...")
urllib.request.urlretrieve(
'https://zenodo.org/records/16954427/files/data.zip?download=1',
zip_path
)
print("Download complete")
if not os.path.exists(data_dir) or force:
print("Extracting data files...")
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(data_dir)
print("Data extracted")
return data_dir
download_data()