Version 2 (modified by juaco, 8 years ago) (diff) |
---|
Analysing model drift in South-western Iberia
We will take as reference for measuring the drift the lead-month 0 forecast (i.e. the July initializations)
> ref <- loadECOMS(dataset = "CFSv2_seasonal_16", var = "tas", lonLim = c(-10,-1), latLim = c(36,40), season = 7, years = 2006, leadMonth = 0) > plotMeanField(ref) > ref.field <- apply(ref$Data, MARGIN = c(4,3), FUN = mean, na.rm = TRUE)
Next, we will load the forecast of the target variable recursively for lead month values from 1 to 6 (i.e., the initializations from January to June). The different objects are arranged in a list:
> cfs.list <- lapply(1:6, function(lead.month) { loadECOMS(dataset = "CFSv2_seasonal_16", var = "tas", lonLim = c(-10,-1), latLim = c(36,40), season = 7, years = 2006, leadMonth = lead.month) })
In order to visualize the departures of each lead month from the reference in the same range of values, we will use the spplot method for plotting spatial objects of the library sp. To this aim, we will first compute the multi-member spatial mean for each lead month forecast, and then we will arrange the data in a matrix of 6 columns (one for each month), and x*y coordinates rows:
> require(sp) > # Matrix of anomalies between lead month and reference > aux.mat <- matrix(ncol = length(cfs.list), nrow = length(ref$xyCoords$x)*length(ref$xyCoords$y)) + for (i in 1:length(cfs.list)) { + mm.field <- apply(cfs.list[[i]]$Data, MARGIN = c(4,3), FUN = mean, na.rm = TRUE) + aux.mat[ ,i] <- mm.field - ref.field + } > # 2D coordinates > xy <- expand.grid(ref$xyCoords$x, ref$xyCoords$y) > xy.coords <- coordinates(points2grid(points = SpatialPoints(xy), tolerance = .003)) > df <- cbind.data.frame(xy.coords, aux.mat) > names(df) <- c("x","y",paste("LeadMonth_",1:6, sep = "")) > str(df) 'data.frame': 55 obs. of 8 variables: $ x : num -10.31 -9.38 -8.44 -7.5 -6.56 ... $ y : num 40.2 40.2 40.2 40.2 40.2 ... $ LeadMonth_1: num 0.0398 0.0691 0.1427 0.116 0.1935 ... $ LeadMonth_2: num 0.386 0.451 0.472 0.311 0.161 ... $ LeadMonth_3: num 0.0428 0.0787 0.0707 -0.125 -0.2751 ... $ LeadMonth_4: num 0.261 0.258 0.131 -0.177 -0.464 ... $ LeadMonth_5: num 0.0576 0.154 0.1327 -0.1282 -0.3963 ... $ LeadMonth_6: num 0.0789 0.192 0.0989 -0.2667 -0.6457 ... > Conversion of the data.frame to a Spatial gridded object: > coordinates(df) <- c(1,2) > class(df) [1] "SpatialPixelsDataFrame" attr(,"package") [1] "sp" > # Application of the 'spplot' method, generating a lattice-type map: > spplot(df, as.table = TRUE, col.regions = colorRampPalette(c("blue","white","red")), at = seq(-2.5,2.5,.25))
The results show how a increasing lead month leads to a negative bias of the forecast, demonstrating that the mean state of a variable of a forecast is not stationary through time.
Attachments (3)
- image-20160513-145433.png (45.6 KB) - added by juaco 6 years ago.
- image-20160513-145600.png (13.1 KB) - added by juaco 6 years ago.
- image-20160513-145707.png (19.5 KB) - added by juaco 6 years ago.
Download all attachments as: .zip