-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
117 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import json | ||
|
||
|
||
def createTopskyCpdlcTxt(input_file, output_file): | ||
try: | ||
# Load cpdlc_callsign_map from the file | ||
with open("topsky/cpdlcMap.json", "r") as callsign_map_file: | ||
cpdlc_callsign_map = json.load(callsign_map_file) | ||
|
||
# Load data from the inputFile | ||
with open(input_file, "r") as json_file: | ||
data = json.load(json_file) | ||
|
||
cpdlc_station_data = [] | ||
|
||
for item in data: | ||
cpdlc_login = item.get("cpdlc_login") | ||
callsign = cpdlc_callsign_map.get(item.get("logon").split("_")[0]) | ||
abbreviation = item.get("abbreviation") | ||
|
||
if cpdlc_login and callsign and abbreviation: | ||
cpdlc_station_data.append( | ||
{ | ||
"login": cpdlc_login, | ||
"callsign": callsign, | ||
"abbreviation": abbreviation, | ||
} | ||
) | ||
|
||
# Sort cpdlc_station_data first by callsign and then by login alphabetically | ||
sorted_cpdlc_station_data = sorted( | ||
cpdlc_station_data, | ||
key=lambda station: (station["callsign"], station["login"]), | ||
) | ||
|
||
output_lines = [] | ||
|
||
# store the last callsign to add line breaks between callsign changes | ||
last_callsign = None | ||
|
||
for station in sorted_cpdlc_station_data: | ||
if station["callsign"] != last_callsign: | ||
# Add an empty line after every change of callsign (excluding the first) | ||
if last_callsign is not None: | ||
output_lines.append("\n") | ||
|
||
output_lines.append( | ||
f"LOGIN:{station['login']}:{station['callsign']}:{station['abbreviation']}\n" | ||
) | ||
|
||
last_callsign = station["callsign"] | ||
|
||
with open(output_file, "w") as output_text: | ||
output_text.writelines(output_lines) | ||
|
||
except Exception as error: | ||
print("Error while creating cpdlc txt", error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ | |
"EDDC", | ||
"EDDE" | ||
], | ||
"cpdlc_login": "EDMH" | ||
"cpdlc_login": "EDMO" | ||
}, | ||
{ | ||
"logon": "EDMM_RDG_CTR", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
[ | ||
{ | ||
"login": "EDG", | ||
"callsign": "LANGEN CTR" | ||
}, | ||
{ | ||
"login": "EDM", | ||
"callsign": "MUENCHEN CTR" | ||
}, | ||
{ | ||
"login": "EDW", | ||
"callsign": "BREMEN CTR" | ||
}, | ||
{ | ||
"login": "EDY", | ||
"callsign": "MAASTRICHT CTR" | ||
}, | ||
{ | ||
"login": "EDU", | ||
"callsign": "RHEIN CTR" | ||
} | ||
] | ||
{ | ||
"EDGG": "LANGEN CTR", | ||
"EDMM": "MUENCHEN CTR", | ||
"EDWW": "BREMEN CTR", | ||
"EDYY": "MAASTRICHT CTR", | ||
"EDUU": "RHEIN CTR" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,52 @@ | ||
// Bremen | ||
LOGIN:EDWW:BREMEN CTR: | ||
LOGIN:EDWA:BREMEN CTR: | ||
LOGIN:EDWB:BREMEN CTR: | ||
LOGIN:EDWD:BREMEN CTR: | ||
LOGIN:EDWE:BREMEN CTR: | ||
LOGIN:EDWM:BREMEN CTR: | ||
LOGIN:EDWA:BREMEN CTR:ALR | ||
LOGIN:EDWB:BREMEN CTR:BOR | ||
LOGIN:EDWD:BREMEN CTR:DST | ||
LOGIN:EDWE:BREMEN CTR:EIDE | ||
LOGIN:EDWM:BREMEN CTR:MRZ | ||
LOGIN:EDWW:BREMEN CTR:WC | ||
|
||
// Langen | ||
LOGIN:EDGB:LANGEN CTR: | ||
LOGIN:EDGD:LANGEN CTR: | ||
LOGIN:EDGG:LANGEN CTR: | ||
LOGIN:EDGK:LANGEN CTR: | ||
LOGIN:EDGP:LANGEN CTR: | ||
LOGIN:EDGR:LANGEN CTR: | ||
LOGIN:EDGB:LANGEN CTR:BAD | ||
LOGIN:EDGD:LANGEN CTR:DKB | ||
LOGIN:EDGG:LANGEN CTR:GIN | ||
LOGIN:EDGK:LANGEN CTR:KTG | ||
LOGIN:EDGP:LANGEN CTR:PADH | ||
LOGIN:EDGR:LANGEN CTR:RUD | ||
|
||
// Muenchen | ||
LOGIN:EDMM:MUENCHEN CTR: | ||
LOGIN:EDML:MUENCHEN CTR: | ||
LOGIN:EDMB:MUENCHEN CTR: | ||
LOGIN:EDME:MUENCHEN CTR: | ||
LOGIN:EDMG:MUENCHEN CTR: | ||
LOGIN:EDMH:MUENCHEN CTR: | ||
LOGIN:EDMN:MUENCHEN CTR: | ||
LOGIN:EDMS:MUENCHEN CTR: | ||
LOGIN:EDMO:MUENCHEN CTR: | ||
LOGIN:EDMR:MUENCHEN CTR: | ||
LOGIN:EDMU:MUENCHEN CTR: | ||
LOGIN:EDMZ:MUENCHEN CTR: | ||
LOGIN:EDCH:MAASTRICHT CTR:CELH | ||
LOGIN:EDJH:MAASTRICHT CTR:JEVH | ||
LOGIN:EDSH:MAASTRICHT CTR:SOLH | ||
LOGIN:EDYC:MAASTRICHT CTR:CEL | ||
LOGIN:EDYH:MAASTRICHT CTR:HOL | ||
LOGIN:EDYJ:MAASTRICHT CTR:JEV | ||
LOGIN:EDYM:MAASTRICHT CTR:MNS | ||
LOGIN:EDYR:MAASTRICHT CTR:RHR | ||
LOGIN:EDYS:MAASTRICHT CTR:SOL | ||
|
||
// Maastricht | ||
LOGIN:EDYC:MAASTRICHT CTR: | ||
LOGIN:EDYD:MAASTRICHT CTR: | ||
LOGIN:EDYH:MAASTRICHT CTR: | ||
LOGIN:EDYJ:MAASTRICHT CTR: | ||
LOGIN:EDYM:MAASTRICHT CTR: | ||
LOGIN:EDYR:MAASTRICHT CTR: | ||
LOGIN:EDYS:MAASTRICHT CTR: | ||
LOGIN:EDMB:MUENCHEN CTR:BBG | ||
LOGIN:EDME:MUENCHEN CTR:EGG | ||
LOGIN:EDMG:MUENCHEN CTR:GER | ||
LOGIN:EDMH:MUENCHEN CTR:HAL | ||
LOGIN:EDML:MUENCHEN CTR:ALB | ||
LOGIN:EDMM:MUENCHEN CTR:MMC | ||
LOGIN:EDMN:MUENCHEN CTR:NDG | ||
LOGIN:EDMO:MUENCHEN CTR:HOF | ||
LOGIN:EDMR:MUENCHEN CTR:RDG | ||
LOGIN:EDMS:MUENCHEN CTR:MEI | ||
LOGIN:EDMU:MUENCHEN CTR:TRU | ||
LOGIN:EDMZ:MUENCHEN CTR:ZUG | ||
|
||
// Rhein | ||
LOGIN:EDUA:RHEIN RADAR CTR: | ||
LOGIN:EDUC:RHEIN RADAR CTR: | ||
LOGIN:EDUD:RHEIN RADAR CTR: | ||
LOGIN:EDUF:RHEIN RADAR CTR: | ||
LOGIN:EDUH:RHEIN RADAR CTR: | ||
LOGIN:EDUI:RHEIN RADAR CTR: | ||
LOGIN:EDUL:RHEIN RADAR CTR: | ||
LOGIN:EDUN:RHEIN RADAR CTR: | ||
LOGIN:EDUO:RHEIN RADAR CTR: | ||
LOGIN:EDUP:RHEIN RADAR CTR: | ||
LOGIN:EDUR:RHEIN RADAR CTR: | ||
LOGIN:EDUS:RHEIN RADAR CTR: | ||
LOGIN:EDUT:RHEIN RADAR CTR: | ||
LOGIN:EDUU:RHEIN RADAR CTR: | ||
LOGIN:EDUW:RHEIN RADAR CTR: | ||
LOGIN:EDUA:RHEIN CTR:SAL | ||
LOGIN:EDUC:RHEIN CTR:CHI | ||
LOGIN:EDUD:RHEIN CTR:DON | ||
LOGIN:EDUF:RHEIN CTR:FFM | ||
LOGIN:EDUH:RHEIN CTR:HVL | ||
LOGIN:EDUI:RHEIN CTR:ISA | ||
LOGIN:EDUL:RHEIN CTR:ALP | ||
LOGIN:EDUN:RHEIN CTR:NTM | ||
LOGIN:EDUO:RHEIN CTR:OSE | ||
LOGIN:EDUP:RHEIN CTR:SPE | ||
LOGIN:EDUR:RHEIN CTR:ERL | ||
LOGIN:EDUS:RHEIN CTR:SLN | ||
LOGIN:EDUT:RHEIN CTR:TGO | ||
LOGIN:EDUU:RHEIN CTR:FUL | ||
LOGIN:EDUW:RHEIN CTR:WUR |