blob: 5a8dd025eb4b7ad133a99c54e80b6ce1192b93a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/python
import sys
sk_file = open(sys.argv[1])
labels = sk_file.readline().strip().split(',')
end = labels.index('h-sc')
print(','.join(labels[0:end] + ["height"]))
for line in sk_file:
line = line.strip().split(',')
out = line[0:end]
height = 0.0
for limb in map(lambda x: float(line[labels.index(x)]), ['h-sc','sc-s','s-hc','hi-kn','kn-an']):
if limb > 0:
height += limb
else:
height = -1
break
out += [str(height)]
print(','.join(out))
|