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

Is it possible to get the times for a given sun position on a given date ? #30

Open
MBenoli opened this issue Sep 14, 2017 · 2 comments

Comments

@MBenoli
Copy link

MBenoli commented Sep 14, 2017

Dear Chris,

Here is an example of what I mean:
Knowing the latitude, longitude of a location (Let's say: 40.730610, -73.935242 for New York) and knowing the sun angle (for example for the sunset the sun angle is defined as making an angle of -0.833 below the horizon) can I get the time of the sunset for a given date (for example: 6:22 AM on the 12th of July) ?

Of course, here I gave an example for the sunset but I want to get times for different sun angles.

So the call to the function would be like:
getTimeForGivenSunAngle(date,lat,long,sunAngle)
that will return something like: "In New York, on the 12th of July the Sun will make an angle of -0.833 degrees at 6:22 AM"

Best regards,

Michael

@maurymarkowitz
Copy link

I realize this is out of the blue, but I wrote such a function in Swift a while back. See https://stackoverflow.com/questions/41656453/suns-position-in-swift. ceeK, if you see this, feel free to add this code to your library, that will save me having to reinvent the wheel.

@isVoid
Copy link

isVoid commented Feb 10, 2019

+1 request for this function.

Surely one can enumerate every single second from this point on for a fixed time range and store them in a linear list. However for a function which requires frequent calls, the memory and computing overhead is unnecessarily large. Is it possible to have a closed form solution/approximation to the sun positions?

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