opensoar.competition package

Submodules

opensoar.competition.competition_day module

class opensoar.competition.competition_day.CompetitionDay(name: str, date: datetime.date, plane_class: str, competitors: List[opensoar.competition.competitor.Competitor], task: opensoar.task.task.Task)

Bases: object

This class contains the competition day information, equal fo all competitors.

analyse_flights(classification_method: str, analysis_progress=None, skip_failed_analyses: bool = False)
Parameters:
  • classification_method – method for detecting thermals. See FlightPhases for more info.
  • analysis_progress – optional function to log the analysis progress. Should have the following signature: func(number_of_analyses, total_number_of_flights)
  • skip_failed_analyses – if True, exceptions are caught during a failed analysis. a list is return with the competition ids of all failed analyses.
Returns:

opensoar.competition.competitor module

class opensoar.competition.competitor.Competitor(trace: List[T], competition_id: str = None, plane_model: str = None, ranking: Union[int, str] = None, pilot_name: str = None)

Bases: object

All the information of one entry in a CompetitionDay. This encompasses information about the pilot, the plane and the gps trace.

analyse(task, classification_method: str)
phases
pilot_name
plane_model
trip

opensoar.competition.daily_results_page module

class opensoar.competition.daily_results_page.DailyResultsPage(url)

Bases: abc.ABC

Abstract Base Class for daily result pages. Specific implementation example: soaringspot.

download_flight(igc_url: str, competition_id: str) → str

Download flight and return file_path

Parameters:
  • igc_url
  • competition_id
Returns:

generate_competition_day(target_directory: str, download_progress=None, start_time_buffer: int = 0, include_hc_competitors: bool = True) → opensoar.competition.competition_day.CompetitionDay

Construct a CompetitionDay. Information is pulled from the overview table and from the igc files, which are automatically downloaded.

Parameters:
  • include_hc_competitors – optional argument for including contestants which fly ‘Hors Concours’, which means that they don’t officially participate in the competition.
  • target_directory – directory in which the igc files are saved
  • download_progress – optional progress function. Should have the following signature: func(downloads, total_number_of_flights)
  • start_time_buffer – optional relaxation on the start time in seconds. E.g. start_time_buffer = 10 means that a contestant can cross the start line 10 seconds before the official opening time
Returns:

igc_directory
igc_file_name(competition_id: str) → str

Create igc file name from competition_id

Parameters:competition_id
Returns:
igc_file_path(competition_id: str) → str

Construct file_path from competition_id

Parameters:competition_id
Returns:
set_igc_directory(target_directory, competition_name, plane_class, date)

opensoar.competition.soaringspot module

Helper functions for SoaringSpot competitions. The files from SoaringSpot always contain task information, which can be used for competition analysis.

class opensoar.competition.soaringspot.SoaringSpotDaily(url: str)

Bases: opensoar.competition.daily_results_page.DailyResultsPage

Helper class for dealing with daily result pages which are published on the SoaringSpot platform.

generate_competition_day(target_directory: str, download_progress=None, start_time_buffer: int = 0, include_hc_competitors: bool = True) → opensoar.competition.competition_day.CompetitionDay

Construct a CompetitionDay. Information is pulled from the overview table and from the igc files, which are automatically downloaded.

Parameters:
  • include_hc_competitors – optional argument for including contestants which fly ‘Hors Concours’, which means that they don’t officially participate in the competition.
  • target_directory – directory in which the igc files are saved
  • download_progress – optional progress function. Should have the following signature: func(downloads, total_number_of_flights)
  • start_time_buffer – optional relaxation on the start time in seconds. E.g. start_time_buffer = 10 means that a contestant can cross the start line 10 seconds before the official opening time
Returns:

opensoar.competition.soaringspot.get_comment_lines_from_parsed_file(parsed_igc_file: dict) → List[str]

In the parsed file, lines are split into source and comment. This function stiches them back together

opensoar.competition.soaringspot.get_distance_correction(lseeyou_line: str) → Optional[str]
opensoar.competition.soaringspot.get_fixed_orientation_angle(lseeyou_line: str) → float
opensoar.competition.soaringspot.get_info_from_comment_lines(parsed_igc_file: dict, start_time_buffer: int = 0) → Tuple[opensoar.task.task.Task, dict, dict]

There is specific contest information stored in the comment lines of the IGC files. This function extracts this information

opensoar.competition.soaringspot.get_lat_long(lcu_line: str) → Tuple[float, float]
Parameters:lcu_line – line in soaringspot igc file starting with ‘LCU::C’
Returns:latitude, longitude in degrees
opensoar.competition.soaringspot.get_sector_dimensions(lseeyou_line: str) → Tuple[int, int, int, int]
opensoar.competition.soaringspot.get_sector_orientation(lseeyou_line: str, number_of_waypoints: int) → str
Parameters:
  • lseeyou_line – e.g. ‘LSEEYOU OZ=-1,Style=1,R1=500m,A1=180’
  • number_of_waypoints
Returns:

opensoar.competition.soaringspot.get_task_rules(lseeyou_tsk_line: str) → Tuple[datetime.time, datetime.timedelta, bool]
opensoar.competition.soaringspot.get_waypoint(lcu_line: str, lseeyou_line: str, number_of_waypoints: int) → opensoar.task.waypoint.Waypoint
Parameters:
  • number_of_waypoints
  • lcu_line – line in soaringspot igc starting with ‘LCU::C
  • lseeyou_line – line in soaringspot igc starting with ‘LSEEYOU OZ’
Returns:

Waypoint

opensoar.competition.soaringspot.get_waypoints(lcu_lines: List[str], lseeyou_lines: List[str]) → List[opensoar.task.waypoint.Waypoint]
Parameters:
  • lcu_lines – lines in soaringspot igc file starting with ‘LCU::C’
  • lseeyou_lines – lines in soaringspot igc starting with ‘LSEEYOU OZ’
Returns:

list of Waypoints

opensoar.competition.strepla module

Helper functions for Strepla competitions. The files from Strepla always contain task information, which can be used for competition analysis.

opensoar.competition.strepla.get_info_from_comment_lines(parsed_igc_file: dict, start_time_buffer: int = 0)
opensoar.competition.strepla.get_task_and_competitor_info(lscsd_lines: List[str], lscsr_lines: List[str], lscsa_lines: List[str]) → Tuple[dict, dict]
opensoar.competition.strepla.get_waypoint(lscs_line_tp: str, task_info: dict, n: int, n_tp: int) → opensoar.task.waypoint.Waypoint
opensoar.competition.strepla.get_waypoint_name_lat_long(lscs_line_tp: str) → Tuple[str, float, float]

Parse LSCSCT line (LSCSCT:074 Main Lohr-M:N4959700:E00934900)

opensoar.competition.strepla.get_waypoints(lscsc_lines: List[str], task_info: dict) → List[opensoar.task.waypoint.Waypoint]

Module contents

This package provides functionality to combine multiple flights in a CompetitionDay. Besides manually combining Competitors, it also provides high level interfaces with competition websites (e.g. SoaringSpot), which make it very easy to download and analyse all flights within a published CompetitionDay.