Learn R Programming

bioRad (version 0.5.1)

sunrise_sunset: Calculate sunrise or sunset for a time and place

Description

Calculate sunrise or sunset for a time and place

Usage

sunrise(date, lon, lat, elev = -0.268, tz = "UTC")

sunset(date, lon, lat, elev = -0.268, tz = "UTC")

Arguments

date

Date inheriting from class POSIXt or a string interpretable by as.Date.

lon

Longitude in decimal degrees.

lat

Latitude in decimal degrees.

elev

Sun elevation in degrees.

tz

output time zone. Ignored if date has an associated time zone already

Value

The moment of sunrise or sunset in UTC time.

Details

The angular diameter of the sun is about 0.536 degrees, therefore the moment of sunrise/sunset corresponds to half that elevation at -0.268 degrees.

This is a convenience function mapping to crepuscule.

Approximate astronomical formula are used, therefore the moment of sunrise / sunset may be off by a few minutes

Examples

Run this code
# NOT RUN {
# sunrise in the Netherlands
sunrise("2016-01-01", 5, 53)

# sunset in the Netherlands
sunset("2016-01-01", 5, 53)

# civil twilight in Ithaca, NY, today
sunrise(Sys.time(), -76.5, 42.4, elev = -6)
# }

Run the code above in your browser using DataLab