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

Sun position azimuth less than 0 #171

Open
Jakub-Plan-d-k opened this issue Jun 21, 2023 · 2 comments
Open

Sun position azimuth less than 0 #171

Jakub-Plan-d-k opened this issue Jun 21, 2023 · 2 comments

Comments

@Jakub-Plan-d-k
Copy link

Hello,
in the documentation it is stated that sunPosition.azimuth is an angle in radians calculated from south to west.
Therefore I assumed the values should be between 0 and 2*PI, however this is apparently not the case. How should I interpret this angle then?

Steps to reproduce: run sunPosition with arguments:
date: Date Wed Jun 21 2023 11:09:23 GMT+0200 (Central European Summer Time)
latitude: 50.121110169781446
longitude: 8.768237964680083

Observe that azimuth is less than 0:
sunPosition.azimuth -1.0092469987441774

For the record, the sun is around south-east in real world for those parameters I posted.

@Phoscur
Copy link

Phoscur commented Jun 15, 2024

I'm having similar issues with the moon's azimuth from Europe: This month (June 2024), the moon sets in the west, but it azimuth values are far too low for that.

Concerning the sun, it's the same, it sets in the West but the azimuth is too low for that.

Edit: Wait... (thank you for quoting the docs, I did not see) "south to west"? That means I need to add 180° to the Azimuth.. and now it is not far from I what I expect anymore!

@Phoscur
Copy link

Phoscur commented Jun 15, 2024

@Jakub-Plan-d-k and Copilot completed my comment:

const angle = azimuth * (180 / Math.PI) + 180 // azimuth needs to be converted from -180° to 180° to 0° to 360°

Does this explain your negative value?

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

2 participants