bearing package

Submodules

bearing.angle module

This module includes the Bearing class which handles all the bearings and azimuth values and performs all the conversions.

class bearing.angle.Bearing[source]

Bases: object

The Bearing class handles storing the data for bearing and azimuth. It does the conversion between the two and returns the information in several formats.

calc_azimuth() → None[source]

Performs the azimuth conversion using the private members

Returns:None
calc_bearing(az: float) → None[source]

Performs the bearing calculation. :param az: Azimuth as a float

Returns:None
dec_to_dms() → None[source]

Adjust the angle based on north and sets the degrees, minutes, and seconds member variables.

Returns:None
get_azimuth() → float[source]

Since accessing the member variables directly is discouraged, this method returns the azimuth value.

Returns:azimuth value
Return type:float
get_bearing() → str[source]

Return just the bearing as a formatted string.

Returns:bearing value
Return type:str
get_bearing_dict() → Dict[KT, VT][source]

Return the components of a bearing in a dictionary.

Returns:bearing
Return type:Dict
set_azimuth(az: float) → str[source]

Set the value of the azimuth and perform the bearing conversion.

Parameters:az (float) – azimuth value
Returns:The bearing as a string
Return type:str
set_bearing(n: str, d: int, m: int, s: int, e: str) → float[source]

Initialize a bearing and perform the azimuth conversion

Parameters:
  • n (str) – northing (is always either ‘N’ or ‘S’)
  • d (int) – degrees
  • m (int) – minutes
  • s (int) – seconds
  • e (str) – easting (always either ‘E’ or ‘W’)
Returns:

the azimuth as a float

Return type:

float

submit_azimuth(az: str) → Dict[KT, VT][source]

Sets the azimuth value when the input is a string. Does some validation and returns the bearing as a dictionary.

Parameters:az (str) – azimuth value
Returns:bearing components
Return type:Dict
submit_bearing(n: str, d: str, m: str, s: str, e: str) → float[source]

Initialize a bearing using string values for input. submit_bearing does some extra validation and converts degrees minutes, and seconds to integers.

Parameters:
  • n (str) – northing (is always either ‘N’ or ‘S’)
  • d (str) – degrees
  • m (str) – minutes
  • s (str) – seconds
  • e (str) – easting (always either ‘E’ or ‘W’)
Returns:

the azimuth as a float or 0 on failure

Return type:

float

bearing.bearing module

Bearing main module. Runs the user interface to allow entering the bearing and azimuth values

class bearing.bearing.UI[source]

Bases: object

The UI class defines the user interface dialog using PySimpleGUI. It allows entering the bearing and azimuth values and performs the conversions as text is entered into the form fields.

draw_axis()[source]

Draws the X and Y axis on the canvas for the graphical representation of the angle on the user interface form.

draw_vector()[source]

Draws the angle on the canvas. Adds a little arc to illustrate.

Module contents

Top-level package for bearing.