From 4aa6702d40b67e8a026f683a25dfca136361bbb9 Mon Sep 17 00:00:00 2001 From: Silvester Date: Tue, 19 Jan 2016 18:17:47 +0100 Subject: [PATCH 1/2] support for min and max altitude added --- tcxparser.py | 12 ++++++++++++ test_tcxparser.py | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/tcxparser.py b/tcxparser.py index 4d8e07b..ab22bfc 100644 --- a/tcxparser.py +++ b/tcxparser.py @@ -78,6 +78,18 @@ def altitude_avg(self): """Average altitude for the workout""" altitude_data = self.altitude_points() return sum(altitude_data)/len(altitude_data) + + @property + def altitude_max(self): + """Max altitude for the workout""" + altitude_data = self.altitude_points() + return max(altitude_data) + + @property + def altitude_min(self): + """Min altitude for the workout""" + altitude_data = self.altitude_points() + return min(altitude_data) @property def ascent(self): diff --git a/test_tcxparser.py b/test_tcxparser.py index 8a19ee9..09f75a2 100644 --- a/test_tcxparser.py +++ b/test_tcxparser.py @@ -46,7 +46,13 @@ def test_pace(self): def test_altitude_avg_is_correct(self): self.assertAlmostEqual(self.tcx.altitude_avg, 172.020056184) + + def test_altitude_max_is_correct(self): + self.assertAlmostEqual(self.tcx.altitude_max, 215.95324707) + def test_altitude_min_is_correct(self): + self.assertAlmostEqual(self.tcx.altitude_min, 157.793579102) + def test_ascent_is_correct(self): self.assertAlmostEqual(self.tcx.ascent, 153.80981445) From e22ee1c796b37bb10c2a048908066845d2e46818 Mon Sep 17 00:00:00 2001 From: Silvester Date: Tue, 19 Jan 2016 21:12:02 +0100 Subject: [PATCH 2/2] README updated --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 556299a..c77e0ed 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Data extracted: - average pace during workout - average altitude during workout - ascent and descent of workout + - max and min altitude ## Installation