Closed permaBox closed 6 months ago
Thanks for the report. I am actively developing this at the moment, so please grab the latest version and re-test.
What time zone are you in? If UTC+1, you need to set the local time offset to 1. However this will affect sun and moon data. Please let me know if this fixes problem 1. I will investigate problem 2.
I have pushed an update with the latest improvements from Raul Kompaß. Here is the outcome on a Pico W (the platform with the poorest precision):
>>> from sun_moon import RiSet
>>> rs = RiSet(48.4010822, 9.9876076, 1) # Ulm Germany
>>> rs.sunrise(2)
'07:55:48'
>>> rs.sunset(2)
'16:26:04'
>>> rs.moonrise(2)
'00:29:49'
>>> rs.moonset(2)
'13:27:52'
>>>
Times from timeanddate.com (only 1 minute precision): Sun 7:55 - 16:25 Moon: 00:29 - 13:28
Interestingly a 64-bit platform now produces exactly the same results.
Note that .set_day()
and the RiSet
constructor set the object's date relative to the system clock. The latter must therefore be initialised to local time. It doesn't need to be accurate so long as the date portion is correct when called. I will clarify this in the docs.
I assume this is now fixed, but please check for updates. I have improved the moon phase calculation, with an API change.
There is two issues with the moon data:
Used location: Ulm Germany, 48.4010822/9.9876076 https://aa.usno.navy.mil/api/rstt/oneday?date=2023-12-03&coords=48.4401822,9.8976076&tz=1&dst=false
Sun data look ok!