usr bin python coding utf-8 import sys import numpy file sys argv inpu

 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import numpy
file = sys.argv[1]
input = open(file,"r").readlines()
lats = numpy.zeros((0))
lons = numpy.zeros((0))
name = numpy.zeros((0))
for line in input:
i = line.split(";")[5]
print i
lat_deg = i[0:2]
lat_min = i[4:6]
lat_sec = i[8:9]
lon_deg = i[19:21]
lon_min = i[23:24]
lon_sec = i[26:28]
lat_dec_min = float(lat_min) + float(lat_sec)/60
lat_dec_deg = float(lat_deg) + lat_dec_min/60
lon_dec_min = float(lon_min) + float(lon_sec)/60
lon_dec_deg = float(lon_deg) + lon_dec_min/60
names = line.split(";")[2]
lats = numpy.append(lats,lat_dec_deg)
lons = numpy.append(lons,lon_dec_deg)
name = numpy.append(name,names)
output = sys.argv[1][:-3]
file = open("%sdat" % output,"w")
print lats
print lons
print name
for i in range(len(lats)):
file.write("%.4f;%.4f;%s\n" % (lats[i],lons[i],name[i]))
exit()