-
Notifications
You must be signed in to change notification settings - Fork 424
Wrong azimuth angle #6
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
Comments
You're right, I used south-based azimuth whereas north-based azimuth is usually used for sun position... |
Thank you ! I'm currently writing an Android app and I've ported this awesome tool to java and I didn't understand where was my mistake concerning the sun azimuth :) |
I created PR #35 to address this with tests. |
just noticed this bug myself, thanks for the great work. The pull request seems to fix it for me, will be double checking in the next days. |
Will fix this be merged into the main branch soon? |
Probably, but I'd suggest just adding a PI instead of waiting for it to be merged. |
Is there a reason #35 hasn't been merged? |
Yeah, hesitating to break backwards compatibility, leading to even more confusion :) I'll deal with this eventually, just didn't get my hands on it yet. |
Makes sense! Crazy how many forks are downstream also… |
If breaking backwards compatibility is a concern than it might be good to add a new interface method which would give the correct result and leave the old one for those who were doing their own workarounds. |
I did not consider backwards functionality when I did the PR, that's my bad, I simply updated my library here and ran with it. @mourner if you have another solution, I'd be happy to work something up, otherwise no harm no foul on the PR. |
According to semver, the way to avoid breaking users existing apps is to release a new version with a major version number change (i.e. release as 2.0.0). This way, the vast majority of users won't pull it into their project automatically. |
- Wrong azimuth angle: mourner/suncalc#6 - Nadir shifted from past to future: mourner/suncalc#125 - Coefficient is incorrect in solarTransitJ() function: mourner/suncalc#178
- Wrong azimuth angle: mourner/suncalc#6 - Nadir shifted from past to future: mourner/suncalc#125 - Coefficient is incorrect in solarTransitJ() function: mourner/suncalc#178
Sorry but i find that the sun azimuth must plus 180 degree so:
function getAzimuth(H, phi, dec) {
return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi));
}
must be:
function getAzimuth(H, phi, dec) {
return PI + atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi));
}
The text was updated successfully, but these errors were encountered: