Question
Python Programming def list_weather_violations(directory): Returns the (annotated) list of flight reservations that violate weather minimums. This function reads the data files in the given
Python Programming
def list_weather_violations(directory): """ Returns the (annotated) list of flight reservations that violate weather minimums. This function reads the data files in the given directory (the data files are all identified by the constants defined above in this module). It loops through the list of flight lessons (in lessons.csv), identifying those takeoffs for which get_weather_violation() is not the empty string. This function returns a list that contains a copy of each violating lesson, together with the violation appended to the lesson. Example: Suppose that the lessons S00687 548QR I061 2017-01-08T14:00:00-05:00 2017-01-08T16:00:00-05:00 VFR Pattern S00758 548QR I072 2017-01-08T09:00:00-05:00 2017-01-08T11:00:00-05:00 VFR Pattern S00971 426JQ I072 2017-01-12T13:00:00-05:00 2017-01-12T15:00:00-05:00 VFR Pattern violate for reasons of 'Winds', 'Visibility', and 'Ceiling', respectively (and are the only violations). Then this function will return the 2d list [[S00687, 548QR, I061, 2017-01-08T14:00:00-05:00, 2017-01-08T16:00:00-05:00, VFR, Pattern, Winds], [S00758, 548QR, I072, 2017-01-08T09:00:00-05:00, 2017-01-08T11:00:00-05:00, VFR, Pattern, Visibility], [S00971, 426JQ, I072, 2017-01-12T13:00:00-05:00, 2017-01-12T15:00:00-05:00, VFR, Pattern, Ceiling]] REMEMBER: VFR flights are subject to minimums with VMC in the row while IFR flights are subject to minimums with IMC in the row. The examples above are all VFR flights. If we changed the second lesson to S00758, 548QR, I072, 2017-01-08T09:00:00-05:00, 2017-01-08T11:00:00-05:00, IFR, Pattern then it is possible it is no longer a visibility violation because it is subject to a different set of minimums. Parameter directory: The directory of files to audit Precondition: directory is the name of a directory containing the files 'daycycle.json', 'weather.json', 'minimums.csv', 'students.csv', and 'lessons.csv' """ # Load in all of the files # For each of the lessons # Get the takeoff time # Get the pilot credentials # Get the pilot minimums # Get the weather conditions # Check for a violation and add to result if so
Following are the functions needed for this to work and the functions are working:
def get_minimums(cert, area, instructed, vfr, daytime, minimums)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started