flopp / GpxTrackPoster

Create a visually appealing poster from your GPX tracks
MIT License
430 stars 51 forks source link

methods (--type github --type circular) do not work if there are more than one track. #99

Open snooppr opened 2 years ago

snooppr commented 2 years ago

Works if there is one file in the directory.

Doesn't work, there are 3 files in the directory. create_poster --type circular

Creating poster of type circular with 2 tracks and storing it in file poster.svg... Traceback (most recent call last): File "/home/user/.local/bin/create_poster", line 10, in sys.exit(main()) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/cli.py", line 277, in main p.draw(drawers[args.type], args.output) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/poster.py", line 169, in draw self._draw_tracks(d, XY(self.width - 20, self.height - 30 - 30), XY(10, 30)) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/poster.py", line 194, in _draw_tracks self.tracks_drawer.draw(d, g, size, offset) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/circular_drawer.py", line 103, in draw self._draw_year(dr, g_year, sub_size, offset + margin + cell_size * XY(x, y), year) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/circular_drawer.py", line 174, in _draw_year key_times_list = utils.make_key_times(year_count) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/utils.py", line 121, in make_key_times s = list(takewhile(lambda n: n < 1, itercount(0, 1 / year_count))) ZeroDivisionError: division by zero

create_poster --type github

Creating poster of type github with 2 tracks and storing it in file poster.svg... Traceback (most recent call last): File "/home/user/.local/bin/create_poster", line 10, in sys.exit(main()) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/cli.py", line 277, in main p.draw(drawers[args.type], args.output) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/poster.py", line 169, in draw self._draw_tracks(d, XY(self.width - 20, self.height - 30 - 30), XY(10, 30)) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/poster.py", line 194, in _draw_tracks self.tracks_drawer.draw(d, g, size, offset) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/github_drawer.py", line 44, in draw year_length_str = utils.format_float(self.poster.m2u(year_length)) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/poster.py", line 175, in m2u return m.m_as(Units().km) File "/home/user/.local/lib/python3.8/site-packages/pint/quantity.py", line 533, in m_as return self.to(units).magnitude File "/home/user/.local/lib/python3.8/site-packages/pint/quantity.py", line 741, in to magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs) File "/home/user/.local/lib/python3.8/site-packages/pint/quantity.py", line 690, in _convert_magnitude_not_inplace return self._REGISTRY.convert(self._magnitude, self._units, other) File "/home/user/.local/lib/python3.8/site-packages/pint/registry.py", line 1036, in convert return self._convert(value, src, dst, inplace) File "/home/user/.local/lib/python3.8/site-packages/pint/registry.py", line 1951, in _convert return super()._convert(value, src, dst, inplace) File "/home/user/.local/lib/python3.8/site-packages/pint/registry.py", line 1558, in _convert return super()._convert(value, src, dst, inplace) File "/home/user/.local/lib/python3.8/site-packages/pint/registry.py", line 1069, in _convert raise DimensionalityError(src, dst, src_dim, dst_dim) pint.errors.DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'kilometer' ([length])

snooppr commented 2 years ago

create_poster --type heatmap """In addition, when I wanted to process a large array of data, I caught another uncaught:"""

Error while loading /home/user/GPX/10.10.2021 08_25 (1).gpx: Track has no start or end time. Error while loading /home/user/GPX/01.11.2021 12_36 (1).gpx: Track has no start or end time. Traceback (most recent call last): File "/home/user/.local/bin/create_poster", line 10, in sys.exit(main()) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/cli.py", line 247, in main tracks = loader.load_tracks(args.gpx_dir) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/track_loader.py", line 120, in load_tracks return self._filter_and_merge_tracks(tracks) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/track_loader.py", line 175, in _filter_and_merge_tracks tracks = self._merge_tracks(tracks) File "/home/user/.local/lib/python3.8/site-packages/gpxtrackposter/track_loader.py", line 185, in _merge_tracks tracks = sorted(tracks, key=lambda t1: t1.start_time()) TypeError: can't compare offset-naive and offset-aware datetimes

GNU/Linux deb; Python3.8.

snooppr commented 2 years ago

The anomalous behavior causes "dependency" on the training order and results in the error above.

create_poster --type "github" --gpx-dir "~/dir" Example, if I am going to process workouts (2015 and 2016, there will be no error), if (2015, 2016, 2018 then an error will appear and the poster will not be created), if (2015, 2016, 2017, 2018 there will be no error).