Description Usage Arguments Details Value Author(s) Examples
View source: R/utilSolarTime.R
tell for each timestamp, whether its daytime
1 2 3 | computeIsDayByLocation(timestamp, latDeg,
longDeg, timeZone = getHoursAheadOfUTC(timestamp),
duskOffset = 0, isCorrectSolartime = TRUE)
|
timestamp |
POSIXct vector |
latDeg |
Latitude in (decimal) degrees |
longDeg |
Longitude in (decimal) degrees |
timeZone |
Time zone (in hours) ahead of UTC (Central Europe is +1) |
duskOffset |
integer scalar: time in hours after dusk for which records are still regarded as day |
isCorrectSolartime |
set to FALSE to omit correction between local time and solar time, e.g. if coordinates cannot be provided |
computes hour of sunrise and sunset from given date in timezone hour (assuming dates are given in timezone instead of solartime)
logical vector (length(date)): true if its daytime
Thomas Wutzler
1 2 3 4 5 6 7 8 9 10 11 12 | dateSeq <- seq( as.POSIXct("2017-03-20", tz = "Etc/GMT-1")
,as.POSIXct("2017-03-21", tz = "Etc/GMT-1")
, by = "30 min")
tmp <- computeIsDayByLocation(
dateSeq, latDeg = 50.93, longDeg = 11.59, timeZone = 1)
plot( tmp ~ dateSeq )
yday <- as.POSIXlt(dateSeq[1])$yday + 1L
sunrise <- computeSunriseHourDoy(
yday, latDeg = 50.93, longDeg = 11.59, timeZone = 1)
sunset <- computeSunsetHourDoy(
yday, latDeg = 50.93, longDeg = 11.59, timeZone = 1)
abline( v = trunc(dateSeq[1], units = "days") + c(sunrise,sunset)*3600L )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.