Learn R Programming

solartime (version 0.0.4)

computeSolarToLocalTimeDifference: computeSolarToLocalTimeDifference

Description

computes the time difference in hours between (apparent) solar time and local time

Usage

computeSolarToLocalTimeDifference(longDeg, 
    timeZone, doy = NA, fracYearInRad = 2 * 
        pi * (doy - 1)/365.24)

Value

time difference in hours to be added to local winter time to get solar time

Arguments

longDeg

Longitude in (decimal) degrees

timeZone

Time zone (in hours) ahead of UTC (Berlin is +1)

doy

integer vector with day of year [DoY, 1..366], Specify NA get mean solar time across the year instead of apparent solar time (i.e. with differences throughout the year due to eccentricity of earth orbit)

fracYearInRad

may specify instead of doy for efficiency.

Author

Thomas Wutzler

Examples

Run this code
# Jena: 50.927222, 11.586111
longDeg <- 11.586
doi <- 1:366
# due to longitude: west of timezone meridian: sun culminates later,
# solar time is less than local time
(localDiff <- computeSolarToLocalTimeDifference(longDeg, 1L)*60)
# taking into account shift during the year due to earth orbit eccentricity
plot( computeSolarToLocalTimeDifference(longDeg, 1L, doi)*60 ~ doi )
abline(h = localDiff)

Run the code above in your browser using DataLab