-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathread_all_sorted_filenames.py
44 lines (32 loc) · 1.01 KB
/
read_all_sorted_filenames.py
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
34
35
36
37
38
39
40
41
42
43
44
import snappy
from snappy import ProductIO
from snappy import HashMap
import os, gc
from snappy import GPF
def read_sorted_fileNamesList_from(path):
output = []
dates = []
date_output_dict = {}
# path = "D:\\Stockholm\\Descending\\DSC_orb22_Scene_2\\DSC_orb22_Scene_2_S1_zip\\"
for folder in os.listdir(path):
gc.enable()
# output.append(path + folder + "\\")
output.append(folder)
# print(folder)
cur_date = folder.split("_")[5]
dates.append(cur_date)
date_output_dict[cur_date] = folder
# print(folder, timestamp, date)
dates.sort()
print(dates)
filenames = []
for idx in range(len(dates)):
name = date_output_dict[dates[idx]]
filenames.append(name)
return filenames, dates
### Testing codes
# path = "D:\\Stockholm\\Descending\\DSC_orb22_Scene_2\\DSC_orb22_Scene_2_S1_zip\\"
# filenames, dates = read_all_sorted_folders_in(path)
#
# for i in range(len(filenames)):
# print(path + filenames[i])