本文整理汇总了Python中weather.Weather.retrieve_weather_from_day方法的典型用法代码示例。如果您正苦于以下问题:Python Weather.retrieve_weather_from_day方法的具体用法?Python Weather.retrieve_weather_from_day怎么用?Python Weather.retrieve_weather_from_day使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weather.Weather
的用法示例。
在下文中一共展示了Weather.retrieve_weather_from_day方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import retrieve_weather_from_day [as 别名]
def main():
dates = ['2015-06-20', '2015-06-21', '2015-06-22', '2015-06-23', '2015-06-24']
api_key = os.environ.get("WEATHER_API_KEY", None)
latitude, longitude = (-35.280317, 149.111644)
weather = Weather(api_key, latitude, longitude, units='si')
logger = LogData()
for each_date in dates:
forecast = weather.retrieve_forecast(each_date)
weather_whole_day = weather.retrieve_weather_from_day(forecast)
hourly_weather = weather.retrieve_weather_by_hour(forecast)
weather_6_am = hourly_weather[6]
night_weather, day_weather = weather.summarise_night_day(hourly_weather, np.mean)
logger.log_output(weather_whole_day, each_date, 'daily')
logger.log_output(weather_6_am, each_date, 'hourly', 6)
logger.log_output(night_weather, each_date, 'night')
logger.log_output(day_weather, each_date, 'day')
logger.write_output('test.csv')