Segment a stream of messages into continuous tracks.
Usage: gpsdio segment [OPTIONS] INFILE OUTFILE
Segment AIS data into continuous segments.
Options:
--version Show the version and exit.
--mmsi INTEGER Only segment this MMSI. If not given the first MMSI
found will be used.
--max-hours FLOAT Points with a time delta larger than N hours are forced
to be discontinuous. (default: 24)
--max-speed FLOAT Units are knots. Points with a speed above this value
are always considered discontinuous. (default: 30)
--noise-dist FLOAT DEPRECATED. Units are nautical miles. Points within this distance
are always considered continuous. Used to allow a
certain amount of GPS noise. (default: 0.27)
--segment-field TEXT Add the segment ID to this field when writing messages.
(default: segment)
--help Show this message and exit.
$ git clone https://github.com/SkyTruth/gpsdio-segment
$ pip install gpsdio-segment/
$ git clone https://github.com/SkyTruth/gpsdio-segment
$ cd gpsdio-segment
$ virtualenv venv
$ source venv/bin/activate
$ pip install -e .\[dev\]
$ py.test tests --cov gpsdio_segment --cov-report term-missing
You can also use the docker environment if you don't want to use any dependency on your machine. Just install docker and `docker compose <https://docs.docker.com/compose/`_ and then you can run development commands inside the container by running this:
If you make changes and you know they are right, but test_cli.py is failing because the expectd output is now different, you can update the expected output with this
To sort a newlineJSON file by timestamp .. code-block:: console
cat tests/data/416000000.json | jq -s -c '. | sort_by(.timestamp)[]'
See LICENSE.txt