Ephem is around one hour too early for the sunrise and sunset. Here is my code, the google prediction (which is verified myself) and the ephem prediction. It is almost around one hour different. The datetime function is working correctly, so I do not think it has something todo with my setup:
print(datetime.datetime.now())
2020-03-12 11:51
Ephem: Float - Sunrise: 2020/3/13 05:24:15 Sunset: 2020/3/12 17:06:23
Google result for the same date: Sunrise / Sunset : 06:27 / 18:06
Can someone spot a mistake I made? I am using spyder3 with anaconda on debian with Python 3.7 and ephem-3.7.7.0.
def isTheSunShining(mydate, mytime):
mycity = ephem.cities.city("Berlin")
floatime_rise = mycity.next_rising(ephem.Sun())
floatime_set = mycity.next_setting(ephem.Sun())
print("Float - Sunrise: " + str(floatime_rise) + " Sunset: " + str(floatime_set))
From the documentation:
PyEphem’s Date type itself does not support time zones. All PyEphem dates are expressed in Universal Time (UTC), which is similar to Standard Time in Greenwich, England. But if you need a time displayed in your local timezone, then you can use the PyEphem localtime function, which takes a PyEphem date and returns a Python datetime giving your local time.