Skip to content

Instantly share code, notes, and snippets.

@kerel-fs
Last active June 6, 2019 13:46
Show Gist options
  • Save kerel-fs/d8f14731cbe4ac8e6a016c1518f8c0ad to your computer and use it in GitHub Desktop.
Save kerel-fs/d8f14731cbe4ac8e6a016c1518f8c0ad to your computer and use it in GitHub Desktop.
Dannstadter Vergleichsfliegen 2019
ID CALL CN TYPE HANDICAP NAME
FLRDF0E4E D-0553 2A Std. Libelle 98 Felix Maier
FLRDD93E8 D-7826 4P LS 4 104 M.Laubender & M.Engisch
FLRDDB0CD D-0894 4R LS 4 104 R.Fürderer & J.Medic
FLRDD9641 D-0266 66 ASK 13 79 K.H.Müller & K.Müller
FLR3F0487 D-9200 7J LS 7 WL 107 Ch.Müller & J.Kiefer
FLRDDC010 D-1372 7S DG 300 105 Juli Goll
FLRDD92E3 D-0002 CH LS 7 WL 107 R.Hähndel & G.Sturm
FLRDD8443 D-8568 CL ASK 21 92 Team K.Leitner/S.Lorenz/LSeitz/Y.Strickler
FLRDDA8A8 D-3693 I ASW-15 97 Mika Zeyen
FLRDF1045 D-5549 IH LS 4 104 Frank Donnermeyer
FLRDDA30B D-0914 JF Std. Libelle 98 Jana Schmidt
FLR0D9206 D-9206 JO Ka 6CR 82 Wolfgang Zeyen
FLR3F05B0 D-9497 KT Std. Cirrus 99 Stefan Schneider
FLRDDAF16 D-8649 R9 LS 4 104 A.Marcks & S.Gieß
FLRDD9266 D-3717 RP LS 1 f 100 Sophie Müller
FLRDD51FF D-0141 S1 Std. Libelle 99 Johannes Flieger
FLRDDB2CF D-9413 SM LS 1 f Neo 101 Jan Bischoff
FLRDDD9AB D-4891 UB ASW 15 97 Christoph Kauf
FLRDDD820 D-4621 V1 SB 5 E 88 Rene Kernbach
FLRDDE801 D-6944 W Std. Libelle 98 Steffen Rogoll
FLRDDA30B D-0914 X4 LS 4 104 Fabian Pascal Schmidt
ID CALL CN TYPE HANDICAP NAME
FLRDD9C14 04 Glasflugel 304 110 Stephan Schnell
FLR3A1FFF 1G Ventus 2 114 Henrik Bieler
ICA3ECBFF D-KSFF 63 ASG 32Mi 114 Frank Fröhlich & M.Dupont & W.Decker & A.-L.Ludwig
FLRD004B2 AG JS 3-18m J 121 Bernd Hubka
FLR3ED542 D-KVSK AI Ventus bT/15m 110 Stefan Kuse
FLRDD9A37 D-0274 C1 Ventus 2 114 Peter Lutz
FLRDDA83F D-6508 DL Duo Discus 110 Team D. Sailler & M.Grohe & A.Schottmüller & L. Hildebrandt
FLRDD9C1D DR Ventus 2 114 Marc Schick
FLRDDFE77 EL DG 200/17 109 Alfred Perlich
FLRDDA260 D-KLEO EO LS 8 18m T 114 Jan Hertrich
FLRDD7295 GIU DG 1000T/20m 110 Team J.Schliephake & V.Schliephake & M.Ott & F.Müller
FLRDDBFDE D-6233 GT ASW 28 108 Jochen Kuhn
FLRDDA36C KB Ventus bT/15m 110 Sebastian Bethge
FLRDD9FBB D-1524 KD Duo Discus 110 J.Schmidt & H.Rupp
FLRDD9612 D-3976 L8 LS8 15 m 108 D.Lott & K.Goll
FLRDDF16B LT ASG 29 15m 114 Laurenz Theisinger
FLRDD876F D-0598 MR Kestrel 17m 110 M.Wallmer & L.Krause
RI DG 1000T/20m 110 N.Kratz & P.Sobucki
FLRDF0FD3 D-3571 SI Ls 8 15m Neo 108 Johannes Dibbern
FLRDDF16B T JS 3-15m 116 Georg Theisinger
FLRDDA79C D-4169 XL Duo Discus 110 Team S.Theis & C.Theis & V.Stutzer
FLRDD99BC D 8556 XR Glasflugel 304 110 Juergen Sottung
FLRDD8713 D-5574 XXX Duo Discus XL 111 Team A.Boml & H.Kreuzer & M.Deichmann
FLRDDEBCB D-KSDG YH DG 1000T/20m 110 Team M.Althaus & M.Schmitt & M.Karl & J.Thomas
#!/usr/bin/env python3
import argparse
import sys
import logging
import requests
from bs4 import BeautifulSoup
soaringspot_pilots_url = "https://www.soaringspot.com/en_gb/{}/pilots"
def get_competitors(competition_name):
r = requests.get(soaringspot_pilots_url.format(competition_name))
r.raise_for_status()
soup = BeautifulSoup(r.text, 'html.parser')
table = soup.find('table')
table_rows = table.find_all('tr')
competitors = []
for tr in table_rows[1:]:
td = tr.find_all('td')
row = [i.text for i in td]
competitors.append({'CN': row[0],
'Contestant': row[1],
'Club': row[2],
'Glider': row[3],
'Class': row [4],
'Handicap': row[5]})
return competitors
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Fetch the list of competitors of a given competition"
"hosted on soaringspot.com and generate an ogn-web-viewer-compatible"
"tracking filter file for the selected class.")
parser.add_argument('competition_name', type=str, help="Name of the competition as given in the soaringspot-URLs.")
parser.add_argument('selected_class', type=str, help="Competition class the list should be compiled for, e.g.: Club")
parser.add_argument('--sort-by', metavar="KEY", type=str, help="Sort by the given KEY, e.g.: CN")
args = parser.parse_args()
try:
competitors = get_competitors(args.competition_name)
except requests.exceptions.HTTPError:
logging.error("Couldn't fetch the competitors list from soaringspot.")
sys.exit(-1)
classes = set([c['Class'] for c in competitors])
if not args.selected_class in classes:
logging.error('Selected competition class not found, only the following classes are available: {}'.format(classes))
sys.exit(-1)
if args.sort_by:
competitors = sorted(competitors, key= lambda k: k[args.sort_by])
print("ID,CALL,CN,TYPE,HANDICAP,NAME")
for c in competitors:
if c['Class'] != args.selected_class:
continue
print("{},{},{},{},{},{}".format("", "", c['CN'], c['Glider'], c['Handicap'], c['Contestant']))
#!/usr/bin/env python3
import requests
import pandas as pd
# Load vergleichsfliegen filter list for Flarm-IDs
filter_list_url = "http://helpdesk.ssv-lu.de/vergleichsfliegen/ogn/competitors_club.php"
pilots = pd.read_csv(filter_list_url, keep_default_na=False, index_col=2)
pilots['device_id'] = pilots['ID'].apply(lambda k: k[2:].upper())
# NOTE: The following step requires the previous creation of the file with:
# ./fetch_soaringspot_competitors_list.py --sort-by CN 34-dannstadter-vergleichsfliegen-ludwigshafen-2019 Club > competitors_club_soaringspot.lst
# Load soaringspot competitor list for pilot names and handicap
soaringspot = pd.read_csv("competitors_club_soaringspot.lst", keep_default_na=False, index_col=2)
soaringspot = soaringspot.drop(['ID', 'CALL'], axis=1)
m = pd.merge(soaringspot, pilots['device_id'], on="CN", how="left")
# Manually add missing or wrong IDs
m.at['JO', 'device_id'] = "0D9206" # source: IGC file 4.WT
m.at['7S', 'device_id'] = "DDC010" # source: OGN-DDB
m.at['X4', 'device_id'] = "DDA84A" # source: OGN-DDB
# Load DDB for the registration
r = requests.get("http://ddb.glidernet.org/download/?j=1")
ddb_devices = pd.DataFrame(r.json()['devices'])
m = pd.merge(m.reset_index(), ddb_devices[['device_id', 'registration']], on='device_id', how='left')
m = m.set_index('CN')
m.at['7J', 'registration'] = "D-9200" # source: 4.WT, OLC
m.at['IH', 'registration'] = "D-5549" # source: 4.WT, OLC
m.at['JO', 'registration'] = "D-9206" # source: 4.WT, OLC
m.at['S1', 'registration'] = "D-0141" # source: 3.WT, OLC
m.at['SM', 'registration'] = "D-9413" # source: OLC, https://www.onlinecontest.org/olc-3.0/gliding/flightinfo.html?dsId=7099455
# Generate the filter list for ogn-web-viewer
print("ID,CALL,CN,TYPE,HANDICAP,NAME")
for k,v in m.iterrows():
print("FLR{},{},{},{},{},{}".format(v['device_id'], v['registration'], k, v['TYPE'], v['HANDICAP'], v['NAME']))
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
beautifulsoup4==4.7.1
opensoar==0.1.3
pandas==0.24.2
requests==2.22.0
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment