computeIsDayByLocation: computeIsDayByLocation

Description Usage Arguments Details Value Author(s) Examples

View source: R/utilSolarTime.R

Description

tell for each timestamp, whether its daytime

Usage

1
2
3
computeIsDayByLocation(timestamp, latDeg, 
    longDeg, timeZone = getHoursAheadOfUTC(timestamp), 
    duskOffset = 0, isCorrectSolartime = TRUE)

Arguments

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

Details

computes hour of sunrise and sunset from given date in timezone hour (assuming dates are given in timezone instead of solartime)

Value

logical vector (length(date)): true if its daytime

Author(s)

Thomas Wutzler

Examples

 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 )

solartime documentation built on April 22, 2021, 5:10 p.m.