library("data.table")
setDTthreads(2)
BTd <- fBTd(mode = 'serie')
lat <- 37.2
(fSolD(lat, BTd[100]))
(fSolD(lat, BTd[100], method = 'strous'))
(fSolD(lat, BTd[100], method = 'spencer'))
(fSolD(lat, BTd[100], method = 'cooper'))
lat <- -37.2
(fSolD(lat, BTd[283]))
#Solar angles along the year
SolD <- fSolD(lat, BTd = fBTd())
xyplot(SolD)
#Calculation of the daylength for several latitudes
library("latticeExtra")
Lats <- c(-60, -40, -20, 0, 20, 40, 60)
NomLats <- ifelse(Lats > 0, paste(Lats,'N', sep = ''),
paste(abs(Lats), 'S', sep = ''))
NomLats[Lats == 0] <- '0'
BTd <- fBTd(mode = 'serie')
mat <- matrix(nrow = length(BTd), ncol = length(Lats))
colnames(mat) <- NomLats
WsZ <- data.table(Dates = BTd, mat)
for (i in seq_along(Lats)){
SolDaux <- fSolD(lat = Lats[i], BTd = fBTd(mode = 'serie'));
WsZ[,i+1] <- r2h(2*abs(SolDaux$ws))}
p = xyplot(`60S` + `40S` + `20S` + `0` + `20N` + `40N` + `60N` ~ Dates, data = WsZ, type = "l",
ylab = expression(omega[s] * (h)))
plab = p+glayer(panel.text(x[1], y[1], NomLats[group.number], pos = 2))
print(plab)
Run the code above in your browser using DataLab