martin-ueding / geo-activity-playground

Data analysis and visualization based on GPS tracked outdoor activities.
https://martin-ueding.github.io/geo-activity-playground/
MIT License
38 stars 14 forks source link

Time series without latitude data aren't handled #147

Closed Hanfbaum closed 3 months ago

Hanfbaum commented 3 months ago

Bei eingerichteter Strava API kommt es zu diesem Fehler. Mit einer offline Variante in der nur die neusten paar Dutzend Aktivitäten fehlen kommt es nicht zu diesem Fehler.

E:\Martin\Playground_Strava>python -m geo_activity_playground serve
Import from Strava export: 0it [00:00, ?it/s]
Downloading Strava activities: 0it [00:00, ?it/s]
Enrich new activity data:   0%|                                                               | 0/2190 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\\_libs\\hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\\_libs\\hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'latitude'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 116, in <module>
    main()
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 92, in main
    options.func(options)
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 66, in <lambda>
    *make_activity_repository(options.basedir, options.skip_strava),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 110, in make_activity_repository
    scan_for_activities(repository, tile_visit_accessor, config, skip_strava)
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\webui\upload\controller.py", line 105, in scan_for_activities
    enrich_activities(config.get("kind", {}))
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\core\enrichment.py", line 79, in enrich_activities
    time_series = _embellish_single_time_series(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\core\enrichment.py", line 142, in _embellish_single_time_series
    timeseries["latitude"].shift(1),
    ~~~~~~~~~~^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\frame.py", line 4102, in __getitem__
    indexer = self.columns.get_loc(key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc
    raise KeyError(key) from err
KeyError: 'latitude'

E:\Martin\Playground_Strava>pause
Drücken Sie eine beliebige Taste . . .
martin-ueding commented 3 months ago

Du hast wohl eine Aktivität, die keine Geodaten enthält, aber trotzdem eine Zeitreihe. Das kann zum Beispiel Gewichtstraining sein, bei der man Pulsdaten hat.

Da das Programm ja nur mit Geodaten funktioniert, muss ich die einfach herausfiltern.

martin-ueding commented 3 months ago

Hätte eigentlich schon herausgefiltert werden sollen, ist jetzt aber noch eine Überprüfung drin.