Learn R Programming

solartime (version 0.0.4)

computeSunriseHourDoy: computeSunriseHourDoy

Description

Compute the hour of sunrise for given day and coordinates

Usage

computeSunriseHourDoy(doy, latDeg, longDeg = NA, 
    timeZone = NA, isCorrectSolartime = TRUE)

Value

numeric vector of length(doy) giving the time of sunrise in hours after midnight. Polar night is indicated by 12h, polar day by 0h.

Arguments

doy

integer vector with day of year [DoY, 1..366]

latDeg

Latitude in (decimal) degrees

longDeg

Longitude in (decimal) degrees (not required if solar time is sufficient)

timeZone

Time zone (in hours) ahead of UTC (Central Europe is +1) (not required if solar time is sufficient)

isCorrectSolartime

sunrise hour is computed first for solar time (where noon is exactly at 12:00) If TRUE (default) then sunrise hour is converted to local winter time, based on timeZone and longitude.

Author

Thomas Wutzler

Examples

Run this code
today <-
  as.POSIXlt(Sys.Date())$yday
(sunrise <- computeSunriseHourDoy(today, latDeg = 51, isCorrectSolartime = FALSE))
(sunrise <- computeSunriseHourDoy(today, latDeg = 51, longDeg = 11.586, timeZone = +1))
# elevation near zero
computeSunPositionDoyHour(160, sunrise, latDeg = 51, isCorrectSolartime = FALSE)
#
doy <- 1:366
plot( computeSunriseHourDoy(doy, latDeg = 51, isCorrectSolartime = FALSE) ~ doy )
# north pole: daylength 0 and 24 hours
plot( computeSunriseHourDoy( doy, latDeg = +80, isCorrectSolartime = FALSE) ~ doy )
plot( computeSunriseHourDoy( doy, latDeg = -80, isCorrectSolartime = FALSE) ~ doy )

Run the code above in your browser using DataLab