Changes between Version 1 and Version 2 of udg/ecoms/RPackage/examples/globalSelection


Ignore:
Timestamp:
Feb 20, 2014 10:11:06 AM (8 years ago)
Author:
juaco
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • udg/ecoms/RPackage/examples/globalSelection

    v1 v2  
    3333ref <- SpatialGridDataFrame(lm1$LonLatCoords, as.data.frame(t.mean))
    3434spplot(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")
     35
     36}}}
     37
     38[[Image(ethiopia_mean.png)]]
     39
     40
     41The following function computes drift in terms of anomalies with the reference ()in this case the lead month 1 forecast):
     42
     43{{{
     44delta.drift <- function(x, ref) {
     45      delta <- colMeans(x) - ref
     46      return(delta)
     47}
     48df.deltas <- sapply(lm2_6, FUN=delta.drift, ref = t.mean)
     49colnames(df.deltas) <- paste("LeadMonth_", 2:6, sep = "")
    3550}}}
    3651
    3752
     53The next steps allow the visualization of the model drift, considering the anomalies of different lead month forecasts with regard to the lead month 1 reference:
    3854
     55{{{
     56# Preparation of the panel text showing the mean values
     57for (x in 1:5) {
     58      assign(paste("l", x+1, sep=""), list("sp.text", c(43, -2), paste("mean =", round(sp.mean.ref + colMeans(df.deltas), 2)[x]), which = x))
     59}
     60delta.sgdf <- SpatialGridDataFrame(lm1$LonLatCoords, as.data.frame(df.deltas))
     61delta.colors <- colorRampPalette(c("red", "white", "blue"))
     62spplot(delta.sgdf, scales = list(draw = TRUE), sp.layout =list(l1,l2,l3,l4,l5,l6), col.regions = delta.colors(41), as.table = TRUE, at = seq(-2,2,.1))
     63
     64}}}
     65
     66
     67[[Image(ethiopia_drift.png)]]
     68
     69