refactor(weather): add wind object to WeatherValue model
This commit is contained in:
@@ -3,6 +3,7 @@ import datetime
|
||||
from gallery.sketch.weather.model import Cloudness, Precipitation, WeatherValue
|
||||
from gallery.sketch.weather.util import build_weather_value
|
||||
|
||||
from ...sketch.weather.parser import parse_wind_direction
|
||||
from .openweather import ForecastItem
|
||||
|
||||
|
||||
@@ -31,9 +32,9 @@ class ForecastItemParser:
|
||||
# value.temperature = [round(item.main.temp_max), round(item.main.temp_min)]
|
||||
value.pressure = [round(item.main.pressure * 0.75006)]
|
||||
value.humidity = item.main.humidity
|
||||
value.wind_speed = round(item.wind.speed)
|
||||
value.wind_gust = round(item.wind.gust)
|
||||
value.wind_direction = item.wind.deg
|
||||
value.wind.speed = round(item.wind.speed)
|
||||
value.wind.gust = round(item.wind.gust)
|
||||
value.wind.direction = parse_wind_direction(item.wind.deg)
|
||||
value.sky.cloudness = self.CLOUDNESS_MAP.get(item.weather[0].description, Cloudness.CLEAR)
|
||||
value.sky.precipitation = self.PRECIPITATION_MAP.get(item.weather[0].description, Precipitation.NO)
|
||||
if item.rain:
|
||||
|
||||
Reference in New Issue
Block a user