data(examplegridtopography)
data(exampleinterpolationdata)
data(examplecorrectiondata)
#Creates spatial topography points from the grid
p = 1:2
spt = as(examplegridtopography, "SpatialPointsTopography")[p]
#Interpolation of two points for the whole time period (2000-2003)
historical = interpolationpoints(exampleinterpolationdata, spt)
#Downscaling of future predictions (RCM models, year 2023)
predicted = correctionpoints(examplecorrectiondata, historical, spt@data)
#Plot predicted mean temperature for point 1
meteoplot(predicted, 1, "MeanTemperature", ylab="Temperature (Celsius)", ylim=c(-5,40))
meteoplot(predicted, 1, "MinTemperature", add=TRUE, col="blue")
meteoplot(predicted, 1, "MaxTemperature", add=TRUE, col="red")
#Add uncorrected mean temperature data (cell #3)
lines(examplecorrectiondata@dates,
examplecorrectiondata@projection_data[[3]]$MeanTemperature,
lty=3)
lines(examplecorrectiondata@dates,
examplecorrectiondata@projection_data[[3]]$MinTemperature,
col="blue", lty=3)
lines(examplecorrectiondata@dates,
examplecorrectiondata@projection_data[[3]]$MaxTemperature,
col="red", lty=3)
legend("topright", legend=c("corrected","uncorrected", "Maximum", "Mean", "Minimum"),
col=c("black","black", "red","black","blue"), lty=c(1,3,1,1,1), bty="n")
#Scatter plot
plot(examplecorrectiondata@projection_data[[3]]$MeanTemperature,
predicted@data[[1]]$MeanTemperature, cex=0.1, asp=1,
ylab="Corrected mean temperature", xlab="Uncorrected mean temperature")
abline(a=0,b=1,col="gray")
#Plot predicted precipitation for point 1
meteoplot(predicted, 1, "Precipitation", ylab="Precipitation (mm)", ylim=c(0,120))
#Add uncorrected mean temperature data (cell #3)
lines(examplecorrectiondata@dates,
examplecorrectiondata@projection_data[[3]]$Precipitation,
col="red", lty=3)
legend("topleft", legend=c("corrected","uncorrected"), col=c("black","red"), lty=c(1,3), bty="n")
#Scatter plot
plot(examplecorrectiondata@projection_data[[3]]$Precipitation,
predicted@data[[1]]$Precipitation, cex=0.1, asp=1,
ylab="Corrected precipitation (mm)", xlab="Uncorrected precipitation (mm)")
abline(a=0,b=1,col="gray")
Run the code above in your browser using DataLab