wiki:udg/ecoms/RPackage/examples/globalSelection

Version 1 (modified by juaco, 8 years ago) (diff)

--

Analysing model drift in the African Horn

This example analyses model drift of mean surface temperature at the African Horn. As an example we will use the first member of the System4 seasonal model of 15 members, and will analyse the mean temperature of June, considering the 20-year period 1991-2010.

First, we load the reference data that will be used as a benchmark for quantifying the drift, corresponding to the prediction with lead month 1:

lm1 <- loadSeasonalForecast("System4_seasonal_15", var="tas", members=1, lonLim=c(30,52), latLim=c(-5,20), season=6, years=1991:2010, leadMonth=1)

Next, we load the data corresponding to the first member for lead months 2 to 6. Note that we retain only the MemberData element of the output, since the spatial reference and the times are identical to the ones already available in object lm1

lm2_6 <- lapply(2:6, function(lead.month) loadSeasonalForecast("System4_seasonal_15", var="tas", members=1, lonLim=c(30,52), latLim=c(-5,20), season=6, years=1991:2010, leadMonth=lead.month)$MemberData[[1]])

In the next lines of code we compute the grid-point and spatial means of temperature for the reference forecast of lead month 1:

# Calculation of the mean at each grid point:
t.mean <- colMeans(lm1$MemberData$Member_1)
# Calculation of the spatial mean:
sp.mean.ref <- mean(t.mean)

And next the reference climatology using lead month 1 is plotted:

data(world_map)
wl <- as(world_map, "SpatialLines")
l1 <- list("sp.lines", wl)
l2 <- list("sp.text", c(47, -2), paste("mean =", round(sp.mean.ref, 2)), cex = 1.5)
ref <- SpatialGridDataFrame(lm1$LonLatCoords, as.data.frame(t.mean))
spplot(ref, col.regions=rev(heat.colors(21)), scales = list(draw = TRUE), sp.layout = list(l1, l2), main = "Mean 2m temp June (1991-2010) - Lead Month 1")

Attachments (3)

Download all attachments as: .zip