-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_over_1month.py
More file actions
35 lines (27 loc) · 1.13 KB
/
script_over_1month.py
File metadata and controls
35 lines (27 loc) · 1.13 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
import os
import JP2_Image_Download as Jpd
import logging
if __name__ == '__main__':
save_dir = os.path.abspath('/Users/mskirk/Desktop/MLDataTest')
tstart = '2018/07/01 00:00:00'
tend = '2018/08/01 00:00:00'
j = Jpd.Jp2ImageDownload(save_dir, tstart=tstart, tend=tend)
logging.basicConfig(format='%(asctime)s %(message)s', filename=os.path.join(j.save_dir, 'logger.log'), level=logging.INFO)
while j.missed_downloads_flag:
try:
j.download_images()
if j.missed_downloads:
print('Missed downloads. Making new attempt(s)...')
except ConnectionResetError:
print('HEK server error. Trying again...')
logging.warning('HEK server error raised ConnectionResetError')
continue
j.data_cleanup()
# Test the creation of label-masks
while j.missed_labels_flag:
try:
j.make_labels()
except ConnectionResetError:
print('HEK server error during make_labels(). Trying again...')
logging.warning('HEK server error raised ConnectionResetError during make_labels()')
continue