# \donttest{
library (graphics)
# Loading mandatory data for the Example 'Points'
data(inp_exPoints)
# Measured and estimated one-year time series of the monthly mean relative sunshine duration,
# at a grid cell near Szeged, Hungary (46.3N, 20.2E), in the year 2010
with(inp_exPoints, {
bsdf01 <- matrix(nrow = 0, ncol = 12, dimnames = list(NULL, month.abb))
bsdf01 <- rbind(bsdf01, "Measured" = bsdf["2010", ])
bsdf01 <- rbind(bsdf01, "Solar123" = cliBrtSunDurFrcPoints(temp["2010", ], prec["2010", ],
lat, lon, elv, year = 2010))
bsdf01 <- rbind(bsdf01, "SPLASH" = cliBrtSunDurFrcPoints(temp["2010", ], prec["2010", ],
lat, lon, elv, year = 2010, aprchSIM = "SPLASH"))
cols <- c("black", "green", "blue")
matplot(t(bsdf01), type = "l", lwd = 2, col = cols, xaxt = "n", xlab = "Month",
ylab = "Average relative sunshine duration (unitless)")
axis(1, at = seq(1, ncol(bsdf01)), labels = colnames(bsdf01))
legend(1, 0.7, legend = rownames(bsdf01), col = cols, lty = 1 : 2, lwd = 2, xpd = TRUE)
})
# Relative root mean square error between measured and estimated values for the 'bsdf',
# at a grid cell near Szeged, Hungary (46.3N, 20.2E), in the period 1981-2010
with(inp_exPoints, {
years <- seq(1981, 2010)
bsdf02 <- cliBrtSunDurFrcPoints(temp, prec, lat, lon, elv, year = years)
rrmse <- function(pre, obs) { (sqrt(mean((pre - obs) ^ 2.)) / mean(obs)) * 100. }
rrmse_bsdf <- sapply(1 : 12, function(i) { rrmse(bsdf02[, i], bsdf[, i]) })
cols <- c("black", "green")
plot(rrmse_bsdf, type = "l", lwd = 2, col = cols, xaxt = "n", xlab = "Month",
ylab = "Relative root mean square error (%)")
axis(1, at = 1 : 12, labels = month.abb)
})
# }
Run the code above in your browser using DataLab