Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement this function def get _ weather _ violation ( weather , minimums ) : Returns a string representing the type of

Implement this function
def get_weather_violation(weather,minimums):
"""
Returns a string representing the type of weather violation (empty string if flight is ok)
The weather reading is a dictionary with the keys: 'visibility', 'wind', and 'sky'.
These correspond to a visibility, wind, and ceiling measurement, respectively. It
may have other keys as well, but these can be ignored. For example, this is a possible
weather value:
{
"visibility": {
"prevailing": 21120.0,
"minimum": 1400.0,
"maximum": 21120.0,
"units": "FT"
},
"wind": {
"speed": 12.0,
"crosswind": 3.0,
"gusts": 18.0,
"units": "KT"
},
"temperature": {
"value": -15.6,
"units": "C"
},
"sky": [
{
"cover": "clouds",
"type": "broken",
"height": 2100.0,
"units": "FT"
}
],
"weather": [
"light snow"
]
}
The minimums is a list of the four minimums ceiling, visibility, and max windspeed,
and max crosswind speed in that order. Ceiling is in feet, visibility is in statute
miles, max wind and cross wind speed are both in knots. For example,
[3000.0,10.0,20.0,8.0] is a potential minimums list.
This function uses bad_visibility, bad_winds, and bad_ceiling as helpers. It returns
'Visibility' if the only problem is bad visibility, 'Winds' if the only problem is
wind, and 'Ceiling' if the only problem is the ceiling. If there are multiple
problems, it returns 'Weather', It returns 'Unknown' if no weather reading is
available (e.g. weather is None). Finally, it returns ''(the empty string) if
the weather is fine and there are no violations.
Parameter weather: The weather measure
Precondition: weather is dictionary containing a visibility, wind, and ceiling measurement,
or None if no weather reading is available.
Parameter minimums: The safety minimums for ceiling, visibility, wind, and crosswind
Precondition: minimums is a list of four floats
"""
the error message is
get_weather_violation({'visibility': {'prevailing': 4.0, 'units': 'SM'}, 'wind': {'speed': 11.0, 'crosswind': 3.0, 'gusts': 28.0, 'units': 'KT'}, 'temperature': {'value': 6.7, 'units': 'C'},'sky': [{'cover': 'clouds', 'type': 'broken', 'height': 2800.0, 'units': 'FT'},{'cover': 'clouds', 'type': 'broken', 'height': 5500.0, 'units': 'FT'}], 'weather': ['rain', 'mist', 'thunderstorm'], 'code': '201705142156Z'},[500,0.75,30,20]) returned None, not ''.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

Students also viewed these Databases questions