twilight: calculate sunrise and sunset (nautic, civil, rise/set)

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/twilight.R

Description

The function calculates sunrise and sunset of specified coordinates in POSIXct-format. You can choose out of three different twilight conditions: "civil", "nautic" and "rise/set".

Usage

1
twilight(data_POSIXct, latitude, longitude, twilight = "civil")

Arguments

data_POSIXct

An object of class POSIXct. It is important to specify the correct timezone.

latitude

specify latitude

longitude

specify longitude

twilight

A character value: Choose between "civil", "nautic" or "rise/set" to specify required twilight condition. Default: "civil"

Value

The output is a data.frame object containing 2 columns (sunrise and sunset in POSIXct-format). If desired you can use cbind() to add this information to the original dataframe.

Note

The function is invoked by running twilight_timeframe().

Author(s)

Thomas Ruf; Frederik Sachser

References

The formula was adapted from the following webpage: http://lexikon.astronomie.info/zeitgleichung/

See Also

twilight_timeframe

Examples

1
2
3
4
5
6
now <- as.POSIXct(x = "2015-01-30 20:58:00", tz = "CET", origin = "01/01/1970")
art_date <- seq(now, now + 90*60*99, 90*60)
attributes(art_date)$tz <- 'CET'
lat <- runif(n = 100, min = 46.1, max = 46.9)
lon <- runif(n = 100, min = 13.1, max = 13.9)
twilight(data_POSIXct = art_date, latitude = lat, longitude = lon, twilight = "civil")

sachserf/chronobiology documentation built on May 29, 2019, 12:21 p.m.