twilight | R Documentation |
Estimate time of sunrsie or sunset for a given day and location
twilight(tm, lon, lat, rise, zenith = 96, iters = 3, closest = FALSE)
tm |
vector of approximate times of twilight. |
lon |
vector of longitudes. |
lat |
vector of latitudes. |
rise |
logical vector indicating whether to compute rise or set. |
zenith |
the solar zenith angle that defines twilight. |
iters |
number of iteratve refinements made to the initial |
closest |
if TRUE, attempt to find the twilight closest to tm. |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.