-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathget_data.py
More file actions
28 lines (20 loc) · 750 Bytes
/
get_data.py
File metadata and controls
28 lines (20 loc) · 750 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
27
import urllib.request, zipfile, os
def download_data(force=False):
"""Download and extract course data from Zenodo."""
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/18235955/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
if __name__ == "__main__":
download_data()