edist

class upoints.edist.LocationsError(function=None, data=None)[source]

Bases: exceptions.ValueError

Error object for data parsing error.

New in version 0.6.0.

function

Function where error is raised.

data

Location number and data

Initialise a new LocationsError object.

Parameters:
  • function (str) – Function where error is raised
  • data (tuple) – Location number and data
class upoints.edist.NumberedPoint(latitude, longitude, name, units='km')[source]

Bases: upoints.point.Point

Class for representing locations from command line.

See also

upoints.point.Point

New in version 0.6.0.

name

A name for location, or its position on the command line

units

Unit type to be used for distances

Initialise a new NumberedPoint object.

Parameters:
  • latitude (float) – Location’s latitude
  • longitude (float) – Location’s longitude
  • name (str) – Location’s name or command line position
  • units (str) – Unit type to be used for distances
class upoints.edist.NumberedPoints(locations=None, format='dd', verbose=True, config_locations=None, units='km')[source]

Bases: upoints.point.Points

Class for representing a group of NumberedPoint objects.

New in version 0.6.0.

Initialise a new NumberedPoints object.

Parameters:
  • locations (list of str) – Location identifiers
  • format (str) – Coordinate formatting system to use
  • verbose (bool) – Whether to generate verbose output
  • config_locations (dict) – Locations imported from user’s config file
  • units (str) – Unit type to be used for distances
bearing(mode, string)[source]

Calculate bearing/final bearing between locations.

Parameters:
  • mode (str) – Type of bearing to calculate
  • string (bool) – Use named directions
destination(distance, bearing, locator)[source]

Calculate destination locations for given distance and bearings.

Parameters:
  • distance (float) – Distance to travel
  • bearing (float) – Direction of travel
  • locator (str) – Accuracy of Maidenhead locator output
display(locator)[source]

Pretty print locations.

Parameters:locator (str) – Accuracy of Maidenhead locator output
distance()[source]

Calculate distances between locations.

flight_plan(speed, time)[source]

Output the flight plan corresponding to the given locations.

Todo

Description

Parameters:
  • speed (float) – Speed to use for elapsed time calculation
  • time (str) – Time unit to use for output
import_locations(locations, config_locations)[source]

Import locations from arguments.

Parameters:
  • locations (list of str) – Location identifiers
  • config_locations (dict) – Locations imported from user’s config
  • file
range(distance)[source]

Test whether locations are within a given range of the first.

Parameters:distance (float) – Distance to test location is within
sun_events(mode)[source]

Calculate sunrise/sunset times for locations.

Parameters:mode (str) – Sun event to display
upoints.edist.read_locations(filename)[source]

Pull locations from a user’s config file.

Parameters:filename (str) – Config file to parse
Returns:List of locations from config file
Return type:dict
upoints.edist.read_csv(filename)[source]

Pull locations from a user’s CSV file.

Read gpsbabel‘s CSV output format

Parameters:filename (str) – CSV file to parse
Returns:List of locations as str objects
Return type:tuple of dict and list
upoints.edist.main()[source]

Main script handler.

Returns:0 for success, >1 error code
Return type:int