solar_calc: solar_calc

View source: R/solar_calc.R

solar_calcR Documentation

solar_calc

Description

Calculate the time of sunrise and sunset based on date and location.

Usage

solar_calc(latitude, longitude, focal_date, format = "%Y-%m-%d", tz,
  return_var = "both")

Arguments

latitude

Latitude in decimal degrees.

longitude

Longitude in decimal degrees.

focal_date

Date as a character.

format

Format of the date supplied. Defaults to '%Y-%m-%d'.

tz

Time zone expressed as the time difference compared to UTC, in a character format e.g. '+0100' or '-0830'. Must be five characters, including sign of the time difference and zeros where necessary. Must take account of Daylight Saving Time, where applicable.

return_var

Variables to return: 'both', 'sunrise' or 'sunset'. Defaults to 'both'.

Value

Either single result for sunset or sunrise, or a dataframe containing both variables. For simplicity, time is always reported in the format '%H:%M', and in the same time zone as the location of interest.

Examples

solar_calc(latitude = 53.6955847, longitude = -2.0015868, focal_date = '26/06/2017', format = '%d/%m/%Y', tz = '+0100', return_var = 'both')
solar_calc(latitude = 52.2099218, longitude = 0.1156409, focal_date = '1950-30-12', format = '%Y-%d-%m', tz = '+0000', return_var = 'sunrise')
solar_calc(latitude = 5.9790166, longitude = 116.0711132, focal_date = '01.04.2001', format = '%d.%m.%Y', tz = '+0800', return_var = 'Sunset')

rasenior/SolarCalc documentation built on Feb. 10, 2024, 6:29 a.m.