I wrote my sample script to help with initial decision making when I am flying.
Every runway is denoted by the direction it is pointing to divided by 10. For example taking off runway 9 would indicate we are traveling to the east (90 degrees). Every runway has an alternate runway offset by 180 degrees, so the same strip of pavement serves as runway 9 and 27.
It is also important to take wind direction and speed into account. An aircraft should always be taking off into the wind, and never with a tailwind. The crosswind component is an important piece of information when determining if it is safe to takeoff or land on a particular runway.
# crosswind.py
#
# Author: Grant Luisi
#
# Date: 2020-02-07
#
# This script calculates which runway should be used based
# on the wind and calculates the crosswind component
# Required Modules
from math import sin, radians
import argparse
# Function
def crosswind():
= int(input('Enter a runway number (1-36): '))
r = int(input('Enter wind direction in degrees (1-360): '))
d = int(input('Enter wind velocity: '))
s try:
# determining runways
= r
first_runway if first_runway <= 18:
= r+18
second_runway else:
= r-18
second_runway # determining the desired runway
= first_runway*10
first_runway = second_runway*10
second_runway = abs(d-first_runway)
first_runway_degree_crosswind = abs(d-second_runway)
second_runway_degree_crosswind if first_runway_degree_crosswind>second_runway_degree_crosswind:
= second_runway
desired_runway else:
= first_runway
desired_runway # Calculating crosswind component if intial runway is preferred
if desired_runway == first_runway:
= s*sin(radians(first_runway_degree_crosswind))
crosswind_component print('Use runway '+str(first_runway/10)+'. The crosswind component is '+str(crosswind_component))
# Calculating crosswind component if other runway is preferred
elif desired_runway == second_runway:
= s*sin(radians(second_runway_degree_crosswind))
crosswind_component print('Instead of your intial runway, use runway '+str(second_runway/10)+'. The crosswind_component is '+str(crosswind_component))
except ValueError:
print('Oops')
if __name__ == "__main__":
= argparse.ArgumentParser(
p ="Calculates which runway to use and the associated crosswind component")
description= p.parse_args()
args crosswind()