nathan-osman / go-sunrise

Go package for calculating the sunrise and sunset times for a given location
MIT License
145 stars 17 forks source link

Add TimeOfElevation #9

Closed dinosaursrarr closed 2 years ago

dinosaursrarr commented 2 years ago

Computes the two times of day when the sun is at a given angle above (or below) the horizon.

It's not strictly sunrise or sunset, but the maths is closely related and it's really handy to use your functions.

I realise you're not actively working on this library, but I have a use case in a project that depends on it (https://github.com/tidbyt/pixlet).

Someone wants to display the start and end time of Shabbat. The end time is when the sun is 8.5 degrees below the horizon. This function makes it easy to compute that.

The alternative would be to add this logic just to pixlet. It can use all of the same functions as they're exported by your library. But it seems general and related enough to belong in the library where others could use them.

Included tests to ensure this gives consistent answers to SunriseSunset.

nathan-osman commented 2 years ago

Hey, thank you so much! This looks fantastic and I'd love to add these two functions to the package.