opensoar.utilities package¶
Submodules¶
opensoar.utilities.helper_functions module¶
-
opensoar.utilities.helper_functions.add_seconds(time: datetime.time, seconds: int) → datetime.time¶ Add seconds to datetime.time object and return resulting datetime.time object.
Parameters: - time –
- seconds – not limited to 0-59.
Returns:
-
opensoar.utilities.helper_functions.add_times(start_time: datetime.time, delta_time: datetime.timedelta)¶ Helper to circumvent problem that normal datetime.time instances can not be added. :param start_time: :param delta_time: :return:
-
opensoar.utilities.helper_functions.altitude_gain_and_loss(fixes: List[dict], gps_altitude=True)¶
-
opensoar.utilities.helper_functions.both_none_or_same_float(var1, var2)¶ Determine wheter both vars are the same. Either None or float
-
opensoar.utilities.helper_functions.both_none_or_same_str(var1, var2)¶ Determine wheter both vars are the same. Either None or float
-
opensoar.utilities.helper_functions.calculate_average_bearing(bearing1, bearing2)¶ Calculate the average bearing :param bearing1: bearing in degrees :param bearing2: bearing in degrees :return: average bearing in degrees
-
opensoar.utilities.helper_functions.calculate_bearing_change(fix_minus2, fix_minus1, fix)¶ Calculate bearing change between three fixes. :param fix_minus2: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :param fix_minus1: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :param fix: fix1: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :return: bearing change in degrees between -180 and +180 degrees. Return 0 when two of the of the fixes are the same.
-
opensoar.utilities.helper_functions.calculate_bearing_difference(bearing1, bearing2)¶ Calculate smallest difference from bearing 1 -> bearing2. :param bearing1: start bearing in degrees (0-360) :param bearing2: end bearing in degrees (0-360) :return: angle between -180 and +180 degrees.
-
opensoar.utilities.helper_functions.calculate_destination(start_fix, distance, bearing)¶
-
opensoar.utilities.helper_functions.calculate_distance_bearing(fix1, fix2, final_bearing=False)¶ Calculate bearing between fix1 and fix. By default the bearing is taking tangent to the great circle at fix1. :param final_bearing: switch to True results in taking the tangent at fix2. :param fix1: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :param fix2: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :return: distance in meters, bearing in degrees
-
opensoar.utilities.helper_functions.calculate_time_differences(time1, time2, interval)¶
-
opensoar.utilities.helper_functions.dm2dd(degrees, minutes, cardinal)¶ convert coordinate format with degrees and minutes to degrees
-
opensoar.utilities.helper_functions.dms2dd(degrees, minutes, seconds, cardinal)¶ convert coordinate format with degrees, minutes and second to degrees
-
opensoar.utilities.helper_functions.double_iterator(lst)¶ Create iterator with two values. E.g.: current, plus1 in a for loop
-
opensoar.utilities.helper_functions.height_difference_fixes(fix1, fix2, gps_altitude=True)¶
-
opensoar.utilities.helper_functions.interpolate_fixes(fix1, fix2, interval=1)¶ Create list of fixes between fix1 and fix2. Split is defined at time interval. Only time, latitude and longitude are interpolated. :param fix1: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :param fix2: b-record from IGC file (dict with keys ‘lat’ and ‘lon’) :param interval: interval between fixes in seconds :return: list of fixes between fix1 and fix2 with given interval
-
opensoar.utilities.helper_functions.range_with_bounds(start: int, stop: int, interval: int) → List[int]¶ Return list
-
opensoar.utilities.helper_functions.seconds_time_difference(time1: datetime.time, time2: datetime.time)¶ Determines the time difference between to datetime.time instances, mocking the operation time2 - time1 It is assumed that both take place at the same day. :param time1: :param time2: :return: time difference in seconds
-
opensoar.utilities.helper_functions.seconds_time_difference_fixes(fix1, fix2)¶
-
opensoar.utilities.helper_functions.subtract_times(start_time: datetime.time, delta_time: datetime.time)¶
-
opensoar.utilities.helper_functions.total_distance_travelled(fixes: List[dict])¶ Calculates the total distance, summing over the inter fix distances
-
opensoar.utilities.helper_functions.triple_iterator(lst)¶ Create iterator with three values. E.g.: current, plus1, plus2 in a for loop
Module contents¶
This package contains helper functions, which support the other packages