maptools (version 0.6-3)

sunriset-methods: Sunriset methods

Description

Two sunriset methods are available for dates given as POSIXct objects and spatial position given either as SpatialPoints in geographical coordinates, or as a matrix of points taken as geographical coordinates.

Arguments

Details

Usage:\ sunriset(crds, dateTime, direction=c("sunrise", "sunset"), POSIXct.out=FALSE)

Arguments:\

  • crds
{spatial positions} dateTime{POSIXct time object} direction{either "sunrise" or "sunset"} \item{POSIXct.out}{return a fraction of day vector or a data frame with fraction of day values, and their POSIXct representation}

See Also

crepuscule-methods, solarnoon-methods, solarpos-methods

Examples

Run this code
## Location of Helsinki, Finland, in decimal degrees,
## as listed in NOAA's website
hels <- matrix(c(24.97, 60.17), nrow=1)
Hels <- SpatialPoints(hels, proj4string=CRS("+proj=longlat +datum=WGS84"))
d041224 <- as.POSIXct("2004-12-24", tz="EET")
sunriset(hels, d041224, direction="sunrise", POSIXct.out=TRUE)
sunriset(Hels, d041224, direction="sunrise", POSIXct.out=TRUE)

## Using a sequence of dates
Hels_seq <- seq(from=d041224, length.out=365, by="days")
up <- sunriset(Hels, Hels_seq, direction="sunrise", POSIXct.out=TRUE)
down <- sunriset(Hels, Hels_seq, direction="sunset", POSIXct.out=TRUE)
day_length <- down$time - up$time
plot(Hels_seq, day_length, type="l")

Run the code above in your browser using DataCamp Workspace