-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessAVCGAList.py
62 lines (50 loc) · 1.5 KB
/
ProcessAVCGAList.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import AVCGAmmsi
import GlobalDefinitions
from configparser import ConfigParser
# used to take in a CSV version of the Portal Spreadsheet AVCGA EPIRB MMSI.xls saved as CSV
# and create a Dictionary keyed on MMSI of AVCGA vessels
#
def ProcessAVCGAList():
loop = True
AVCGADict = {}
filename = (
GlobalDefinitions.Global.WorkingDir + "\\" + GlobalDefinitions.Global.AVCGAList
)
try:
csv = open(filename, "r")
except FileNotFoundError: # file non-existent
return AVCGADict
x = 11 # column in csv file containing MMSI (0 based)
while loop:
instring = csv.readline()
if instring != "":
# reads tpo EOF indicated by a null return
list = instring.split(",")
if list[x] != "" and list[x].isnumeric():
while len(list[x]) < 9:
list[x] = "0" + list[x]
AVCGADict[list[x]] = (
list[0],
list[1],
list[2],
list[3],
list[4],
list[5],
list[6],
list[7],
list[8],
list[9],
list[10],
list[11],
list[12],
list[13],
list[14],
)
else:
loop = False
csv.close()
return AVCGADict
def main(self):
pass
if __name__ == 'main':
main()