Esempio n. 1
0
# shift to tomorrow if already occurred
if sunrise_time < time_now:
    sunrise_time += 86400

if sunset_time < time_now:
    sunset_time += 86400

# seconds until next solar event
sunrise_in = sunrise_time - time_now
sunset_in = sunset_time - time_now

# age of current data in seconds
data_age = time_now - current['dt']

current_weather = Weather.from_hourly(current)
hourly_forecast = [Weather.from_hourly(x) for x in hourly['list']]
daily_forecast = [Weather.from_daily(x) for x in daily['list']]

# make sure current weather (not forecast[0]) is used for first segment! (though, they should be the same.)

print("Hours until next sunset:", sunset_in / 60 / 60)
print("Hours until next sunrise:", sunrise_in / 60 / 60)

if sunrise_time < sunset_time:
    print("Sun is", BColors.blue, "down")
else:
    print("Sun is", BColors.yellow, "up")

p1 = Point(10, 10)
p2 = Point(20, 20)