Skip to content

Commit

Permalink
temporary changes to facilitate wgc analyses; need to figure out wher…
Browse files Browse the repository at this point in the history
…e this should land
  • Loading branch information
GliderGeek committed Aug 25, 2024
1 parent b8d955a commit 1d490f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions opensoar/competition/soaringspot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from opensoar.task.race_task import RaceTask
from opensoar.task.task import Task
from opensoar.task.waypoint import Waypoint
from opensoar.utilities.helper_functions import dm2dd, subtract_times
from opensoar.utilities.helper_functions import dm2dd, subtract_times, add_times
from opensoar.competition.daily_results_page import DailyResultsPage


Expand Down Expand Up @@ -84,8 +84,9 @@ def get_info_from_comment_lines(parsed_igc_file: dict, start_time_buffer: int=0)
timezone = int(line.split(':')[3])

if start_opening is not None:
# convert start opening to UTC time
start_opening = subtract_times(start_opening, datetime.timedelta(hours=timezone))
pass
# not converting start opening to UTC
# start_opening = subtract_times(start_opening, datetime.timedelta(hours=timezone))

if len(lcu_lines) == 0 or len(lseeyou_lines) == 0:
# somehow some IGC files do not contain the LCU or LSEEYOU lines with task information
Expand Down Expand Up @@ -358,11 +359,17 @@ def generate_competition_day(self, target_directory: str, download_progress=None
print('{} is skipped because of invalid trace'.format(competition_id))
continue



# get info from file
task, contest_information, competitor_information = get_info_from_comment_lines(parsed_igc_file, start_time_buffer)
plane_model = competitor_information.get('plane_model', None)
pilot_name = competitor_information.get('pilot_name', None)

tz = task.timezone
for fix in trace:
fix['time'] = add_times(fix['time'], datetime.timedelta(hours=tz))

competitor = Competitor(trace, competition_id, plane_model, ranking, pilot_name)

competitors.append(competitor)
Expand Down
2 changes: 2 additions & 0 deletions opensoar/thermals/flight_phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ def _get_phase_within_leg(self, phase: Phase, leg: int) -> Phase:
else:
end_fix = phase.fixes[-1]


phase_start_index = phase.fixes.index(start_fix)
phase_end_index = phase.fixes.index(end_fix)

return Phase(phase.is_cruise, phase.fixes[phase_start_index:phase_end_index + 1])

def _get_phase_within_trip(self, phase):
Expand Down

0 comments on commit 1d490f0

Please sign in to comment.