library(graphics)
# Loading mandatory data for the Example 'Points'
data(inp_exPoints)
with(inp_exPoints, {
# Generate quasi-daily time series for basic climate variables with default settings,
# at a grid cell near Szeged, Hungary (46.3N, 20.2E) (for the normal period 1981-2010)
year <- trunc(mean(seq(1981, 2010)))
wea01 <- dlyWeaGenPoints(colMeans(temp), colMeans(prec), colMeans(bsdf), year = year)
# Modify the daily weather data generation techniques
# To temperature data, apply the iterative interpolation technique with basic settings
# To precipitation data, change the value of the damping variable, over the whole year
# To sunshine data, assume that its values are constant within each month
wea02 <- dlyWeaGenPoints(colMeans(temp), colMeans(prec), colMeans(bsdf), aprchTEMP = "tsi",
aprchBSDF = "const", dvPREC = rep(0.6, 12), year = year)
# Check the differences
vars <- c("TEMP", "PREC", "BSDF")
lbls <- list(expression(italic(T[a])~(~degree*C)), expression(italic(P[n])~(mm)),
expression(italic(S[f])~(unitless)))
ys <- c(20, 2.5, 0.6)
ats <- list(seq(-4, 24, 4), seq(0, 3, 0.5), seq(0., 0.8, 0.2))
cols <- c("black", "green")
opar <- par(no.readonly = TRUE)
par(mfrow = c(3, 1))
for (i in 1 : length(vars)) {
par(mar = c(2, 5, 1, 1))
matplot(t(rbind(wea01[[vars[i]]], wea02[[vars[i]]])), type = "l", lwd = 2, col = cols,
xaxt = "n", xlab = NA, ylab = NA, axes = FALSE)
axis(side = 1, las = 1, tck = -0.03, labels = NA, at = seq(-60, 720, 30))
axis(side = 2, las = 1, tck = -0.03, labels = NA, at = ats[[i]])
axis(side = 2, las = 1, lwd = 0, line = -0.4, cex.axis = 1.6, at = ats[[i]])
if (i == length(vars)) {
axis(side = 1, las = 1, lwd = 0, line = -0.4, at = seq(-60, 720, 30), cex.axis = 1.6)
}
mtext(side = 2, lbls[[i]], line = 3, cex = 1.1)
legend(1, ys[i], legend = c("default", "modified"), col = cols, lty = 1 : 2, lwd = 2, xpd = TRUE)
}
par(opar)
})
Run the code above in your browser using DataLab