Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- ###### here just enter the snowtam nothing else is required to run this script #####
- #note that only up to 2 runways can be supported, have fun
- text = '''A)EADD
- B) 12220945
- C) 08L
- F) 5/5/5
- G) 2/2/3
- H) 2/1/1
- N)5
- C)26R
- F) 1/1/1
- G) XX/XX/XX
- H) 5/5/5
- N) 5
- T) RUNWAY 08L CONTAMINATION 100 PERCENT.
- RUNWAY 08R CONTAMINATION 100 PERCENT - WET DUE TO CHEMICAL SPRAYING.
- ALL TWYS AND APRONS CONTAMINATED AT 100 PERCENT.'''
- ##### DEPOSITS #######
- var_d_NIL = "Clear and dry"
- var_d_1 = "Damp"
- var_d_2 = "Wet or water patches"
- var_d_3 = "Rime (normally less than 1 mm deep)"
- var_d_4 = "Dry snow"
- var_d_5 = "Wet snow"
- var_d_6 = "Slush"
- var_d_7 = "Ice"
- var_d_8 = "Compact or rolled snow"
- var_d_9 = "Frozen ruts or ridges"
- ##### BREAKING ACTION #####
- #estimated#
- A_BA_5 = 'Good'
- A_BA_4 = 'Medium/good'
- A_BA_3 = 'Medium'
- A_BA_2 = 'Medium/poor'
- A_BA_1 = 'Poor'
- A_BA_9 = 'Unreliable'
- type_BRD = 'Brakemeter-Dynometer'
- type_GRT = 'Grip Tester'
- type_MUM = 'Mu-meter'
- type_RFT = 'Runway friction tester'
- type_SFH = 'Surface friction tester (high pressure tires)'
- type_SFL = 'Surface friction tester (low pressure tires)'
- type_SKH = 'Skiddometer (high pressure tires)'
- type_SKL = 'Skiddometer (low pressure tires)'
- type_TAP = 'Tapleymeter'
- ###### clean space mistakes if present at text #####
- text = re.sub("(?P<word>[A-Z]\))(?P<notspace>\S)", r"\g<word> \g<notspace>", text)
- text = re.sub("(?P<word>[A-Z]\))(?P<spaces>\s{2,30})", r"\g<word> ", text)
- ##### correct for the last one ################
- text = text+"Z\)"
- ###### check if multiple runways ##################
- list_multiple_runways = []
- list_multiple_runways_position = []
- p = re.compile("C\)")
- for m in p.finditer(text):
- list_multiple_runways.append( m.group())
- list_multiple_runways_position.append(m.start())
- ####### CROP THE LAST STANDARD REGION #######
- text_end = ''
- counter_end_r = 0
- counter_end_s = 0
- counter_end_t = 0
- regex_end_r = (r'R\)')
- pattern_end_r = re.compile(regex_end_r,re.DOTALL)
- try:
- var_end = pattern_end_r.search(text).group()
- counter_end_r = 1
- except:
- pass
- regex_end_s = (r'S\)')
- pattern_end_s = re.compile(regex_end_s,re.DOTALL)
- try:
- var_end = pattern_end_s.search(text).group()
- counter_end_s = 1
- except:
- pass
- regex_end_t = (r'T\)')
- pattern_end_t = re.compile(regex_end_t,re.DOTALL)
- try:
- var_end = pattern_end_t.search(text).group()
- counter_end_t = 1
- except:
- pass
- try:
- if counter_end_r > 0 :
- regex_end= (r'R\)(.*?)\Z')
- pattern_end = re.compile(regex_end,re.DOTALL)
- text_end = pattern_end.search(text).group()
- elif counter_end_s > 0 :
- regex_end= (r'S\)(.*?)\Z')
- pattern_end = re.compile(regex_end,re.DOTALL)
- text_end = pattern_end.search(text).group()
- elif counter_end_t > 0 :
- regex_end= (r'T\)(.*?)\Z')
- pattern_end = re.compile(regex_end,re.DOTALL)
- text_end = pattern_end.search(text).group()
- else:
- text_end = ''
- except:
- pass
- ###### CROP C RUNWAYSSSS ############
- if len(list_multiple_runways) == 1:
- pass
- elif len (list_multiple_runways) == 2:
- text2 = text[:list_multiple_runways_position[1]]
- text2 = text2 + "Z\)"
- text3 = text[list_multiple_runways_position[1]:]
- list_all_text_double = [text2,text3]
- elif len (list_multiple_runways) >2:
- pass
- #### run #####
- if len(list_multiple_runways) == 1:
- output_text = ""
- regex_A = (r'A\)(.*?)\)')
- pattern = re.compile(regex_A,re.DOTALL)
- try:
- var_A = pattern.search(text).group()
- output_text = output_text + "\n" + "A)-->The aerodrome {} is the aerodrome the Snowtam is referred to.".format(var_A[3:-3])
- except:
- pass
- regex_B = (r'B\)(.*?)\)')
- pattern = re.compile(regex_B,re.DOTALL)
- try:
- var_B = pattern.search(text).group()
- output_text = output_text + "\n" + "B)-->Observation of the Snowtam is at {}nth Month at {}nth Day {}:{}UTC.".format(var_B[3:5],var_B[5:7],var_B[7:9],var_B[9:-3])
- except:
- pass
- regex_C = (r'C\)(.*?)\)')
- pattern = re.compile(regex_C,re.DOTALL)
- try:
- var_C = pattern.search(text).group()
- output_text = output_text + "\n" + "C)-->The runway,Snowtam refers to is runway {}.".format(var_C[3:-3])
- except:
- pass
- regex_D = (r'D\)(.*?)\)')
- pattern = re.compile(regex_D,re.DOTALL)
- try:
- var_D = pattern.search(text).group()
- output_text = output_text + "\n" + "D)-->The runway's clear of deposits lenght region is {} meters.".format(var_D[3:-3])
- except:
- pass
- regex_E = (r'E\)(.*?)\)')
- pattern = re.compile(regex_E,re.DOTALL)
- try:
- var_E = pattern.search(text).group()
- output_text = output_text + "\n" + "E)-->The runway's clear of deposits width region is {} meters.\nInfo: If L or R is included here,the region is as viewed from the threshold having the lower runway designation number.".format(var_E[3:-3])
- except:
- pass
- regex_F = (r'F\)(.*?)\)')
- pattern = re.compile(regex_F,re.DOTALL)
- try:
- var_F = pattern.search(text).group()
- var_F = var_F[3:-3]
- var_F = var_F.split("/")
- var_F_first = ''
- var_F_second = ''
- var_F_third = ''
- for i in range (0,3):
- if var_F[i] == "NIL":
- if i == 0:
- var_F_first = var_d_NIL
- elif i == 1:
- var_F_second = var_d_NIL
- else:
- var_F_third = var_d_NIL
- elif var_F[i] == "1":
- if i == 0:
- var_F_first = var_d_1
- elif i == 1:
- var_F_second = var_d_1
- else:
- var_F_third = var_d_1
- elif var_F[i] == "2":
- if i == 0:
- var_F_first = var_d_2
- elif i == 1:
- var_F_second = var_d_2
- else:
- var_F_third = var_d_2
- elif var_F[i] == "3":
- if i == 0:
- var_F_first = var_d_3
- elif i == 1:
- var_F_second = var_d_3
- else:
- var_F_third = var_d_3
- elif var_F[i] == "4":
- if i == 0:
- var_F_first = var_d_4
- elif i == 1:
- var_F_second = var_d_4
- else:
- var_F_third = var_d_4
- elif var_F[i] == "5":
- if i == 0:
- var_F_first = var_d_5
- elif i == 1:
- var_F_second = var_d_5
- else:
- var_F_third = var_d_5
- elif var_F[i] == "6":
- if i == 0:
- var_F_first = var_d_6
- elif i == 1:
- var_F_second = var_d_6
- else:
- var_F_third = var_d_6
- elif var_F[i] == "7":
- if i == 0:
- var_F_first = var_d_7
- elif i == 1:
- var_F_second = var_d_7
- else:
- var_F_third = var_d_7
- elif var_F[i] == "8":
- if i == 0:
- var_F_first = var_d_8
- elif i == 1:
- var_F_second = var_d_8
- else:
- var_F_third = var_d_8
- elif var_F[i] == "9":
- if i == 0:
- var_F_first = var_d_9
- elif i == 1:
- var_F_second = var_d_9
- else:
- var_F_third = var_d_9
- multiple_first_c = ''
- c1 = 0
- if len(var_F[0]) > 1:
- multiple_first = var_F[0]
- for i in reversed(multiple_first):
- if i == '1':
- multiple_first_c = multiple_first_c + var_d_1 +" and on top "
- if i == '2':
- multiple_first_c = multiple_first_c + var_d_2 +" and on top "
- if i == '3':
- multiple_first_c = multiple_first_c + var_d_3 +" and on top "
- if i == '4':
- multiple_first_c = multiple_first_c + var_d_4 +" and on top "
- if i == '5':
- multiple_first_c = multiple_first_c + var_d_5 +" and on top "
- if i == '6':
- multiple_first_c = multiple_first_c + var_d_6 +" and on top "
- if i == '7':
- multiple_first_c = multiple_first_c + var_d_7 +" and on top "
- if i == '8':
- multiple_first_c = multiple_first_c + var_d_8 +" and on top "
- if i == '9':
- multiple_first_c = multiple_first_c + var_d_9 +" and on top "
- c1 = 1
- c2 = 0
- multiple_second_c = ''
- if len(var_F[1]) > 1:
- multiple_second = var_F[1]
- for i in reversed(multiple_second):
- if i == '1':
- multiple_second_c = multiple_second_c + var_d_1 +" and on top "
- if i == '2':
- multiple_second_c = multiple_second_c + var_d_2 +" and on top "
- if i == '3':
- multiple_second_c = multiple_second_c + var_d_3 +" and on top "
- if i == '4':
- multiple_second_c = multiple_second_c + var_d_4 +" and on top "
- if i == '5':
- multiple_second_c = multiple_second_c + var_d_5 +" and on top "
- if i == '6':
- multiple_second_c = multiple_second_c + var_d_6 +" and on top "
- if i == '7':
- multiple_second_c = multiple_second_c + var_d_7 +" and on top "
- if i == '8':
- multiple_second_c = multiple_second_c + var_d_8 +" and on top "
- if i == '9':
- multiple_second_c = multiple_second_c + var_d_9 +" and on top "
- c2 = 1
- c3 = 0
- multiple_third_c = ''
- if len(var_F[2]) > 1:
- multiple_third = var_F[2]
- for i in reversed(multiple_third):
- if i == '1':
- multiple_third_c = multiple_third_c + var_d_1 +" and on top "
- if i == '2':
- multiple_third_c = multiple_third_c + var_d_2 +" and on top "
- if i == '3':
- multiple_third_c = multiple_third_c + var_d_3 +" and on top "
- if i == '4':
- multiple_third_c = multiple_third_c + var_d_4 +" and on top "
- if i == '5':
- multiple_third_c = multiple_third_c + var_d_5 +" and on top "
- if i == '6':
- multiple_third_c = multiple_third_c + var_d_6 +" and on top "
- if i == '7':
- multiple_third_c = multiple_third_c + var_d_7 +" and on top "
- if i == '8':
- multiple_third_c = multiple_third_c + var_d_8 +" and on top "
- if i == '9':
- multiple_third_c = multiple_third_c + var_d_9 +" and on top "
- c3 = 1
- if c1 > 0:
- var_F_first = multiple_first_c[:-12]
- if c2 > 0:
- var_F_second = multiple_second_c[:-12]
- if c3 > 0:
- var_F_third = multiple_third_c[:-12]
- output_text = output_text + "\n" + "F)-->The runway's first thrird has {} , second third has {} ,and the third part has {}.\nInfo: Deposit over total runway length, observed on each third of the runway, starting from threshold having the lower runway designation number.".format(var_F_first,var_F_second,var_F_third)
- except:
- pass
- regex_G = (r'G\)(.*?)\)')
- pattern = re.compile(regex_G,re.DOTALL)
- try:
- var_G = pattern.search(text).group()
- var_G = var_G[3:-3]
- var_G = var_G.split('/')
- output_text = output_text + "\n" + "G)-->The runway's mean depth deposit at first thrird is {}mm , at second third is {}mm ,and the third part is {}mm.(All numbers in milimeters(mm))\nInfo:Observed on each third of the runway, starting from threshold having the lower runway designation number.\nIf XX , it means that the deposit is not measurable or operationally not significant.".format(var_G[0],var_G[1],var_G[2])
- except:
- pass
- regex_H = (r'H\)(.*?)\)')
- pattern = re.compile(regex_H,re.DOTALL)
- var_H_E_first = ''
- var_H_E_second = ''
- var_H_E_third = ''
- var_H_A_first = ''
- var_H_A_second = ''
- var_H_A_third = ''
- var_H_machine = ''
- try:
- var_H = pattern.search(text).group()
- var_H = var_H[3:-3]
- if len(var_H) < 7:
- var_H = var_H.split("/")
- if var_H[0] == "5":
- var_H_E_first = A_BA_5
- elif var_H[0] == "4":
- var_H_E_first = A_BA_4
- elif var_H[0] == "3":
- var_H_E_first = A_BA_3
- elif var_H[0] == "2":
- var_H_E_first = A_BA_2
- elif var_H[0] == "1":
- var_H_E_first = A_BA_1
- elif var_H[0] == "9":
- var_H_E_first = A_BA_9
- if var_H[1] == "5":
- var_H_E_second = A_BA_5
- elif var_H[1] == "4":
- var_H_E_second = A_BA_4
- elif var_H[1] == "3":
- var_H_E_second = A_BA_3
- elif var_H[1] == "2":
- var_H_E_second = A_BA_2
- elif var_H[1] == "1":
- var_H_E_second = A_BA_1
- elif var_H[1] == "9":
- var_H_E_second = A_BA_9
- if var_H[2] == "5":
- var_H_E_third = A_BA_5
- elif var_H[2] == "4":
- var_H_E_third = A_BA_4
- elif var_H[2] == "3":
- var_H_E_third = A_BA_3
- elif var_H[2] == "2":
- var_H_E_third = A_BA_2
- elif var_H[2] == "1":
- var_H_E_third = A_BA_1
- elif var_H[2] == "9":
- var_H_E_third = A_BA_9
- output_text = output_text + "\n" + "H)-->The runway's estimated(not from machine) Friction measurment(breaking action) at the first thrird is {}, at the second third is {},and at the third part is {}.".format(var_H_E_first,var_H_E_second,var_H_E_third)
- else:
- var_H = var_H.split("/")
- if int(var_H[0]) <= 25:
- var_H_A_first = A_BA_1
- elif int(var_H[0]) <= 29:
- var_H_A_first = A_BA_2
- elif int(var_H[0]) <= 35:
- var_H_A_first = A_BA_3
- elif int(var_H[0]) <= 39:
- var_H_A_first = A_BA_4
- elif int(var_H[0]) >= 40:
- var_H_A_first = A_BA_5
- if int(var_H[1]) <= 25:
- var_H_A_second = A_BA_1
- elif int(var_H[1]) <= 29:
- var_H_A_second = A_BA_2
- elif int(var_H[1]) <= 35:
- var_H_A_second = A_BA_3
- elif int(var_H[1]) <= 39:
- var_H_A_second = A_BA_4
- elif int(var_H[1]) >= 40:
- var_H_A_second = A_BA_5
- if int(var_H[2][:2]) <= 25:
- var_H_A_third = A_BA_1
- elif int(var_H[2][:2]) <= 29:
- var_H_A_third = A_BA_2
- elif int(var_H[2][:2]) <= 35:
- var_H_A_third = A_BA_3
- elif int(var_H[2][:2]) <= 39:
- var_H_A_third = A_BA_4
- elif int(var_H[2][:2]) >= 40:
- var_H_A_third = A_BA_5
- if 'BRD' in var_H[2]:
- var_H_machine = type_BRD
- elif 'GRT' in var_H[2]:
- var_H_machine = type_GRT
- elif 'MUM' in var_H[2]:
- var_H_machine = type_MUM
- elif 'RFT' in var_H[2]:
- var_H_machine = type_RFT
- elif 'SFH' in var_H[2]:
- var_H_machine = type_SFH
- elif 'SFL' in var_H[2]:
- var_H_machine = type_SFL
- elif 'SKH' in var_H[2]:
- var_H_machine = type_SKH
- elif 'SKL' in var_H[2]:
- var_H_machine = type_SKL
- elif 'TAP' in var_H[2]:
- var_H_machine = type_TAP
- else:
- var_H_machine = 'Unknown'
- output_text = output_text + "\n" + "H)-->The runway's Measured(by machine) Friction (breaking action) at the first thrird is {}, at the second third is {},and at the third part is {}.\nThe measurement was made by a {}.".format(var_H_A_first,var_H_A_second,var_H_A_third,var_H_machine)
- except:
- pass
- regex_J = (r'J\)(.*?)\)')
- pattern = re.compile(regex_J,re.DOTALL)
- try:
- var_J = pattern.search(text).group()
- var_J = var_J[3:-3]
- var_J_1 = 0
- var_J_2 = 0
- if "L" in var_J:
- var_J_1 = 1
- var_J = var_J.replace("L","")
- if "R" in var_J:
- var_J_2 = 1
- var_J = var_J.replace("R","")
- var_J_C = var_J.split("/")
- if var_J_1 == 0 and var_J_2 == 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 > 0 and var_J_2 > 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway both at left and right side.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 > 0 and var_J_2 == 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway at the left side.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 == 0 and var_J_2 > 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway at the right side.".format(var_J_C[0],var_J_C[1])
- except:
- pass
- regex_K = (r'K\)(.*?)\)')
- pattern = re.compile(regex_K,re.DOTALL)
- try:
- var_K = pattern.search(text).group()
- var_K = var_K[3:-3]
- cnt_K1 = 0
- cnt_K2 = 0
- if "L" in var_K:
- cnt_K1 = 1
- if "R" in var_K:
- cnt_K2 = 1
- if cnt_K1 == 0 and cnt_K2 == 0:
- output_text = output_text + "\n" + "K)-->The runway lights are obscured."
- elif cnt_K1 > 0 and cnt_K2 == 0:
- output_text = output_text + "\n" + "K)-->The runway lights are on the left side is obscured.\nInfo:As viewed from the threshold having the lower runway designation number."
- elif cnt_K1 == 0 and cnt_K2 > 0:
- output_text = output_text + "\n" + "K)-->The runway lights are on the right side is obscured.\nInfo:As viewed from the threshold having the lower runway designation number."
- elif cnt_K1 > 0 and cnt_K2 > 0:
- output_text = output_text + "\n" + "K)-->The runway lights are obscured on both sides of the runway."
- except:
- pass
- regex_L = (r'L\)(.*?)\)')
- pattern = re.compile(regex_L,re.DOTALL)
- try:
- var_L = pattern.search(text).group()
- var_L = var_L[3:-3]
- if "TOTAL" in var_L:
- output_text = output_text + "\n" + "L)-->The whole runway will be cleared.\nInfo:If it is provided in item M) is the time in UTC when the runway will be cleared."
- else:
- var_L_c = var_L.split("/")
- output_text = output_text + "\n" + "L)-->Another {} meters in lenght and {} meters in width will be cleared.\nInfo:If it is provided in item M) is the time in UTC when the runway will be cleared.".format(var_L_c[0],var_L_c[1])
- except:
- pass
- regex_M = (r'M\)(.*?)\)')
- pattern = re.compile(regex_M,re.DOTALL)
- try:
- var_M = pattern.search(text).group()
- var_M = var_M[3:-3]
- output_text = output_text + "\n" + "M)-->The runway is expected to be cleared by the time {} UTC.".format(var_M)
- except:
- pass
- regex_N = (r'N\)(.*?)\)')
- pattern = re.compile(regex_N,re.DOTALL)
- try:
- var_N = pattern.search(text).group()
- var_N = var_N[3:-3]
- output_text = output_text + "\n" + "N)-->The taxiway condition associated with the runway(typically in plain language or as runways but not in thirds).\nInfos:\nCheatSheet\n\t5 : Good\n\t4 : Medium/good\n\t3 : Medium\n\t2 : Medium/poor\n\t1 : Poor\n\t9 : Unreliable"
- except:
- pass
- regex_P = (r'P\)(.*?)\)')
- pattern = re.compile(regex_P,re.DOTALL)
- try:
- var_P = pattern.search(text).group()
- var_P = var_P[3:-3]
- var_P = var_P.replace("YES","")
- output_text = output_text + "\n" + "P)-->In taxiways connected to aerodrome there are various snowbanks greater than 60cm high,and the distance between them is about {} meters.".format(var_P)
- except:
- pass
- regex_R = (r'R\)(.*?)\)')
- pattern = re.compile(regex_R,re.DOTALL)
- try:
- var_R = pattern.search(text).group()
- var_R = var_R[3:-3]
- output_text = output_text + "\n" + "R)-->The Aprons conditions (typically in plain language or as runways but not in thirds).\nInfos:\nCheatSheet\n\t5 : Good\n\t4 : Medium/good\n\t3 : Medium\n\t2 : Medium/poor\n\t1 : Poor\n\t9 : Unreliable"
- except:
- pass
- regex_S = (r'S\)(.*?)\)')
- pattern = re.compile(regex_S,re.DOTALL)
- try:
- var_S = pattern.search(text).group()
- var_S = var_S[3:-3]
- output_text = output_text + "\n" + "S)-->Next observation from airport is anticipated at the {}nth Month at {}nth Day {}:{}UTC.".format(var_S[0:2],var_S[2:4],var_S[4:6],var_S[6:8])
- except:
- pass
- regex_T = (r'T\)(.*?)\)')
- pattern = re.compile(regex_T,re.DOTALL)
- try:
- var_T = pattern.search(text).group()
- var_T = var_T[3:-3]
- output_text = output_text + "\n" + "T)-->Open language remarks:{}".format(var_T)
- except:
- pass
- if len(list_multiple_runways) == 2:
- output_text = ""
- for x in list_all_text_double:
- output_text = output_text+"\n"
- regex_A = (r'A\)(.*?)\)')
- pattern = re.compile(regex_A,re.DOTALL)
- try:
- var_A = pattern.search(str(x)).group()
- output_text = output_text + "\n" + "A)-->The aerodrome {} is the aerodrome the Snowtam is referred to.".format(var_A[3:-3])
- except:
- pass
- regex_B = (r'B\)(.*?)\)')
- pattern = re.compile(regex_B,re.DOTALL)
- try:
- var_B = pattern.search(str(x)).group()
- output_text = output_text + "\n" + "B)-->Observation of the Snowtam is at {}nth Month at {}nth Day {}:{}UTC.".format(var_B[3:5],var_B[5:7],var_B[7:9],var_B[9:-3])
- except:
- pass
- regex_C = (r'C\)(.*?)\)')
- pattern = re.compile(regex_C,re.DOTALL)
- try:
- var_C = pattern.search(str(x)).group()
- output_text = output_text + "\n" + "C)-->The runway,Snowtam refers to is runway {}.".format(var_C[3:-3])
- except:
- pass
- regex_D = (r'D\)(.*?)\)')
- pattern = re.compile(regex_D,re.DOTALL)
- try:
- var_D = pattern.search(str(x)).group()
- output_text = output_text + "\n" + "D)-->The runway's clear of deposits lenght region is {} meters.".format(var_D[3:-3])
- except:
- pass
- regex_E = (r'E\)(.*?)\)')
- pattern = re.compile(regex_E,re.DOTALL)
- try:
- var_E = pattern.search(str(x)).group()
- output_text = output_text + "\n" + "E)-->The runway's clear of deposits width region is {} meters.\nInfo: If L or R is included here,the region is as viewed from the threshold having the lower runway designation number.".format(var_E[3:-3])
- except:
- pass
- regex_F = (r'F\)(.*?)\)')
- pattern = re.compile(regex_F,re.DOTALL)
- try:
- var_F = pattern.search(str(x)).group()
- var_F = var_F[3:-3]
- var_F = var_F.split("/")
- var_F_first = ''
- var_F_second = ''
- var_F_third = ''
- for i in range (0,3):
- if var_F[i] == "NIL":
- if i == 0:
- var_F_first = var_d_NIL
- elif i == 1:
- var_F_second = var_d_NIL
- else:
- var_F_third = var_d_NIL
- elif var_F[i] == "1":
- if i == 0:
- var_F_first = var_d_1
- elif i == 1:
- var_F_second = var_d_1
- else:
- var_F_third = var_d_1
- elif var_F[i] == "2":
- if i == 0:
- var_F_first = var_d_2
- elif i == 1:
- var_F_second = var_d_2
- else:
- var_F_third = var_d_2
- elif var_F[i] == "3":
- if i == 0:
- var_F_first = var_d_3
- elif i == 1:
- var_F_second = var_d_3
- else:
- var_F_third = var_d_3
- elif var_F[i] == "4":
- if i == 0:
- var_F_first = var_d_4
- elif i == 1:
- var_F_second = var_d_4
- else:
- var_F_third = var_d_4
- elif var_F[i] == "5":
- if i == 0:
- var_F_first = var_d_5
- elif i == 1:
- var_F_second = var_d_5
- else:
- var_F_third = var_d_5
- elif var_F[i] == "6":
- if i == 0:
- var_F_first = var_d_6
- elif i == 1:
- var_F_second = var_d_6
- else:
- var_F_third = var_d_6
- elif var_F[i] == "7":
- if i == 0:
- var_F_first = var_d_7
- elif i == 1:
- var_F_second = var_d_7
- else:
- var_F_third = var_d_7
- elif var_F[i] == "8":
- if i == 0:
- var_F_first = var_d_8
- elif i == 1:
- var_F_second = var_d_8
- else:
- var_F_third = var_d_8
- elif var_F[i] == "9":
- if i == 0:
- var_F_first = var_d_9
- elif i == 1:
- var_F_second = var_d_9
- else:
- var_F_third = var_d_9
- multiple_first_c = ''
- c1 = 0
- if len(var_F[0]) > 1:
- multiple_first = var_F[0]
- for i in reversed(multiple_first):
- if i == '1':
- multiple_first_c = multiple_first_c + var_d_1 +" and on top "
- if i == '2':
- multiple_first_c = multiple_first_c + var_d_2 +" and on top "
- if i == '3':
- multiple_first_c = multiple_first_c + var_d_3 +" and on top "
- if i == '4':
- multiple_first_c = multiple_first_c + var_d_4 +" and on top "
- if i == '5':
- multiple_first_c = multiple_first_c + var_d_5 +" and on top "
- if i == '6':
- multiple_first_c = multiple_first_c + var_d_6 +" and on top "
- if i == '7':
- multiple_first_c = multiple_first_c + var_d_7 +" and on top "
- if i == '8':
- multiple_first_c = multiple_first_c + var_d_8 +" and on top "
- if i == '9':
- multiple_first_c = multiple_first_c + var_d_9 +" and on top "
- c1 = 1
- c2 = 0
- multiple_second_c = ''
- if len(var_F[1]) > 1:
- multiple_second = var_F[1]
- for i in reversed(multiple_second):
- if i == '1':
- multiple_second_c = multiple_second_c + var_d_1 +" and on top "
- if i == '2':
- multiple_second_c = multiple_second_c + var_d_2 +" and on top "
- if i == '3':
- multiple_second_c = multiple_second_c + var_d_3 +" and on top "
- if i == '4':
- multiple_second_c = multiple_second_c + var_d_4 +" and on top "
- if i == '5':
- multiple_second_c = multiple_second_c + var_d_5 +" and on top "
- if i == '6':
- multiple_second_c = multiple_second_c + var_d_6 +" and on top "
- if i == '7':
- multiple_second_c = multiple_second_c + var_d_7 +" and on top "
- if i == '8':
- multiple_second_c = multiple_second_c + var_d_8 +" and on top "
- if i == '9':
- multiple_second_c = multiple_second_c + var_d_9 +" and on top "
- c2 = 1
- c3 = 0
- multiple_third_c = ''
- if len(var_F[2]) > 1:
- multiple_third = var_F[2]
- for i in reversed(multiple_third):
- if i == '1':
- multiple_third_c = multiple_third_c + var_d_1 +" and on top "
- if i == '2':
- multiple_third_c = multiple_third_c + var_d_2 +" and on top "
- if i == '3':
- multiple_third_c = multiple_third_c + var_d_3 +" and on top "
- if i == '4':
- multiple_third_c = multiple_third_c + var_d_4 +" and on top "
- if i == '5':
- multiple_third_c = multiple_third_c + var_d_5 +" and on top "
- if i == '6':
- multiple_third_c = multiple_third_c + var_d_6 +" and on top "
- if i == '7':
- multiple_third_c = multiple_third_c + var_d_7 +" and on top "
- if i == '8':
- multiple_third_c = multiple_third_c + var_d_8 +" and on top "
- if i == '9':
- multiple_third_c = multiple_third_c + var_d_9 +" and on top "
- c3 = 1
- if c1 > 0:
- var_F_first = multiple_first_c[:-12]
- if c2 > 0:
- var_F_second = multiple_second_c[:-12]
- if c3 > 0:
- var_F_third = multiple_third_c[:-12]
- output_text = output_text + "\n" + "F)-->The runway's first thrird has {} , second third has {} ,and the third part has {}.\nInfo: Deposit over total runway length, observed on each third of the runway, starting from threshold having the lower runway designation number.".format(var_F_first,var_F_second,var_F_third)
- except:
- pass
- regex_G = (r'G\)(.*?)\)')
- pattern = re.compile(regex_G,re.DOTALL)
- try:
- var_G = pattern.search(str(x)).group()
- var_G = var_G[3:-3]
- var_G = var_G.split('/')
- output_text = output_text + "\n" + "G)-->The runway's mean depth deposit at first thrird is {}mm , at second third is {}mm ,and the third part is {}mm.(All numbers in milimeters(mm))\nInfo:Observed on each third of the runway, starting from threshold having the lower runway designation number.\nIf XX , it means that the deposit is not measurable or operationally not significant.".format(var_G[0],var_G[1],var_G[2])
- except:
- pass
- regex_H = (r'H\)(.*?)\)')
- pattern = re.compile(regex_H,re.DOTALL)
- var_H_E_first = ''
- var_H_E_second = ''
- var_H_E_third = ''
- var_H_A_first = ''
- var_H_A_second = ''
- var_H_A_third = ''
- var_H_machine = ''
- try:
- var_H = pattern.search(str(x)).group()
- var_H = var_H[3:-3]
- if len(var_H) < 7:
- var_H = var_H.split("/")
- if var_H[0] == "5":
- var_H_E_first = A_BA_5
- elif var_H[0] == "4":
- var_H_E_first = A_BA_4
- elif var_H[0] == "3":
- var_H_E_first = A_BA_3
- elif var_H[0] == "2":
- var_H_E_first = A_BA_2
- elif var_H[0] == "1":
- var_H_E_first = A_BA_1
- elif var_H[0] == "9":
- var_H_E_first = A_BA_9
- if var_H[1] == "5":
- var_H_E_second = A_BA_5
- elif var_H[1] == "4":
- var_H_E_second = A_BA_4
- elif var_H[1] == "3":
- var_H_E_second = A_BA_3
- elif var_H[1] == "2":
- var_H_E_second = A_BA_2
- elif var_H[1] == "1":
- var_H_E_second = A_BA_1
- elif var_H[1] == "9":
- var_H_E_second = A_BA_9
- if var_H[2] == "5":
- var_H_E_third = A_BA_5
- elif var_H[2] == "4":
- var_H_E_third = A_BA_4
- elif var_H[2] == "3":
- var_H_E_third = A_BA_3
- elif var_H[2] == "2":
- var_H_E_third = A_BA_2
- elif var_H[2] == "1":
- var_H_E_third = A_BA_1
- elif var_H[2] == "9":
- var_H_E_third = A_BA_9
- output_text = output_text + "\n" + "H)-->The runway's estimated(not from machine) Friction measurment(breaking action) at the first thrird is {}, at the second third is {},and at the third part is {}.".format(var_H_E_first,var_H_E_second,var_H_E_third)
- else:
- var_H = var_H.split("/")
- if int(var_H[0]) <= 25:
- var_H_A_first = A_BA_1
- elif int(var_H[0]) <= 29:
- var_H_A_first = A_BA_2
- elif int(var_H[0]) <= 35:
- var_H_A_first = A_BA_3
- elif int(var_H[0]) <= 39:
- var_H_A_first = A_BA_4
- elif int(var_H[0]) >= 40:
- var_H_A_first = A_BA_5
- if int(var_H[1]) <= 25:
- var_H_A_second = A_BA_1
- elif int(var_H[1]) <= 29:
- var_H_A_second = A_BA_2
- elif int(var_H[1]) <= 35:
- var_H_A_second = A_BA_3
- elif int(var_H[1]) <= 39:
- var_H_A_second = A_BA_4
- elif int(var_H[1]) >= 40:
- var_H_A_second = A_BA_5
- if int(var_H[2][:2]) <= 25:
- var_H_A_third = A_BA_1
- elif int(var_H[2][:2]) <= 29:
- var_H_A_third = A_BA_2
- elif int(var_H[2][:2]) <= 35:
- var_H_A_third = A_BA_3
- elif int(var_H[2][:2]) <= 39:
- var_H_A_third = A_BA_4
- elif int(var_H[2][:2]) >= 40:
- var_H_A_third = A_BA_5
- if 'BRD' in var_H[2]:
- var_H_machine = type_BRD
- elif 'GRT' in var_H[2]:
- var_H_machine = type_GRT
- elif 'MUM' in var_H[2]:
- var_H_machine = type_MUM
- elif 'RFT' in var_H[2]:
- var_H_machine = type_RFT
- elif 'SFH' in var_H[2]:
- var_H_machine = type_SFH
- elif 'SFL' in var_H[2]:
- var_H_machine = type_SFL
- elif 'SKH' in var_H[2]:
- var_H_machine = type_SKH
- elif 'SKL' in var_H[2]:
- var_H_machine = type_SKL
- elif 'TAP' in var_H[2]:
- var_H_machine = type_TAP
- else:
- var_H_machine = 'Unknown'
- output_text = output_text + "\n" + "H)-->The runway's Measured(by machine) Friction (breaking action) at the first thrird is {}, at the second third is {},and at the third part is {}.\nThe measurement was made by a {}.".format(var_H_A_first,var_H_A_second,var_H_A_third,var_H_machine)
- except:
- pass
- regex_J = (r'J\)(.*?)\)')
- pattern = re.compile(regex_J,re.DOTALL)
- try:
- var_J = pattern.search(str(x)).group()
- var_J = var_J[3:-3]
- var_J_1 = 0
- var_J_2 = 0
- if "L" in var_J:
- var_J_1 = 1
- var_J = var_J.replace("L","")
- if "R" in var_J:
- var_J_2 = 1
- var_J = var_J.replace("R","")
- var_J_C = var_J.split("/")
- if var_J_1 == 0 and var_J_2 == 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 > 0 and var_J_2 > 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway both at left and right side.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 > 0 and var_J_2 == 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway at the left side.".format(var_J_C[0],var_J_C[1])
- elif var_J_1 == 0 and var_J_2 > 0:
- output_text = output_text + "\n" + "J)-->There are critical snowbanks {}cm high,{} meters from the edge of the runway at the right side.".format(var_J_C[0],var_J_C[1])
- except:
- pass
- regex_K = (r'K\)(.*?)\)')
- pattern = re.compile(regex_K,re.DOTALL)
- try:
- var_K = pattern.search(str(x)).group()
- var_K = var_K[3:-3]
- cnt_K1 = 0
- cnt_K2 = 0
- if "L" in var_K:
- cnt_K1 = 1
- if "R" in var_K:
- cnt_K2 = 1
- if cnt_K1 == 0 and cnt_K2 == 0:
- output_text = output_text + "\n" + "K)-->The runway lights are obscured."
- elif cnt_K1 > 0 and cnt_K2 == 0:
- output_text = output_text + "\n" + "K)-->The runway lights are on the left side is obscured.\nInfo:As viewed from the threshold having the lower runway designation number."
- elif cnt_K1 == 0 and cnt_K2 > 0:
- output_text = output_text + "\n" + "K)-->The runway lights are on the right side is obscured.\nInfo:As viewed from the threshold having the lower runway designation number."
- elif cnt_K1 > 0 and cnt_K2 > 0:
- output_text = output_text + "\n" + "K)-->The runway lights are obscured on both sides of the runway."
- except:
- pass
- regex_L = (r'L\)(.*?)\)')
- pattern = re.compile(regex_L,re.DOTALL)
- try:
- var_L = pattern.search(str(x)).group()
- var_L = var_L[3:-3]
- if "TOTAL" in var_L:
- output_text = output_text + "\n" + "L)-->The whole runway will be cleared.\nInfo:If it is provided in item M) is the time in UTC when the runway will be cleared."
- else:
- var_L_c = var_L.split("/")
- output_text = output_text + "\n" + "L)-->Another {} meters in lenght and {} meters in width will be cleared.\nInfo:If it is provided in item M) is the time in UTC when the runway will be cleared.".format(var_L_c[0],var_L_c[1])
- except:
- pass
- regex_M = (r'M\)(.*?)\)')
- pattern = re.compile(regex_M,re.DOTALL)
- try:
- var_M = pattern.search(str(x)).group()
- var_M = var_M[3:-3]
- output_text = output_text + "\n" + "M)-->The runway is expected to be cleared by the time {} UTC.".format(var_M)
- except:
- pass
- regex_N = (r'N\)(.*?)\)')
- pattern = re.compile(regex_N,re.DOTALL)
- try:
- var_N = pattern.search(str(x)).group()
- var_N = var_N[3:-3]
- output_text = output_text + "\n" + "N)-->The taxiway condition associated with the runway(typically in plain language or as runways but not in thirds).\nInfos:\nCheatSheet\n\t5 : Good\n\t4 : Medium/good\n\t3 : Medium\n\t2 : Medium/poor\n\t1 : Poor\n\t9 : Unreliable"
- except:
- pass
- regex_P = (r'P\)(.*?)\)')
- pattern = re.compile(regex_P,re.DOTALL)
- try:
- var_P = pattern.search(str(x)).group()
- var_P = var_P[3:-3]
- var_P = var_P.replace("YES","")
- output_text = output_text + "\n" + "P)-->In taxiways connected to aerodrome there are various snowbanks greater than 60cm high,and the distance between them is about {} meters.".format(var_P)
- except:
- pass
- regex_R = (r'R\)(.*?)\)')
- pattern = re.compile(regex_R,re.DOTALL)
- try:
- var_R = pattern.search(str(x)).group()
- var_R = var_R[3:-3]
- output_text = output_text + "\n" + "R)-->The Aprons conditions (typically in plain language or as runways but not in thirds).\nInfos:\nCheatSheet\n\t5 : Good\n\t4 : Medium/good\n\t3 : Medium\n\t2 : Medium/poor\n\t1 : Poor\n\t9 : Unreliable"
- except:
- pass
- regex_S = (r'S\)(.*?)\)')
- pattern = re.compile(regex_S,re.DOTALL)
- try:
- var_S = pattern.search(str(x)).group()
- var_S = var_S[3:-3]
- output_text = output_text + "\n" + "S)-->Next observation from airport is anticipated at the {}nth Month at {}nth Day {}:{}UTC.".format(var_S[0:2],var_S[2:4],var_S[4:6],var_S[6:8])
- except:
- pass
- regex_T = (r'T\)(.*?)\)')
- pattern = re.compile(regex_T,re.DOTALL)
- try:
- var_T = pattern.search(str(x)).group()
- var_T = var_T[3:-3]
- output_text = output_text + "\n" + "T)-->Open language remarks:{}".format(var_T)
- except:
- pass
- if len(list_multiple_runways) > 2:
- print ("Up to 2 runways")
- else:
- print (output_text)
Add Comment
Please, Sign In to add comment