top | item 39026706

(no title)

Amithv | 2 years ago

The hard part was obtaining information such as solar azimuth, altitude, declination, hour angle, etc without using external APIs. Spent around 5 days implementing backend.

discuss

order

antgiant|2 years ago

Way too late now, but to help others this fancy Excel sheet provided by NOAA is awesome! It implements all of these equations in Excel and is pretty easily portable to your programming language of choice. https://gml.noaa.gov/grad/solcalc/calcdetails.html

P.S. Using this has made it clear to me how bad most sunrise/sunset calculators actually are.

grecy|2 years ago

> P.S. Using this has made it clear to me how bad most sunrise/sunset calculators actually are.

That may just be a function of how you define "sunrise" and "sunset". It is never as simple as "when the sun hits the horizon", but something about some number of arc minutes from something something.

manchego|2 years ago

For anyone wanting to do this calculation yourself, this site is really good: https://www.aa.quae.nl/en/reken/zonpositie.html

I've previously used the formulas on this site to calculate the altitude/azimuth of the Sun and all the planets from a given lat/long/time on Earth.