twilight: Times of Sunrise and Sunset

Description Usage Arguments Details Value

View source: R/SGAT.R


Estimate time of sunrsie or sunset for a given day and location


twilight(tm, lon, lat, rise, zenith = 96, iters = 3)



vector of approximate times of twilight.


vector of longitudes.


vector of latitudes.


logical vector indicating whether to compute rise or set.


the solar zenith angle that defines twilight.


number of iteratve refinements made to the initial approximation.


twilight uses an iterative algorithm to estimate times of sunrise and sunset.

Note that these functions return the twilight that occurs on the same date GMT as tm, and so sunset may occur before sunrise, depending upon latitude.

Solar declination and equation of time vary slowly over the day, and so the values of the Solar declination and equation of time at sunrise/sunset are well approximated by their values at 6AM/6PM local time. The sun's hour angle and hence sunrise/sunset for the required zenith can then be caclulates from these approximations. The calculation is then repeated using the approximate sunrise/sunset times to derive more accurate values of the Solar declination and equation of time and hence better approximations of sunrise/sunset. The process is repreated and is accurate to less than 2 seconds within 2 or 3 iterations.

sunrise and sunset are simple wrappers for twilight.


a vector of twilight times.

GeoLight documentation built on May 1, 2019, 8 p.m.