You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great library, and thank you so much for making it available!
I too have been confused by the use of time zones. While the text above says that the datetime must be UTC, I agree that it seems to require a local time.
But the use of time zones is inconsistent. The time returned by get_times() -- e.g., sunset -- is indeed in UTC. Calculating the solar altitude at the computed sunset time should be zero, but it is not that way. Am I mis-understanding the time zone usage?
lon = 80 # Position [deg] for Sri Lanka, GMT + 5.5
lat = 7
offset = timedelta(seconds=3600*5.5) # Offset from UTC to local time
date = datetime.now()
get_position(get_times(date, lon, lat)['sunset'], lon, lat) # Incorrect result: altitude 1.37 radians
get_position(get_times(date, lon, lat)['sunset'] + offset, lon, lat) # Correct result: altitude ~0 radians
This was intended to be a direct port of suncalc. I don't remember how the UTC/time zone behavior works/is supposed to work. I haven't been using this lately, but PRs are welcome
This comment made me use
datetime.utcnow()
incorrectly.And actually need to pass the local time like in your example code using
datetime.now()
The text was updated successfully, but these errors were encountered: