From 0aba3b01362f7a7500921f34ec46ecc016ba15d7 Mon Sep 17 00:00:00 2001 From: glidergeek Date: Sun, 25 Aug 2024 16:55:38 +0200 Subject: [PATCH] temporary fixes for uvalde wgc; need to figure out where permanent fixes land --- PySoar/analysis.py | 38 ++++++++++++++++++++++++++------------ PySoar/exportClass.py | 6 +++--- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/PySoar/analysis.py b/PySoar/analysis.py index 7ec53c1..9e2a6a1 100644 --- a/PySoar/analysis.py +++ b/PySoar/analysis.py @@ -5,6 +5,7 @@ from opensoar.competition.soaringspot import SoaringSpotDaily from exportClass import ExcelExport +from opensoar.utilities.geojson_serializers import generate_geojson, task_to_geojson_features, trip_to_geojson_features, trace_to_geojson_features from performanceClass import Performance from settingsClass import Settings @@ -78,20 +79,33 @@ def run(self): for competitor in competition_day.competitors: + print('comp id:', competitor.competition_id) + if competitor.competition_id in failed_comp_ids: - continue + print('failed_comp_id:', failed_comp_ids) else: - try: - # put gps_altitude to False when nonzero pressure altitude is found - gps_altitude = True - for fix in competitor.trace: - if fix['pressure_alt'] != 0: - gps_altitude = False - - competitor.performance = Performance(competition_day.task, competitor.trip, competitor.phases, - gps_altitude) - except Exception: - failed_comp_ids.append(competitor.competition_id) + + import json + if competitor.competition_id == 'MG': + features = [ + *task_to_geojson_features(competition_day.task), + *trip_to_geojson_features(competitor.trip, "#062123"), + *trace_to_geojson_features(competitor.trace), + + ] + geojson_dct = generate_geojson(features) + with open('debug.json', 'w') as f: + json.dump(geojson_dct, f) + print('successfully dumped json') + + # put gps_altitude to False when nonzero pressure altitude is found + gps_altitude = True + for fix in competitor.trace: + if fix['pressure_alt'] != 0: + gps_altitude = False + + competitor.performance = Performance(competition_day.task, competitor.trip, competitor.phases, + gps_altitude) failed_competitors = [] for competitor in competition_day.competitors: diff --git a/PySoar/exportClass.py b/PySoar/exportClass.py index 74681fe..f5cfa9f 100644 --- a/PySoar/exportClass.py +++ b/PySoar/exportClass.py @@ -263,9 +263,9 @@ def write_perf_indics(self, leg, settings, competition_day): if perf_ind in ['t_start', 't_finish']: - timezone = competition_day.task.timezone - if timezone is not None: - content = add_times(content, datetime.timedelta(hours=timezone)) + # timezone = competition_day.task.timezone + # if timezone is not None: + # content = add_times(content, datetime.timedelta(hours=timezone)) content = content.strftime('%H:%M:%S')