maptools (version 0.6-3)

crepuscule-methods: Crepuscule methods

Description

Two crepuscule 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. Crepuscule methods give the onset or termination of periods of twilight before sunrise or after sunset.

Arguments

Details

Usage:\ crepuscule(crds, dateTime, solarDep, direction=c("dawn", "dusk"), POSIXct.out=FALSE)

Arguments:\

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

See Also

sunriset-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")
## Astronomical dawn
crepuscule(hels, d041224, solarDep=18, direction="dawn", POSIXct.out=TRUE)
crepuscule(Hels, d041224, solarDep=18, direction="dawn", POSIXct.out=TRUE)
## Nautical dawn
crepuscule(hels, d041224, solarDep=12, direction="dawn", POSIXct.out=TRUE)
crepuscule(Hels, d041224, solarDep=12, direction="dawn", POSIXct.out=TRUE)
## Civil dawn
crepuscule(hels, d041224, solarDep=6, direction="dawn", POSIXct.out=TRUE)
crepuscule(Hels, d041224, solarDep=6, direction="dawn", POSIXct.out=TRUE)

## Using a grid of spatial points for the same point in time
grd <- GridTopology(c(-179,-89), c(1,1), c(359,179))
SP <- SpatialPoints(coordinates(grd),
                    proj4string=CRS("+proj=longlat +datum=WGS84"))
wint <- as.POSIXct("2004-12-21", tz="GMT")
win <- crepuscule(SP, wint, solarDep=6, direction="dawn")
SPDF <- SpatialGridDataFrame(grd,
 proj4string=CRS("+proj=longlat +datum=WGS84"),
 data=data.frame(winter=win))
image(SPDF, axes=TRUE, col=cm.colors(40))

Run the code above in your browser using DataCamp Workspace