Compute duration of day light for a given latitude and Julian Day.

daylength(lat, long = 0, jd, tmz = 0)

Arguments

lat

Latitude in degrees and decimal fraction.

long

Longitude in degrees and decimal fraction.

jd

Julian Day.

tmz

Timezone, west of Greenwich is negative.

Value

sunrise

Time of sunrise.

sunset

Time of sunset.

daylen

Duration of daylight in hours and decimal fraction.

It returns NA for sunrise and sunset during the polar night.

Details

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.

Note

You may like to double check at: https://gml.noaa.gov/gmd/grad/solcalc/azel.html

References

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.

See also

Author

Javier G. Corripio jgc@meteoexploration.com

Examples


# 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))