climacell_celestial: Sunrise, Sunset, and Moon Phase Readings from Climacell

Description Usage Arguments Details Value Examples

View source: R/climacell_celestial.R

Description

This function will make a call to the Climacell API and retrieve sunrise, sunset times and moon phase variables.

Usage

1
2
3
4
5
6
7
8
climacell_celestial(
  api_key,
  lat,
  long,
  timestep = "1d",
  start_time = NULL,
  end_time = NULL
)

Arguments

api_key

character string representing the private API key. Provided by user or loaded automatically from environment variable (environment variable must be called "CLIMACELL_API").

lat

a numeric value (or a string that can be coerced to numeric) representing the latitude of the location.

long

a numeric value (or a string that can be coerced to numeric) representing the longitude of the location.

timestep

a 'step' value for the time. For the climacell_celestial function, the only acceptable value (per the limitations of the Climacell API) is '1d'.

start_time

the start time of the query. This input must be a character string that can be parsed into a data/time or a date/time value. If the input does not contain a timezone, the value will be assumed to be in UTC. It is recommended that the lubridate::now() function or Sys.time() be used to define the start_time. For this function, the start_time cannot be less than 6 hours from the current time.

end_time

the end time of the query. This input must be a character string that can be parsed into a data/time or a date/time value. If the input does not contain a timezone, the value will be assumed to be in UTC. For this function, the end_time cannot be greater than 15 days from the current date/time.

Details

climacell_celestial returns a tibble that consists of sunrise/sunset times along with the moon phase (code & description).

Value

a tibble

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
climacell_celestial(
  api_key = Sys.getenv('CLIMACELL_API'),
  lat = 0,
  long = 0,
  timestep = '1d',
  start_time = lubridate::now(),
  end_time = lubridate::now() + lubridate::days(5))

## End(Not run)

nikdata/RClimacell documentation built on March 26, 2021, 10:43 p.m.