sample_distance - bruno-beloff/scs_analysis GitHub Wiki

docs > software repositories > scs_analysis > commands > filtering and aggregating data


DESCRIPTION

The sample_distance utility is used to find the distance (in kilometres, to the nearest metre) between a given position, and the position in each of the input GPS JSON documents. A command flag specifies the path to the node within the document that is to be examined.

The quality of the GPS fix may be taken into account: if a quality is specified, then any GPS fix with a quality (rounded to the nearest integer) below that level is discarded.

A simple, spherical model of the earth is used.

SYNOPSIS

sample_distance.py -p LAT LNG [-i ISO] [-q QUALITY] [-v] GPS_PATH

Options
--version show program's version number and exit
-h, --help show this help message and exit
-p POSITION, --position=POSITION position (in degrees)
-i ISO, --iso-path=ISO path for ISO 8601 datetime output (default 'rec')
-q QUALITY, --quality=QUALITY minimum acceptable GPS quality
-v, --verbose report narrative to stderr

EXAMPLES

csv_reader.py -v scs-ph1-10-status-H2-15min.csv | sample_distance.py -v -p 51.4889752 -0.4418752 -q 1 val.gps | csv_writer.py -v scs-ph1-10-distance-H2-15min.csv

DOCUMENT EXAMPLE - INPUT

{"rec": "2020-12-09T21:00:00Z", "val": {"gps": {"pos": [51.48877673, -0.44155907], "elv": 33.3, "qual": 1.0}, "tag": "scs-ph1-10"}

DOCUMENT EXAMPLE - OUTPUT

{"rec": "2020-12-09T21:00:00Z", "gps": {"pos": [51.48877673, -0.44155907], "elv": 33.3, "qual": 1}, "dist": 0.031}

SEE ALSO

scs_dev/status_sampler

RESOURCES

Getting distance between two points based on latitude/longitude