Learn R Programming

solaR2 (version 0.11)

A1_calcSol: Apparent movement of the Sun from the Earth

Description

Compute the apparent movement of the Sun from the Earth with the functions fSolD and fSolI.

Usage

calcSol(lat, BTd, sample = 'hour', BTi,
        EoT = TRUE, keep.night = TRUE,
        method = 'michalsky')

Value

A Sol-class object.

Arguments

lat

Latitude (degrees) of the point of the Earth where calculations are needed. It is positive for locations above the Equator.

BTd

Daily time base, a POSIXct object which may be the result of fBTd. It is not considered if BTi is provided.

sample

Increment of the intradaily sequence. It is a character string, containing one of ‘"sec"’, ‘"min"’, ‘"hour"’. This can optionally be preceded by a (positive or negative) integer and a space, or followed by ‘"s"’. It is used by seq.POSIXt.

It is not considered if BTi is provided.

BTi

Intradaily time base, a POSIXct object to be used by fSolI. It may be the result of fBTi.

EoT

logical, if TRUE the Equation of Time is used. Default is TRUE.

keep.night

logical, if TRUE (default) the night is included in the time series.

method

character, method for the sun geometry calculations to be chosen from 'cooper', 'spencer', 'michalsky' and 'strous'. See references for details.

Author

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

References

Examples

Run this code
library("data.table")
setDTthreads(2)

BTd <- fBTd(mode <- 'serie')

lat <- 37.2
sol <- calcSol(lat, BTd[100])
print(as.data.tableD(sol))

library(lattice)
xyplot(as.data.tableI(sol))

solStrous <- calcSol(lat, BTd[100], method = 'strous')
print(as.data.tableD(solStrous))

solSpencer <- calcSol(lat, BTd[100], method = 'spencer')
print(as.data.tableD(solSpencer))

solCooper <- calcSol(lat, BTd[100], method = 'cooper')
print(as.data.tableD(solCooper))

Run the code above in your browser using DataLab