-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstrava_max_speed.py
32 lines (22 loc) · 992 Bytes
/
strava_max_speed.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
from fitparse import FitFile
import os
# the overall max speed in meter p/s
max_speed = 0.0
# loop through all fit files in directory
for filename in os.listdir(os.path.abspath(os.getcwd())):
if filename.endswith(".fit"):
# open fitfile
fitfile = FitFile(filename)
# Get all data messages that are of type record
for record in fitfile.get_messages('record'):
# Go through all the data entries in this record
for record_data in record:
if record_data.name == "enhanced_speed":
# save new max speed if higher than previous value
if record_data.value > max_speed:
max_speed = record_data.value
# continue if not a fit file
else:
continue
print "Your max speed in KM/H is " + str(max_speed * 3.6)
print "Your max speed in M/PH is " + str(max_speed * 2.237)