In [6]:
import pyowm
In [7]:
owm = pyowm.OWM('1625dc2505f770bd77be9faa382dad78')
In [ ]:
# Will it be sunny tomorrow at this time in Milan (Italy) ?
forecast = owm.daily_forecast('berlin,de')
tomorrow = pyowm.timeutils.tomorrow()
forecast.will_be_sunny_at(tomorrow) # Always True in Italy, right? ;-)
In [14]:
# Search for current weather in London (UK)
observation = owm.weather_at_place('berlin,de')
w = observation.get_weather()
print(w) # <Weather - reference time=2013-12-18 09:20,
# status=Clouds>
In [15]:
# Weather details
w.get_wind() # {'speed': 4.6, 'deg': 330}
w.get_humidity() # 87
w.get_temperature('celsius') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}
Out[15]:
In [13]:
# Search current weather observations in the surroundings of
# lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
observation_list = owm.weather_around_coords(-22.57, -43.12)
In [16]:
observation.get_reception_time()
Out[16]:
In [22]:
observation.get_reception_time(timeformat='iso')
Out[22]:
In [21]:
observation = owm.weather_at_place('berlin,de')
In [26]:
times = []
for _ in range(10):
observation = owm.weather_at_place('berlin,de')
t = observation.get_reception_time()
times.append(t)
In [27]:
times
Out[27]:
In [ ]: