Compute duration of day light for a given latitude and Julian Day.
daylength(lat, long = 0, jd, tmz = 0)
Latitude in degrees and decimal fraction.
Longitude in degrees and decimal fraction.
Julian Day.
Timezone, west of Greenwich is negative.
Time of sunrise.
Time of sunset.
Duration of daylight in hours and decimal fraction.
It returns NA for sunrise and sunset during the polar night.
It considers sunrise and sunset as the time when the center of the
sun pass above or below the horizon, it does not take into account
limb, summer time, atmospheric refraction or twilight. Code comes
from the archived insol
R package on CRAN written by Javier
G. Corripio jgc@meteoexploration.com.
You may like to double check at: https://gml.noaa.gov/gmd/grad/solcalc/azel.html
Corripio, J. G.: 2003, Vectorial algebra algorithms for calculating terrain parameters from DEMs and the position of the sun for solar radiation modelling in mountainous terrain, International Journal of Geographical Information Science 17(1), 1-23.
# Daylength is 12 hours on March, 20th at the Equator.
daylength(0, 6.86933, 79, +1)
#> sunrise sunset daylen
#> [1,] 6.78 18.78 12
# Daylength for the whole year in Chamonix (assuming UTC+1)
jd <- c(1:365)
plot(daylength(45.92375, 6.86933, jd, 1)[, 3], type="l",
xlab='Day of the year', ylab='day length [h]', ylim=c(0,24))