forked from zhurui0509/COVID-Forecast-Graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestore_progress_file.py
More file actions
32 lines (20 loc) · 884 Bytes
/
restore_progress_file.py
File metadata and controls
32 lines (20 loc) · 884 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
28
29
30
31
###### Code to (1). restore the progress_file.csv (2). solve the issue of accidentlt deleting the progress_file.csv
import os
from glob import glob
import csv
folder_PATH = './output/'
EXT = "*.ttl"
ttl_file_list = [file for path, subdir, files in os.walk(folder_PATH) for file in glob(os.path.join(path, EXT))]
progress_list = []
progress_file_name = './covid19-forecast-hub-master/data-processed/'
for ttl_file in ttl_file_list:
if '2020' in ttl_file:
forecast_name = ttl_file.replace('./output/', '')
forecast_name = forecast_name.replace('.ttl', '')
model_name = forecast_name[11:]
forecast_csv_file = forecast_name+".csv"
csv_file_name = ttl_file.replace('.ttl', '.csv')
progress_list.append(progress_file_name+model_name+'/'+forecast_csv_file)
with open('progress_file2.csv', 'w') as csvfile:
for item in progress_list:
csvfile.write(item + '\n')