Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong annotations are misleading #8

Open
Hcreak opened this issue Sep 15, 2022 · 2 comments
Open

Wrong annotations are misleading #8

Hcreak opened this issue Sep 15, 2022 · 2 comments

Comments

@Hcreak
Copy link

Hcreak commented Sep 15, 2022

date (datetime or a pandas series of datetimes): date and time to find sunlight phases of. Datetime must be in UTC.

This comment made me use datetime.utcnow() incorrectly.
And actually need to pass the local time like in your example code using datetime.now()

@henrythroop
Copy link

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

@kylebarron
Copy link
Owner

kylebarron commented Mar 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants