local2UTC: Local time, mean solar time and UTC time zone.

C_local2SolarR Documentation

Local time, mean solar time and UTC time zone.

Description

The function local2Solar converts the time zone of a POSIXct object to the mean solar time and set its time zone to UTC as a synonym of mean solar time. It includes two corrections: the difference of longitudes between the location and the time zone, and the daylight saving time.

The function lonHH calculates the longitude (radians) of a time zone.

Usage

local2Solar(x, lon = NULL)
lonHH(tz)

Arguments

x

a POSIXct object

lon

A numeric value of the longitude (degrees) of the location. If lon = NULL (default), this value is assumed to be equal to the longitude of the time zone of x, so only the daylight saving time correction (if needed) is included.

tz

A character, a time zone as documented in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Details

Since the result of local2Solar is the mean solar time, the Equation of Time correction is not calculated with this function. The eot function includes this correction if desired.

Value

The function local2Solar produces a POSIXct object with its time zone set to UTC.

The function lonHH gives a numeric value.

Note

It is important to note that the solaR2 package sets the system time zone to UTC with Sys.setenv(TZ = 'UTC').

Author(s)

Oscar Perpiñán Lamigueiro, Francisco Delgado López.

References

  • Perpiñán, O, Energía Solar Fotovoltaica, 2015. (https://oscarperpinan.github.io/esf/)

  • Perpiñán, O. (2012), "solaR: Solar Radiation and Photovoltaic Systems with R", Journal of Statistical Software, 50(9), 1-32, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v050.i09")}

Examples

library("data.table")


t.local <- as.POSIXct("2006-01-08 10:07:52", tz = 'Europe/Madrid')

##The local time zone and the location have the same longitude (15 degrees)
local2Solar(t.local)
##But Madrid is at lon = -3
local2Solar(t.local, lon = -3)

##Daylight saving time
t.local.dst <- as.POSIXct("2006-07-08 10:07:52", tz = 'Europe/Madrid')

local2Solar(t.local.dst)
local2Solar(t.local.dst, lon = -3)


solaR2 documentation built on April 3, 2025, 6:11 p.m.