Using `prodb`
l = get_json_from_query('London')
l
Check woeid(Where On Earth ID) is correct for London
assert l['woeid'] == 44418
Get weather data for the London woeid
utc = arrow.utcnow().format('YYYY/MM/DD')
utc
Today's forecast 🌤️
%%time
res = get_current_weather('London')
res['consolidated_weather'][0]
There are a number of metrological properties available to us from the API.
The ones we are most interested in are:
the_temp🌡️ current temperatureweather_state_name⛅ current sky conditionmax_temp🥵 daily max tempmin_temp🥶 daily min temp
res = get_current_weather('London')
df = pd.DataFrame.from_records(res['consolidated_weather'][:1])
df['readable_time'] = df.created.apply(lambda x: arrow.get(x).humanize())
df
df = df_from_loc('London', days_ahead=2)
df
Example output showing location and current weather situation
df = df_from_loc('Auckland')
df
import sys
sys.path.append('../')
from prodb.core import generate_db, insert_row
dbpath = 'weather_db.csv'
cols = 'location temp high low weather_state'.split()
generate_db(cols=cols, dbpath=dbpath)
df = pd.read_csv(dbpath)
df.head()
dx = df_from_loc('Auckland')
dx
df = visit_city(df, ['Christchurch', 'Wellington', 'Lagos', 'Zagreb'], dbpath)
display(df)
df = visit_city(df, 'Yangon', dbpath)
display(df)
df = visit_city(df, ['Singapore', 'Alexandria', 'Bangkok'], dbpath)
display(df)