solar_time computes from a time and geocode, the time of day expressed
in seconds since midnight.
solar_date returns the same instant in time
as a date-time object. Solar time is useful when we want to plot data
according to the local solar time of day, irrespective of the date. Solar
date is useful when we want to plot a time series stretching for several days
using the local solar time but distinguishing between days.
1 2 3 4 5
POSIXct Time, any valid time zone (TZ) is allowed, default is current time
data frame with variables lon and lat as numeric values (degrees).
character string, One of "datetime", "hour", "minute", or "second".
solar_time() numeric value in seconds from midnight but
with an additional class attribute "solar.time".
Returned values are computed based on the time zone of the argument for parameter time. In the case of solar time, this timezone does not affect the result. However, in the case of solar dates the date part may be off by one day, if the time zone does not match the coordinates of the geocode value provided as argument.
The algorithm is approximate, it calculates the difference between
local solar noon and noon in the time zone of
time and uses this
value for the whole day when converting times into solar time. Days are not
exactly 24 h long. Between successive days the shift is only a few seconds,
and this leads to a small jump at midnight.
1 2 3 4 5 6 7 8 9 10 11 12
BA.geocode <- data.frame(lon = -58.38156, lat = -34.60368, address = "Buenos Aires, Argentina") sol_t <- solar_time(lubridate::dmy_hms("21/06/2016 10:00:00", tz = "UTC"), BA.geocode) sol_t class(sol_t) sol_d <- solar_time(lubridate::dmy_hms("21/06/2016 10:00:00", tz = "UTC"), BA.geocode, unit.out = "datetime") sol_d class(sol_d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.