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

please add refraction correction to the terminator #7

Open
chaimkeh opened this issue Mar 20, 2017 · 4 comments
Open

please add refraction correction to the terminator #7

chaimkeh opened this issue Mar 20, 2017 · 4 comments

Comments

@chaimkeh
Copy link

chaimkeh commented Mar 20, 2017

Please update your wonderful javascript using the calculation of the terminator that includes an averaged atmoshpheric refraction addition: that I (chaim) explained how to calculated in the following post:
http://physics.stackexchange.com/questions/28563/hours-of-light-per-day-based-on-latitude-longitude-formula/320092#320092
The calculation manner is as following. After calculating the percentage of dayligh for any latitude, calculate the longitude of noon for any time, and the day night terminator at that latitude will be a half of the percentage of daylight in angle on either direction of the noon position. Thank you!

@joergdietrich
Copy link
Owner

Thanks for your suggestion. It's unfortunately not quite straightforward to implement this. Leaflet.Terminator internally computes the hour angle of the Sun for each longitude and not the hour angle of the sunset, i.e., you need to solve the equation

cos \theta_s = sin \phi sin \delta + cos \phi cos \delta cos h

for \phi. This is trivial if \theta_s = 90°, which is currently what the code does. The general case requires some spherical trigonometry, which I currently don't have the time for. I'd be happy to take somebody else's solution (or even better a PR). Otherwise it'll be a while before I get to this.

@chaimkeh
Copy link
Author

chaimkeh commented Mar 21, 2017 via email

@chaimkeh
Copy link
Author

chaimkeh commented Mar 21, 2017 via email

@joergdietrich
Copy link
Owner

Dear Chaim,

Many thanks for your detailed explanation. I agree having the zenith angle as a configure option would be very nice to have, e.g., to plot twilight in addition to a sharp terminator. As I said the logic right now is that I assumed there would be a unique solution for latitude at every longitude. With a zenith angle different from 90° this is not correct anymore.

It'll be a few weeks before I can implement this, but it's definitely on my to do list.

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

No branches or pull requests

2 participants