Aliases: crepuscule sunriset solarnoon solarpos crepuscule-methods crepuscule,SpatialPoints,POSIXct-method crepuscule,matrix,POSIXct-method solarnoon-methods solarnoon,SpatialPoints,POSIXct-method solarnoon,matrix,POSIXct-method solarpos-methods solarpos,SpatialPoints,POSIXct-method solarpos,matrix,POSIXct-method sunriset-methods sunriset,SpatialPoints,POSIXct-method sunriset,matrix,POSIXct-method
Keywords: methods manip utilities
### ** Examples ## 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") ## Astronomical dawn crepuscule(hels, d041224, solarDep=18, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.2762 2004-12-24 06:37:43
crepuscule(Hels, d041224, solarDep=18, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.2762 2004-12-24 06:37:43
## Nautical dawn crepuscule(hels, d041224, solarDep=12, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.3121822 2004-12-24 07:29:32
crepuscule(Hels, d041224, solarDep=12, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.3121822 2004-12-24 07:29:32
## Civil dawn crepuscule(hels, d041224, solarDep=6, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.3519249 2004-12-24 08:26:46
crepuscule(Hels, d041224, solarDep=6, direction="dawn", POSIXct.out=TRUE)
day_frac time newlon 0.3519249 2004-12-24 08:26:46
solarnoon(hels, d041224, POSIXct.out=TRUE)
day_frac time newlon 0.5137966 2004-12-24 12:19:52
solarnoon(Hels, d041224, POSIXct.out=TRUE)
day_frac time newlon 0.5137966 2004-12-24 12:19:52
solarpos(hels, as.POSIXct(Sys.time(), tz="EET"))
[,1] [,2] [1,] 274.8815 14.66269
solarpos(Hels, as.POSIXct(Sys.time(), tz="EET"))
[,1] [,2] [1,] 274.8815 14.66268
sunriset(hels, d041224, direction="sunrise", POSIXct.out=TRUE)
day_frac time newlon 0.3924249 2004-12-24 09:25:05
sunriset(Hels, d041224, direction="sunrise", POSIXct.out=TRUE)
day_frac time newlon 0.3924249 2004-12-24 09:25:05
## 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")
## Using a grid of spatial points for the same point in time ## Not run: ##D grd <- GridTopology(c(-179,-89), c(1,1), c(359,179)) ##D SP <- SpatialPoints(coordinates(grd), ##D proj4string=CRS("+proj=longlat +datum=WGS84")) ##D wint <- as.POSIXct("2004-12-21", tz="GMT") ##D win <- crepuscule(SP, wint, solarDep=6, direction="dawn") ##D SPDF <- SpatialGridDataFrame(grd, ##D proj4string=CRS("+proj=longlat +datum=WGS84"), ##D data=data.frame(winter=win)) ##D image(SPDF, axes=TRUE, col=cm.colors(40)) ## End(Not run)