Sunriset methods

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.

methods, spatial

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


  • 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

  • sunriset-methods
  • sunriset
  • sunriset,ANY-method
  • sunriset,SpatialPoints,POSIXct-method
  • sunriset,matrix,POSIXct-method
## 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")
Documentation reproduced from package maptools, version 0.6-3, License: GPL version 2 or later (R and interface code), MIT (shapelib code)

Community examples

Looks like there are no examples yet.