Code Monkey home page Code Monkey logo

fit_processing's Introduction

Converting Garmin FIT to CSV (and GPX to CSV)

article for original version

Requirements:

  • Python 3.5+

  • BeautifulSoup

  • fitparse (installation instructions below)

  • tzwhere (to localize timezones)

  • pytz (to localize timezones)

  • FIT files to convert (if using that feature)

  • GPX files to convert (if using that feature)

First, install fitparse

sudo pip3 install -e git+https://github.com/dtcooper/python-fitparse#egg=python-fitparse

OR

sudo pip3 install fitparse

Then you can execute process_all.py

python3 process_all.py --subject-name=mysubjectname --fit-source-dir=/media/myname/GARMIN/Garmin/ACTIVITY/

This will create a bunch of CSVs for all of your workouts in that directory. The files will be stored in a subject_data directory's subdirectory (check the defaults for the specific folders), which is generated based off the subject name. Up to 3 files are made per FIT file:

  1. A CSV of all of the track data

  2. A CSV of the lap data

  3. A CSV of the start (and stop) data

Each of the CSVs is in the format '{activity_type}YY-MM-DD_HH-MM-SS[{laps,starts}].csv.

You can also provide a csv to censor certain geographic regions by latitude, longitude, and radius. Simply create a CSV with longitude, latitude, and radius column headers, and add as many circular regions as you want. Note that radius is assumed to be in meters.

python3 process_all.py --subject-name=mysubjectname --fit-source-dir=/media/myname/GARMIN/Garmin/ACTIVITY/ --censorfile=/home/mydir/censor.csv --censor

This will be stored in a folder called "censored" that is in the subject's directory. You can use the --censor-string= to change what censored fields are replaced with (default is [CENSORED]).

You can also archive the data after it's been processed:

python3 process_all.py --subject-name=mysubjectname --fit-source-dir=/media/myname/GARMIN/Garmin/ACTIVITY/ --censorfile=/home/mydir/censor.csv --censor --archive-results

By default, this stores data in a directory called archives in the main subject_data folder. You can add the --archive-censored-only, which will only archive the censored folder.

GPX data

You can also process GPX data (and censor it the same way as FIT data)

For the initial processing, you can do

python3 process_all.py --subject-name=mysubjectname --skip-fit-conversion gpx-source-dir=/home/mydir/gpx_files

By default, the program will always try to copy/process FIT files unless you add the --skip-fit-conversion flag, but you can always tweak the code to your needs.

Additional Help

You can use python3 process_all.py --help to see more information.

fit_processing's People

Contributors

mcandocia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.