diff --git a/app.py b/app.py index 82ed4e24..0c19f84e 100644 --- a/app.py +++ b/app.py @@ -34,10 +34,12 @@ if "error" in weather: st.error(weather["error"]) else: - col1, col2, col3 = st.columns(3) + col1, col2, col3,col4 = st.columns(4) col1.metric("Temperature (°C)", weather["temperature"]) col2.metric("Feels Like (°C)", weather["feels_like"]) col3.metric("Humidity (%)", weather["humidity"]) + #Added a factor wind speed and coverted m/s to km/hr + col4.metric("Wind Speed (km/hr)", round(weather["wind_speed"]*3.6, 2)) st.write(f"**Description:** {weather['description'].capitalize()}") st.image(f"http://openweathermap.org/img/wn/{weather['icon']}@2x.png") diff --git a/utils/weather.py b/utils/weather.py index bbbfa7f7..7021be86 100644 --- a/utils/weather.py +++ b/utils/weather.py @@ -19,6 +19,7 @@ def get_current_weather(city_name, lat, lon): "temperature": data["main"]["temp"], "feels_like": data["main"]["feels_like"], "humidity": data["main"]["humidity"], + "wind_speed": data["wind"]["speed"], "description": data["weather"][0]["description"].title(), "icon": data["weather"][0]["icon"] }