Skip to content

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

Open

Description

@MBenoli

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

Activity

  1. maurymarkowitz commented on May 8, 2018

    @maurymarkowitz

    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.

  2. isVoid commented on Feb 10, 2019

    @isVoid

    +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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions